Skip to main content
Skip table of contents

Increased PDF/UA Support

Following the addition of support for the brand-new PDF/UA-2 standard in our previous release, we are excited to announce increased PDF/UA support as a part of the iText Core 8.0.4 release! This makes a significant step forward in enhancing the accessibility and user-friendliness of PDF document creation.

Matterhorn Protocol Automated Checks

PDF/UA is an ISO Standardized specification containing the accessibility requirements of PDF Software, as well as PDF Documents. The Matterhorn Protocol is a guide published by the PDF Association. It contains the criteria required for a PDF document to be considered conforming to the PDF/UA-1 standard, and ensuring everyone has equal access to the information therein. It includes over 30 checkpoints, and descriptions of every way a document can fail to meet these requirements.

We have utilized the Matterhorn Protocol to develop programmatic support for many of the PDF/UA-1 conformance checks, employing the new PdfUAConformanceException (Java/.NET) with descriptive and informative PdfUAExceptionMessageConstants (Java/.NET) notifying the user of helpful details related to the accessibility failure.

PdfUAExceptionMessageConstants examples:

JAVA
static final String CONTENT_WITH_MCID_BUT_MCID_NOT_FOUND_IN_STRUCT_TREE_ROOT
static final String DOCUMENT_SHALL_CONTAIN_VALID_LANG_ENTRY
static final String IMAGE_SHALL_HAVE_ALT

New PDF/UA APIs

Our new PdfUADocument (Java/.NET), and PdfUAConfig (Java/.NET) APIs are another feature greatly improving the user experience when working with PDF/UA documents. When instantiating the PdfUADocument you pass in PdfUAConfig and set properties right within the constructor. Our newly added conformance checks will alert the user of any errors present with a PdfUAConformanceException (Java/.NET), and points them in the right direction to solve them using our descriptive PdfUAExceptionMessageConstants (Java/.NET).

Previously, (iText Core 8.0.3 and earlier) the user would have to instantiate a PdfDocument (Java/.NET), then customize it with WriterProperties (Java/.NET), adding metadata, setting the PDF version, then had to remember to set the document as tagged. Then they had to do several lines of low level code to simply set a title, and language. There was no internal conformance checking, so when a step was forgotten, there was no reminder.

Lets look at a comparison example on the implementation of generating a PDF/UA-1 document using these improved APIs.

Improved Implementation with iText Core 8.0.4

JAVA
PdfDocument pdfDoc =  new PdfUADocument(new PdfWriter(dest),
                new PdfUAConfig(PdfUAConformanceLevel.PDFUA_1, "Some title", "en-US"));
Document document = new Document(pdfDoc, PageSize.A4.rotate());          

Previous Implementation

JAVA
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest,
                new WriterProperties().addUAXmpMetadata().setPdfVersion(PdfVersion.PDF_1_7)));

        Document document = new Document(pdfDoc, PageSize.A4.rotate());

        pdfDoc.setTagged();
        pdfDoc.getCatalog().setViewerPreferences(new PdfViewerPreferences().setDisplayDocTitle(true));
        pdfDoc.getCatalog().setLang(new PdfString("en-US"));
        PdfDocumentInfo info = pdfDoc.getDocumentInfo();
        info.setTitle("English pangram");

We’ve updated our PDF/UA code sample in our Java and .NET GitHub example repos showing these new APIs in action.


IAccessibleElement for Form Fields

We have also implemented IAccessibleElement (Java/.NET) on form fields, enabling the user to more easily access and change the metadata on form fields, such as easily define and set roles, set languages and other information needed to conform with PDF/UA.

Below we can see a comparison example. Previously to set a language for a form field, you had to access the Form Accessibility Language property. With our new implementation using IAccessibleElement, the user can easily access Accessibility Properties with the built in method.

Improved Implementation with iText Core 8.0.4

CODE
formField.getAccessibilityProperties().setLanguage("random language")

Previous Implementation

CODE
formField.setProperty(FormProperty.FORM_ACCESSIBILITY_LANGUAGE, "random language");

This update not only streamlines the process of creating accessible PDFs but also helps ensure that all users, regardless of ability, have equal access to the information. We are committed to continuous improvement in this area. and are excited to see how these advancements will support our users in creating more accessible content.

JavaScript errors detected

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

If this problem persists, please contact our support.