Generate a PDF from a Raw XML String

The following sample shows how to generate a PDF from a raw XML string.

Note:

This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.

          /**
 * @NApiVersion 2.x
 */

require(['N/render'],
    function(render) {
        function generatePdfFileFromRawXml() {
            var xmlStr = "<?xml version=\"1.0\"?>\n" +
                "<!DOCTYPE pdf PUBLIC \"-//big.faceless.org//report\" \"report-1.1.dtd\">\n" +
                "<pdf>\n<body font-size=\"18\">\nHello World!\n</body>\n</pdf>";
            var pdfFile = render.xmlToPdf({
                xmlString: xmlStr
            });
        }
        generatePdfFileFromRawXml();
    }); 

        

General Notices