Working with PDF/A from the FastReport VCL designer

Working with PDF/A from the FastReport VCL designer

We continue to tell you about the export options of FastReport VCL. Our development team adds many new and exciting features with each update. Today we want to remind you about the export format that we added back in 2017. We will talk about PDF/A and its functions.

The well-known PDF document format (Portable Document Format) appeared a long time ago and enjoys deserved popularity, because you can create and open these documents on any platform, be it Windows, Linux, iOS, еtc. This advantage promotes the use of PDF to archive documents. However, not all documents are suitable for archiving. For example, if your document contains links, uses specific fonts (that are not embedded in the document itself), or multimedia data. This document is not self-contained.

The PDF/A standard was developed specifically for archiving documents. It is also certified as a regular PDF(ISO 19005-1:2005 standard). What is the difference between PDF and PDF/A?

The main requirement for the PDF/A format is to guarantee the reproducibility of the document after several years in the same form. First, this is ensured by the self-containment of the document. This means that the document must contain all the necessary data (text, raster and vector images, fonts, and color data) and not have external links.

Let's look at in order what the document should and should not contain.

It is forbidden:


It is prescribed:

Thus, we get an integral self-contained document that does not depend on external data. You can always open such a document with a standard viewer program. Guaranteed document reproduction is also ensured by international standard.

The PDF/A document will be slightly larger than the PDF due to all the data it contains.

After creating the template, let’s switch to the preview mode of the finished report. Find export to PDF in the upper left corner.

Export to PDF

 

Let’s look at PDF/A standards available in FastReport VCL:

Export to PDF

 

Standard PDF/A-1a and PDF/A-1b (ISO 19005-1)

Level 1B conformance requires only that standards necessary for the reliable reproduction of a document's visual appearance be followed, while Level 1A conformance includes all Level 1B requirements in addition to features intended to improve a document's accessibility.

Additional level 1A requirements:

Level A conformance was intended to increase the accessibility of conforming files for physically impaired users by allowing assistive software, such as screen readers, to more precisely extract and interpret a file's contents.

 

PDF/A-2 standard (ISO 19005-2)

The PDF/A-2 addresses some of the new features added with PDF versions 1.5, 1.6, and 1.7. PDF/A-2 has backward compatibility with PDF/A-1, meaning all PDF/A-1 documents must be PDF/A-2 compliant. However, PDF/A-2 will not necessarily conform to PDF/A-1.

PDF/A-2 is based on PDF 1.7 (as defined in ISO 32000-1) which supports some workflow enhancements such as JPEG2000 compression, transparency effects, and layers, OpenType font embedding, and provisions for digital signatures in accordance with the PDF Advanced Electronic Signatures

PDF/A-2 also allows archiving of sets of documents with a single file.

PDF/A-2 has the following compliance levels:
- PDF/A-2a meets all requirements in the ISO 19005-2 specification;
- PDF/A-2b is a lower level of compliance. It covers the standard's requirement for the document’s appearance, rather than its structural and semantic properties.

 

PDF/A-3 standard (ISO 19005-3)

PDF/A-3 differs from PDF/A-2 in one important regard: it allows embedding. Moreover, it can be not only other PDF/A (supported in PDF/A-2) but also any other files. This is essential for archiving.

Like PDF/A-2, the PDF/A-3 standard defines three compliance levels:

In PDF/A-3 files, any embedded files must be considered "non-archival". In other words, the embedded file is considered temporary and should not be regarded as a file for long-term storage. Only the primary PDF content is intended for long-term storage.

So, let's look at how to export according to the PDF/A standard. We will see an export settings window. Go to the "Options" tab. This is where we can choose the PDF/A standard. Please note that there are 4 standards in the dropdown list: PDF/A-2a, PDF/A-2b, PDF/A-3a and PDF/A-3b. There is no PDF/A-1 here as it is considered obsolete.

Export to PDF

 

Note that the embedded fonts were no longer editable when we selected the PDF/A option. The fonts are now embedded by default. This meets the standard requirements.

Let's go over all the export properties.

Page range — selecting the pages of our document that will be exported to PDF.

PDF Standard — selecting PDF specification (regular or PDF/A).

PDF Version — it will not be available now, as we are talking about PDF/A, but PDF export versions from 1.4 to 1.7 will be available with the regular specification.

Compressed — a property that determines whether report data should be compressed.

Embedded fonts — this property will be disabled in PDF/A as the standard does not support the use of any fonts.

Background — allows the user to make a background in the report without a watermark.

Print optimized — PDFs can be optimized for printing, which improves the quality of the images, but their size will become larger.

Outline — property to enable or disable outlining.

