How to get the barcode size? #146
-
I'm trying to center a PDF417 barcode on the page, but I can't figure out how to get its size. It is dynamically generated from my program, i.e. the data is not known in advance, and the size can vary quite a bit. I guess I could try estimating it from the length of the input string, but I wonder if there is a better way to do it? Thanks in advance for any ideas! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The simplest option is to determine the maximum size that you require, then to fix the size of all symbol to this:
This has the benefit that BWIPP will opportunistically raise the error correction level as far as possible to make the most use of the available data capacity. Otherwise, you can try a variation of the following to obtain the dimensions within PostScript: Other users perform an initial pass using the https://github.com/adamchainz/treepoem/blob/main/src/treepoem/__init__.py |
Beta Was this translation helpful? Give feedback.
The simplest option is to determine the maximum size that you require, then to fix the size of all symbol to this:
This has the benefit that BWIPP will opportunistically raise the error correction level as far as possible to make the most use of the available data capacity.
Otherwise, you can try a variation of the following to obtain the dimensions within PostScript:
https://github.com/bwipp/postscriptbarcode/blob/master/contrib/Examples/PostScript/dimensions/dimensions.ps
Other users perform an initial pass using the
bbox
driver, for example:https://github.com/adamchainz/treepoem/blob/main/src/treepoem/__init…