Use iTextsharp to edit pdf template without Acrofields

I have a pdf template without AcroFields and I need to replace the text in it. The text is formed as follows ((aFieldToReplace)) , but there are also tables that are filled with lines n .

Is there a good tutorial, resource or sample to search for?

Is there a way to replace text in a PDF using itextsharp? has more or less the same question, but the answer ignores the part of the β€œno Acrofield” question.

EDIT:
To make it even harder, I have several templates that I can use. Templates have their own formatting style (font, color, ...)

EDIT 2:
The goal is to create a report with some data in the database. Data in a database comes from several forms in an ASP.NET MVC application.
A report may contain several layouts depending on the selected template.

Templates must be added dynamically, so I cannot create a layout from scratch. I really need to get the layout from the template.

+4
source share
2 answers

Quote from the excellent iText in action :

In a PDF document, each character or glyph on the PDF page has a fixed position regardless of the application used to view the document. [...] Suppose you want to replace the word "edit" with the word "manipulate" in a sentence, you need to pay for the text. You must move all the characters that follow this word. You may even have to move part of the text to the next page. This is not trivial, if not impossible. [...] Do not expect any tool to be able to edit a PDF file in the same way as you are editing a Word document.

PDF is a document display format. If you want templates, you probably have to use something else.

+1
source

@Frederiek:

If you can spend some money, this will do exactly what you want. Check out the demo, it's pretty cool. It can melt text, replace images, etc. Pretty nice.

http://www.iceni.com/infixServer.htm

Let me know if this works for you.

+1
source

All Articles