Barcode Printing on ERPNext

Hello @avapiitahari please could you please share the steps to make this ?

I facing the same problem in v14. Could it be its not working for print format in doctype item or it has nothing to do with doctype type?
Is your version v14?
I have the jsbarcode both pointed to local or direct link, still not working, only bar code shows in full page print view, but doesn’t show in pdf, nor print view.

nobody is informing about the issue they’re facing while just saying that it does not work.

If someone can be more specific then I can help.

Hi @fkardame

I just want to say I’m very thankful for you being there.

I am no expert as I don’t have a background coding.

But I figured out some things, in v14 at least.

Différent things but might not be related.

  1. When the HTML gets converted to pdf, erpnext is using gkhtmltopdf. The problem is gkhtmltopdf works with JavaScript but not with js from what I read. It use very basic JavaScript, so depending on the JavaScript version, it will fails to execute the code because most likely of syntax error or elements that aren’t present with the compatibility version of JavaScript inside gkhtmltopdf. The thing is I don’t know which version of JavaScript gkhtmltopdf uses and if there is a way to change gkhtmltopdf for another HTML to pdf, and replacing it in erpnext.

  2. Some CSS code will not be compatible with gkhtmltopdf. Making it not displaying the barcode… (not sure why)

So I think, we either need to use basic JavaScript coding in the HTML print format (jinja? Js?) to fit the compatibility of the JavaScript version of gkhtmltopdf. Either we replace gkhtmltopdf with something equivalent.

Since I don’t have programming skills, it takes me weeks to just figure out some simple codes.

I see erpnext still includes jsbarcode.js in their install, but what is the use of it if we can’t use it in pdf?

In summary :

1- the print view and choosing print format. Everything words but just no barcode. By everything I mean all HTML and css code for other non related barcode fields such as item name, item code etc…

2- the full page view button in print view option has everything working. Barcode displays and all is working.

3- the pdf generated has 2 things not working : 1- some css working 2- no barcode displayed.

The good thing is I can still print with option 2, however, I have like 500 items and more, I can’t print 1 label per page, and also to click on every single item to print 1 by 1 is not efficient. And I don’t know how I can print the selection of some items or all items.

The item list page where I CAn select can only generate pdf but no option for full page. So that is even worse, as the pdf can’t even view display and also has css not loading up.

I saw in ur other posts, that u also can’t get it to work. So I am not sure, should we give up? What is your alternative solution?

I dont use pdf button to print barcodes as pdf will resize the paper to a4 by default.

I will share the barcode code I used in v13 rest is the same from before.

src='https://barcode.tec-it.com/barcode.ashx?data={{row.batch or row.item_code}}&code=Code128&multiplebarcodes=false&translate-esc=true&unit=Fit&dpi=96&imagetype=Gif&rotation=0&color=%23000000&bgcolor=%23ffffff&codepage=Default&qunit=Mm&quiet=0' 
style="height:35px; padding:1px;"?draggable="false"/><br>

You can use it and check if that works. I have no answer for other issue your facing with gkhtml2pdf as I have never used it yet.

Good Luck.

Hi @fkardame

Thank you for the sharing!

May I know do I put this into a print format to src just to replace the jsbarcode with this code?

And as for the style, it’s the CSS, right?

Do you know if it’s supposed to work with v14 too?

Yes.

Not sure.

No idea, never tried v14 yet.

Hi @fkardame

Wonderful!
I have a few questions if you don’t mind.


img src=“https://barcode.tec-it.com/barcode.ashx?data={{ doc.barcodes[0].barcode }}&code=UPCA&multiplebarcodes=false&translate-esc=true&unit=Fit&dpi=96&imagetype=Gif&rotation=0&color=%23000000&bgcolor=%23ffffff&codepage=Default&qunit=Mm&quiet=0” height=“35px” padding=“1px” draggable=“false” />


  1. I guess the correct tag is with , correct? (not SVG)

  2. I used UPCA rather than code 128, but I have a problem because not all UPC-A barcodes are put in the first row of the table. So when it’s not in the first row for items that have multiple barcodes type, it will not work. It is referred to doc.barcodes[0].barcode . Is there a way to automatically select all valid UPC-A barcode types of the table, or if not, the last UPC-A of the list?

Because I have:
A. some item that has multiple UPC-A
B. other items that have other barcode on row 1, and the UPC-A appear in row 2,3 or 4, etc…

  1. How can I print multiple barcodes in 1 letter sheet 8.5x11 (5 columns x 10 rows = total 50 barcodes per page)?

I tried to go to “Item List” and select the items I want to print and choose the print format, but it is only 1 barcode per page.

Gives output:

Hi, maybe in the new print designer tool, this seems to be considered:

1 Like

Hi @federico_calvo

May I know that it means?

I check the link, is [dj12djdjs] from github trying to incorporate the jsbarcode, or he already did it successfully?

Hi all,

Just to chime in, a common problem on another platform was that the font for barcodes was not installed properly and accessible. Maybe double check this first.

which font?

@fkardame

can you share your script in how to print multiple or all items in a warehouse in a letter paper? like 4 columns x 9 rows of item barcode labels (each different items of the warehouse)? I been working on it for a days, but still had no idea what I am doing… Thanks!

Normally CODE-39 and CODE-128 needed for GTINs and UPC

Save the PDF to your computer and see what font PDF uses, you will need that specific font. Sometimes a pdf file would have the font embedded, but something like HTML looks on the system for the font

Your previous post about using “barcode.tec-it.com” is just sending the rendering of the font to their server and returning an image. To render on the server the server needs the font

hey, unfortunately, my scanners don’t scan libre code font… for some reasons i don’t know

1D laser scanners normally cannot scan monitors. Have you tried to print them out?

The font does not have to be Libre Barcode. It needs to be whatever the generator uses. I only linked them as an example. For us, we use another font that I cannot find anymore but we only use the old CODE-39 as the barcodes we need to scan are quite short and for internal use only.

No I do not have any such script.

You can make one in html,css.