Print Format Settings

Hi All,
I have created a custom print format(HTML+CSS+Jinja) and all works well but I would like to add some variables to retrieve before rendering the document the likes of “Compact Item Print” when printing a sales invoice. I would appreciate it if I can get some guidance on how to go about achieving this.

Please see below,
print_format_custom

Best Regards,
Dave

Any suggestions?
Many thanks!

If you are using custom format builder, you can use Jinja rendering to add custom variables.

For example, to add customer in the print you can add the following line

{{ doc.customer }}

Similarly you can use other variables as needed.

Oh, wow, this is super-cool. I’d never noticed that before. Apparently Frappe polls each doctype for additional print settings to show, using the method get_print_setting.

The only implementation I could find was in the accounts controller:

Using that for an example, it should be pretty straightforward to add other settings to other documents. It will, however, require a custom app. I don’t think it’s possible to do this client-side.

1 Like

Many thanks @peterg