Home » Troubleshooting » How to Append Two Or More PDF Documents In NetSuite

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.

CTA - NetSuite Implementation Banner

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>

CTA - NetSuite Integration Connector Banner

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  

Get In Touch With Our Experts


    Get In Touch With Our Experts

      I have read and agree to the Privacy Policy of Folio3
      I agree to be contacted by Phone or Email by Folio3

      Get in touch with the

      Award-Winning

      End-to-end NetSuite Servicing Agency

      Tell us how may we assist you!