Covert UI page to pdf and attach to form

SAM321
Tera Contributor

Hi all , I created a ui page, This Ui page open when I click Ui button in form. Now after filling Ui page if i click submit button in UI page it should be converted to pdf and attach to that form.. How can i achieve this . can anyone help

Screenshot (292).png

5 REPLIES 5

Samaksh Wani
Giga Sage
Giga Sage

Hello @SAM321 

 

Use this script :-

 

var gr=new GlideRecord('your table name');
if(gr.get('current.sys_id'))
{
var pdfconverter = new global.GlideHTMLToPConverter();
var pdfDocument = pdfConverter.convert();
var attachment = new global.GlideSysAttachment();
attachment.write(gr, 'your table name', 'PDF Attachment', 'application/pdf', pdfDocument);
}
else{
gs.error('record not found');
}

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh

Ankur Bawiskar
Tera Patron
Tera Patron

@SAM321 

you will have to try using PDF Generation API, somehow get the complete HTML of your UI page and then convert it to PDF

Generating Custom PDFs - using the new PDFGenerationAPI 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Is there a away to convert email to attachment.

 

Email received in sys_email table should be converted to attachment 

jackswiftbo
Giga Contributor

Interesting topic for discussion. Is it possible to integrate an API from an online converter like https://pdfguru.com/csv-to-pdf that can convert data from HTML or CSV to PDF? Of course, an API key is required, but still. I’m specifically interested in this solution because I often work with online converters and PDF editors.