Print format in version-13

Hi all,

After upgrade to version-13 from version-12.
I found that jsbarcode is not showing on printview, only work in full page view.
also document.getElementById is also not working in 13, returning null.
I have try using script defer to wait for doc ready, but the result still null.

Its working in version-12.
Is this true ?



There is a solution Ive found in the forum using barcode.tec-it
But library relying on window.document.getElement (like jsbarcode, qrcode etc._) will not work on the ‘app/print’ and only show
in the full page print view.

Anybody have work around for this.?

thanks and regards,

Print format problems are commonly associated to a mismatched version of wkhtmltopdf (should be v0.12.6+ with qt patch)

where to find / how to upgrade wkhtmltopdf v0.12.5 to v0.12.6 with qt patch


Assuming you’re on debian 10+ or ubuntu 20+…

wget && sudo dpkg --install wkhtmltox_0.12.6-1.focal_amd64.deb;
wkhtmltopdf --version  #Test the install: wkhtmltopdf 0.12.6 (with patched qt)

I have installed wkhtmltopdf versin 0.12.6 and confirmed it
wkhtmltopdf --version
wkhtmltopdf 0.12.6 (with patched qt)

The problem is not fixed.
My print format was working perfectly in version-12 and break in version-13.
Barcode image not shown on the ‘app/print’ and only show (perfectly) in the full page print view

Although I can still use it and the print out still accessible by using full page view but I am not confidence to show it to my client.
I think I will pending the upgrade and keep version-12 while finding for solution.
I will also install another site on this version-13 bench and try again without my custom apps installed.
Maybe also try without erpnext/frappe only if the error is still the same.


You can try adding an entry to your hosts file, and then also put your domain into the site_config file.

from this post…Wkhtmltopdf layout error - #4 by lasalesi maybe check for

  • the hostname configuration of ERPNext (see site/site1.local/site_config.json should contain "host_name": "",)

I have follow your suggestion but still got same error.
my site name is

wkhtmltopdf 0.12.6 (with patched qt)

/etc/host edited, I can ping to
sites/ added:

“host_name”: “”,
“http_port” : 8004,

I have try print format on Frappe only site.
Here is the browser console error:

Unable to handle success response

  1. {message: {…}}

request.js:273 NoElementException: No element to render on. at new e ( at d.render ( at h ( at eval (eval at globalEval (, :1:1) at eval () at Function.globalEval ( at ua ( at n.fn.init.append ( at n.fn.init. ( at K (

(anonymous) @ request.js:273
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
z @ jquery.min.js:4
(anonymous) @ jquery.min.js:4
load (async)
send @ jquery.min.js:4
ajax @ jquery.min.js:4 @ request.js:251 @ request.js:103
get_print_html @ print.js:623
preview @ print.js:396
refresh_print_format @ print.js:290
change @ print.js:101
(anonymous) @ base_control.js:181
handleMouseUp_ @ unknown
Promise.then (async)
(anonymous) @ dom.js:258
frappe.run_serially @ dom.js:256
set @ base_control.js:172
validate_and_set_in_model @ base_control.js:196
parse_validate_and_set_in_model @ base_control.js:158
change_handler @ data.js:142
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
handleMouseUp_ @ unknown

Sorry I forgot to mention it before but this error remain the same on these three sites,
barcode only shown on full preview ( also no related error on the browser console)

apps installed on site:

frappe, erpnext, myapp
frappe, erpnext

Is this means the error came from frappe ?

btw this is the format, its from jsbarcode sample:

pls note that with erpnext installed I dont do the import for jsbarcode.all.min.js since its already included.



I found a way to do it on version 13 and 14. which are using jinja hook
The barcode / qrcode is printed both on app/print and full preview and pdf also.
Dont need to save the image on tables, just generate the barcode in external python module access
via setup , we need to install python library for barcode/qrcode and mention in custom-app/requirements.txt and do bench install requirements.

version 13:
jenv = {


jinja = {
“methods”: [

Thanks and regards,

1 Like