[
https://issues.apache.org/jira/browse/PDFBOX-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14312804#comment-14312804
]
Daniel Brownell commented on PDFBOX-2665:
-----------------------------------------
I'm not too sure what the API should do, but all of the smart ways I've seen on
Stackoverflow of formatting text use a technique of judging the width of a Font
rendered String, by multiplying the getStringWidth() by a factor.
What I'd ideally like is for Type 1 fonts not to suck as much. If I have to
deal with width estimation, I'll need a hashmap, to convert my Strings before
they reach PDFBox.
For some reason I couldn't get \u0000 and \u0096 mapping, perhaps because
they're too crazy for Java. I can't get a String to print out at all if it has
a null character. I will take a look when I get back to work on Wednesday and
let you know. It's some obvious bug but it might be a pdfbox issue yet.
I think there should be a better way than whatever I'm doing, mapping Strings,
and it should be a default implementation option, since I'd think it would be
pretty common to deal with special characters and PDF fonts. Like almost an
ability to subclass the PdType1Fonts to add a default to the glyph map, so that
I don't have to deal with exceptions.
> PDType1Font (HELVETICA) encode getting NullPointerException
> -----------------------------------------------------------
>
> Key: PDFBOX-2665
> URL: https://issues.apache.org/jira/browse/PDFBOX-2665
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.0
> Environment: Win 7, JDK 7, JBoss AS 7
> Reporter: Daniel Brownell
> Assignee: John Hewson
> Fix For: 2.0.0
>
>
> Hi,
> I have been trying to revert to previous pdfbox-2.0.0 versions, which is why
> the error is from a previous build, but this is applicable to the latest
> (2.0.0-20150204.015951-1042) too.
> I am getting this error, which I was not getting a month ago.
> Regards...
> Error: java.lang.NullPointerException
> at
> org.apache.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:309)
> [pdfbox-2.0.0-20150129.080600-1013.jar:2.0.0-SNAPSHOT]
> at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:267)
> [pdfbox-2.0.0-20150129.080600-1013.jar:2.0.0-SNAPSHOT]
> at
> org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:316)
> [pdfbox-2.0.0-20150129.080600-1013.jar:2.0.0-SNAPSHOT]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]