[
https://issues.apache.org/jira/browse/PDFBOX-5432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17536436#comment-17536436
]
Tilman Hausherr commented on PDFBOX-5432:
-----------------------------------------
The font isn't copied, it's a reference that is copied. Yes the limitation is
part of the PDF specification and yes each form XObject should have its own
resources directory. Unlike itext, PDFBox allows its users to experience 100%
of the pain of the PDF specification.
> Use embedded fonts in text annotations
> --------------------------------------
>
> Key: PDFBOX-5432
> URL: https://issues.apache.org/jira/browse/PDFBOX-5432
> Project: PDFBox
> Issue Type: New Feature
> Affects Versions: 2.0.26
> Reporter: Laurence Urbain
> Priority: Major
>
> Hi,
> We are using pdfbox to add text annotations to a pdf document. Now, we need
> to embed the font used in the annotations to preserve the PDF/A compliance.
> Here is the code snippet we use to create the text annotation :
> {code:java}
> final PDDocument document = new PDDocument();
> final PDPage page = new PDPage();
> document.addPage(page);
> final PDAnnotationMarkup annotation = new PDAnnotationMarkup();
> annotation.getCOSObject().setName(COSName.SUBTYPE,
> PDAnnotationMarkup.SUB_TYPE_FREETEXT);
> annotation.setRectangle(new PDRectangle(200, 600, 100, 20));
> annotation.setContents("some text");
> annotation.setPrinted(true);
> annotation.setDefaultAppearance("/Helv 12 Tf 0 g");
> annotation.constructAppearances(document);
> final List<PDAnnotation> annotations = page.getAnnotations();
> annotations.add(annotation);
> page.setAnnotations(annotations);
> {code}
> It is currently not possible to use an embedded font. From what I can see,
> _PDFreeTextAppearanceHandler_ is building the annotation's appearance
> dictionnary based on the annotation's default appearance or the form's
> default appearance.
> The font is then either retrieved by name from the form default resources, or
> the standard font helvetica is used.
> Would it be possible to pass a _PDFont_ object to the
> annotation/appearanceHandler ?
> That way, we could either choose an embedded font, a reference to an existing
> font (from the page resources for example), or a standard font.
> Thanks for your help
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]