Long text input from user and PDF generation

Posted by Petteri Hietavirta on Stack Overflow See other posts from Stack Overflow or by Petteri Hietavirta
Published on 2009-10-29T22:11:23Z Indexed on 2010/05/13 4:14 UTC
Read the original article Hit count: 327

I have built a web application that can be seen as an overcomplicated application form. There are bunch of text areas with a given character limit. After the form submission various things happen and one of them is PDF generation.

The text is queried from the DB and inserted in the PDF template created in iReports. This works fine but the major pain is overflowing text.

The maximum number of characters is set based on 'average' text. But sometimes people prefer to write with CAPS or add plenty of linefeeds to format their text. These then cause user's text to overflow the space given in PDF. Unfortunately the PDF document must look like a real application form so I cannot allow unlimited space.

What kind of approaches you have used to tackle this?

  • Clean/restrict user input?
  • Calculate the space requirement of the text based on font metrics?
  • Provide preview of the PDF? (too bad users are not allowed to change their input after submission...)

© Stack Overflow or respective owner

Related posts about jasper-reports

Related posts about java