Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Not supported image type

$
0
0
The enclosed pdf returns a "Not supported image type" when I try to run through 
the images in the file using the following code. I use version 8.2.0.0 of aspose.pdf. 
Can you tell me what kind of image type it is that aspose.pdf doesn't support?
        public static MemoryStream ConvertPdfToPdf(Stream inputStream)
        {            var pdfDocument = new Aspose.Pdf.Document(inputStream);            int idx = 1;            var images = pdfDocument.Pages[1].Resources.Images;            foreach (XImage image in images)            {                using (var imageStream = new MemoryStream())                {                    // Here it fails with not supported image type                    image.Save(imageStream, ImageFormat.Png);                    imageStream.Seek(0, SeekOrigin.Begin);                    if (image.Width > PdfPixelWidth || image.Height > PdfPixelHeight)                    {                        using (var resizedImage = new MemoryStream())                        {                            ResizeImage(new Bitmap(imageStream)).Save(resizedImage, ImageFormat.Png);                            resizedImage.Seek(0, SeekOrigin.Begin);                            images.Replace(idx, resizedImage);                        }                    }                    else                    {                        images.Replace(idx, imageStream);                    }                }                idx++;            }


Viewing all articles
Browse latest Browse all 3131

Trending Articles