Dear Frds, I have a Tamplet PDF File in which i have to replace Some Text like company Name,Date etc . & save it to the new name. I have been given a task to replace text within an existing PDF file. I need to find the precise x & y location of the text, and then I could draw. I’ve trying to replace text in PDF file and this is most simple way to replace text in PDF files. Before approaching this, I’ve tried to replace text.

Author: Maushura Shakagal
Country: Uganda
Language: English (Spanish)
Genre: Video
Published (Last): 7 March 2015
Pages: 71
PDF File Size: 7.84 Mb
ePub File Size: 18.77 Mb
ISBN: 979-1-22111-936-7
Downloads: 53175
Price: Free* [*Free Regsitration Required]
Uploader: Vudotilar

Long time no see. I have been given a task to replace text within an existing PDF file.

Search and Remove a Text from a PDF using iTextsharp

I played around with iTextSharp and is halfway. I did come accross an excellent sample on the CodeBank by stanav, which I have been using. Now, I know that you cannot replace the existing text on the file, because a PDF document is not a Word document as such. So my way of thinking is to draw a block around the existing text, and resave the file. For this, I need help. This is my code: Object, ByVal e As System.

Empty End Try Return sb. Create ‘ step 3 document. Open ‘ step 4 document. Add New Paragraph “Hello World! Close Next End If Return text.

Can any one help an old dumb guy out please? Just in case you didn’t consider this alternative here is a link where it’s explained: After doing a Google search and reading lots of answers saying “it can’t be done” I found this one.


The idea in the answer given there is just taking Class LocationTextExtractionStrategy from iTextSharp sourcecode to your Project, because it contains these coordinates you need. I don’t have time right now to investigate further, but i’ll take a look later, having these coordinates the rest should be easy.

Last edited by jcis; Jun 6th, at Thanks for all your kind help. This is what I have done so far: Append ” “c End If sb. I2orientationVector Vector. I am missing a trick somewhere. Doing this would be easier just by making some modifications in iTextSharp dll but i don’t want to give a solution that would require recompiling this dll sourcecode.

How to replace specific word in pdf using itextsharp – CodeProject

But i’m getting closer, i’ll post back just after I get this part about placing blank blocks over words or phrases. About the Replace idea that comes after all this adding other text over this blank rectanglesthis has known limitations like: Last edited by jcis; Jun 13th, at Add the reference to your iTextSharp dll.

See the comments in code.

In the call you should specify the text to search, compare method, source and destination file paths.

I’m not sure what’s the best way to make solid white rectangles but If finr remove line cb. Report back if you find an error or any weird behavior, or if there is something else to add, for example adding different text where the words have been removed or whatever.

How to replace specific word in pdf using itextsharp

Words cannot describe your kindness. Your way of doing things are way more simpler than mine. My brain is not what it used to be.


Thank you for helping me! I need little help from you in this regard that i am using VS i.

C also getting complie qnd in below code. Last is not a member of List Function Name: Last Then Error 2: Last is not a member of IList Function Name: FontIndex So could you please help me in sharing c i. Your code will be of great help. I am using a modified version of the test solution which creates the new file where i need it to be but when i go to open it i get the error There was an error opening this document. Some of the products that appear on this site are from companies from which QuinStreet receives compensation.

This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or fjnd types of products available in the marketplace. Results 1 to 10 of Last edited by jcis; Jul 30th, at The file is damaged and could not be repaired.

Quick Navigation Visual Basic. Better understand the signs that your business has outgrown its current database. All times are GMT The time now is You may have to register before you can post: To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 10 of 10 Thread: