[ 
https://issues.apache.org/jira/browse/PDFBOX-2848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14609038#comment-14609038
 ] 

Maruan Sahyoun commented on PDFBOX-2848:
----------------------------------------

This is because the field does set the font Courier within the default 
appearance string but doesn't have the font resource nor does any of the 
parents or the AcroForm itself.

Acrobat is able to handle that but we are currently not. See also PDFBOX-2661 
and PDFBOX-2662

> Could not find font: /Courier for PDTextField
> ---------------------------------------------
>
>                 Key: PDFBOX-2848
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2848
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>         Attachments: TestTemplate.pdf
>
>
> This code
> {code}
> PDField newField = 
> tplDoc.getDocumentCatalog().getAcroForm().getField("01.011.Name");
> PDTextField newTextField = (PDTextField) newField;
> newTextField.setValue("huhu");
> {code}
> brings this exception:
> {code}
> Exception in thread "main" java.io.IOException: Could not find font: /Courier
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.PDAppearanceString.getFont(PDAppearanceString.java:128)
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.PDAppearanceString.copyNeededResourcesTo(PDAppearanceString.java:175)
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:130)
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:106)
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:262)
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:220)
>       at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:217)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to