```Good afternoon. Excuse my written English, I do...
# general
f
Copy code
Good 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.
n
I am not entirely sure but your renderer.templatename has a space in it, this may be causing you a problem. "results " In future can you post your code and not use images of the code? This would allow someone trying to help you to easily take your code and try it for themselves to help troubleshoot your issue. Also the error message has a line number but I don't know which line that is exactly as you've supplied an image.
f
Thank you so much. I solved this way:
Copy code
var 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
                    });
👍🏻 1