Is styling dependent on attribute possible in PDF

0
I have an order (in dataview) with orderitems (in datagrid) in a document template from which I create a pdf document. Orderitems have a boolean attribute used to mark the orderitem damaged/spoiled. I would like to see all orderitems of the order in my pdf but the damaged ones in red text (or possible strike-through)   What would be a good approach to that? I seem to be unable to use xpath in the datagrid and a data source microflow ignores context (https://docs.mendix.com/refguide/microflow-source) thanks for your time.   Bert
asked
2 answers
3

Mendix PDF generation is… a challenging thing. Most of the apps I’ve worked on while using the platform need them to some extent, and yet Mendix all but refuse to acknowledge it’s a common requirement. As such, the PDF designer is in the dark ages, and you have to get a little messy if you want your user to see nice things.

You’ll have to use some conditional visibility here – one row that shows when boolean is “true” and one one “false”, with each row having your respective style in, such as a strikethrough or some red text.

So rather than this:

You’ll have something like this, with a nested table:

answered
1

you can create a conditional visibilty, with a damaged vs non-damaged design.

(maybe add class “label label-danger” and “label label-warning” to the text.

than create a “print this page” button, that goes to a new page without a menu, and than ctrl+p and print the HTML to pdf.

there are beter ways of doing this, but this is the simpelist way of creating something that does that behaviour.

answered