Has anyone customized their pdf exports?

joshua18
Giga Expert

Has anyone customized their pdf exports?

Such as like a custom header?

I'm trying to find a good example or something to point me in the right direction. I've been going through UI Actions and the default UI Context menu to go off of but I can't seem to find some of the functions used in it.

1 ACCEPTED SOLUTION

Hi Joshua,



You won't be able to get to see the code behind the GwtPollDialog so you can go the above approach.



You can also check below links


PDF Generator


I am a creator — PDF Document Generator - Walter Brame


http://wiki.servicenow.com/index.php?title=PDF_Web_Service#gsc.tab=0


Custom PDF Files in ServiceNow through PDFCrowd | John Andersen



Also one thing you can do is in the script of UI action for form button add this script


this works for form view



var url = '/u_sample_table.do?PDF&sys_id=' + g_form.getUniqueValue() + '&sysparm_view=default' ;


window.open(url,'_blank');



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur




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

View solution in original post

9 REPLIES 9

bjhughey164
Mega Expert

Joshua,



Navigate to Reports > Header Footer Templates.



I'd suggest making a copy of the default and then adding your company logo or whatever you need there!



Thanks,



Ben-


Sorry. I meant for when you right click the context menu, lets say in a incident or a request, and export a PDF that way.



I'm trying to create a custom UI action that generates a different PDF view from what it currently is.



If that makes sense.


Hi Joshua,



May be you can go through the below thread. I have provided answer in that question. We can have customized UI action in List and form as well to export pdf


I want to generate a pdf of selected records in a list?



1) List view - this ui action will export only the records which are selected from the list



function downloadPdf(){



  var checked = g_list.getChecked(); // get's the sys_id of the checked records


  var query = "sys_idIN" + checked.toString();


  var rows = checked.split(",").length; // rows to be sent to the pdf function


  var view = "default"; // set this to default for columns present in default view for list layout


  //var view = ""; // set this to empty if you want all the columns present in the list layout including the customized ones.



  var dialog = new GwtPollDialog('u_sample_table', query, rows, view, 'unload_pdf');


  dialog.execute();


}



2) Form - this ui action will export only the current record



This script is also present in the comments



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

I couldn't get that to work on the form.



So here what I'm trying to do, edit this output


Capture.PNG



Clean it up and format it, attach a header, add the proper spacing. I'm trying to make an official looking Summery Report/After Action Report for some of our more major problem tickets.



Kind of similar to the Security Incidents under Security Operations.



I'm just asking someone to point me in the right direction, like where the GwtPollDialog function is located so I can see how it builds the pdf.



If it just isn't possible then that's fine.