I'm currently trying out some sample code from Net...
# suitescript
u
I'm currently trying out some sample code from Netsuite's official docs, but using
String.raw()
formatting on it instead of sorting through the backslashes. It looks something like this:
Copy code
var renderer = render.create();    
var xmlStr = `<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd"><body font-size="18">Hello World!</body></pdf>`;

    var pdfFile = render.xmlToPdf({
      xmlString: xmlStr
    });
    context.response.writeFile(pdfFile);
I am getting a "Syntax Error: Illegal Character" error however. Does Netsuite support Template literals and Template strings? I had assumed it did since its own
Advanced PDF/HTML Template
wysiwyg editor utilized a similar function, but I might be misinformed.
b
your xml is invalid
there is no pdf start tag
other than that, make sure you are using suitescript 2.1
1
u
the SS2.1 fix seems to be the solution here, alongside the missing start tag. Thanks.
b
unfortunately you will have to keep track of which features suitescript supports, its not entirely modern
suitescript 1 and 2 go upto a pathetic es5
suitescript 2.1 goes upto 2019
👍 1