Using PDF/A in Teigha PDF Export

Sergey Sherstnev
January 12, 2017

Tags: export pdf Example

Teigha includes a PDF export module that can be used to export CAD file formats to high quality PDF. The export module includes a number of options that allow Teigha client applications to fine-tune the contents of the resulting PDF file. This article explains how to configure PDF export to generate PDF/A documents.

PDF/A is an ISO-standardized version of the Portable Document Format (Adobe® PDF) designed for archiving and long-term preservation of electronic documents. PDF/A differs from PDF by prohibiting features that are ill-suited to long-term archiving, such as font linking (as opposed to font embedding) and encryption. The ISO requirements for PDF/A file viewers include color management guidelines, support for embedded fonts, and a user interface for reading embedded annotations.

There are several versions of the PDF/A standard:

PDF/A-1 Part 1: Use of PDF 1.4
PDF/A-2 Part 2: Use of ISO 32000-1
PDF/A-3 Part 3: Use of ISO 32000-1 with support for embedded files

To format a .pdf document as PDF/A, set the corresponding flag in PdfExportParams:

enum PDF_A_mode
        /** PDF/A format is not supported*/
        kPDFA_None = 0,
        /**PDF/A-1b version*/
        /**PDF/A-2b version*/

Use the void setArchived(PDF_A_mode mode) method. In the OdaMfcApp.exe sample application, you can see the option in the Custom PDF Export Properties dialog:

Because the only difference between PDF/A-2 and PDF/A-3 is support for embedded files, which has no meaning for CAD applications and drawings, Teigha supports only the first two standard versions. However, it is strongly recommended to use the second standard version for archiving a drawing because there are some restrictions for the PDF/A-1 version:

  • PDF/A-1 doesn’t support layers. So, layers will be disabled if the PDF/A-1 format is chosen.
  • PDF/A-1 doesn’t support transparency. So, transparency will also be disabled. In addition, the “MergeControl” parameter will be set to “Lines Overwrite” mode.
  • According to the specification, the real values (such as coordinates) cannot be greater than 32767, so the document resolution will possibly be reduced.
  • According to the specification, the strings (including streams and stream parts) cannot be greater than 64K, so the picture quality will be set to a minimum value, ASCII hex encoding will be disabled, and flat encoding will be enabled for export in this case to reduce the possibility of an issue.
  • PDF/A-1 doesn’t support measuring, so it will be disabled.

The PDF/A-2 version is free of these restrictions and recommended to use if the PDF/A-1 version is not needed for a specific purpose.

In the end there are a couple of issues related to both PDF/A standard versions:

  • Fonts must be embedded into a PDF/A document. This is meaningful for long-term preservation but leads to an increase in document size.
  • 3D annotations are not supported with PDF/A standards, so if you try to export a PRC document (that uses 3D annotations) to PDF/A, the export will return exInternalError. Unlike the issues with incompatible parameters described above (layers, DPI, etc.), in this case, the PdfExport module cannot prioritize the caller needs. Therefore it is left up to the client application to handle this situation.
All posts