adli89
October 18, 2024, 2:25pm
1
Hi, sorry for asking this seemingly basic question, but where do I find documentation on how to use Custom Data part of the Print Designer?
I know code in there should be in Jinja, but if I assign a variable there with the information I want to put in my print format, how do I use it afterwards?
Thanks in advance for help
1 Like
ARK_143
November 20, 2024, 4:33am
2
this is the only guide brother
rmeyer
March 8, 2025, 6:47pm
3
@maharshivpatel can you answer this one?
avc
March 8, 2025, 7:31pm
4
Hi @rmeyer @ARK_143 @adli89 :
Check here.
frappe:main
← maharshivpatel:feat-custom-jinja-data-template
opened 09:40PM - 20 Dec 23 UTC
feat: add custom data using jinja
Reason for adding this feature:
- to allow u… sers to add custom data to the template using jinja
- It is not ideal to fetch data for every field in the template when it is shared at template level
- This feature allows users to add custom data at the template level using jinja
How to use this feature:
- Add custom template by clicking `Manage Custom Data` using print_designer
- on the last line make dictionary of data you want to send to template
- make sure to use `send_to_jinja` variable name.
like `{%- set send_to_jinja = {'key_to_access_in_template': 'value'} -%}`
Example:
Code shared below will make `status` and `custom_var` available in the template
```
{% set status = doc.status %}
{% set custom_var = "This is Custom Text Saved in Custom Variable" %}
{% set send_to_jinja = {"status": status, "custom_var": custom_var} %}
```
https://github.com/frappe/print_designer/assets/39730881/65c52f05-8c4b-4dc6-b8f1-615695ebfe72
misc: removed pdfjs from print_designer ui as it is no longer used.
Hope this helps.
adli89
March 9, 2025, 6:50am
5
This indeed helps, thank you! I suggest this information be surfaced somewhere more accessible, or at least the link to the PR be documented in either documentation or the Print Designer itself so users are aware about the feature.
1 Like
avc
March 9, 2025, 7:53am
6
Absolutely. Maybe after some changes introduced on Print Designer docs would be improved. I think anyone can collaborate on this.