paragraph in itext

onanar
onanar used Ask the Experts™
on
hi . i have question. i got a pdf template, and i am reading that template and placing some dynamic data, now i need to add a constatnt data with the signature at the end, wht is the best way to do this,  if my dynamic data is filled the template then i will add one more template with the signature, if the dynamic data is too small then i need to add this message in the same tmplate.

pls suggest me
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
The issue of remaining space is solved by getHeight is it not?

Author

Commented:
i can find the empty space now, the problwm now is, if i got more empty place in my template(after filling the dynami data) , it would be not good adding one more template with constant notes and singnature.

if i have enough place in my second template , then i should add third template data in my second template , so that it would be look nicer, how can i add that one?
using paragraph?
or?

please find the attatche final template
Top Expert 2016

Commented:
You'll have to wait until objects sees this - he knows more about this than i do
Yes, add this constant data as dynamic data / even it is not/ immediately after your dynamic data.
According to me in this way you will avoid the problem with empthy space.
You can do this with Paragraph.
Paragraph prg = new Paragraph(...
document.add(prg);

For the signatures at the end I have used table
            PdfPTable tblSigns = new PdfPTable(2);
            tblSigns.setWidthPercentage(100.0f);

            PdfPCell cellSign = new PdfPCell(new Phrase("blahblah......................", fonts[2]));

            cellSign.setBorder(PdfCell.NO_BORDER);
            cellSign.setHorizontalAlignment(Element.ALIGN_LEFT);
            tblSigns.addCell(cellSign);

            cellSign = new PdfPCell(new Phrase("blahblah......................" , fonts[2]));
            cellSign.setBorder(PdfCell.NO_BORDER);
            cellSign.setHorizontalAlignment(Element.ALIGN_RIGHT);
            tblSigns.addCell(cellSign);
            document.add(tblSigns);
Hope it will help you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial