PDF and Print Formatting
- Jimmy Daresta
- Posts: 13
- Joined: Mon Aug 01, 2016
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?
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?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Jimmy,
Currently, you cannot handle exporting to PDF except using JavaScript:
As for printing, you can use CSS-styles applicable to printing forms only:
http://www.w3schools.com/css/css3_mediaqueries.asp
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();
});
Code: Select all
@media print {
// your CSS here
}
- Jimmy Daresta
- Posts: 13
- Joined: Mon Aug 01, 2016
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.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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
});
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests