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

Free Support Forum - aspose.com

Pdf to tiff problem

Hi

Im trying to convert PDF files to TIFF images, this works most of the time but for some PDF files the stream returned is empty if i set SkipBlankPages to true, or if i set it to falsethe TIFF file will be empty and 104 kb of size.
here is my code:

public byte[] ConvertFromPDF(MemoryStream instream)
{
Aspose.Pdf.License licencePdf = new Aspose.Pdf.License();
licencePdf.SetLicense(“Aspose.Total.lic”);

        byte[] arr = null;
        using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(instream))
        {
            using (MemoryStream outstream = new MemoryStream())
            {
                Aspose.Pdf.Facades.PdfConverter converter = new Aspose.Pdf.Facades.PdfConverter(document);
                converter.Resolution = new Resolution(300);
                converter.RenderingOptions = new Aspose.Pdf.RenderingOptions()
                {
                    ScaleImagesToFitPageWidth = true
                };
                TiffSettings settings = new TiffSettings()
                {
                    Compression = CompressionType.LZW,
                    SkipBlankPages = true,
                };
                converter.SaveAsTIFF(outstream, settings);
                arr = outstream.ToArray();
            }
        }

        return arr;
    }

Im using version 18.6, but have tried this in version 19.5 (latest) with the same result.

the PDF file contains a single, rather large Image and no text.
when I try to loop pages to get the page.ColorType obect i get an error: “Not supported image type”

here is an example of the pdf file:
.file.pdf (4.3 MB)
thank you

@joi

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46450 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-46450) have been fixed in Aspose.PDF for .NET 22.2.