How to download PDF from SuiteScript?

Hi,

 

I’m looking for a way to download a PDF directly from a client script.  I am currently using the N/file module to save any PDF’s that I generate into the file cabinet.

How would I make it so that I can download the PDF rather than save it in the file cabinet?

Rookie Asked on September 11, 2019 in SuiteScript.
Add Comment
1 Answer(s)
Best answer

Hi Daniel,

You can use the render module to render and then write the file. You can have it either display or download.

Zack

var renderer=render.create();

 

renderer.templateContent=xmlStr;

 

var newfile=renderer.renderAsPdf();

 

response.writeFile(newfile, true);

 

Beginner Answered on September 11, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor