[
https://issues.apache.org/jira/browse/PDFBOX-3672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15848026#comment-15848026
]
Said Herzallah commented on PDFBOX-3672:
----------------------------------------
Hi
thank you for your reply.
Here is another way to get the exception without using getStringWidth(). I just
need to be able to print some symbols on the pdf using this font
PDType1Font.ZAPF_DINGBATS
would you please provide a very small example on how to, for example, print the
"Black florette U+273F" ?
PDPageContentStream contStream = null;
try{
contStream = new PDPageContentStream(pdDoc, page,
PDPageContentStream.AppendMode.APPEND, true);
contStream.saveGraphicsState();
PDFont pdFont = PDType1Font.ZAPF_DINGBATS;
contStream.setFont(pdFont,50);
contStream.beginText();
contStream.showText("ABCDEF");
contStream.endText();
contStream.restoreGraphicsState();
}finally{
if (null != contStream)
contStream.close();
}
Thanks
Said
> Exception on font PDType1Font.ZAPF_DINGBATS
> -------------------------------------------
>
> Key: PDFBOX-3672
> URL: https://issues.apache.org/jira/browse/PDFBOX-3672
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.4, 2.1.0
> Reporter: Said Herzallah
>
> Hi
> I am getting this exception using snapshot
> pdfbox-2.1.0-20170131.210242-692.jar and fontbox-2.1.0-20170131.215925-709.jar
> Debugging PDType1Font.java, the unicode value passed to method "protected
> byte[] encode(int unicode) throws IOException" was 84
> and the call to method "encode(int unicode)" was triggered from
> font.getStringWidth(...) when font was PDType1Font.ZAPF_DINGBATS
> java.lang.IllegalArgumentException: U+0054 ('.notdef') is not available in
> this font ZapfDingbats (generic: MS-Gothic) encoding: ZapfDingbatsEncoding
> at
> org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:409)
> at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:316)
> at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:345)
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]