Hi,
as for me creating decent layouts with the PDF template editor is quite a pain in the ass, I have been experimenting a bit.
For an entity with relationships and lots of fields I created an email template. Searching for solution of some minor problems during this I came across one post, where it says, that the email template as well as the PDF templates are using handlebars as template engine.
So I thought, this could be compatible with each other. Email templating is a bit easier and leads faster to nice looking layouts.
Well then, I did the following:
When my email template was ready, I copied all the source code, put it in an editor and changed the single brackets to double brackets (as it is needed in the PDF editor). Furthermore I stripped all entity assignments of the fields (as in {entity_name.relationship_name.fieldname} (this way in email template) to {{relationship_name.field_name}} (this way in PDF editor)). I guess you do not need to assign the base entity, as the PDF template is made in relation to an entity by configuration.
This modified source code I copied into the source code of the PDF Editor and it worked.
It is the result of an experiment and I will have to investigate more, if this is really sustainable.
as for me creating decent layouts with the PDF template editor is quite a pain in the ass, I have been experimenting a bit.
For an entity with relationships and lots of fields I created an email template. Searching for solution of some minor problems during this I came across one post, where it says, that the email template as well as the PDF templates are using handlebars as template engine.
So I thought, this could be compatible with each other. Email templating is a bit easier and leads faster to nice looking layouts.
Well then, I did the following:
When my email template was ready, I copied all the source code, put it in an editor and changed the single brackets to double brackets (as it is needed in the PDF editor). Furthermore I stripped all entity assignments of the fields (as in {entity_name.relationship_name.fieldname} (this way in email template) to {{relationship_name.field_name}} (this way in PDF editor)). I guess you do not need to assign the base entity, as the PDF template is made in relation to an entity by configuration.
This modified source code I copied into the source code of the PDF Editor and it worked.
It is the result of an experiment and I will have to investigate more, if this is really sustainable.
Comment