Avatar of ITsolutionWizard
ITsolutionWizard
Flag for United States of America asked on

c#, itextsharp, aspx

I have 100 pdf files with a field name called 'firstname'
and I want to load all of them and using itextsharp to change the fieldname to 'myfirstname'

how can I do that in itextsharp with c#?

Thanks
ASP.NETC#

Avatar of undefined
Last Comment
Frank Helk

8/22/2022 - Mon
ITsolutionWizard

ASKER
Any helps?
Shaun Vermaak

Please post sample PDF
ITsolutionWizard

ASKER
It is just blank PDF with fields any sample will be fine
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Shaun Vermaak

Is the PDF scanned or generated?
ITsolutionWizard

ASKER
It is PDF with textbox fields. It is not scanned doc
ITsolutionWizard

ASKER
Any helps
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Shaun Vermaak

Going offline, please have a look at this from http://stackoverflow.com/questions/9635982/altering-pdf-through-itextsharp-to-replace-some-existing-text-with-a-new-text
    String formFile = Server.MapPath("~/") + "source.pdf";
    String newFile = Server.MapPath("~/") + "sink.pdf";
    PdfReader reader = new PdfReader(formFile);
    PdfStamper stamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Create));
    AcroFields fields = stamper.AcroFields;
    // set form fields
    fields.SetField("{TO}", "John Doe");
    fields.SetField("{FROM}", "2 Milky Way, London");
    stamper.FormFlattening = true;
    stamper.Close();

Open in new window

ASKER CERTIFIED SOLUTION
Daniel Van Der Werken

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Frank Helk

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Daniel Van Der Werken (https:#a42081718)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer