I'm trying to append text on an existing PDF. There is a huge text box(may be a paragraph box?) and when I try to add multiple lines of text, it's flowing out of the box. I'm doing this:
TextFragment txtFrag = new TextFragment(str);
txtFrag .setPosition(100,200);
txtFrag .getTextState().setFont(new FontRepository().findFont("Arial"));
txtFrag .getTextState().setFontSize(9.0F);
TextBuilder textBuilder = new TextBuilder(page);
textBuilder.appendText(txtFrag);
The string str
in TextFragment(str)
is a paragraph with multiple lines. How should I achieve text wrapping?