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

Free Support Forum - aspose.com

PDF to TIFF Image Conversion

We use following code to convert PDF file into TIFF images. For attached PDF file named "Sample.pdf", it is only 1st page that convert into TIFF. For rest of the pages it gives "Out of Memory" error. We use following code for different compression techniques. Please advise.

1) Compression : CCITT4

var savePdfDocument = new Aspose.Pdf.Document(inputPDFFile);
var tiffSettings = new TiffSettings
{
Compression = CompressionType.CCITT4,
Shape = ShapeType.None,
SkipBlankPages = true
};

var tiffDevice = new TiffDevice(resolution, tiffSettings);
var pages = savePdfDocument.Pages;
var pgCount = pages.Count;

for (int pg = 1; pg <= pgCount; pg++)
{
var saveName = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(outputMultipageTiff), System.IO.Path.GetFileNameWithoutExtension(outputMultipageTiff) + pg + System.IO.Path.GetExtension(outputMultipageTiff));
tiffDevice.Process(savePdfDocument, pg, pg, saveName);
}
savePdfDocument.Dispose();



2) Compression :- LZW

Document pdfDocument = new Document(inputPDFFile);

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
var saveName = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(outputMultipageTiff), System.IO.Path.GetFileNameWithoutExtension(outputMultipageTiff) + pageCount + System.IO.Path.GetExtension(outputMultipageTiff));

using (FileStream imageStream = new FileStream(saveName, FileMode.Create))
{
GifDevice jpegDevice = new GifDevice(resolution);
jpegDevice.Process(pdfDocument.Pages[pageCount], imageStream);
imageStream.Close();
}
}

Hi there,


Thanks for your inquriy. I have tested the scenario with Aspose.Pdf for .NET 11.4.0 and unable to notice the reported exception. We will appreciate it if you please download and try latest version of Aspose.Pdf for .NET, it will resolve the issue.

Best Regards,