How to Append Two Or More PDF Documents In NetSuite

While working on NetSuite implementations you may have come across situations where you had to generate a PDF report from a particular record by appending two or more PDF documents together. We recently encountered this requirement while working on an ERP implementation for one of our NetSuite clients.

The client wanted us to provide a button on the Estimate record that would enable them to generate a record specific PDF. The catch here was that in order to generate this PDF report, we had to append two existing PDF documents with our newly generated PDF via SuiteScript. To solve this problem, we used the PDFSET tag provided by BFO for appending PDFs (as shown below).

<pdfset>

<pdf>

<body>

Document body here

</body>

</pdf>

<pdf src=”resource/pdf1.pdf” />

<pdf src=”resource/pdf2.pdf” />

</pdfset>

 

Here’s the code snippet we used in NetSuite.

var xml = “<?xml version=\”1.0\”?>\n<!DOCTYPE pdf PUBLIC \”-//big.faceless.org//report\” \”report-1.1.dtd\”>\n”;

xml += “<pdfset>\n”;

xml += “<pdf>\n<body font-size=\”12\”>\n<h3>Genereated PDft</h3>\n”;

xml += “<p></p>”;

xml += “Document body here”;

xml += “</body>\n</pdf>”;

xml += “<pdf src=”resource/pdf1.pdf” />”;

xml += “<pdf src=”resource/pdf2.pdf” />”;

xml += “</pdfset>”;

 

var file = nlapiXMLToPDF( xml );

file.setFolder(<FOLDER_ID>);

nlapiSubmitFile(file);

If you have a NetSuite implementation requirement you would like to discuss, or would like to know more about our NetSuite implementation services, please get in touch with us  

It's only fair to share...Tweet about this on TwitterShare on LinkedInShare on Google+Share on Facebook
How Netsuite Defines Cloud ERP
Use Excel to Update NetSuite without Traditional Integration Options

Zeeshan Ahmed

Leave a Reply

Your email address will not be published.