We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merging PDF files with dynamic fields - we are losing the dynamic fields

We are using Aspose.PDF to merge pdf files. Attached are 2 sample documents that need to be merge, they are the same document, renamed.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Problem Statement: When documents with dynamic fields like drop downs and editable text fields are merged with other such documents, the result is losing these dynamic fields.

Expected Result: We want to preserve these dynamic fields even after the merge.

Aspose’s online example at - http://www.aspose.com/demos/.net-components/aspose.pdf/csharp/pdfdemos/General/Concatenate.aspx is able to do the merge correctly, but when write the same code in a standalone console or windows app, it is still losing these dynamic fields for the first document.

Code Snippet:

using System;

using System.IO;

using System.Windows.Forms;

using Aspose.Pdf;

namespace AsposeMerge

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

AsposeMerge();

}

private void AsposeMerge()

{

string f1 = @"C:\Users\nbdelxy\Desktop\d0ae7428-4eb2-4c59-abd4-2b9fdb373baa.pdf";

string f2 = @"C:\Users\nbdelxy\Desktop\testmergepdfs.pdf";

string outFile = @"C:\Users\nbdelxy\Desktop\testing123.pdf";

Aspose.Pdf.License lic = new Aspose.Pdf.License();

lic.SetLicense("Aspose.Total.lic");

Aspose.Pdf.Document doc1 = new Document(f1);

Aspose.Pdf.Document doc2 = new Document(f2);

MemoryStream outStream = new MemoryStream();

try

{

doc1.Pages.Add(doc2.Pages);

doc1.Save(outStream);

using (FileStream file = new FileStream(outFile, FileMode.Create, FileAccess.Write))

{

byte[] bytes = new byte[outStream.Length];

outStream.Read(bytes, 0, (int)outStream.Length);

file.Write(bytes, 0, bytes.Length);

outStream.Close();

}

}

catch (Exception ex)

{

;

}

}

}

}v

Hi Robert,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for NET 8.8.0, We have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWNET-36386 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Robert,


In addition to above reply, as a workaround you can use facade package to merge PDF documents. It is working fine with you source document, i.e. preserving form fields. However, we will keep you updated about the resolution progress of original issue.

Best Regards,

We tried with Façade solution. It works but the output is a bit strange. Every time you open the output document, the dynamic fields seem to shift to different pages. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Example: First time I open the output file, fields are not shown in page 10, 12, 16, etc. I close it and reopen it, now directly jump to end of the document – page 16. You will see that fields appear but are lost on other pages. Dynamic fields are never shown on page 9. I am not sure if this is a result of the using the Aspose image tool or the behavior of merged pdfs with dynamic fields. Do you have any input on this?

Code:

public void AsposeMergePDFStream()

{

Aspose.Pdf.License lic = new Aspose.Pdf.License();

lic.SetLicense("Aspose.Total.lic");

string f1 = @"C:\Users\nbdelxy\Desktop\testmergepdfs1.pdf";

string f2 = @"C:\Users\nbdelxy\Desktop\testmergepdfs2.pdf";

string outFile = @"C:\Users\nbdelxy\Desktop\testing222.pdf";

PdfFileEditor pdfEditor = new PdfFileEditor();

pdfEditor.Concatenate(f1, f2, outFile);

}

boadean:

We tried with Façade solution. It
works but the output is a bit strange. Every time you open the output document,
the dynamic fields seem to shift to different pages. <o:p></o:p>

Example: First time I open the output file, fields are not shown in page 10, 12, 16, etc. I close it and reopen it, now directly jump to end of the document – page 16. You will see that fields appear but are lost on other pages. Dynamic fields are never shown on page 9. I am not sure if this is a result of the using the Aspose image tool or the behavior of merged pdfs with dynamic fields. Do you have any input on this?

Hi Robert,


Thanks for sharing the details.


I have tested the above stated scenario and following are my observations.


  • Open merged document and traverse through pages starting form page 1. The form fields on page 9, 10, 11, 12, 13, 14, 15, 16 fields missing.
  • Open the document and directly jump to page 16 and traverse in back direction. The form fields on page 2, 3, 4, 5, 6, 7, 8, 9, 13 are missing.


For the sake of correction, I have separately logged this problem as PDFNEWNET-36395 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time.

Hi,

Any status update on bug PDFNEWNET-36386v ?

Thank you,

-Robert

Hi Robert,


Thanks for your patience.

As we
recently have been able to notice this issue, so development team requires
little time to investigate and figure out the reasons of this problem.
However, as soon as we have made some definite progress towards
its resolution, we would be more than happy to update you with the status of
correction.
<o:p></o:p>


Furthermore, please note that you
have reported issue under normal/free support forum and as a normal rule
of practice, issues are resolved in first come and first serve basis; but the
problems logged/reported under Enterprise or Priority support model, have high
precedence in terms of resolution, as compare to issues under normal/free
support model.

Hi,

Can you provide status on this open issue? We've been waiting several months for a reply.

Thank you.

Hi Robert,

Thanks for your inquiry. I am afraid your reported issue (PDFNEWNET-36386) is still not resolved, it is pending for investigation in queue with other priority task. We have requested our development team to investigate the issue and share an ETA at their earliest. We will notify you as soon as we get a feedback.<o:p></o:p>

Thanks for your patience and cooperation.<o:p></o:p>

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-36395) have been fixed in Aspose.Pdf for .NET 9.3.0.

Blog post for this release can be viewed over this link


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as PDFNET-36386) have been fixed in Aspose.PDF for .NET 22.5.