https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
u

7px

04/28/2022, 7:42 AM
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

battk

04/28/2022, 7:49 AM
your xml is invalid
there is no pdf start tag
other than that, make sure you are using suitescript 2.1
1
u

7px

04/28/2022, 7:57 AM
the SS2.1 fix seems to be the solution here, alongside the missing start tag. Thanks.
b

battk

04/28/2022, 8:00 AM
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