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

Free Support Forum - aspose.com

Not supported image type

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)
        {
        <span style="color:blue;">var</span> pdfDocument = <span style="color:blue;">new</span> Aspose.Pdf.<span style="color:#2b91af;">Document</span>(inputStream);
        <span style="color:blue;">int</span> idx = 1;
        <span style="color:blue;">var</span> images = pdfDocument.Pages[1].Resources.Images;
        <span style="color:blue;">foreach</span> (<span style="color:#2b91af;">XImage</span> image <span style="color:blue;">in</span> images)
        {
            <span style="color:blue;">using</span> (<span style="color:blue;">var</span> imageStream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>())
            {
                <span style="color:green;">// Here it fails with not supported image type</span>
                image.Save(imageStream, <span style="color:#2b91af;">ImageFormat</span>.Png);
                imageStream.Seek(0, <span style="color:#2b91af;">SeekOrigin</span>.Begin);

                <span style="color:blue;">if</span> (image.Width > PdfPixelWidth || image.Height > PdfPixelHeight)
                {
                    <span style="color:blue;">using</span> (<span style="color:blue;">var</span> resizedImage = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>())
                    {
                        ResizeImage(<span style="color:blue;">new</span> <span style="color:#2b91af;">Bitmap</span>(imageStream)).Save(resizedImage, <span style="color:#2b91af;">ImageFormat</span>.Png);
                        resizedImage.Seek(0, <span style="color:#2b91af;">SeekOrigin</span>.Begin);
                        images.Replace(idx, resizedImage);
                    }

                }
                <span style="color:blue;">else</span>
                {
                    images.Replace(idx, imageStream);
                }
            }

            idx++;
        }


Seems like this bug has been fixed in version 8.3.0.0.

Hi there,


Thanks for your feedback. Its good to know you have manged to resolve the issue at your own.

Please feel free to contact us for any further assistance.

Best Regards,