These reports are sent back as PDF files. There is no need to open these files before printing them. PDF files must be served from the same domain as your app is hosted under. There is an open bug in Mozilla’s website about this.
PDF file into a new tab. The element can be of any tag, as long it has a unique id. This can be useful when you have multiple images on the screen, using a low resolution version of the images. When users try to print the selected image, you can pass the high resolution url to Print.
There are four print document types available: ‘pdf’, ‘html’, ‘image’ and ‘json’. Document source: pdf or image url, html element id or json data object. Optional header to be used with HTML, Image or JSON printing. It will be placed on the top of the page. Optional header style to be applied to the header text. Many people would recommend this to be around 600px.
We tested many prints with 800 and it fits well for us. Typeface used when printing HTML or JSON. Font size used when printing HTML or JSON. This is used to keep or remove padding and margin from elements that are being printed. Sometimes these styling settings are great on screen but it looks pretty bad when printing. You can remove it by setting this to false. To print text in color, set this property to true.
By default all text will be printed in black. By default, the library process some styles only, when printing HTML elements. This option allows you to pass an array of styles that you want to be processed. You can also pass to process all styles.
Accepts an array of html ids that should be ignored when printing a parent html element. These are the object property names. Optional style for the grid header when printing JSON data. Optional style for the grid rows when printing JSON data. Enable this option to show user feedback when retrieving or processing large PDF files.
When printing html, image or json, this will be shown as the document title. It will also be the name of the document, if the user tries to save the print job to a pdf file. Browser Compatibility Currently, not all library features are working between browsers. Below are the results of tests done with these major browsers, using their latest versions. Make sure your patches are well tested: README. Description PDFKit is a PDF document generation library for Node and the browser that makes creating complex, multi-page, printable documents easy. The API embraces chainability, and includes both low level functions as well as abstractions for higher level functionality.