We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Pdf JpegDevice: Exception: Unable to read beyond the end of stream

In trying to convert pages of a pdf to a jpeg image prior to searching for barcodes, I’m getting a System.IO.EndOfStreamException with message "Unable to read beyond the end of the stream."


I’m using Aspose.Pdf version 7.7.0.0. The latest for which i have a valid license. I’ve attached a sample pdf that encounters the error.

The relevant code is as follows:
Aspose.Pdf.License lic = new Aspose.Pdf.License { Embedded = true };
lic.SetLicense(“Aspose.Pdf.lic”);
Aspose.Pdf.Devices.JpegDevice jpegDevice = new Aspose.Pdf.Devices.JpegDevice(new Aspose.Pdf.Devices.Resolution(resolution), int.Parse(quality));
using (Aspose.Pdf.Document inputDoc = new Aspose.Pdf.Document(stream))
{
	foreach(Aspose.Pdf.Page pge in inputDoc.Pages)
	{
using (MemoryStream imageStream = new MemoryStream())
{
			//exception is thrown on the following line	
jpegDevice.Process(pge, imageStream);
			//do more stuff
}
}
}

THanks for your help.

Lance Safford

Hi Lance,

Thanks for your inquiry. I’ve tested the scenario with latest version of Aspose.Pdf for .NET 8.3.0 and I’m afraid I’m unable to replicate the issue, sample output is enclosed here. Please download and try Aspose.Pdf for .NET 8.3.0, hopefully your issue will be resolved.

We are sorry for the inconvenience. Please feel free to contact us for any further assistance.

Best Regards,

Sadly, version 8.3.0 did not correct the problem. I still get an exception “Unable to read beyond the end of stream.” when executing jpegDevice.Process(pdf.page[i], stream);.


Strangely, this has been working flawlessly for months.

Since you can’t repro the problem, it has to be some conflict with other aspects of my application. Is there any data on these sorts of conflicts?

Thanks.

Lance

Hi Lance,


Thanks for your feedback. I’m using win 7 64bit and VS2010 with .NET 4.0 Aspose.Pdf dll. Can you please confirm your environment settings? Moreover, It would help us to replicate the issue if you please share some simple console application for investigation.

We are sorry for the inconvenience caused.

Best Regards,