この例を使用して、java swing JFrame を pdf に変換しています: jcomponent を itext で pdf にエクスポートします。問題は、フレームに čěř... のような UTF-8 文字が含まれている場合です。この文字は、エクスポートされたドキュメントにありません。PDF でこの文字をオンにするにはどうすればよいですか?
アップデート:
あなたの例を試してみましたが、例外がありました:
ExceptionConverter: com.itextpdf.text.DocumentException: Font 'fonts/verdana.ttf,1' with 'Identity-H' is not recognized.
at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:699)
at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:606)
at com.itextpdf.text.pdf.BaseFont.createFont(BaseFont.java:549)
at com.itextpdf.text.pdf.DefaultFontMapper.awtToPdf(DefaultFontMapper.java:107)
at com.itextpdf.text.pdf.PdfGraphics2D.getCachedBaseFont(PdfGraphics2D.java:1082)
at com.itextpdf.text.pdf.PdfGraphics2D.setFont(PdfGraphics2D.java:1075)
at javax.swing.JComponent.paintChildren(JComponent.java:855)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at javax.swing.JComponent.paintChildren(JComponent.java:874)
at javax.swing.JComponent.printChildren(JComponent.java:1214)
at javax.swing.JComponent.paint(JComponent.java:1049)
at javax.swing.JComponent.print(JComponent.java:1183)
at GUI.PlayOffPanel.export(PlayOffPanel.java:322)
verdana や times などの .ttf フォントのインポートに問題があるように見えますが、追加したものは機能します。しかし、私は本当にVerdanaフォントを使いたいので、まだ答えを探しています