I need to union 2 pdf files, on the server site Netsuite script api2. Or other native javascript option. Thanks
Asked
Active
Viewed 1,159 times
-1
-
Please share more details and what you tried to do to get clear idea about the problem Make a look here https://stackoverflow.com/help/how-to-ask – Romil Patel Mar 21 '19 at 16:10
1 Answers
2
Use the pdfset element in a template file. This is a fragment from an SS2 Suitelet:
function renderSet(opts){
var tpl = ['<?xml version="1.0"?>','<pdfset>'];
opts.files.forEach(function(id, idx){
const partFile = file.load({id:id});
var pdf_fileURL = xml.escape({xmlText:partFile.url});
tpl.push("<pdf src='" + pdf_fileURL + "'/>");
});
tpl.push("</pdfset>");
log.debug({title:'bound template', details:xml.escape({xmlText:tpl.join('\n')})});
return render.xmlToPdf({
xmlString: tpl.join('\n')
});
}
var pdf = renderSet({files:[file1, file2]});
pdf.name = basename +'_'+ getDateStamp() +'.pdf';
response.writeFile({
file:pdf,
isInline: false
});

bknights
- 14,408
- 2
- 18
- 31