pdfFileEditor.Concatenate(...) throws ArgumentOutOfRangeException

Hi Aspose Support,

When I merge 2 pdfs placed on disc I receive following exception:
ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

Here’s the code snippet:
var filesToMerge = new List() {
@“d:\test\broken1.pdf”,
@“d:\test\broken2.pdf”};

var license = new Aspose.Pdf.License();
license.SetLicense(@“Aspose.Total.lic”);

var outputFile = @“d:\test\output.pdf”;

var pdfFileEditor = new PdfFileEditor()
{
MergeDuplicateLayers = false,
CopyOutlines = true,
CopyLogicalStructure = true,
KeepActions = false,
AllowConcatenateExceptions = true
};

pdfFileEditor.Concatenate(filesToMerge.ToArray(), outputFile);

I attach 2 pdf’s and 2 documents (docx, docm) I used to create pdfs in Word, Aspose. Notice that when you change order of merged file, exception is not thrown (unfortunately we can’t do that).

Best regards,
Bartłomiej Chojnowski

mergeTest.zip (255.6 KB)

@jhas

We have logged this problem in our issue tracking system as PDFNET-51867. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi,

We are hearing from our clients that this issue occurs quite often. Is there any way to detect pdf that will cause issues before merging?

/Bartek

@jhas

Your issue is pending for analysis. Once we complete the analysis of this issue, we will then provide you the detail on it.

Hi,

Our investigation showed that this property (of PdfFileEditor) set to True is the factor:

CopyLogicalStructure = true,

when ‘false’ is used merge is done. Unfortunately we require this property be set to True.

/Bartek

@jhas

Thanks for sharing the detail. We have logged this detail in our issue tracking system. You will be notified once this issue is resolved.

Hi Tahir,
are there any news on this case?
/Bartel

@jhas

Your issue has been resolved and its fix will be available in the next version of Aspose.PDF for .NET i.e. 22.8. We will inform you via this forum thread once it is released.

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