On Fri, May 17, 2019 at 1:26 PM Tilman Hausherr <[email protected]>
wrote:

> Am 17.05.2019 um 15:54 schrieb Christopher Schultz:
> > It occurs to me that my code is doing more work than necessary to
> > print paragraphs, and that maybe manual word-wrapping is not
> > necessary. Are there any examples that show how to print a paragraph
> > of text without having to compute the width of text and manually chop
> > things up into lines? Or is that part of the price of PDF?
>
>
> There is no feature in PDF that does automatic word wrap. Yes you have
> to do it yourself.
>
> There is a class in the PDFBox source code, PlainTextFormatter, that can
> also do it, but it was designed for form fields. It is used in
> AppearanceGeneratorHelper. You'd have to copy  the code, it is not public.
>
> Tilman
>

About a year ago I converted PDF code from iText to PDFBox. One issue to
resolve was wordwrap. This snippet from Stack Overflow was very helpful:
http://stackoverflow.com/a/14107244/1316011

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)

Reply via email to