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

Free Support Forum - aspose.com

ImageInfo.ImageStream - is it valid property?

Hi,
Do have any sample of using ImageStream?
I don’t know what to do with my code as it gives an error?

Exception Details:
System.ApplicationException: Can’t open image file

pdfDoc.Save(“AdPages.pdf”, SaveType.OpenInBrowser, Response);


this my block of code:

FileHttpDownLoader httpDownLoader = new FileHttpDownLoader();
httpDownLoader.DownLoad(Utility.GetAdImageUrl(adId, index));
Stream fileStream = httpDownLoader.GetFileStream();
System.Drawing.Image downLoadedImage = new Bitmap(fileStream);

downLoadedImage.Save(@“D:\test1.jpg”,System.Drawing.Imaging.ImageFormat.Jpeg);

Aspose.Pdf.Image pdfImage = new Aspose.Pdf.Image();
pdfImage.ImageInfo.ImageStream = fileStream;
pdfImage.ImageInfo.ImageFileType = ImageFileType.Jpeg;
pdfImage.ImageInfo.Alignment = AlignmentType.Center;
content.Paragraphs.Add(pdfImage);





pdfDoc.Save(“AdPages.pdf”, SaveType.OpenInBrowser, Response);

thanks.


Hi,

Thank you for considering Aspose.

I have not found error in your code of using ImageStream. Please make sure the stream is correct by saving it to disk. You can also try using SystemImage.