You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Will May <wi...@gmail.com> on 2012/08/12 18:10:25 UTC

Multiline text boxes

Hi all,

I found out when trying to use PDFBox that it doesn't support filling in 
multiline text boxes correctly [1] so I've created a patch which 
improves multiline (and auto-sizing) support.

The text positioning algorithm is still black magic and was tweaked 
until text in a multiline text boxes started close to where Acrobat put it.
The maximum size of auto-sized fonts in multiline text boxes of 12 was 
chosen as that is what Acrobat appeared to do. Not sure if this was from 
limited test data or it's defined somewhere...

I've been using a PDF which contains numerous text boxes of different 
styles to test it and what PDFBox produces is very similar to what Adobe 
Acrobat Professional produces but this PDF is copyrighted by a third 
party. Does anyone know of decent source of PDFs with text fields in 
them or would it be acceptable to create tests which just use mock 
objects? I assume tests are required before creating a JIRA and 
attaching the patch...

Cheers,

Will.


1 Main problems found were problems like
* Not positioning the start of the text correctly
* Not displaying the text at all (auto-sized text boxes)
* Not adding line breaks to long lines
* Very large fonts had the next line of text start too close to the line 
above.