Netsuite帮助中的以下示例很好地说明了如何使用渲染模块创建自定义PDF报告。
/**
*@NApiVersion 2.x
*/
// This example shows how to render an invoice into a PDF file using an XML template in the file cabinet.
// Note that this example requires the Advanced PDF/HTML Templates feature.
require(['N/render', 'N/file', 'N/record'],
function(render, file, record) {
function renderRecordToPdfWithTemplate() {
var xmlTemplateFile = file.load('Templates/PDF Templates/invoicePDFTemplate.xml');
var renderer = render.create();
renderer.templateContent = xmlTemplateFile.getContents();
renderer.addRecord('record', record.load({
type: 'inventoryadjustment',
id: 37
}));
var invoicePdf = renderer.renderAsPdf();
}
renderRecordToPdfWithTemplate();
});
我的问题:
addRecord
添加项目