Hello, I have two advpdfhtml templates, Template ...
# advancedpdf
a
Hello, I have two advpdfhtml templates, Template A and Template B. Now, I want to create another template, Template C and reference both contents of Template A and Template B inside of Template C (kind of like an aggregate) without using SuiteScript so that I would have to only maintain Templates A, and B. Has this been done before? I was able to do it using suitescript but when trying to send a standard email message via the communications tab, the templates where not being sourced over. Here's how I was able to do it via suitescript
Copy code
if (ctx.type === ctx.UserEventType.PRINT) {

    const renderer = render.create();
    renderer.setTemplateByScriptId({ scriptId: 'CUSTTMPL_TEMPLATE_PDF_VB_B' });
    renderer.addRecord({ templateName: 'record', record: ctx.newRecord });

    const xmlContent = renderer.renderAsString()
        .replace(/<\?xml[^?]*\?>\s*/i, '')
        .replace(/<!DOCTYPE[^>]*>\s*/i, '');

    ctx.form.addField({
        id:    'custpage_second_template',
        type:  serverWidget.FieldType.INLINEHTML,
        label: 'Second Part',
    }).defaultValue = xmlContent;
}
n
Typically, if you want to combine more than one PDF you would use <PDFSET> but I'm not sure if that's applicable in your scenario. Essentially it's <pdfset> <pdf> contents A </pdf> <pdf> contents B </pdf> <pdf> contents B </pdf> </pdfset> I imagine you could add logic to say if the content is rendered or not inside each pdf based on the record details.
s
Something like this. Where Template A is rendered via URL and Template B is rendered via URL and combined in Template C. Below would be Template C. As long as URL is available without login, it should work. A simple Suitelet could do the trick to render Template A/B.
Copy code
<?xml version="1.0"?>
<!DOCTYPE pdfset PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdfset>
    <pdf src="<https://netsuite.com>"/>
    <pdf src="<https://netsuite.com>"/>
</pdfset>