Page 1 of 1

Keep field fixed width in PDF output

PostPosted: Wed Oct 22, 2014 1:06 pm
by javasol
I need an idea how to keep a field as fixed width in the PDF output. If you look at the attached summary.docx you will see a "Child's Name" field that I would like to populate dynamically but still keep the field the same width, meaning that there will still be all underlines past the name up to the position that it is in the .docx

If the above isn't clear please look at the attached .docx and at the resulting PDF. You will notice that in the .docx the "Child name" field is much longer than in the PDF. But the other fields that are not being dynamically populated remain the same width

Re: Keep field fixed width in PDF output

PostPosted: Wed Oct 22, 2014 9:34 pm
by jason
If you can use a fixed width font, then you can just replace one underline for each character in the field value.

Alternatively, you could try using a table (no borders) with fixed widths, so that the cells provide the layout.

Re: Keep field fixed width in PDF output

PostPosted: Thu Oct 23, 2014 4:01 am
by javasol
The issue with fixed font is that it will change the way the ouput looks. The issue with a table is that the other rows will have to be the same width, unless I make each row a separate table but I get the feeling that it will slow everything down even more.

What about Word Forms? will docx4j be able to convert form fields to PDF?

Re: Keep field fixed width in PDF output

PostPosted: Thu Oct 23, 2014 8:22 pm
by jason
If you don't want to use a fixed width font, you could do your own character width calculations, but that's starting to get more complex...