Giving the right location for JsBarcode.all.min.js

Hello;

What is the right path for JsBarcode.all.min.js that should be given for the source to be used locally instead of downloading it from the Internet?

In ERPNext version 10 and version 11, it contains JsBarcode.all.min.js under the path: /home/frappe/frappe-bench/apps/frappe/frappe/public/js/lib$, I need to use it instead of downloading it from the link https://cdn.jsdelivr.net/npm/jsbarcode@3.9.0/dist/JsBarcode.all.min.js, so what is the right path that I have to give it in the following codes (in case of javascript or in the printing format):

Javascript Code:

$.getScript(“/Path_to_the_JSBarcode_file/JsBarcode.all.min.js”, function( data, textStatus, jqxhr ) {
}

Printing Format:

< svg class=“barcode”
jsbarcode-margin=“0”
jsbarcode-margintop=“0”
jsbarcode-marginbottom=“1”
jsbarcode-height=“25”
jsbarcode-width=“1”
jsbarcode-fontsize=“12”
jsbarcode-flat=“true”
jsbarcode-value=“{{ doc.barcode}}”/>

< script src=“https://cdn.jsdelivr.net/npm/jsbarcode@3.9.0/dist/JsBarcode.all.min.js”>
< script>
JsBarcode(“.barcode”).init();
< /script>

I tried to place this path: “public/js/lib/JsBarcode.all.min.js” but it is giving the 404 (NOT FOUND) error at the browser console.

Appreciate the kindly help from @fkardame and @Pawan because I found a topic about this in this link:

One note on this reference post:
Using the code the proposed from @Pawan, I am able to view the barcode at the image, but after refreshing, I do not see the barcode again, and really I do not know what is the benefit of using the code field type?

I think that @bkm also complained about the same problem (displaying the image but does not save).

Regards
Bilal

I will have to login to your system and check your custom script that you are using to really comment on the issue you are having. I have personally used similar script for a customer and it is working fine. Also, the idea behind sharing a generic code snippet is that the user / developer / implementor puts in some effort to modify it according to their needs.

You are welcome via Team Viewer if you would.

Anyway, my problem that I need to know what is the right path to be given for getScript in the line:
$.getScript("/public/js/lib/JsBarcode.all.min.js", function( data, textStatus, jqxhr )

Because **/public/js/lib/JsBarcode.all.min.js** is wrong path and causing error in the browser.
But it is working if I placed this path: https://cdn.jsdelivr.net/npm/jsbarcode@3.9.0/dist/JsBarcode.all.min.js

The other problem that it is not saving the barcode as image (so once I reloaded the page after I saved, the barcode image disappear) as shown below:

Barcode_saving_problem

And below is the custom fields that I added and its type:

So what I am missing to keep the barcode image appearing? I think something related to the code field which is barcode_svg and its related with the image field.
Regards
Bilal

Really the location for the JsBarcode.all.min.js is the needed if possible please.

Regards
Bilal

I got to know the right path, it should be:

/assets/frappe/js/lib/JsBarcode.all.min.js
So the path is taken from the sites directory, it is the home directory.

Regards
Bilal

I have been trying to get this to work. Even placed it in the directory as instructed.

Also followed the procedure given herehttps://discuss.frappe.io/t/how-to-print-barcode-labels/33111/18

Were you able to get barcode generation to work?

@danishaak I think it will help you this link

/home/Your User/User-bench/sites/assets/Your User/js/lib

Thanks