Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:32:38+00:00 2026-06-15T21:32:38+00:00

I have two PDF forms – an orignial form and a new form. The

  • 0

I have two PDF forms – an orignial form and a new form. The new form has x amount of extra acro fields on it, however it doesn’t have the original PDF fields.

I want to merge the fields from the old PDF to the new PDF form. The new field/fields would of moved some of the placeholders for the old fields so they may overlap or not be in the correct place, but this is irrelevant.

What I have tried

//Get the old PDF
PdfReader oldPdfReader = new PdfReader("Old.Pdf");
MemoryStream oldMs = new MemoryStream();
PdfStamper oldPdfStamper = new PdfStamper(oldPdfReader, oldMs);
//Get the new PDF
PdfReader newPdfReader = new PdfReader("New.Pdf");
MemoryStream newMs = new MemoryStream();
PdfStamper newPdfStamper = new PdfStamper(newPdfReader, newMs);

foreach(var oldField in oldPdfStamper.AcroFields.Fields)
{
   //Do a check to see if the field isn't already added
   if(!newPdfStamper.AcroFields.Fields.Any(x => x.Key == oldField.Key))
      newPdfStamper.AcroFields.Fields.Add(oldField);
}

This only outputs the new fields even though the debug hits the add, I have concluded this isn’t correct and I need to draw the fields on some how.

I have also tried the following example:

Merging multiple PDFs using iTextSharp in c#.net

It puts the new field on from New.PDF but doesn’t carry over the fields from Old.PDF. Any ideas on how I can merge the AcroFields from two PDF forms?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:32:39+00:00Added an answer on June 15, 2026 at 9:32 pm
      //Get the old PDF
      PdfReader oldPdfReader = new PdfReader(@"old.pdf");
      MemoryStream oldMs = new MemoryStream();
      PdfStamper oldPdfStamper = new PdfStamper(oldPdfReader, oldMs);
      //Get the new PDF
      PdfReader newPdfReader = new PdfReader(@"new.pdf");
      MemoryStream newMs = new MemoryStream();
      PdfStamper newPdfStamper = new PdfStamper(newPdfReader, newMs);
      AcroFields af = oldPdfStamper.AcroFields;
    
      foreach (var oldField in oldPdfStamper.AcroFields.Fields)
      {
        var rectangles = af.GetFieldPositions(oldField.Key).Select(x => x.position.GetRectangle(x.position.Top, x.position.Bottom));
        foreach (var rectangle in rectangles)
        {
          TextField tf = new TextField(newPdfStamper.Writer, rectangle, oldField.Key);
          newPdfStamper.AddAnnotation(tf.GetTextField(), af.GetFieldPositions(oldField.Key).First().page);
        }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two fields to upload two extensions: first field to upload (PDF,doc,docx) second
I have two PDF-files. Both have the same geometry and the same amount of
I have two PNGs that I am trying to combine into a PDF using
I have the following code which will generate two pdf files containing plots to
I am generating a pdf for a client. This has two columns ... ID
Let's say I have two PDF templates created with Adobe Acrobat, which are both
I have two PDFs that are made on the fly using Prawn PDF. The
I have two tables with lists of files: table1 has column1 with file names
I have a PDF template (designed using Adobe Livecycle designer), that has a subform
I have ten fields in my table in database..And two columns out of them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.