Adjust the size of the barcode image in the PDF

Top WooCommerce & WordPress Plugins Forums EAN and Barcodes for WooCommerce Adjust the size of the barcode image in the PDF

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #85215
    Martin Andersen
    Participant

    Great 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,
    Martin

    #85216
    Tom Anbinder
    Moderator
    Plugin Support

    Hi 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.

    #85217
    Tom Anbinder
    Moderator
    Plugin Support

    Hi 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 and h 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 and img_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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.