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

Free Support Forum - aspose.com

Converting Blank PDF document to *.tiff image

When we are converting from pdf to tiff image using the following code, we are getting an error.
This is happening only when we are using a "blank pdf document. If the pdf document has anything in it, it works fine.

					    			//load pdf stream into PdfFileInfo
                                    PdfFileEditor pdfEditor = new PdfFileEditor();
                                    PdfFileInfo fileInfo = new PdfFileInfo(docStream);
    
                                    //new code to unpack pdf and create tiff
                                    Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
                                    
                                    TiffSettings tiffSettings = new TiffSettings();
                                    tiffSettings.Depth = ColorDepth.Format1bpp;
                                    tiffSettings.Compression = CompressionType.CCITT3;
                                    tiffSettings.SkipBlankPages = true;

                                    TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
                               
                                    Document pdfDoc = new Aspose.Pdf.Document(docStream);
                                    Document pdfDoc2 = new Document();

                                    MemoryStream docStream2 = new MemoryStream();
                                    using (MemoryStream pdfPageOutput = new MemoryStream())
                                    {
                                        pdfDoc.Save(docStream2, SaveFormat.Pdf);
                                        pdfDoc2 = new Aspose.Pdf.Document(docStream2);
                                    }

                                    _logger.LogDebug("DocumentHandler.ConvertFileAsync: Begin unpacking PDF pages.  Page Count: " + fileInfo.Document.Pages.Count.ToString() + "  PDF file: " + document.FileName);

                                    using (MemoryStream pdfPageOutput = new MemoryStream())
                                    {   
                                        maxPDFPageCount = maxPDFPageCount < fileInfo.Document.Pages.Count ? maxPDFPageCount : fileInfo.Document.Pages.Count;
                                        tiffDevice.Process(pdfDoc2, 1, maxPDFPageCount, pdfPageOutput);
                                        pdfPageOutput.Position = 0;

                                        TiffImage tiffImage = (TiffImage)Aspose.Imaging.Image.Load(pdfPageOutput);

                                        mainImage.Add(tiffImage);

Can you please help me in finding out why it is not able to convert blank pdf document to tiff image.

Attaching a sample Blank document that I am converting to *.tiff and it is giving errors. Blank.pdf (1.4 KB)

@azamatali,

I have observed the issue shared by you and it seems related to Aspose.PDF. I am moving this issue to concerned forum so that we may help you further in this regard.

@azamatali

Thanks for contacting support.

Would you kindly share an error detail that you are facing at your end. We will further proceed to assist you accordingly.