Search code examples
netsuitesuitescript

What is the SuiteScript 2.0 equivalent to nlapiXMLToPDF()


Does anyone know where I can find documentation on the SuiteScript 2.0 version of the nlapiXMLToPDF() command? It's not in the Help Center at all as far as I can tell


Solution

  • It's part of the render module, 'N/render'.

    Example from Help Center

     /**
     *@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();
        });