Print to pdf throws blank

Hi
I have an issue with printing to pdf
print to pdf throws blank
i edited the .json file and added
“host_name”:“http://localhost:8080”,
still not able to print to pdf
i have not used a custom script
iam using a custom print format
the letter head is not showing on standard print formats
please help
regards
hemanth

Hi
d ~/frappe-bench
bench set-url-root erpnext.erpnext-vm http://localhost:8080
the above command throws up the error shown below

Regards
Hemanth

Somebody please help
I had to discard the previous installation due to purchase reciept submit error
downloaded a fresh installation of .ova file
reloaded all my data
now iam stuck with print to pdf
regards
Hemanth

Would you mind creating a github issue for this. It seems to be an issue and is reported by other users as well.

after a lot of searching around posts
in the config/nginx.conf file, site1.local is missing
is that an issue with print to pdf
Please let me know
regards
hemanth

1 Like

Hi
a custom script
.print-format {
margin-top: 0mm;
margin-left: 10mm;
margin-right: 0mm;
}
throws up error

setup@http://localhost:8080/assets/js/form.min.js:2578:5
_f.Frm.prototype.setup@http://localhost:8080/assets/js/form.min.js:172:2
_f.Frm.prototype.refresh@http://localhost:8080/assets/js/form.min.js:439:4
load@http://localhost:8080/assets/js/form.min.js:87:3
show_doc/<@http://localhost:8080/assets/js/form.min.js:82:4
callback@http://localhost:8080/assets/js/desk.min.js:6556:6
callback@http://localhost:8080/assets/js/desk.min.js:1201:11
_@http://localhost:8080/assets/js/desk.min.js:1225:29
frappe.request.call/<@http://localhost:8080/assets/js/desk.min.js:1321:4
i@http://localhost:8080/assets/frappe/js/lib/jquery/jquery.min.js:2:27146
fireWith@http://localhost:8080/assets/frappe/js/lib/jquery/jquery.min.js:2:27914
z@http://localhost:8080/assets/frappe/js/lib/jquery/jquery.min.js:4:12057
c/<@http://localhost:8080/assets/frappe/js/lib/jquery/jquery.min.js:4:15619

i am losing all hopes on this
is somebody there who can help me out on pdf print

now the situation is
Earlier
standard print formats>>> could print pdf without letterhead
custom print format >>>> pdf print output is blank

now
sales order
standard print formats>>> can print pdf with letterhead
custom print format >>>> pdf print output is ok

sales invoice
standard print formats>>> can print pdf with letterhead
custom print format >>>> pdf print output is blank
please help

some positive results to ponder
its all boiling down to custom html i have used in my print format
when i remove the custom html, print to pdf is working
i read that i have to wrap the code in @mediaprint
how do i do that
regards
hemanth

At last i drilled down to the problem
iam not able to print to pdf because
in custom print format
i edited the heading and added this code

there is something wrong with this code
can somebody help me on this
regards
hemanth

issue resolved
Thanks again
Regards
Hemanth

Maybe Jinja render fails to recognize your ‘heading’ code? You are editing a copy of an existing Print Format, to make your own Custom Format, correct? The manual advises:

Select the type of Print Format you want to edit and click on the “Copy” button on the 
right column. A new Print Format will open up with “Is Standard” set as “No” and you can 
edit the Print Format.

Editing a Print Format is a long discussion and you will have to know a bit of HTML, 
CSS, Python to learn this. For help, please post on our forum.

Print Formats are rendered on the server side using the Jinja Templating Language. All 
forms have access to the doc object which contains information about the document 
that is being formatted. You can also access common utilities via the frappe module.

Please would you share your code snippet, thanks

Thanks clarkej
i have posted the problem code in the 10th post above
if i use that code, print to pdf throws a blank
regards
hemanth

I refer to your final code that works - possibly can you post that?

Your example learning or commentary to my post, to benefit all etc

thanks krishnanhemanth!

Hi Clarkej
for Sales Order, to fetch custom print head, i have used this code

for sales invoice
to create separate prints for original, duplicate, triplicate, i have created 3 separate print formats
this is the code in the headder

Important Note
the headder dosent allow any kind of formats like align or bold or anything else
the moment you add an formatting code , the print to pdf throws a blank page
for example, in the above code,
ORIGINAL
iam trying to align the ORIGINAL to right
the code works but the pdf fails
somebody can help me in formatting the headder code correctly
Thanks again
Hemanth

1 Like

Can you remove <div></div> and check?