Error: Index was outside the bounds of the array

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v3 and older)  /  Error: Index was outside the bounds of the array

DynamicPDF Generator for .NET (v3 and older) Forum

I am using version 1.6.1.0 of the DynamicPDF Generator.NET and wanting to load a new PDF cover page (6.pdf).

The line of code is this:

objPage = New ImportedPage(DataFilesDir + "/PDFbulletin/coverPDF/6.pdf", 1)

However I now have a new cover page without the main logo and a different log in the bottom right hand corner (7.pdf) and when I use the same line of code with the new file name:

objPage = New ImportedPage(DataFilesDir + "/PDFbulletin/coverPDF/7.pdf", 1)

I get the following error:

?CType(ex, System.IndexOutOfRangeException)
{"Index was outside the bounds of the array."}
    _className: Nothing
    _COMPlusExceptionCode: -532462766
    _data: {System.Collections.ListDictionaryInternal}
    _dynamicMethods: Nothing
    _exceptionMethod: Nothing
    _exceptionMethodString: Nothing
    _helpURL: Nothing
    _HResult: -2146233080
    _innerException: Nothing
    _ipForWatsonBuckets: 104650250
    _message: "Index was outside the bounds of the array."
    _remoteStackIndex: 0
    _remoteStackTraceString: Nothing
    _safeSerializationManager: {System.Runtime.Serialization.SafeSerializationManager}
    _source: Nothing
    _stackTrace: {SByte()}
    _stackTraceString: Nothing
    _watsonBuckets: Nothing
    _xcode: -532462766
    _xptrs: 0
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: Nothing
    HResult: -2146233080
    InnerException: Nothing
    IPForWatsonBuckets: 104650250
    IsTransient: False
    Message: "Index was outside the bounds of the array."
    RemoteStackTrace: Nothing
    s_EDILock: {Object}
    Source: "DynamicPDF.Merger"
    StackTrace: "   at ceTe.DynamicPDF.Merger.IO.b.A()     at ceTe.DynamicPDF.Merger.IO.b..ctor(Stream document)     at ceTe.DynamicPDF.Merger.PDFDocument..ctor(Stream stream)     at ceTe.DynamicPDF.Merger.PDFDocument..ctor(String filePath)     at ceTe.DynamicPDF.Merger.Caching.A..ctor(String filePath)     at ceTe.DynamicPDF.Merger.Caching.PDFDocumentCache.GetDocument(String filePath)     at ceTe.DynamicPDF.Merger.ImportedPage..ctor(String filePath, Int32 pageNumber)     at EteachBatch.Helper.PDFBulletinsFunctions.AddCoverPage(Document document) in C:\Projects\Eteach\Main\Src\EteachBatch\Helper\PDFBulletinsFunctions.vb:line 962     at EteachBatch.Helper.PDFBulletinsFunctions.LoadBulletin() in C:\Projects\Eteach\Main\Src\EteachBatch\Helper\PDFBulletinsFunctions.vb:line 592"
    TargetSite: {Void A()}
    WatsonBuckets: Nothing

Line 962 highlighted  in the error above, is the line I have pasted above where I am creating a new imported page.

Are you able to give me any idea why I am getting this error with the new page?

I have just sent an email with this information to support@cete.com and received a support incident number of S11394622
Posted by a ceTe Software moderator
Hello Richard,

We received the input PDFs and the code sample you sent to our support team. After reviewing the PDFs we found that the one of the PDF (7.pdf) which is casing error contains object streams. The version 1 DynamicPDF for .NET product does not supports object streams. Support for object streams is included in later versions of DynamicPDF.

Also we did further testing using the current v8 DynamicPDF for .NET product and we are able to import the page from 7.pdf and create a new PDF file. Below is the code sample used for testing.

            ImportedPage page = new ImportedPage(@"D:\temp\7.pdf", 1);
            Document document = new Document();
            document.Pages.Add(page);
            document.Draw(@"D:\temp\MyDocumentv8.pdf");

Feel free to download fully functional evaluation edition of version 8 DynamicPDF for .NET product from our website  here. Also refer to the code samples included with the evaluation download.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:46 AM.