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