Formatting a PDF

0
I am working on creating a way to create a PDF from my app. I have been using the document template but I can't get things formatted the way I'd like. I've attached a screenshot of how it's supposed to look. My issues is that the more text I have the boxes will expand but I want the text to get smaller instead. The boxes on the page should never change and I can't figure out how to do that. Does anyone have any suggestions on how to do that with the document template? I've also been looking into the PDF Document Generation Widget if anyone knows how it could be done there. Thanks! 
asked
1 answers
0

I don't see there is a direct option in Document Template, however, there might be some sort of work around.

First I would recommend to create an entity (or entities) to which you can link your template and in the logic of creating the pdf, you copy all the required data to these entities. That way you are not adding the additional attributes I am suggesting below to your core entities.

When copying the text values (eg Description), you can check the length of the string. Based on the length you could set a boolean or maybe even better an enumeration (eg ENUM_Description) related to this specific attribute. The enumeration could have values like 'under10' 'under50' 'under100' etc., depending on the variety of the fontsize you want.

For each of the attributes, you will create as many rows in a table and add conditional visibility. For the content, you will update the style according to your requirements.

image.png

Hope this helps.

 

Maybe you would be able to use Custom Styling to achieve this with a single row, but for that probably a CSS master would be able to shed some light.

And personally, I don't know how flexible PDF Document Generation is.

answered