You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/05/02 07:46:48 UTC
svn commit: r1889388 -
/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java
Author: tilman
Date: Sun May 2 07:46:48 2021
New Revision: 1889388
URL: http://svn.apache.org/viewvc?rev=1889388&view=rev
Log:
PDFBOX-4892: pass PDDocument, add comments
Modified:
pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java
Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java?rev=1889388&r1=1889387&r2=1889388&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddAnnotations.java Sun May 2 07:46:48 2021
@@ -307,12 +307,15 @@ public final class AddAnnotations
dr = new PDResources();
acroForm.setDefaultResources(dr);
}
- dr.put(COSName.getPDFName("Helv"), PDType1Font.HELVETICA);
+ dr.put(COSName.HELV, PDType1Font.HELVETICA);
+ // If you want to use a specific font, add it here but make sure it is not subset
// Create the appearance streams.
// Adobe Reader will always display annotations without appearance streams nicely,
// but other applications may not.
- annotations.forEach(PDAnnotation::constructAppearances);
+ // Pass the PDDocument so that the appearance handler can look into the default resources
+ // for non-standard fonts.
+ annotations.forEach(ann -> ann.constructAppearances(document));
showPageNo(document, page1, "Page 1");
showPageNo(document, page2, "Page 2");