0

I have one existing PDF file as shown below image

enter image description here

As shown in above image I have one placeholder defined in my existing PDF (Assume that placeholder will always there in pdf file)

Now I want to replace [TableContent] with my table.

Is it possible using iTextSharp?

If using placeholder we cannot get location where we need to add table then is it there any other way to get that location(by changing existing PDF also)?

If it is not possible using iTextSharp then is there any third party tool(paid tool is also fine), from which we can achieve my requirement?

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
Kalpesh Vaghela
  • 183
  • 1
  • 10
  • It is possible to add a `PdfPTable` at an absolute position using `PdfStamper` and the methods `GetOverContent()` and `WriteSelectedRows` (just Google those terms and you'll find plenty of examples). However: what is this placeholder you are taking about? **It should be an AcroForm field**, however, looking at the screen shot, it looks like ordinary text. If it's ordinary text, then you won't find any software (paid or not) that will do the job in a satisfying way. Show us the existing PDF so that we can evaluate your question. Rethink your design. Use form fields as placeholders. – Bruno Lowagie May 30 '15 at 10:10
  • If I use AcroForm field instead of ordinary text then is it possible? – Kalpesh Vaghela May 30 '15 at 10:26
  • Yes, then you can get the position of the rectangle defined by the field as the `Rectangle` for a `ColumnText` object. You can add the `PdfPTable` to the `ColumnText` and hope that it fits. Please download the free ebook [The Best iText Questions on StackOverflow](http://pages.itextpdf.com/ebook-stackoverflow-questions.html) and read the answer to the following question: http://stackoverflow.com/questions/28590487/adding-table-to-existing-pdf-on-the-same-page-itext There's a more complex version of that example here: http://stackoverflow.com/q/26853894 – Bruno Lowagie May 30 '15 at 10:30
  • The examples I refer to in my previous comment are in Java (iText). If you consult the book, you'll find C# (iTextSharp) examples too. On many different pages, you'll find tips and tricks on how to port iText examples to iTextSharp examples. See for instance at the bottom of this answer: http://stackoverflow.com/a/30533786/1622493 – Bruno Lowagie May 30 '15 at 10:34
  • Thanks you very much. I will look at above link – Kalpesh Vaghela May 30 '15 at 10:34

0 Answers0