Transparency — property is responsible for displaying transparency in objects.

Export to PDF

 

This is a section with the insider information added to the PDF file: title, author, subject, keywords (you can upload PDFs to the web, they are well indexed), PDF creator, and document producer.

Export to PDF

 

This is a section with the insider information added to the PDF file: title, author, subject, keywords (you can upload PDFs to the web, they are well indexed), PDF creator, and document producer.

Export to PDF

 

How to customize the PDF viewer when opening a document: hide the toolbar, hide the menu, hide the user interface window, expand the viewer window, center the window, and stretch the size for printing. The default parameters set by the developers are usually used when exporting.

Export to PDF

 

This section contains information about the digital signature. I will leave a link to an article, which explains this function and how to configure it, instead of repeating the information. Link.


How to generate PDF/A from Delphi or Lazarus code

procedure TForm1.Button1Click(Sender: TObject);
begin
 {Generate a report. We must generate a report before exporting}
 frxReport1.PrepareReport();
 {Set the range of exported pages. All pages of the generated report are exported by default}
 frxPDFExport1.PageNumbers := '2-3';
 {Set the PDF standard TPDFStandard = (psNone, psPDFA_1a, psPDFA_1b, psPDFA_2a, psPDFA_2b, psPDFA_3a, psPDFA_3b);  Adding frxExportPDFHelpers module to the uses list is required: uses frxExportPDFHelpers;}
 frxPDFExport1.PDFStandard := psNone;
 {For PDFStandard = psNone you can set the version of the PDF standard TPDFVersion = (pv14, pv15, pv16, pv17);  Adding frxExportPDFHelpers module to the uses list is required: uses frxExportPDFHelpers;}
 frxPDFExport1.PDFVersion := pv17;
 {You can set compression for a smaller file size}
 frxPDFExport1.Compressed := True;
 {Set whether fonts should be embedded in the resulting document.  Font embedding significantly increases the size of the resulting document}
 frxPDFExport1.EmbeddedFonts := False;
 {Set whether to export the background image of the page}
 frxPDFExport1.Background := True;
 {Disable the export of print optimized objects.}
 {When the option is enabled, the image quality will be better, but they will be 9 times larger}
 frxPDFExport1.PrintOptimized := False;
 {Set whether the resulting PDF will include an external table of contents, as in the original report}
 frxPDFExport1.Outline := False;
 {Set whether to export images with transparency}
 frxPDFExport1.Transparency := True;
 {You can set the desired DPI for images. Enabling this option disables the SaveOriginalImages function,}
 {which allows saving images in their original form.}
 frxPDFExport1.PictureDPI := 150;
 {Set compression ratio of raster images}
 frxPDFExport1.Quality := 95;
 {Set whether to open the resulting file after export}
 frxPDFExport1.OpenAfterExport := False;
 {Set whether to display export progress  (show which page is currently being exported)}
 frxPDFExport1.ShowProgress := False;
 {Set whether to display a dialog box with export filter settings}
 frxPDFExport1.ShowDialog := False;
 {Set the name of the resulting file. Note that if you do not set a file name and disable the export filter dialog window,}
 {the dialog will still be displayed for file name selection.}
 frxPDFExport1.FileName := 'C:\Output\test.pdf';
 {Fill in the corresponding fields of the Information tab}
 frxPDFExport1.Title := 'Your Title';
 frxPDFExport1.Author := 'Your Name';
 frxPDFExport1.Subject := 'Your Subject';
 frxPDFExport1.Keywords := 'Your Keywords';
 frxPDFExport1.Creator := 'Creator Name';
 frxPDFExport1.Producer := 'Producer Name';
 {Fill in the corresponding fields of the Security tab}
 frxPDFExport1.UserPassword := 'User Password';
 frxPDFExport1.OwnerPassword := 'Owner Password';
 frxPDFExport1.ProtectionFlags := [ePrint, eModify, eCopy, eAnnot];
 {Set up viewer settings (Viewer tab)}
 frxPDFExport1.HideToolbar := False;
 frxPDFExport1.HideMenubar := False;
 frxPDFExport1.HideWindowUI := False;
 frxPDFExport1.FitWindow := False;
 frxPDFExport1.CenterWindow := False;
 frxPDFExport1.PrintScaling := False;
 {Export the report}
 frxReport1.Export(frxPDFExport1);
end;

Let's sum up. PDF is an Open Standard available for all software developers. It was created specifically to make any data look the same regardless of the used program, operating system, embedded fonts, etc. FastReport VCL has been doing an excellent job for many years and it will continue to develop to meet the needs of users.

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.
Trustpilot