Every day system is generating around 1000 PDF from html for past 7 years. Suddenly system is started failing for particular data when we started checking the data , found that no issues with data. We removed the images from PDF , then pdf was generated successfully when we add the images ,throwing below exception
We found that which is not happening for all the images , particularly some type of images has issue.
we tested with latest version and older version and both has same behavior.
using (MemoryStream ms = new MemoryStream())
{
byte[] bytes = Encoding.UTF8.GetBytes(html);
ms.Write(bytes, 0, bytes.Length);
Document doc = new Document(ms);
foreach (Section sec in doc)
{
sec.PageSetup.LeftMargin = -10;
sec.PageSetup.RightMargin = 5;
sec.PageSetup.TopMargin = 15;
sec.PageSetup.PaperSize = PaperSize.A4;
}
doc.Save(outputPath);
}<a class="attachment" href="/uploads/default/41112">Capture.JPG</a> (39.6 KB)
4937836_637309714703118047_st22.jpeg (90.2 KB)
4937836_637309714708430593_fr.jpeg (121.0 KB)
Exception : FileCorruptedException
Error Message: βThe document appears to be corrupted and cannot be loaded.β
Inner Exception : Stream length must be non-negative and less than 2^31 - 1 - origin.\r\nParameter name: value"}