Prepending and appending PDF files to a ForNAV report

Today, ForNAV already has the capability to merge a report with one or more PDFs when using the Bullzip PDF printer:  https://www.fornav.com/knowledge-base/how-to-add-a-pdf-document-to-a-sales-invoice/

However, this method is limited to creating PDFs and not printing directly to a printer. In addition, the PDFs can only be inserted before or after an entire report and not before or after each data item (for example, before or after each invoice in an Invoice report).

Because of this, we have added the capability to insert PDFs before and after data items using the PrependPdf and AppendPdf C/AL functions, which must be used in the OnInitReport trigger of the report.

In the example below, a PDF with the letter “A” is prepended to each invoice and two PDFs with the letters “B” and “C” are appended to the report by loading the PDFs from files using a stream.

Another option is to store the PDFs in a BLOB database and use the Blob.CREATEOUTSTREAM(MyOutStream); call to create the stream before prepending or appending the PDFs.

Warning: Processing the PDFs can be very time consuming depending on their complexity. If printing speed is an issue, we recommend that you use the Bullzip merge option instead.

 

Example: Adding PDFs to a Sales Invoice report