Copy form fields from one PDF to another

I have a situation where I need to copy all form fields from one PDF to another. The goal is to automate the overlay of fields when small changes are made to the underlying Word page.

I am using a trial version of Aspose.Pdf.Kit, and I can copy everything except the radio buttons to a new form. However, Aspose does not support copying switches, which completely negates its usefulness, not to mention the fact that their customer support was a sub-item.

In any case, I'm looking for some kind of library or plugin that supports copying all types of form fields.

Does anyone have any ideas?

Thank,

~ DJ

+3
source share
2

, . , setField() ... madisonw , .

OTOH, .

- :

PdfReader currentReader = new PdfReader( CURRENT_PDF_PATH ); // throws
PdfReader pdfFromWord = new PdfReader( TWEAKED_PDF_FROM_WORD_PATH ); // throws
PdfStamper stamper = new PdfStamper( currentReader , outputFile ); //throws
for( int i = 1; i <= tempalteReader.getNumberOfPages(); ++i) {
  stamper.replacePage( pdfFromWord, i, i );
}

stamper.close(); // throws 

Java, # .

, , - ADDS A PAGE..., . ? , ? Acrobat Pro.

+4

Oded, iTextSharp . , , . , .

private void CopyFields(PdfStamper targetFile, PdfReader sourceFile){
{
  foreach (DictionaryEntry de in targetFile.AcroFields.Fields)
  {
    string fieldName = de.Key.ToString();
    target.AcroFields.SetField(fieldName, sourceFile.AcroFields.GetField(fieldName));
  }
}
0

Source: https://habr.com/ru/post/1771999/


All Articles