Draw text in rectangle

Help
Ruslan
2012-10-01
2013-05-28
  • Ruslan

    Ruslan - 2012-10-01

    Hello!

    I'm a newbie on the PDF format and jPod library and would appreciate some help.

    There is a need to draw text in PDF document in a specific rectangle with a given width and height. It is necessary to break  text into lines automatically if it does not fit in the specified rectangle's width.
    Is there a simple way of doing this? What primitives should I use?

    Thanks in advance!

     
  • mtraut

    mtraut - 2012-10-01

    There's no existing primitive for rendering plain text in jPod. You must layout/format yourself. A little helo may arise from using the AWT LineBreakMeasurer to do the heavy work.

    If you have a lot of layouting work to do and less "PDF magic", working on internal structures, you may be better of using iText, having builtin layouting.

    An even more flexible solution may be using "flying saucer", a full fledged XHTML renderer.

     
  • Ruslan

    Ruslan - 2012-10-01

    Ok. Thanks for the quick and complete reply.

     

Log in to post a comment.