I am trying to extract thumbnail for pdf file using folowing code:
using (var imageStream = new MemoryStream())
{
var resolution = new Resolution(100);
var page1 = pdfDocument.Pages[1];
var pageSize = page1.GetPageRect(false);
var jpegDevice = new JpegDevice(200, (int)(pageSize.Height * 200 / (pageSize.Width + 1)), resolution, 100);
jpegDevice.Process(page1, imageStream);
}
I have the following Exception for the file in attachment:
"A first chance exception of type ‘System.IO.EndOfStreamException’ occurred in mscorlib.dll"
After calling Process function application crashes!!!
Please give me an advice how to catch or to workaround this problem.