guilhermecgs
guilhermecgs

Reputation: 3041

Search and Replace PDF using Itext

I need to generate a PDF based on some user inputs. The output PDF have some images, tables and texts. I think that Itext is not user friendly for programmatically generate this report.

Since the report I need to generate is quite complicated, I was wondering if it is possible to create a template PDF and then load -> search -> replace the strings/images I want.

The template PDF can be a tagged pdf.

  1. Is it possible to do that?
  2. Is it the best approach?

EDIT: I´m using WPF + MVVM + .Net 3.5

Upvotes: 0

Views: 368

Answers (1)

ThoWoi
ThoWoi

Reputation: 114

Replacing text within a PDF file is not simple. The PDF fileformat uses a dictionary at the file end where elements are listet with their byte offset within the file, also some elements have a field where they give their own length given in bytes. If these offsets are not met, the reader will probably report a broken pdf.

You should have a look at reporting as it is made for these tasks:

http://msdn.microsoft.com/en-us/library/bb885185%28v=vs.100%29.aspx

You can create a template with the report designer, set your data and export it to pdf.

Upvotes: 1

Related Questions