Free Support Forum - aspose.com

Image in byte[]

I have a chart image that is built on the fly. I want to put it in my PDF. Do I have to write it out to a temporary file to get it into the PDF? Can I just set the MemoryData to my byte array?

I have tried:

graphImage.ImageInfo.ImageFileType = ImageFileType.MemoryBmp;
graphImage.ImageInfo.OpenType = ImageOpenType.Memory;


but i still get the message invalid image file name.

Dear jendicot,

Thanks for your consideration.

Please download hot fix 1.5.27 here.


Same error:
[ArgumentException: Invalid image file name ]
br.a(ImageFileType A_0, String A_1, String A_2, String A_3, Int32 A_4, Int32 A_5, Boolean A_6, Boolean A_7, Byte[] A_8)
da.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, Image A_5, a A_6, eu A_7, Boolean A_8)
bj.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, a A_5)
dm.a(Pdf A_0, Section A_1, Table A_2, Row A_3, a A_4)
bh.a(Pdf A_0, Section A_1, Table A_2, a A_3, Boolean A_4)
b2.a(Pdf A_0, Section A_1, a A_2)
bg.a(Pdf A_0)
ai.a(as A_0, Pdf A_1)
Aspose.Pdf.Pdf.Save(Stream stream)
SymphonyDemo.PdfCreator.SaveResults.btnOk_Click(Object sender, EventArgs e) in c:\src4\symphonydemo\saveresults.aspx.cs:76
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

I changed the code to write the image to a file. The file exists and I can open it. The name is
Copy_Demo1__CHART__.jpeg

The code now is:

graphImage.ImageInfo.ImageFileType = ImageFileType.Jpeg;
graphImage.ImageInfo.OpenType = ImageOpenType.File;
graphImage.ImageInfo.File = iFile;
graphImage.ImageScale = 0.77F;

I checked with debug and iFile contains: @"C:\src4\SymphonyDemo\Images\Copy_Demo1__CHART__.jpeg"

The error is still the same as in the previous post. Looks like it isn’t really a problem with the name… but what is it???



It works… The problem was I had not looked at my xml for a while and forgot that there were 2 images…

It would be nice if the error message could give some more information about the location of the error.