TiffDevice.Process fails with StackOverflowException

When I try to convert the attached pdf to tiff images, it fails with stackoverflow exception. It is quite bad since StackOverflowException cannot be caught and it kills the whole process :frowning:


var pdfDocument = new Document(Path.Combine(inputDir, inputFile));

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
var jpegFilename = Path.Combine(outputDir, “Image” + pageCount + “.jpg”);
using (var imageStream = new FileStream(jpegFilename, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
var memoryStream = new MemoryStream();
var resolution = new Resolution(600);
var jpegDevice = new TiffDevice(resolution);

//convert a particular page and save the image to stream
jpegDevice.Process(pdfDocument, pageCount, pageCount, memoryStream);
}


}

Hi Voffka,


Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 7.6.0 over Windows 7 X64 in VisualStudio 2010 project and I am unable to notice any issue. For your reference, I have also attached the resultant PDF which I have generated. Please take a look.

Can you please try using the latest release version and in case the problem still persists, please share the details regarding your working environment. I have used the code snippet provided over Convert all PDF pages to single TIFF Image

We are sorry for this inconvenience.