I think it has some thing to do with website rendering capabilites offered by the wkhtmltopdf.
In my v13 erpnext full web page view, from what I saw, it was a full standard website that allow javascript execution and the barcode rendered successfully.
But in PDF-like view, the erpnext system only call the wkhtmltopdf get_pdf method, which I believe they do not render the javascript. I’ve tried this by getting the output of the get_pdf() method of frappe’s pdf.py file in frappe utils directory and the output was clearly a plain text of jsbarcode javascript without being rendered.
I also notice that in v13 of erpnext, the barcode type is included in the database as an svg tag longtext type , therefore when erpnext print a pdf like page, it doens’t render any javascript aymore. Instead, erpnext just show the svg data already saved previously in the database.
you have loop through barcodes table.
{%- for barcode in doc.barcodes -%}
Place your barcode logic inside this loop
pass the barcode value like below.
jsbarcode-value= {{ barcode }}
{%- endfor-%}
I have been trying to get barcode printing possible for two days now using JsBarcode with no luck. after googling for quite a while, I discovered a simple solution for barcodes.
Using Google Fonts, there are many fonts that convert text to barcodes, so I simply included the font in the print format HTML and targeted it using CSS.
The barcode is based on item code, if you wish to make the barcode based on the barcode field, just do what @MrKovalski did. I used his code as a base for my code.
Has anyone figuring out how to print all barcodes of a selected warehouse, or we can select multiple barcodes so we don’t print 1 barcode per paper? Any guide or instructions?
I want to generate the PDF like in the below image.
All barcode stickers in separate PDF pages and then the invoice or order form of these items.
I created the barcode stickers but the issue is to create multiple PDF pages with the sticker’s size.
Even a single sticker is showing on the whole page of the PDF.
The sticker size is 45mm x 36mm so the PDF page size should be the same as the sticker size.
I could not find an easy way to print labels to a Zebra printer from ERPNext in v14 or develop, but I managed to work out a few things and got it to work as I described in the post. It’s not a 5 minute job but it works very well once it’s setup.