render.TemplateRenderer

Object Description

Encapsulates a template object that produces HTML and PDF printed forms utilizing advanced PDF/HTML template capabilities.

The template object includes methods that pass in a template as string to be interpreted by FreeMarker, and render interpreted content in your choice of two different formats: as HTML output to an nlobjResponse object, or as XML string that can be passed to render.xmlToPdf(options) to produce a PDF.

This object is available when the Advanced PDF/HTML Templates feature is enabled.

For a complete list of this object’s methods and properties, see TemplateRenderer Object Members.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/render Module

Since

2015.2

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/render Module Script Samples.

          //Add additional code
//Advanced PDF/HTML Templates feature must be enabled
...
var xmlTmplFile = file.load('Templates/PDF Templates/invoicePDFTemplate.xml');
var myFile = render.create();
myFile.templateContent = xmlTplFile.getContents();
myFile.addRecord('record', record.load({
    type: record.Type.INVOICE,
    id: 37
    }));
var invoicePdf = myFile.renderAsPdf();
...
//Add additional code 

        

Related Topics

General Notices