UI page to PDF

vamshi krishna4
Giga Guru

Hi,

Hope you are doing well!!

Can we export the UI page into PDF with a button placed on the Ui page?

I have a requirement to export the page into pdf onclick of a button.

 

Thanks in advance.

Regards,

Vamshi

7 REPLIES 7

Justin77
Mega Guru

window.print(); is an easy solution here.  If you have a more specific use case, I've had good luck using jsPDF: https://github.com/MrRio/jsPDF

Slava Savitsky
Giga Sage

Have your button call this function:

function exportMyPage2PDF(){
	
	var dialog = new GwtPollDialog('/my_ui_page.do', JSON.stringify(null), 0, '', 'whtpexport');
	
	dialog.on('beforeclose', function() {
		window.setTimeout(function(){
			$j('.download-report').focus();
		}, 100);
	});
	
	dialog.execute();
	
}

Thanks for the Reply!!

This helped me a lot. But I am not getting the images that are in the ui page into pdf and also can we change the name of the PDF that is getting exported?

Regards,

Vamshi

Try checking this

Generating a PDF from HTML

Regards
Ankur

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