Custom Print Format EMPTY PDF file

I have written a custom print format for a docType, print is perfect as I wanted. Now when I click on PDF to generate pdf file it shows empty pages.

Its like PDF file with a empty page. Nothing is writtten on it.

Hi @avaiskhatri,

this is most probably originating from an issue with your code and wkhtmltopdf. You can debug it for example like this: PDF no logo shown - #4 by lasalesi

Hope this helps.

Hi @lasalesi,

Default format are working fine for PDF, the blank page shows when used custom print format.

Hi @avaiskhatri ,

I understand that the standard works, but not the custom… this is why I guess there is an issue with your code (is it a print format based on “custom print format”, using html code). Have you tried the above debug? Or analysed your html for compatibility?

Yes. I have added following to frappe/frappe/utils/ after line 12


bench restart

Still frappe.log doesn’t show any thing.

Hi @lasalesi,

upon running this command test.pdf was generated with out any error, though the layout was totally destroyed that may due to styling.

$ wkhtmltopdf test.html test.pdf

But when click on PDF button from print area, PDF with empty pages is generated.

Have you checked that you have the latest version of wkhtmltopdf? (0.12.5.x I think)

Hi, I debugged my format by removing all the html and css code. Later I start by adding one 1 block of code to print format and tested with PDF until all my html code was pasted.

I found that there was issue with my css code. In the end css was found to be the culprit.

Thanks @lasalesi for the continous support.


Thanks for your feedback, glad you could resolve it.