Print to pdf throws blank

I have an issue with printing to pdf
print to pdf throws blank
i edited the .json file and added
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

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


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

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

1 Like

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


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

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

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

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

issue resolved
Thanks again

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

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,
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

1 Like

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