Merge multiple PDF Attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2019 03:57 AM
Hi,
We are trying to combine multiple PDf'S from a table record to ONE PDF, we tried using the OOB PDF generator but it didn't work as we are not sure what parameters need to be passed on. We also tried multiple approaches like attachment API, GlideSysAttachment, encode decode GlideStringUtil, base64.
Thanks in advance !

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 08:57 PM
I don't think SN natively has the ability to do this. It would probably be possible to do it on a midserver with some python or nodejs. Seems like a difficult requirement. What does combining these files save your business?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2019 01:30 PM
Hi ,
The client uses some third party tool which accepts only PDF file. The records may contain multiple files, but at the end they want a single PDF at one place, so that they can upload in their tool and reduce the man power to find files and upload manually.
This is the requirement we have .
Kindly suggest any approach.
Regards,
Kalyani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 11:17 PM
Hi Kalyani,
I don't think out of the box this is present
Are you saying that you have 3 pdf files and want to merge those 3 into 1 and then attach again to the same record
what is your exact requirement here?
you will have to do something custom for this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2019 01:31 AM
Hi Kalyani,
have this approach:
1) set up a mid server
2) create mid server script include and function
3) that function will accept base64encoded data of those 2 files
4) java code will merge that and return the combined base64encoded data
5) write an after insert business rule on ecc_queue that will create an attachment using Attachment Creator
var fileName = 'merged1';
var contentType = 'application/pdf';
var tableName = 'incident'; // for example purpose
var tableSysId = 'bdd212d04fbf7340fc11fa218110c7d5'; // incident record sys_id
// you need to parse the ecc_queue payload field and then pick the combinedBase64EncodedData
var content = 'combinedBase64EncodedData';
gs.info("content is " + content);
var eccGr = new GlideRecord('ecc_queue');
eccGr.initialize();
eccGr.setValue('agent', 'AttachmentCreator');
eccGr.setValue('topic', 'AttachmentCreator');
eccGr.setValue('name', fileName + ':' + contentType);
eccGr.setValue('source', tableName + ':' + tableSysId);
eccGr.setValue('payload', content);
eccGr.insert();
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader