NetSuite: How to view your reports as PDF in browser. (SuiteScript)

Difficulty: EZ

In this blog, I will teach you how to view your reports as PDF in browsers instead of its default nature of downloading it upon access.


  • SuiteScript 1.0/2.0 (required)
  • Advanced PDF/HTML Templates (optional)

I will not cover the report creation stage since I am assuming that you already know how to use nlobjTemplateRenderer or ‘N/Render’ module.

Let me give you the answer immediately.

The secret is on the response headers. By default, if you created a report in NetSuite via SuiteScript its response headers is set to auto download the file. To prevent this action we must update the response headers by:

Content-Type: application/pdf

Content-Disposition: inline; filename=”report.pdf”

You must set these headers on your response object before you call your actual rendering action.

Example (SuiteScript 2.0)

// script type: Suitelet

// create template and add record logic here..

// now we set the headers

name: ‘Content-Type:’,
value: ‘application/pdf’
name: ‘Content-Disposition’,
value: ‘inline; filename=”report.pdf”‘

// now we render the pdf to response


Example Usage:

On a record, there is a button that would call this suitelet, upon clicking the button it would open a new page containing the report in PDF viewer of your browser.

That is basically it 🙂

Happy Coding!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s