ceTe Software Help Library for Java August - 2020
DynamicPDF Generator for Java / Programming with Generator for Java / PDF/A
In This Topic
    PDF/A
    In This Topic

    Overview

    PDF/A (Archiving) is a subset of the traditional PDF specification that specifically targets PDF documents that need to be preserved long term.  The goal of the PDF/A specification was to create a specification that defined a PDF document to be self-contained and device-independent.  The result of a document adhering to the PDF/A specification is one that will remain readable, render able and accessible for an indefinite amount of time in the future even as technologies like media and data formats could change over time.

    DynamicPDF can produce and preserve PDF documents with the following conformance levels

    • PDF/A-1a
    • PDF/A-1b
    • PDF/A-2a
    • PDF/A-2b
    • PDF/A-2u
    • PDF/A-3a
    • PDF/A-3b
    • PDF/A-3u

    Conformance Level B (PDF/A-1b) is the minimum requirement necessary for PDF/A compliance and guarantees that the text will be properly displayed. Conformance Level A (PDF/A-1a) builds off of the Level B compliance and guarantees that the text will display correctly and also uses PDF tagging to preserve the logical structure of the document.

    Rules to Follow for PDF/A-1a & PDF/A-1b

    In order to create PDF documents that are PDF/A compliant certain things must be done as well as certain things can never be done. The following rules must be followed in order to make a Document PDF/A compliant:

    • All fonts must be embedded (core fonts cannot be used)
    • All colors used must be device-independent
    • Must include XMP MetaData
    • Encryption can not be used
    • Text, Combo Box, List Box and Signature Form Fields can be used
    • Form Fields using OpenType font with postscript outline is not PDF/A compliant
    • Button, Check Box and Radio Button Form Fields cannot be used
    • No images can use LZW compression (GIF Images)
    • No embedded files can be added
    • No external content can be referenced
    • No transparency (Transparency Group or Transparent Images)
    • No multimedia content
    • No use of JavaScript
    • PDF must be tagged (required only for PDF/A-1a compliance)

    NOTE:  The DynamicPDF Evaluation Watermark will cause the PDF to not validate as PDF/A. For options on removing the watermark during evaluation please contact DynamicPDF Support.

    All of the above elements must be in place for full PDF/A-1b compatibility. Be careful not to inadvertently use any RGB colors in the document (our product does not automatically check for this). This includes verifying that all added images or merged in PDF pages (if DynamicPDF Merger is used) do not contain any RGB colors.

    Lastly, you will need to verify that all of the fonts you used are embedded in the PDF. This means that all fonts used within your PDF document need to be either OpenTypeFont or Type1Font objects. The 14 core fonts do not get embedded into the PDF and therefore can not be used when creating PDF/A-1b documents.

    Examples:

    1. The following code sample demonstrates the elements needed to specify a document as PDF/A-1b compatible:

    [Java]
         Document document = new Document();
         document.setTitle("PDF/A1 Document");
         document.setTag = new TagOptions();
            
         XmpMetadata xmp = new XmpMetadata();
    
         // User has to add PDF/A schema with the conformance level.
         PdfASchema pdfaschema = new PdfASchema(PdfAStandard.PDF_A_1b_2005);
         xmp.addSchema(pdfaschema);
    
         DublinCoreSchema dc = xmp.getDublinCore();
         dc.getTitle().setDefault(document.getTitle());
         dc.getDescription().setDefault(document.getSubject());
         dc.getCreators().add(document.getAuthor());     
         dc.getTitle().addLang("en-us", "PDF/A1 Document");
         document.setXmpMetadata(xmp);
    
         // Needs iccprofile file to be embedded.
         IccProfile iccProfile = new IccProfile("[PhysicalPath]/sRGB_IEC61966-2-1_noBPC.icc");
         OutputIntent outputIntents = new OutputIntent("", "IEC 61966-2.1 Default RGB colour space - sRGB 1 ", "http://www.color.org", "sRGB IEC61966-2.1 1", iccProfile);
         outputIntents.setVersion(OutputIntentVersion.PDF_A);
         document.getOutputIntents().add(outputIntents);
    
         String text = "Hello World...\nFrom DynamicPDF Generator for Java\nDynamicPDF.com";
         OpenTypeFont font = new OpenTypeFont("[PhysicalPath]/verdana.ttf");
         Label label = new Label(text, 0, 0, 504, 100, font, 18, TextAlign.CENTER, RgbColor.getBlueViolet());
    
         Page page = new Page(PageSize.LETTER, PageOrientation.PORTRAIT, 54.0f);
         page.getElements().add(label);
         document.getPages().add(page);
         document.draw("[PhysicalPath]/MyDocument.pdf");
    

     

    2. The following code sample demonstrates how to create PDF/A-3a document with file attachments( Embedded Files):

    [Java]
         Document document = new Document();
         document.setTitle("PDF/A1 Document");
         document.setTag = new TagOptions();
            
         XmpMetadata xmp = new XmpMetadata();
    
         // User has to add PDF/A schema with the conformance level.
         PdfASchema pdfaschema = new PdfASchema(PdfAStandard.PdfA3a);
         xmp.addSchema(pdfaschema);
    
         DublinCoreSchema dc = xmp.getDublinCore();
         dc.getTitle().setDefault(document.getTitle());
         dc.getDescription().setDefault(document.getSubject());
         dc.getCreators().add(document.getAuthor());     
         dc.getTitle().addLang("en-us", "PDF/A1 Document");
         document.setXmpMetadata(xmp);
    
         // Needs iccprofile file to be embedded.
         IccProfile iccProfile = new IccProfile("[PhysicalPath]/sRGB_IEC61966-2-1_noBPC.icc");
         OutputIntent outputIntents = new OutputIntent("", "IEC 61966-2.1 Default RGB colour space - sRGB 1 ", "http://www.color.org", "sRGB IEC61966-2.1 1", iccProfile);
         outputIntents.setVersion(OutputIntentVersion.PDF_A);
         document.getOutputIntents().add(outputIntents);
    
         EmbeddedFile embeddedFile1 = new EmbeddedFile(@"ExcelFilePath\HelloWorldExcel.xls");
         embeddedFile1.setRelation(com.cete.dynamicpdf.EmbeddedFileRelation.DATA); 
    embeddedFile1.setMimeType("application/excel");
    document.getEmbeddedFiles().add(embeddedFile1); EmbeddedFile embeddedFile2 = new EmbeddedFile(@"XMLFilePath\Simple.xml"); embeddedFile2.setRelation(com.cete.dynamicpdf.EmbeddedFileRelation.SOURCE);
    embeddedFile2.setMimeType("application/xml");
    document.getEmbeddedFiles().add(embeddedFile2); String text = "Hello World...\nFrom DynamicPDF Generator for Java\nDynamicPDF.com"; OpenTypeFont font = new OpenTypeFont("[PhysicalPath]/verdana.ttf"); font.setSubset(false); Label label = new Label(text, 0, 0, 504, 100, font, 18, TextAlign.CENTER, RgbColor.getBlueViolet()); Page page = new Page(PageSize.LETTER, PageOrientation.PORTRAIT, 54.0f); page.getElements().add(label); document.getPages().add(page); document.draw("[PhysicalPath]/MyDocument.pdf");
    See Also