Skip to main content
Skip table of contents

iText 8.0.2 Delivers PDF/A-4 Support

Background

The PDF/A standards, established by the International Organization for Standardization (ISO), are essential for ensuring the lasting accessibility and reliability of electronic documents. Designed specifically for industries with strict archival needs, such as legal, finance, and government, PDF/A guidelines guarantee that documents meet specific criteria for consistent rendering and interpretation over time.

In these industries, where document integrity and longevity are paramount, PDF/A has become a common and widely adopted format. Its importance lies in preserving the content and structure of electronic documents for the long term. For instance, in legal practices, PDF/A ensures that legal documents retain their original format and are accessible for reference or legal proceedings even after many years. In the financial sector, where regulatory compliance is crucial, PDF/A helps maintain the integrity of financial records for auditing purposes.

The widespread use of PDF/A standards signifies their significance in addressing the archival challenges faced by various sectors. These standards play a pivotal role in safeguarding electronic documents, making them a trusted choice for industries where accuracy, consistency, and longevity are non-negotiable.

Support for generating documents which are PDF/A compliant is an important component of the iText and Apryse feature set.

Pre PDF/A-4

PDF/A has evolved significantly since its inception, with each version introducing new features and enhancements to improve its capabilities for long-term preservation. Here's a chronological overview of the major achievements and milestones of PDF/A pre PDF/A-4:

PDF/A-1 (2005)

  • Established the initial foundation for PDF/A as a standardized format for long-term preservation of electronic documents.

PDF/A-2 (2011)

  • Introduced support for embedding fonts, ensuring consistent rendering of text across different systems.

  • Enhanced support for color management, providing more accurate color representation.

  • Refined conformance levels, providing a clearer distinction between different levels of PDF/A compliance.

PDF/A-3 (2012)

  • Expanded support for image compression algorithms, enabling smaller file sizes without compromising quality.

  • Introduced support for embedded files, allowing for inclusion of supplementary content in PDF/A documents.

  • Enhanced accessibility features, making PDF/A documents more usable for individuals with disabilities.

Why PDF/A-4

PDF/A-4, published in November 2020, was aimed to address the evolving needs of long-term preservation, accessibility, functionality, security, and compatibility, while maintaining the core principles of the PDF/A standard.

In 2017, specifications for the PDF 2.0 standard were published. This was a major milestone in PDF technology and the new standard introduced significant advancements which expanded the functionality and versatility of the format. These advancements include, but are not limited to, enhanced security features, accessibility improvements, embedded fonts, transparency controls and metadata handling.

Significantly, PDF A/-4 is the first PDF/A format which is built on top of PDF 2.0. This is a crucial development in leveraging the latest advancements in PDF technology. Other developments in PDF/A-4 are:

  • Enhanced Long-term Preservation: PDF/A-4 strengthens the long-term preservation capabilities of PDF/A documents by addressing potential obsolescence and ensuring consistent rendering over time. This reduces the risk of data loss or format incompatibility in the future, making PDF/A-4 a more reliable choice for archiving and preserving critical documents.

  • Improved Accessibility: PDF/A-4 enhances the accessibility of PDF/A documents for individuals with disabilities, making it easier for them to access and interact with PDF/A content. This includes improved tagging for screen readers, support for alternative text descriptions, and compliance with WCAG 2.1 accessibility guidelines.

  • Expanded Functionality: PDF/A-4 adds new features to expand the functionality of PDF/A, making it more versatile and adaptable to various document processing needs. This includes support for Rich Media content like audio and video, enhanced transparency effects for more complex designs, and improved embedded file handling for efficient document management.

  • Strengthened Security: PDF/A-4 focuses on enhancing the security of PDF/A documents by prohibiting actions that could compromise viewer security or privacy. This helps protect sensitive information and prevent malicious code from executing within PDF/A documents.

  • Maintain Backward Compatibility: PDF/A-4 maintains backward compatibility with previous versions of PDF/A, ensuring that existing PDF/A documents remain compliant with the updated standard. This compatibility allows users to transition seamlessly to PDF/A-4 without compromising the integrity of existing archives.

  • Simplified Compliance: PDF/A-4 provides clearer guidelines and improved validation tools to simplify compliance checking and ensure that PDF/A documents meet the standard's requirements. This reduces the risk of non-compliance and ensures that documents are consistently preserved for long-term access.

  • Enhanced Integration: PDF/A-4 is designed for better integration with document processing workflows, allowing for easier conversion, validation, and management of PDF/A documents within existing document processing systems. This streamlines document processing tasks and reduces the overhead associated with long-term preservation.

What we’ve done in iText 8.02

