SoFunction
Updated on 2025-04-14

The front-end uses Print Js to implement batch printing function

property default value describe
printable null Document source: pdf or image url, html element id or json data object.
type 'pdf' Printable type. Available printing options include: pdf, html, image, json, and raw-html.
header null Optional title for HTML, image, or JSON printing. It will be placed at the top of the page. This property will accept text or raw HTML.
headerStyle 'font-weight: 300;' Optional header styles to apply to header text.
maxWidth 800 Maximum document width in pixels. Change this setting as needed. Used when printing HTML, image, or JSON.
css null This allows us to pass one or more css file URLs that should be applied to the html being printed. The value can be a string with a single URL or an array with multiple URLs.
style null This allows us to pass a string with a custom style that should be applied to the html being printed.
scanStyles true When set to false, the library will not handle the styles applied to the html being printed. It is useful when using parameters.
targetStyle null By default, libraries only handle certain styles when printing HTML elements. This option allows you to pass an array of styles to process. For example: ['padding-top', 'border-bottom']
targetStyles null

However, as with "targetStyle", this will handle any series of styles. For example: ['border', 'padding'] will include 'border-bottom', 'border-top', 'border-left', 'border-right', 'padding-top', etc.
You can also pass ['*'] to handle all styles.

ignoreElements [] Accepts an array of html IDs that should be ignored when printing the parent html element.
properties null Used when printing JSON. These are the object property names.
gridHeaderStyle 'font-weight: bold;' Optional style for grid headers when printing JSON data.
gridStyle

'border: 1px solid lightgray;

margin-bottom: -1px;'

Optional style for grid lines when printing JSON data.
repeatTableHeader true Used when printing JSON data. When set to , the data table title will only be displayed on the first page.
showModal null Enable this option to display user feedback when retrieving or processing large PDF files.
modalMessage 'Retrieving Document...' Message displayed to the user when set to.
onLoadingStart null Functions to be performed when loading PDFs
onLoadingEnd null Functions to be executed after loading PDF
documentTitle 'Document' This will appear as the document title when printing html, image, or json.
fallbackPrintable null When printing pdf, if the browser is incompatible (check the browser compatibility table), the library opens pdf in a new tab. This allows you to pass the different pdf documents you want to open, rather than the original documents you passed in "Printable". This may be useful if you inject javascript into the alternate pdf file.
onPdfOpen null When printing pdf, if the browser is incompatible (check the browser compatibility table), the library opens pdf in a new tab. The callback function can be passed here, which will be executed when this happens. In some cases, it can be useful when you want to handle the printing process, update the user interface, etc.
onPrintDialogClose null Execute the callback function after closing the browser printing dialog box.
onError error => throw error The callback function to be executed when an error occurs
base64 false Used when printing PDF documents as base64 data.