Error during extracting page image

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.

Hi Vital,


Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 7.9.0 in Visual Studio 2010 application running over Windows 7 (X64) and I am unable to notice any issue. I have tried converting the first page of PDF file to JPEG Image format (using Convert particular PDF page to JPEG Image) and also have tried extracting the image from first page (using Extract Images from the PDF File) and I did not notice any problem in either case. Can you please try using the latest release version and in case the problem still persists, please feel free to contact.

For your reference, I have also attached the extracted image file.

We are sorry for your inconvenience.