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

Tilman Hausherr commented on PDFBOX-4629:
-----------------------------------------

I don't create any pdf templates, so I can't help there.

With "trick" I mean putting the embedded, non-subsetted font in the AcroForm 
default resources and using its name
{code:java}
PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm();
PDFont font = PDType0Font.load(doc, YourClass.class.getResourceAsStream(
                    
"/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf"), false);

PDResources res = acroForm.getDefaultResources();
String fontName = res.add(font).getName();
String defaultAppearanceString = "/" + fontName + " 10 Tf 0 g";

PDVariableText field = (PDVariableText) acroForm.getField("search_query");
field.setDefaultAppearance(defaultAppearanceString);
{code}

> WARNING: Using fallback font 'LiberationSans' for 'LiberationSans'
> ------------------------------------------------------------------
>
>                 Key: PDFBOX-4629
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4629
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.15, 2.0.16
>            Reporter: Nina Sutter
>            Priority: Minor
>         Attachments: image-2019-08-12-08-39-13-652.png, 
> image-2019-08-12-08-43-29-117.png, image-2019-08-12-08-44-58-434.png, 
> image-2019-08-12-09-25-11-355.png, image-2019-08-12-09-27-27-416.png
>
>
> Hey everyone,
> I use pdfbox version 2.0.15 deployed on AWS Lambda.
> My template is done in LibreOffice and the fields are set-up in font 
> Liberation Sans.
> When I fill the fields in the pdf I get the following log message on 
> CloudWatch:
> WARNING: Using fallback font 'LiberationSans' for 'LiberationSans'
>  
> For me this message doesn't tell me what the actual problem is. The pdf still 
> gets filled with the required data, however this message puzzles me. Maybe 
> you can help me understanding the issue.
>  
>  
> Best regards



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to