You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Ivan de la Fuente (JIRA)" <ji...@apache.org> on 2015/09/02 22:15:46 UTC
[jira] [Commented] (PDFBOX-2954) Exception when trying to write
Spanish or French characters
[ https://issues.apache.org/jira/browse/PDFBOX-2954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14727953#comment-14727953 ]
Ivan de la Fuente commented on PDFBOX-2954:
-------------------------------------------
{code}
sep 02, 2015 10:10:34 PM org.apache.pdfbox.pdmodel.font.PDType1Font <init>
ADVERTENCIA: Using fallback font ArialMT for base font ZapfDingbats
Exception in thread "main" java.lang.IllegalArgumentException: This font type only supports 8-bit code points
at org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:327)
at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:282)
at org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:341)
at com.loonger.HelloWorld.main(HelloWorld.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
{code}
> Exception when trying to write Spanish or French characters
> -----------------------------------------------------------
>
> Key: PDFBOX-2954
> URL: https://issues.apache.org/jira/browse/PDFBOX-2954
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 2.0.0
> Environment: Windows 10, Java 8
> Reporter: Ivan de la Fuente
>
> When I create a PDF with PDFBOX 2.0.0 SNAPSHOT using the typical Hello World example with Spanish and French characters:
> {code}
> PDDocument document = new PDDocument();
> PDPage page = new PDPage(PDRectangle.A4);
> document.addPage(page);
> PDType1Font font = PDType1Font.HELVETICA;
> PDPageContentStream stream = new PDPageContentStream(document, page);
> String text = "áÁÀà";
> stream.beginText();
> stream.setFont(font, 12);
> stream.newLineAtOffset(100, 700);
> stream.showText(text);
> stream.endText();
> stream.close();
> document.save("sample.pdf");
> document.close();
> {code}
> I get this error:
> {code}
> sep 02, 2015 12:42:43 PM org.apache.pdfbox.pdmodel.font.PDType1Font <init>
> ADVERTENCIA: Using fallback font ArialMT for base font ZapfDingbats
> Exception in thread "main" java.lang.IllegalArgumentException: This font type only supports 8-bit code points
> {code}
> If I load {{arialuni.ttf}} font with Type0 it compiles but only get question marks instead of the correct characters in the PDF file.
> I have tried PDFBOX 1.8 and doesn´t work either.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org