[
https://issues.apache.org/jira/browse/PDFBOX-3165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15056904#comment-15056904
]
Aaron Eischeid commented on PDFBOX-3165:
----------------------------------------
I do have a form that replicates but probably can't upload that one, I would
suspect any form with a PDTextField with arial font setting would reproduce
though. If you like I can try to spit a simple one out tomorrow. I would think
ignoring at least these invisible characters might be good. In our case they
are getting in there via users copy and pasting, and it is not at all clear
they are tab characters rather than spaces.
For a textField that isn't multi line substituting a space for a tab seems like
it might work as well.
> Tab characters in PDTextField cause error when using .flatten()
> ---------------------------------------------------------------
>
> Key: PDFBOX-3165
> URL: https://issues.apache.org/jira/browse/PDFBOX-3165
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm, FontBox
> Affects Versions: 2.0.0
> Environment: Ubuntu, JDK7
> Reporter: Aaron Eischeid
>
> pdf form gets filled in, then call I call .flatten(fields, true) which last I
> knew was undocumented, but anyway I needed the refreshAppearences for
> pdfViewers that don't support acroForms like pdf.js
> If a tab character some how gets entered into the PDTextField it chokes. I am
> worried other somewhat common characters might have similar issues, but
> haven't experimented so far.
> Using RC2 of pdfBox and fontBox. and fonts in pdfForm elements were all set
> to Arial.
> Relavent stacktrace:
> U+0009 is not available in this font's Encoding. Stacktrace follows:
> java.lang.IllegalArgumentException: U+0009 is not available in this font's
> Encoding
> at
> org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.encode(PDTrueTypeFont.java:358)
> at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:283)
> at org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:312)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PlainTextFormatter.format(PlainTextFormatter.java:193)
> at
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:373)
> at
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:237)
> at
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:144)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:263)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.refreshAppearances(PDAcroForm.java:287)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.flatten(PDAcroForm.java:211)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]