Printing Advanced PDF Cofiguration

From PartKeepr Wiki
Jump to: navigation, search


Often the default configuration is not suitable for your needs. The DefaultPDFRenderer has a bunch of options to configure. To use these configurstions, the "Additional Configurations" field in the Printing Configuration can be used. All things entered here, are encoded in JSON (if you have complex szenarios for the text, you can use the following editor: [[1]]) format, but no fear it is quite simple to use.

This JSON with all defaults are shown below. If you will not add one of these settings, the default will be used:

{"borderGrid":true
,"barcodeEnable":false
,"barcodeType":"QRCODE,L"
,"textBarcode":"!!barcodeId,%06d!!"
,"barcodeWidth":"12"
,"barcodeHeight":"12"
,"barcodeXPos":"-7"
,"barcodeYPos":"-7"
,"barcodeWithText":false
,"barcode2D":true
,"fontFamily":"times"
,"fontStyle":""
,"fontSize":12
,"text":"<span style=\"font-size: 11pt;\"><b>!!name!!<\/b><\/span><br><span style=\"font-size: 8pt;\">!!description!!<\/span>"
,"textXOffset":"0"
,"textYOffset":"0"
}

Attribute Description
borderGrid true or false. enables the border grid of the "table" created by the renderer. This should be disabled for label printing.
barcodeEnable Enables rendering the barcode. Set to true to enable or false to disable.
barcodeType The type of barcode to use. A list of codes can be found in: TCPDF, scroll down to __construct [[2]] Use also the correct barcode2D field!
textBarcode The text of the barcode. You can use field replacement here.
barcodeWidth The width of the barcode. See Size and position formating.
barcodeHeight The height of the barcode. See Size and position formating.
barcodeXPos The x position starting the left top. See Size and position formating.
barcodeYPos The y position starting at the top left from the cell. See Size and position formating.
barcodeWithText true or false. Enables the text for the barcode.
barcode2D true or false. Indicates if we want to print a 2D barcode.
fontFamily The font family to use inside the text as default. Search for setFont in [[3]] to see which families are available.
fontStyle The default font style of the text. Search for setFont in [[4]] to see which styles are available.
fontSize The size of the font.
text The text to use. The text can use a LIMITED amount of different html definitions supported by TCPDF. You can use field replacement here. Be careful to quote the html text, especially the \ and the " correctly. If you use a barcode, we try to let the text flow around the barcode if possible.
textXOffset Offset for the text position in X direction. Per default, the Text is printed at position 0.
textYOffset Offset for the text position in Y direction. Per default, the Text is printed at position 0.

Text replacement

The text can contain fields from the dataset we render. These replacement texts can be seen on a separate page Printing Text Definitions. The codewords are surrounded by !!. Example: !!id!! will be replaced by the id of a part if parts are rendered.