Generate PDF from multiple records, with customized design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2019 06:11 AM
Hello guys,
I have got to generate a PDF with contents from multiple records and customize its design/template to meet customers needs. I have spent several hours googling and I am out of ideas atm.
I am stuck at the PDF generation part.
I know there is OOB functionality Export directly from URL which can export any record or list by typing '?PDF' after the '.do', but there is no way (or tell me I am wrong) how to customize this generic 'form-like' looking template, also it can export only one record/list at a time.
Also, I have found generalPDF class (Script Include), which is global but restricted to global only (huh?) and then another class GeneralPdfUtils which is global and accessible from all scopes, but I have no idea how to use this one as there is no documentation nor comments and from the method names I have a general vibe its a no-use for my case.
My approach is sth like:
- code an UI page with appropiate html mark up and CSS media queries so its meets the branding and layout requirements
- fill in the UI page on the fly with data each time it is called (query the records smh via URL)
- make a "snapshot" of the UI page and export it to PDF
- fetch the PDF and append it to a record
Currently I am struggling to generate custom PDF in ServiceNow UI16.
I am restricted to scripting and/or OOB functionality, no 3rd party libraries, rest calls and definitely no paid plugins.
ANY ideas are welcomed and appreciated in advance!
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2019 12:59 PM
Hi ,
Check this plugin - its free and you can define template which can be used to generate PDF
Thanks,
Nitin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 04:47 AM
A brief update. Two possible courses were considered - writing (editing) into .docx table via binary write method of GlideSysAttachment, or, creating a fillable PDF which will be filled in via GeneralPdfUtils Class. The first one was denied as too complicated and risky, so the second one will be implemented, even though its bit too far from ideal solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 05:38 AM
Please have a look at this post:
https://community.servicenow.com/community?id=community_article&sys_id=c89807bedb1fd74054250b55ca961...
The OOB pdf utility is horrible and does not support a lot of the modern html/css styling.
I will probably be forced to drop the oob utility and use the library jspdf instead. This also has some limitations however it looks like it better support modern html/css.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2019 12:12 AM
jsDOC is client site thinge, in my case its terrible idea to delegate such a thing as creation of pretty huge PDF to the client. Also, I have heard people complain its pretty 'slow'. So be aware...