needananswer (3) [Avatar] Offline
#1
I have an existing template which contains an image in the header, a table in the content (middle part) and a footer part. Now I want to read this template and the template should act as an blank page, i.e. I have to write content to this existing template line by line. I don’t need any AcroFields. I have well formatted string array which handles all positioning of data. Only thing is I have to read the string array and write to the existing template line by line. By doing this it should not impact the existing template. So at the end i will have a template at the background & contents over the template, but both should look like a same page.

How to do this?
blowagie (284) [Avatar] Offline
#2
Re: How to write contents to an existing PDF
Your assumption that you don't need AcroFields is wrong.
You need to know the exact coordinates where to add the extra content.
If you have these coordinates, you can use class ColumnText and class PdfStamper.
Please read the book for further info.
needananswer (3) [Avatar] Offline
#3
Re: How to write contents to an existing PDF
I agree with you i need to keep AcroFields in the existing template. I can also do with absolute position, but it is little tedious as i have to work on trial & error basis. I able to achieve my requirement but only problem now i have is to adjust the character & word spacing. I am using ColumnText. I tried all the possibilities like setting bf.setCharAdvance() in BaseFont class and ck.setHorizontalScaling() in Chunk class. But nothing is working.

Can anyone explain me How can I do this?
blowagie (284) [Avatar] Offline
#4
Re: How to write contents to an existing PDF
"Nothing is working" is an exaggeration to which one can only reply with "I don't understand the problem."