Exporting Documents as PDF Files

Technical Articles > PDF Import and Export

TX Text Control offers two different PDF versions to save a document to:

PDF/A is a format that has been created for long-term archiving of electronic documents. This PDF standard states that the created PDF file must be 100 % self-contained, e.g. all the information, that is necessary to display the content must be embedded in the file. Furthermore, audio and video content is forbidden as well as JavaScript and any executable code. Also, encryption is not allowed.

The PDF/A standard is based on the PDF Reference Version 1.4 from Adobe Systems Inc. and has been published as an ISO standard on October 1, 2005.

TX Text Control's PDF filter can export documents to PDF/A-1b, so that documents can be archived in compliance to ISO standards.

Using PDF/A in TX Text Control

To export any content in TX Text Control to a PDF/A-1b file, the Save method has to be used with the AdobePDFA StreamType enumeration. To export the page size of a document to PDF, the TextControl.ViewMode must be set to PageView.

Basic Steps to Create a PDF/A Document in an Application

1. The ViewMode property has to be set to PageView

2. FontSettings.EmbeddableFontsOnly has to be set to true.

3. The document can now be saved to PDF/A with the TextControl.Save method.

The usage of fonts can be restricted with the properties FontSettings.EmbeddableFontsOnly, FontSettings.ScalableFontsOnly and FontSettings.TrueTypeFontsOnly. The first property triggers if only embedabble can be used in a document, the second if only free scalable fonts and the latter if only TrueType (TTF) fonts are allowed to be used.

Please note that not every font can be embedded using PDF/A, which may have different reasons: Either a font's license forbids embedding or a device dependent font is used.

TX Text Control includes an advanced algorithm to replace any font that can not be embedded. For this purpose, the AdaptFont event has been implemented to provide means to programmatically set the font, that will be used to replace a non-embeddable font. The event itself must be activated with the FontSettings.AdaptFontEvent property.

In the event, the AdaptFontEventArgs.FontName property represents the original font, that can not be embedded. The AdaptFontEventArgs.AdaptedFontName property is the font name, that will be used to replace the original font and SupportedFonts is an array of all supported fonts that can be used in a document.

For each font, that can not be embedded, the AdaptFont event will be fired if FontSettings.AdaptFontEvent has been set previously to true.