iText now allows users to create and validate PDF/A-4 compliant documents. In order to do this, additional development has been necessary to implement checks to support:

  • Signature Algorithms: PDF/A-4 supports a wider range of signatures including RSA, DSA, and ECDSA. It also supports the use of timestamps, which can be used to prove that a signature was created at a specific time. Signatures that rely on hash functions with known vulnerabilities, deprecated key algorithms ,external certificates and non-propriety methods are unsupported.

  • Actions: Actions are embedded instructions that trigger specific behaviors within the documents, they are commonly used to add additional interaction and functionality to PDFs. Actions pose challenges in accessibility and security and in PDF/A-4, several actions (such as ‘Launch’, ‘ImportData’, JavaScript execution) are now prohibited.

  • Graphics: Embedding of fonts in documents is now mandatory, this aids preservation of visual integrity in documents when opened in different viewing environments and eliminates font substitution challenges

  • Metadata: Information relating to document identification (I.e. the archiving standard being used, the tool used to generate the document, time of creation and modification) is attached to all documents meeting the PDF/A-4 standard

  • Output Intent: Key components such as Color Spacing, ICC Profiles, Black Point Compensation are defined to control how documents are rendered on different devices 

Example Usage

Core

Java
JAVA
package org.example;

import com.itextpdf.io.font.PdfEncodings;
import com.itextpdf.io.image.ImageDataFactory;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.pdf.*;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Image;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.pdfa.PdfADocument;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class PdfA4Example {
    public static final String DEST = "results/result.pdf";
    private static final String FONT = "src/main/resources/NotoSans-Regular.ttf";

    static {
        new File(DEST).getParentFile().mkdirs();
    }

    public static void main(String[] args) throws IOException {
        //PDF/a-4 requires a PDF 2.0 document
        PdfWriter writer = new PdfWriter(DEST, new WriterProperties().setPdfVersion(PdfVersion.PDF_2_0));
        //Grab the image color matching profile
        InputStream inputStream = new FileInputStream("src/main/resources/sRGB_CS_profile.icm");
        //Create the PDF/a-4 document by instantiating a PdfADocument object and passing the PDF/a-4 conformance level
        PdfADocument pdfDocument = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_4, new PdfOutputIntent("Custom", "",
                null, "sRGB IEC61966-2.1", inputStream));
        //Taking care of the additional PDF/A requirements
        pdfDocument.getCatalog().setLang(new PdfString("nl-nl"));
        pdfDocument.setTagged();
        PdfDocumentInfo info = pdfDocument.getDocumentInfo();
        info
                .setTitle("title")
                .setAuthor("Author")
                .setSubject("Subject")
                .setCreator("Creator")
                .setKeywords("Metadata, iText, PDF")
                .setCreator("My program using iText")
                .addCreationDate();

        Document document = new Document(pdfDocument);
        //PDF/a requires fonts to be embedded
        PdfFont font = PdfFontFactory.createFont(FONT, PdfEncodings.IDENTITY_H);

        Paragraph element = new Paragraph("Hello World").setFont(font).setFontSize(10);
        document.add(element);

        Image logoImage = new Image(ImageDataFactory.create("src/main/resources/logo.png"));
        //PDF/a requires images to have alternative text
        logoImage.getAccessibilityProperties().setAlternateDescription("Logo");
        document.add(logoImage);

        pdfDocument.close();
    }
}
C#
C#
using System.IO;
using iText.Html2pdf;
using iText.Html2pdf.Resolver.Font;
using iText.IO.Font;
using iText.IO.Image;
using iText.Kernel.Font;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Font;
using iText.Pdfa;

namespace PdfA_Examples
{
    internal class Program
    {
        public static string DEST = "result.pdf";
        private static string FONT = "NotoSans-Regular.ttf";
        private static string HTML = "example.html";


        public static void Main(string[] args)
        {
            PdfA4Example();
        }

        private static void PdfA4Example()
        {
            //PDF/a-4 requires a PDF 2.0 document
            PdfWriter writer = new PdfWriter(DEST, new WriterProperties().SetPdfVersion(PdfVersion.PDF_2_0));
            //Grab the image color matching profile
            FileStream inputStream = new FileStream("sRGB_CS_profile.icm", FileMode.Open);
            //Create the PDF/a-4 document by instantiating a PdfADocument object and passing the PDF/a-4 conformance level
            PdfADocument pdfDocument = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_4, new PdfOutputIntent("Custom", "",
                null, "sRGB IEC61966-2.1", inputStream));
            //Taking care of the additional PDF/A requirements
            pdfDocument.GetCatalog().SetLang(new PdfString("nl-nl"));
            pdfDocument.SetTagged();
            PdfDocumentInfo info = pdfDocument.GetDocumentInfo();
            info
                .SetTitle("title")
                .SetAuthor("Author")
                .SetSubject("Subject")
                .SetCreator("Creator")
                .SetKeywords("Metadata, iText, PDF")
                .SetCreator("My program using iText")
                .AddCreationDate();

            Document document = new Document(pdfDocument);
            //PDF/a requires fonts to be embedded
            PdfFont font = PdfFontFactory.CreateFont(FONT, PdfEncodings.IDENTITY_H);

