Page 1 of 1
PDF and Print Formatting
Posted: 02 Aug 2016
by Jimmy Daresta
I want when one prints or exports to PDF that the form(s) will be formatted differently. I have figured on the printing how to hide elements, but not on the PDF.
Also when I do print the form the font prints out much smaller than expected which I believe is due to the page not fitting size wise ont he page. How can I adjust the style of the print so the form fits on the page?
Re: PDF and Print Formatting
Posted: 03 Aug 2016
by Dmitry Kozlov
Hi Jimmy,
Currently, you cannot handle exporting to PDF except using JavaScript:
Code: Select all
// hide elements you do not want to export
$('.to-hide').hide();
//export to PDF
fd.saveAsPDF('form.pdf')
.then(function() {
// show hidden elements
$('.to-hide').show();
});
As for printing, you can use CSS-styles applicable to printing forms only:
http://www.w3schools.com/css/css3_mediaqueries.asp
Re: PDF and Print Formatting
Posted: 03 Aug 2016
by Jimmy Daresta
To clarify, I would need to add my own PDF export button? The one that shows in the ribbon would not work? I was hoping there was an onPDF() or a way to override the button action on the ribbon so I could then hide elements before rendering.
Re: PDF and Print Formatting
Posted: 04 Aug 2016
by Dmitry Kozlov
If you want to use the ribbon button, you can override fd.saveAsPDF:
Code: Select all
var saveAsPDFOrig = fd.saveAsPDF;
fd.saveAsPDF = function(filename) {
// hide elements
return saveAsPDFOrig(filename)
.then(function() {
//show elements
});
}
Re: PDF and Print Formatting
Posted: 04 Aug 2016
by Jimmy Daresta
Perfect! Thank you!