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/10 13:03:52 UTC

svn commit: r1773517 - /pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java

Author: msahyoun
Date: Sat Dec 10 13:03:52 2016
New Revision: 1773517

URL: http://svn.apache.org/viewvc?rev=1773517&view=rev
Log:
PDFBOX-3618: add comment that developer should check the license terms.

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

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java?rev=1773517&r1=1773516&r2=1773517&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java (original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePDFA.java Sat Dec 10 13:03:52 2016
@@ -64,6 +64,21 @@ 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.
+            //
+            // As there are many different font licenses it is up to the developer to check if the license terms for the
+            // font loaded allows embedding in the PDF.
+            // 
+            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);