            Paragraph element = new Paragraph("Hello World").SetFont(font).SetFontSize(10);
            document.Add(element);

            Image logoImage = new Image(ImageDataFactory.Create("logo.png"));
            //PDF/a requires images to have alternative text
            logoImage.GetAccessibilityProperties().SetAlternateDescription("Logo");
            document.Add(logoImage);

            pdfDocument.Close();
            inputStream.Close();
        }
    }
}

pdfHTML

Java
JAVA
package org.example;

import com.itextpdf.html2pdf.ConverterProperties;
import com.itextpdf.html2pdf.HtmlConverter;
import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
import com.itextpdf.io.font.FontProgram;
import com.itextpdf.io.font.FontProgramFactory;
import com.itextpdf.kernel.pdf.*;
import com.itextpdf.layout.font.FontProvider;
import com.itextpdf.pdfa.PdfADocument;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class PdfA4HtmlExample {
    public static final String DEST = "results/result.pdf";
    private static final String HTML = "src/main/resources/example.html";
    private static final String FONT = "src/main/resources/NotoSans-Regular.ttf";

    static {
        new File(DEST).getParentFile().mkdirs();
    }

    public static void main(String[] args) throws IOException {
        //PDF/a-4 requires a PDF 2.0 document
        PdfWriter writer = new PdfWriter(DEST, new WriterProperties().setPdfVersion(PdfVersion.PDF_2_0));
        //Grab the image color matching profile
        InputStream inputStream = new FileInputStream("src/main/resources/sRGB_CS_profile.icm");
        //Create the PDF/a-4 document by instantiating a PdfADocument object and passing the PDF/a-4 conformance level
        PdfADocument pdfDocument = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_4, new PdfOutputIntent("Custom", "",
                null, "sRGB IEC61966-2.1", inputStream));
        //Taking care of the additional PDF/A requirements
        pdfDocument.getCatalog().setLang(new PdfString("nl-nl"));
        pdfDocument.setTagged();
        PdfDocumentInfo info = pdfDocument.getDocumentInfo();
        info
                .setTitle("title")
                .setAuthor("Author")
                .setSubject("Subject")
                .setCreator("Creator")
                .setKeywords("Metadata, iText, PDF")
                .setCreator("My program using iText")
                .addCreationDate();

        ConverterProperties properties = new ConverterProperties();
        FontProvider fontProvider = new DefaultFontProvider();
        FontProgram fontProgram = FontProgramFactory.createFont(FONT);
        fontProvider.addFont(fontProgram);
        properties.setFontProvider(fontProvider);
        HtmlConverter.convertToDocument(new FileInputStream(HTML), pdfDocument, properties);

        pdfDocument.close();
    }
}
C#
C#
using System.IO;
using iText.Html2pdf;
using iText.Html2pdf.Resolver.Font;
using iText.IO.Font;
using iText.IO.Image;
using iText.Kernel.Font;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Font;
using iText.Pdfa;

namespace PdfA_Examples
{
    internal class Program
    {
        public static string DEST = "result.pdf";
        private static string FONT = "NotoSans-Regular.ttf";
        private static string HTML = "example.html";


        public static void Main(string[] args)
        {
            PdfA4HtmlExample();
        }

        private static void PdfA4HtmlExample()
        {
            //PDF/a-4 requires a PDF 2.0 document
            PdfWriter writer = new PdfWriter(DEST, new WriterProperties().SetPdfVersion(PdfVersion.PDF_2_0));
            //Grab the image color matching profile
            FileStream inputStream = new FileStream("sRGB_CS_profile.icm", FileMode.Open);
            //Create the PDF/a-4 document by instantiating a PdfADocument object and passing the PDF/a-4 conformance level
            PdfADocument pdfDocument = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_4, new PdfOutputIntent("Custom", "",
                null, "sRGB IEC61966-2.1", inputStream));
            //Taking care of the additional PDF/A requirements
            pdfDocument.GetCatalog().SetLang(new PdfString("nl-nl"));
            pdfDocument.SetTagged();
            PdfDocumentInfo info = pdfDocument.GetDocumentInfo();
            info
                .SetTitle("title")
                .SetAuthor("Author")
                .SetSubject("Subject")
                .SetCreator("Creator")
                .SetKeywords("Metadata, iText, PDF")
                .SetCreator("My program using iText")
                .AddCreationDate();

            ConverterProperties properties = new ConverterProperties();
            FontProvider fontProvider = new DefaultFontProvider();
            FontProgram fontProgram = FontProgramFactory.CreateFont(FONT);
            fontProvider.AddFont(fontProgram);
            properties.SetFontProvider(fontProvider);
            HtmlConverter.ConvertToDocument(new FileStream(HTML, FileMode.Open), pdfDocument, properties);

            pdfDocument.Close();
            inputStream.Close();
        }
    }
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.