Creating multiple PDFs with one pdfChip command line invocation
pdfChip 1.1 introduces a very simple mechanism to create more than one PDF file from a single command line invocation of pdfChip:
cchip.setOutputPdf()creates and opens a new PDF file, PDF pages created after this function call will be created in the 'new' PDF
cchip.closeOutputPdf()closes the current PDF output file; it should be called each time no more pages are to be added to the current output PDF. Any output PDF files not closed during processing by pdfChip will be closed automatically once all processing has been completed. As on most operating systems the number of open file handles is limited, care should be taken not to leave output PDF files unnecessarily open.
When used to create just one PDF file per pdfChip command line invocation, there is no need to use either of these two function calls.
Creates and opens a new output PDF file. Any PDF pages created after calling this function will be created in the new output PDF file
<filename>. The folder of the newly cerated output PDF file will be the same as the parent folder for the output PDF file passed as the respective argument on the command line.
<filename> parameter contains the name of the output PDF file to be created and opened. The file name must comply with the rules for file names of the file system on which it is to be created.
Closes the current output PDF file. A new output PDF file must be created and opened after issuing this function call, unless no further PDF pages are being created.
In the following example, each time cchip.printPages() is called, a new output PDF file is created and opened, filled with pages by the cchip.printPages() call, and is then closed (to avoid running out of file handles in cases where many thousands of PDF file get created by pdfChip during a single command line invocation - like would be typical when creating delivery notes, invoices, bank statements or similar high volume PDF documents). The file names to be used are retrieved by a custom function getPdfFileName() that retrieves it from an existing list of file names – but any other method could be used equally well.
cchip.setOutputPdf( getPdfFileName(filename_list, seq_nr) );