C# DynamicPDF Merging causing "Index out of bounds" error
Posted
by Dining Philanderer
on Stack Overflow
See other posts from Stack Overflow
or by Dining Philanderer
Published on 2010-05-21T16:54:35Z
Indexed on
2010/05/21
21:40 UTC
Read the original article
Hit count: 254
c#
|dynamicpdf
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.PdfDocument pdfdoc = new ceTe.DynamicPDF.Merger.PdfDocument(ms);
ceTe.DynamicPDF.Merger.MergeDocument mergedoc = new ceTe.DynamicPDF.Merger.MergeDocument(pdfdoc);
docCombinedPDF.Append(mergedoc);
}
Thanks....
© Stack Overflow or respective owner