Apose.pdf 7.5 combined PDF files

When I try to package the following files I get error when I open the package

Package1.pdf: A.pdf & B.pdf

Package2.pdf: A.pdf & C.pdf

Package3.pdf: A.pdf & D.pdf

I am using the following code

//Instantiate PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
//Call Concatenate method of PdfFileEditor object to concatenate all input streams into a single output stream
bool merged = pdfEditor.Concatenate(InputFiles, OutputFile);
// open the file to get the stream
Stream PdfFile;
//Instantiating PdfFileSecurity object
PdfFileSecurity fileSecurity = new PdfFileSecurity(OutputFile, EncryptedOutputFile);
//Calling EncryptFile method to encrypt the PDF document
//Way2: Based on a predefined privilege and change some specifical permissions.

DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.AllowCopy = true;
privilege.AllowPrint = true;
privilege.AllowFillIn = true;
privilege.AllowScreenReaders = true;
privilege.AllowModifyContents = false;
privilege.AllowModifyAnnotations = true;
bool encrypted = fileSecurity.SetPrivilege("", "ownerpassword", privilege);

if (!encrypted)
throw new ApplicationException("Unable to encrypt input files");

// open the file to get the stream
PdfFile = File.OpenRead(EncryptedOutputFile);
PackageByteArray = WebHelper.ReadStream(PdfFile, 1000);
PdfFile.Close();
return PackageByteArray;
//Instantiate PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
//Call Concatenate method of PdfFileEditor object to concatenate all input streams into a single output stream
bool merged = pdfEditor.Concatenate(InputFiles, OutputFile);
// open the file to get the stream
Stream PdfFile;
//Instantiating PdfFileSecurity object
PdfFileSecurity fileSecurity = new PdfFileSecurity(OutputFile, EncryptedOutputFile);
//Calling EncryptFile method to encrypt the PDF document
//Way2: Based on a predefined privilege and change some specifical permissions.

DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.AllowCopy = true;
privilege.AllowPrint = true;
privilege.AllowFillIn = true;
privilege.AllowScreenReaders = true;
privilege.AllowModifyContents = false;
privilege.AllowModifyAnnotations = true;
bool encrypted = fileSecurity.SetPrivilege("", "ownerpassword", privilege);

if (!encrypted)
throw new ApplicationException("Unable to encrypt input files");

// open the file to get the stream
PdfFile = File.OpenRead(EncryptedOutputFile);
PackageByteArray = WebHelper.ReadStream(PdfFile, 1000);
PdfFile.Close();
return PackageByteArray;

Please open the package files to see the errors

Hi Cody,


Thanks for contacting support.

I
have tested the scenario and I am able to reproduce the same problem. Even the issue is noticeable when PDF files are concatenated. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34587. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

I have another problem when I combined the doucment A_Can_Not-Combined.pdf with another file (Like B.pdf) I get Object reference not set to an instance of an object in the line

bool merged = pdfEditor.Concatenate(InputFiles, OutputFile); What is wrong with document A_Can_Not-Combined.pdf ?

This is currently in production and I need to be resolved as soon as posible.

thanks

Alvaro

Cody Maust:
I have another problem when I combined the doucment A_Can_Not-Combined.pdf with another file (Like B.pdf) I get Object reference not set to an instance of an object in the line

bool merged = pdfEditor.Concatenate(InputFiles, OutputFile); What is wrong with document A_Can_Not-Combined.pdf ?

Hi Cody,

I have tested the scenario using following code snippet and I am unable to notice any issue when tested with Aspose.Pdf for .NET 7.6.0. Can you please try using the following code snippet and latest release version and in case you still face any issue, please feel free to contact. We are sorry for this delay and inconvenience.

[C#]

//open first document<o:p></o:p>

Document pdfDocument1 = new Document(filesArray[0]);

//open second document

Document pdfDocument2 = new Document(filesArray[1]);

//add pages of second document to the first

pdfDocument1.Pages.Add(pdfDocument2.Pages);

//save concatenated output file

pdfDocument1.Save("c:/pdftest/Concatenated_output.pdf");


Thank you for the respond. I will tested in the new version.

Hi Cody,


Thanks for your patience. I am pleased to share that the issue PDFNEWNET-34587 reported earlier has been resolved and its hotfix will be included in upcoming release version of Aspose.Pdf for .NET 7.7.0. During our investigations, we have found that one of the documents contains static form fields whereas other has standard form fields.Field names of the standard form are not compatible with XFA spec which caused error message. In order to fix this issue, XFA data was removed from merged form (document with static form becomes document with standard form) and resultant document is opened and filled successfully.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

thank you, I have test the issue and now is resolved.

Hi Cody,


I am glad to hear that your problem is resolved. Please continue using our products and in the event of any further query, please feel free to contact.