Wednesday, January 30, 2019

Create multiple paged PDF file using nlapiXMLtoPDF

The 'pdfset' element/tag can be used for creating multiple pages for PDF.

Kindly refer to the available PDF tags under BFO :: http://bfo.com/products/report/docs/tags/

Sample code snippet:

   ======================
   var xml = "<?xml version=\"1.0\"?>\n<!DOCTYPE pdf PUBLIC \"-//big.faceless.org//report\" \"report-1.1.dtd\">\n";
   xml += "<pdfset>";
  
   xml += "<pdf>";
   xml += "<body>";
   xml += "This is Page 1";
   xml += "</body>";
   xml += "</pdf>";
  
   xml += "<pdf>";
   xml += "<body>";
   xml += "This is Page 2";
   xml += "</body>";
   xml += "</pdf>";
    
   xml += "<pdf>";
   xml += "<body>";
   xml += "This is Page 3";
   xml += "</body>";
   xml += "</pdf>";
  
  xml += "</pdfset>";

  var filePDF = nlapiXMLToPDF(xml);
  response.setContentType('PDF', 'PDF_3pages.pdf', 'inline');
  response.write(filePDF.getValue());
  ======================

No comments:

Post a Comment