Wednesday, January 16, 2008

Fill in PDF based forms from AX

I stumbled accross the AX class PDFFiller the other day, while investigating some PDF stuff.

It turns out that you can use this report to fill in PDF based forms. The forms must of course be created so it allows the reader to fill in form fields.

The data from the form fields are stored in a file with XFDF extension, an XML file, and this paired with the initial PDF file gives you the filled in form to show on screen or print.

The PDFFiller class is in the standard only used by the Austrian tax report. See \Classes\TaxReport_ReportAT\fillPDFFile.

Also here is a short sample, assuming the PDF file has a "FieldA" and "FieldB" field:
static void PDFFiller(Args _args)
PDFFiller PDFFiller;;

PDFFiller = PDFFiller::construct();


PDFFiller.addStrField("FieldA", "This is for the first field");
PDFFiller.addStrField("FieldB", "This is for the second field");