开发者

iText - Fillable PDF with Field that Overflows to Other Fields (or Files)

I have a two PDF templates (files) created by LiveCycle. On the first PDF file, I have a text field that could potentially overflow. That is, not all text that needs to be written to this field will fit in that field.

If it overflows, then I like the rest of the data to be written to the second template. The second template is essentially an overflow template with just one field. If the second one overflow also, then it uses the second file and generates a third file and overflows the text into that field. This continues u开发者_JS百科ntil all data has been written.

What are my options for doing this?


If you know the pointwidth of the field and all the fontsettings, you can simulate the content in a Chunk that has the same fontsettings and call Chunk.getWidthPoint() to see if it fits.

(Do it in a loop until you know after which character the chunk is too big, and you know the rest of the content that needs to overflow to the new template)

Perhaps another way is to get the AcroFields of the template, retrieve the field you need and check getMaxCharacterLength however I don't know if this takes the fontsize/style into account.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