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 http.ServerResponse 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. |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2015.2 |
Syntax
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