Export to PDF UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2012 08:42 PM
Hi Everyone,
Can you please tell me how to create a UI Action(Export to PDF) on ESS Portal for exporting the form(UI Page) in PDF Format, Actually we have to give functionality to user to extract the form from ESS Portal related to certain category and then use it in PDF Format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2014 06:33 AM
Hi Sami,
In the UI macro, I was more thinking about reusing and adapt to an UI action the code here (if you want to have something into the form):
var mExport = new GwtContextMenu('context_pdfsub${jvar_section_id}');
mExport.setTableName('${ref}');
mExport.clear();
mExport.addFunc("${gs.getMessage('PDF (Portrait)')}", function() { exportToPDF('${ref}','$[${ref}.sys_id]',false,'${JS:sysparm_view}'); });
mExport.addFunc("${gs.getMessage('PDF (Landscape)')}", function() { exportToPDF('${ref}','$[${ref}.sys_id]',true,'${JS:sysparm_view}'); });
more specifically the function part
Same thing with the UI Context menu (if you want to have a specific list export):
/**
* Script executed on the Client for this menu action
*
* The following variables are available to the script:
* 'g_list' the GlideList2 that the script is running against (only valid for List context menus)
* 'g_fieldName' the name of the field that the context menu is running against (only valid for List context menus)
* 'g_sysId' the sys_id of the row or form that the script is running against
* 'rowSysId' is also set to the sys_id of the row to support legacy actions, but g_sysId is preferred
*/
runContextAction();
function runContextAction() {
var sysparm_rows = g_list.grandTotalRows;
var num_rows = parseInt(sysparm_rows);
var sysparm_query = g_list.getQuery({all: true});
var sysparm_view = g_list.view;
if (num_rows < g_export_warn_threshold) {
var dialog = new GwtPollDialog(g_list.tableName, sysparm_query, sysparm_rows, sysparm_view, 'unload_pdf');
dialog.execute();
return;
}
var dialog = new GwtExportScheduleDialog(g_list.tableName, sysparm_query, sysparm_rows, sysparm_view, 'unload_pdf');
dialog.execute();
}
But in all cases, don't forget to document because the features aren't documented and might be obsolete one day.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2014 08:01 AM
Custom PDF Files in ServiceNow through PDFCrowd-John James Andersen
you can take a look here to create some pdf files from ServiceNow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2014 08:34 AM
Have you seen this item on the new Share? https://share.servicenow.com/app.do#/detail/82a718352b54210067b53f4be8da1519

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2014 09:49 AM
Have you looked at this Wiki Article PDF Web Service - ServiceNow Wiki?
Here is a quick UI action I created:
Client: True
OnClick: createPDFESS()
function createPDFESS() {
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var url = sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
window.open(url);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2015 03:10 PM
How would I force the report to open in Landscape instead of Portrait?
Thanks.