Confusion with Print Formats!

I have been trying to set up Print Formats for the main doc types that we would be sending to suppliers and/or customers in ERPNext, such as Purchase Orders, Delivery Notes, Sales Invoices etc.

When I go to ‘customise’ these formats, there seems to be multiple options … 1) customise based on the standard format, which takes me to one kind of drag and drop interface … or 2) check a checkbox saying ‘Use the New Print Format’, which takes me to another type of drag and drop interface … or 3) another option to ‘Try the new Print Designer’, which is completely different again.

The 1st way seems to be more ‘stable’ in terms of generating the PDFs, whereby the header will stay in correct proportion to the rest of the document.

The 2nd way seems to be a nicer, more modern look, but the header which may seem fine to begin with, then goes haywire and enlarges to way bigger than the width of the document. Also, in my tests this 2nd option doesn’t work when emailing the document out from the system, giving an error. (The 1st way seems to email fine.)

The 3rd, new print designer option, seems to be more of a blank slate whereby we need to create the entire document layout from scratch. In my initial attempts at trying this out, I ended up with documents that started out looking promising but again with PDFs where the layout just randomly went all over the place!

I guess I’m just wondering what the go is with all these different print format interfaces, and if anyone can provide any general information / clarity / experience regarding it all?

I got to the point where I thought just sticking to customising based on the standard formats is probably the easiest way, to begin with at least …

However, with the Sales Invoice, I’m having trouble getting the GST amount to show on the PDF (even though the Sales Tax and Charges section is there in the drag/drop interface)? Whereas with the ‘Sales Invoice PD v2’ version that comes up as the default, it does show. Anyway, needless to say, I haven’t been able to figure it out, and if anyone can shed any light on all this, that’d be much appreciated.

1 Like

I have a similar experience. I have also used html and jinja to create various formats. Some work and some break when size of data changes. My best experience is using option 1 along with custom html blocks added. For taxes I suggest adding html based jinja code to add GST Breakup table to Sales Invoice. sample code:-
<p> {{doc.other_charges_calculation}} </p>

You can select print format type as: Jinja

Use Custom HTML and JINJA to create format and fetch data from current doctype. Also you can fetch information from other doctypes and db.

Also, you can style your format using custom CSS block present below the html block according to your convience.

I hope this helps! :smile:

I have used various formats for this including trying macro blocks. Seems to be give random problems. Breaking the table if the item description is too long is one example.

When it works, its for more flexible and functional.

Frappe has three tools for building print formats.

  1. The original Print Format Builder is well established though a bit clunky. It features options for both drag-and-drop or jinja-based templating, and it uses wkhtmltopdf to generate output.

  2. A redesigned version of the original (identified as a beta) was released a few years back. It switched to weasyprint in hopes of solving some of wkhtmltopdf’s more frustrating limitations, but it turned out that weasyprint has significant limitations of its own. Some people liked it, but I was never able to get it to work very well.

  3. Print Designer, a relatively new app, is the heir apparent. I haven’t played with it much, but it looks like an ambitious project. It looks nice, but I’m cautious. PDF generation is really hard to do well.

1 Like

Many thanks to you all for the replies. I appreciate the information and knowledge provided, and getting more of an understanding of the various print format options. (I must say though that I didn’t really anticipate in the beginning that coding might be needed to get basic transaction PDFs to work! :slight_smile: )

I have been playing around some more with the New Print Designer for a Sales Invoice template and for what it’s worth, so far, it seems that if I stick to placing everything down the left margin/left aligned on the page (rather than trying to have some labels or text etc over on the right hand side or centred), the PDF is working out ok. (And the test email worked as well.) We’ll see if that remains true as/if I keep trying it out with other templates.

The drag-and-drop tool works fine enough, though it will limit you to fairly basic layouts. The new print designer may do the job, but it’s a hard thing to do well. I’m optimistic for what it will do in the future.

I say this with deep love for Frappe and ERPNext: if the idea of using jinja to design a print framework sounds unappealing, Frappe may not be the right framework for you. It’s gotten much more user friendly over the years, but at the end of the day it’s still a framework first and a set of applications second.

I love Frappe as a low-code solution, but I can’t really imagine trying to run my site no-code.

If I want to use Jinja template, is their a way I can write the code in an editor (like VSCode) rather than in the Frappe UI?