ERPNext Conference 2019* ERPNext.com Blog

Print Format displays JavaScript result, howevever exporting to PDF or printing ignores it


#1

Hi there, has anybody had this problem?

I created a simple script to calculate, how many years an employee has worked for our company and it shows in the print format in the preview, however when I click Print or PDF, the information dissapears.

What could be the problem?


#2

To give more information,
it replaces the information with following script

var elems = document.getElementsByClassName("gadu_skaits_profesija");
for(var i = 0; i < elems.length; i++) {
    elems[i].innerHTML = gadu_skaits;
}

#3

Check this link - Email pdf is not formatted properly


#4

Hi, sadly, tried it and it didn’t work.
Moving Javascript < script> to the end of the HTML, allows Javascript to run for the Print Preview, however still PDF not working :confused:


#5

Did you add the JSON file pieces?
“host_name” : “http://localhost”,