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

Maruan Sahyoun commented on PDFBOX-4262:
----------------------------------------

{{PDType1Font.HELVETICA_BOLD}} is a PDF standard font. Using that your mileage 
will vary as the font itself supports only a limited set of characters. If you 
need to use Eastern European or other characters you'd better use a different 
font such as {{Arial}} which you can load using {{PDType0Font.load}} (*don't 
use font subsetting* if you expect that the form data might be changed 
interactively). So above sample will become

{code}
PDFont font = PDType0Font.load(doc, new File("Arial.ttf")); // you need to 
specify the fun path of course
fonts.put(COSName.getPDFName("HeBo"), font);
{code}

The other option would be to replace the name used in the fields default 
appearance string.

> HeBo font not found exception even though it's present in the system
> --------------------------------------------------------------------
>
>                 Key: PDFBOX-4262
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4262
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.9
>         Environment: RHEL 7
>            Reporter: Jim Halpert
>            Priority: Blocker
>              Labels: Appearance
>         Attachments: .pdfbox.cache, field.PNG, font.PNG, page2.PNG, pdf.PNG, 
> pdf2.PNG
>
>
> Throws an IO Exception without falling back to other fonts. However, 
> Helvetica-Bold is available IF HeBo means Helvetica-Bold. See .pdfbox.cache 
> file.
>  
>  
>  - Exception : ----Could not find font: /HeBo
>  java.io.IOException: Could not find font: /HeBo
>          at 
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processSetFont(PDDefaultAppearanceString.java:179)
>          at 
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processOperator(PDDefaultAppearanceString.java:132)
>          at 
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processAppearanceStringOperators(PDDefaultAppearanceString.java:108)
> [^.pdfbox.cache]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to