0
var gr = new GlideRecord("sys_attachment");
    gr.addQuery("table_sys_id", current.sys_id);
    gr.addEncodedQuery("file_nameLIKEpng^ORfile_nameLIKEjpg");
    gr.query();
    if (gr.next()) {
        var html = '<p><img style="align: baseline;" src="sys_attachment.do?sys_id=' + gr.sys_id + '" width="auto" height="auto"></p>';
         var pdf = new sn_pdfgeneratorutils.PDFGenerationAPI();
         // I was able to add the footer
        var hfInfo = new Object();
        hfInfo["FooterText"] = "0001/2022 - v1 de 02-02-2022";
        hfInfo["PageSize"] = "A4";
        hfInfo["GeneratePageNumber"] = "true";
        hfInfo["FooterTextAlignment"] = "BOTTOM_LEFT";
         var result = pdf.convertToPDFWithHeaderFooter(html, "sc_req_item", current.sys_id, gr.file_name, hfInfo);
     }
Convert Image into PDF attachment ServiceNow
admin Changed status to publish December 19, 2023