You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2016/12/09 21:30:07 UTC

svn commit: r1773476 - /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java

Author: msahyoun
Date: Fri Dec  9 21:30:07 2016
New Revision: 1773476

URL: http://svn.apache.org/viewvc?rev=1773476&view=rev
Log:
PDFBOX-3618: throw exception if loaded font is not embedded and some additional comments for starters

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java?rev=1773476&r1=1773475&r2=1773476&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java Fri Dec  9 21:30:07 2016
@@ -65,6 +65,16 @@ public final class CreatePDFA
             // load the font as this needs to be embedded
             PDFont font = PDType0Font.load(doc, new File(fontfile));
 
+            // A PDF/A file needs to have the font embedded if the font is used for text rendering
+            // in rendering modes other than text rendering mode 3
+            // This requirement includes the PDF standard fonts, so don't use their static PDFType1Font classes such as
+            // PDFType1Font.HELVETICA.
+            if (!font.isEmbedded())
+            {
+            	throw new IllegalStateException("PDF/A compliance requires that all fonts used for"
+            			+ " text rendering in rendering modes other than rendering mode 3 are embedded.");
+            }
+            
             // create a page with the message
             PDPageContentStream contents = new PDPageContentStream(doc, page);
             contents.beginText();