Top WooCommerce & WordPress Plugins › Forums › EAN and Barcodes for WooCommerce › Adjust the size of the barcode image in the PDF
- Support forum for the EAN and Barcodes for WooCommerce.
- This topic has 2 replies, 2 voices, and was last updated 1 year, 5 months ago by
Tom Anbinder.
- AuthorPosts
-
June 20, 2022 at 1:23 pm #85215
Martin Andersen
ParticipantGreat plugin!
I’m using it with WooCommerce PDF Invoices & Packing Slips plugin and I was wondering if there is a way to adjust the size of the barcode image in the PDF? It’s a bit too big for what I need.
Thank you,
MartinJune 23, 2022 at 12:52 pm #85216Hi Martin,
Sorry for the late reply. Not possible at the moment, however, should be quite easy to do. Let me try to add it to the plugin. Will get back to you soon.
June 23, 2022 at 10:57 pm #85217Hi Martin,
I’ve just sent you the new version (v4.1.3-dev) via WeTransfer.
After the update, please go to “WooCommerce > Settings > EAN > (2D) Barcodes > Compatibility > WooCommerce PDF Invoices & Packing Slips”, and locate new “Content” option I’ve just added. By default it’ set to (for 1D barcodes and 2D barcodes respectively):
<div class="ean_wrapper">[alg_wc_ean_barcode]</div>
<div class="ean_wrapper_2d">[alg_wc_ean_barcode_2d]</div>
That is, now you can customize the barcode output with our
[alg_wc_ean_barcode]
and[alg_wc_ean_barcode_2d]
shortcodes.These shortcodes have
w
andh
attributes that set the width and height of a single bar element (1D barcodes) or single rectangle element (2D barcodes) in pixels. By default, it’s:[alg_wc_ean_barcode w="2" h="30"]
[alg_wc_ean_barcode_2d w="2" h="2"]
So, for example, to make 2D barcodes two times smaller, set the “Content” option to:
<div class="ean_wrapper_2d">[alg_wc_ean_barcode_2d w="1" h="1"]</div>
Finally, two more attributes can help you customize the barcode image size –
img_w
andimg_h
. These attributes set the width and height of the final image. For example, to make 1D barcodes exactly 100 pixels width, we could use this:[alg_wc_ean_barcode w="2" h="30" img_w="100"]
I hope that makes sense, and please let me know if you have any questions.
P.S. If you like the plugin, please consider leaving me a rating here or here, I would really appreciate it.
- AuthorPosts
- You must be logged in to reply to this topic.