GemBox Support Forum

Error "Array item is not indirect object" when trying to merge 2 PDFs

I am trying to merge multiple PDFs into a new document using the following code:

Public Function MergeAsByteArray(pdfFiles As List(Of String)) As Byte()
    Using document = New PdfDocument()
        For Each fileName In pdfFiles
            Using source = PdfDocument.Load(fileName)
                document.Pages.Kids.AddClone(source.Pages)    ' BLOWS UP HERE
            End Using
        Using msPDF As New MemoryStream
            Return msPDF.ToArray
        End Using
    End Using
End Function

The code blows up on the document.Pages.Kids.AddClone(source.Pages) line with “Array item is not indirect object”. The exception contains a help link.

This happens on very few documents - mostly very large ones. Why am I getting this error?

Using GemBox.Pdf 1.3 for .NET Standard 2.0. The dll version is

Hi Robert,

Please try again with the latest bugfix version or with the latest NuGet package.
Does this solve your issue?

If the problem remains, please send us a sample PDF file that can reproduce your issue so that we can investigate it.


Mario, thanks for responding. I tried using my license for GemBox.Pdf 1.3 with the latest from nuget and it told me that I couldn’t use it since it was for an older version. I then tried using “FREE-LIMITED-KEY” license. That didn’t work either because the free version is limited to 2 pages.

At the same time I cannot send you the PDF file because it’s privileged court document (I’d have to request permission from relevant parties). Do you have, perhaps, a time-limited full license that I can try your full version with?