fabianbrizz
09/27/2023, 9:03 PMGood afternoon.
Excuse my written English, I don't know English and I must use a translator.
I want to learn how to send data to an xml template to be able to generate a pdf. What I have not been able to understand is how the data is set in the XML.
I have this and the result is this (First Image). In the second image is the test pdf.
The error is in the third image. In the fourth image is the result of the "results". I would like to know what I am doing wrong
and be able to understand how they work to continue developing and learning more. Thank you so much.
NElliott
09/28/2023, 7:23 AMfabianbrizz
09/28/2023, 9:45 PMvar xmlStr = '<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">'
xmlStr += '<pdfset>';
for(var idEstimate of arrayId){
var renderer = render.create();
renderer.setTemplateByScriptId('CUSTTMPL_SD_ESTIMATE_MERGE');
renderer.addRecord('record', record.load({
type: record.Type.ESTIMATE,
id: idEstimate
}));
xmlStr +=renderer.renderAsString();
}
xmlStr += '</pdfset>';
var pdfFile = render.xmlToPdf({
xmlString: xmlStr
});
context.response.writeFile({
file: pdfFile,
isInline: true
});