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

Free Support Forum - aspose.com

Image not loading

When attempting to load an image from disk, the image is not loaded into the Image object eventhough the path is correct. Code as follows:

var headerImage = new Image(header);
var imageInfo = new ImageInfo();
imageInfo.File = "C:\\svn\\Com.Web\\Images\\header.gif";
headerImage.ImageInfo = imageInfo;

I have similarly tried this using a URL, but the result is the same. Having said this, I have managed to get the image loading to work using exactly the same code in another solution.

Hi,

I have tested loading an image in header using C# and .Net 2.0; it works fine.

Are you using .Net 3.5? Is it Linq or just C#?

Please provide us a little bit of details so we could further investigate the issue.

Regards,

I’m using C# 3.0 but with .NET 2.0. I’m not using LINQ anywhere.

The problem is that, even with a hardcoded path, the image is still not loading from disk.

Please let me know if any other information will help.

Hi,

I have tried using the following code and it loads image from the disk into the header.

Pdf pdf = new Pdf();

Section sec = pdf.Sections.Add();

HeaderFooter hf = new HeaderFooter(sec);

sec.OddHeader = hf;

sec.EvenHeader = hf;

Text txt = new Text(hf, "test header");

hf.Paragraphs.Add(txt);

Aspose.Pdf.Image img = new Aspose.Pdf.Image(hf);

hf.Paragraphs.Add(img);

ImageInfo info = new ImageInfo();

info.File = "C:\\Documents and Settings\\Developer\\My Documents\\My Pictures\\smily.gif";

info.ImageFileType = ImageFileType.Gif;

img.ImageInfo = info;

pdf.Save(Server.MapPath("~/App_Data/loadimage.pdf"));

Please have a look at the code; there could be something you might have missed or overlooked.

If problem still persists then do let us know, we'll be glad to help you out.

Regards,

I should mention that when calling pdf.Save() I am getting a 500 error:

The remote server returned an error: (500) Internal Server Error.

I’m quite sure this is as a result of the missing images.