开发者

C# DynamicPDF Merging causing "Index out of bounds" error

Greetings, We use DynamicPDF to merge multiple PDF documents stored in a MSSQL database. The vast majority of times it works wonderfully, but occasionally one of these documents will fail to merge generating the exception message "Index was outside the bounds of the array."

I think I have isolated the problem to PDF files that are greater than 8.5 x 11.0.

Does anyone know if this is a known issue with DynamicPDF? The merging code is posted here. What would be ideal is if there is a way to resize the PDF files to the correct size so this is not a concern at all...

for (int docs = 0; docs < dsPDFInfo.Tables[0].Rows.Count; docs++)
{
    byte[] bytePDFArray = (byte[])dsPDFInfo.Tables[0].Rows[docs]["Content"];
    int iContentSize = Convert.ToInt32(dsPDFInfo.Tables[0].Rows[docs]["ContentSize"]);

    MemoryStream ms = new MemoryStream(bytePDFArray, 0, iContentSize);
    ceTe.DynamicPDF.Merger.PdfDocum开发者_如何学Pythonent pdfdoc = new ceTe.DynamicPDF.Merger.PdfDocument(ms);
    ceTe.DynamicPDF.Merger.MergeDocument mergedoc = new ceTe.DynamicPDF.Merger.MergeDocument(pdfdoc);

    docCombinedPDF.Append(mergedoc);
}

Thanks....


The next thing I would do is to trace the values of

bytePDFArray.length

and

iContentSize
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