When creating a numbered list, the document looks fine within SilverFin, but when generating a PDF, their is a weird misalignment between the numbers of the numbered list, and the actual text related to it.
A screenshot of the PDF showing this behavior:
Any help on how to avoid this would be appreciated.
I’ve tried to create a minimal block of template code while still keeping the alignment problem on export to PDF:
<font color="777777">BERAADSLAGING EN BESLISSINGEN</font>
1. De vergadering neemt kennis van het
{% stripnewlines %}
2. De vergadering bevestigt en bekrachtigt
{% input custom.ic.beraadslaging_punt2 as:text %}
{% newline %}
{% endstripnewlines %}
3. De vergadering keurt
4. Aan de
5. De abc test
<br>
Results in this output when exporting to PDF:
I’m assuming it has something to do with the newlines, but I find it quite hard to predict whether it will result in a new number in the list, a misalignment or some other behaviour. In the preview it looks perfectly fine.
I simplified it to this code (removing the newlines):
1. De vergadering neemt kennis van het
{% stripnewlines %}
2. De vergadering bevestigt en bekrachtigt
{% input custom.ic.beraadslaging_punt2 as:text %}
{% newline %}
{% endstripnewlines %}
3. De vergadering keurt
4. Aan de
5. De abc test2
Now, points 1, 3, 4 and 5 are correctly aligned, but 2 is still a problem.
I’ve tried attaching the {% stripnewlines %} to the previous lines, but that didn’t help. What’s the recommended approach to show various constructs in lists:
conditional items
input
stripnewlines for cleaner code
Is there any way to add logic in some other location (not in the template layer)?
It’s actually related to the input-tag that is causing this, but you can avoid this by putting an ifi-statement around it that it won’t get exported if it’s actually blank:
1. De vergadering neemt kennis van het
2. De vergadering bevestigt en bekrachtigt {% ifi custom.ic.beraadslaging_punt2 != blank %}
{% input custom.ic.beraadslaging_punt2 as:text %} {% endifi %}
3. De vergadering keurt
4. Aan de
5. De abc test
I’ve tried using your suggestion, but in my actual code -of which the above was a much simplified version- I still get unaligned text.
Is there a way to debug the output? For example, by viewing the generated HTML/CSS somewhere? Currently, the only way I can try to get this to work, is by changing the template and watching the result. Without any debugging support, it feels like I’m making random changes and getting random layout results.
For other projects I am using templates to render plain HTML with CSS and rendering it to PDF using WeasyPrint: https://weasyprint.org/
Is there a way to use a similar process with your software?
Or is there a way to output the data in JSON/XML/YAML so that I can generate the actual reports elsewhere (using WeasyPrint)? Hooking it to an AWS Lambda f.e.?