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

Free Support Forum - aspose.com

Merge issue: Exception is thrown if document has Section Breaks


We have encountered with exception during merging process of a file with Section Breaks.

Steps to reproduce :

  1. Create Word document with Section Breaks

Section Break can be the last element of the document or the single element on the page (see our attachments with 2 examples).

  1. Try to merge some file with this Word document with Section Breaks with the following flow:
  • Convert the Word document with Section Breaks to PDF with exporting structure (i.e use PDF/A-1a standard)
  • Merge the documents in turn:
    • Some other document
    • Word document with Section Breaks is converted to PDF

Required condition – Copying of logical structure is enabled (PdfFileEditor.CopyLogicalStructure = true).

Actual result

Exception is thrown:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

at Aspose.Pdf.Facades.PdfFileEditor.#=zmM$J8H4=(Exception #=z_XQGF4o=)

at Aspose.Pdf.Facades.PdfFileEditor.Concatenate(String[] inputFiles, String outputFile)

at DCError.Program.Merge(String firstFile, String secondFile) in C:\Users\alexander.zolotarev\source\repos\DCError\DCError\Program 228652.cs:line 62

at DCError.Program.Main() in C:\Users\alexander.zolotarev\source\repos\DCError\DCError\Program 228652.cs:line 39

Expected result

Merge is completed
Logical structure of the all input documents is copied

Content :

  • 1.docx - first file example
  • 2.docx - second file example
  • Program.cs – example of the code for conversion and merging (we also added the example for merging the same file is converted via MS Word)

content.zip (204.7 KB)

Aspose libraries that we use:

  • Aspose.Word v.
  • Aspose.Pdf v.

But with the newest ones it is reproducible anyway:

  • Aspose.Word v.
  • Aspose.Pdf v.


We have noticed that the conversion of the Word document with Section break to PDF leads to creation one extra empty page(we already reported this issue - Extra Page is Created when Document with Section Breaks (Odd Page) is Save to PDF using .NET ). The same behavior has conversion of Word document to PDF via MS Word. But file is got via MS Word can be merged successfully.

Could you please advise us with the current behavior?

Best regards,



We were able to replicate the Exception in our environment. We need to investigate this issue in details. Hence, an investigation ticket as PDFNET-50798 has been logged in our issue management system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.