Can't open image file error message


Tech Support;

I have been trying to deploy my solution to our web server (works fine on my local machine) but get the following error:

System.ApplicationException: Can’t open image file C:\DOCUME~1\DSAPPS1\ASPNET\LOCALS~1\Temp\Aspose.Word.632387039588861699.001.Jpeg

at Aspose.Pdf.Figure.aa.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) at Aspose.Pdf.Xml.k.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, Image A_5, a A_6, w A_7, Boolean A_8) at Aspose.Pdf.Xml.u.a(Pdf A_0, Section A_1, a A_2) at A_0) at Aspose.Pdf.Xml.aa.a(a A_0, Pdf A_1) at Aspose.Pdf.Pdf.Save(String fileName, SaveType saveType, HttpResponse response) at DSDMSCorrLtrs.WebForm1.dgCorrLtrs_ItemCommand(Object source, DataGridCommandEventArgs e)

The following code produces the error:

Dim loArray As Byte()

Dim loProxy As New CorrLtrWS.CorrLtrs ’ web service


Dim loDoc As Aspose.Word.Document

Dim loWord As New Aspose.Word.Word

loArray = loProxy.GetStream(strFileNamePath)

Dim loStream As New MemoryStream(loArray)

Dim xmlDoc As XmlDocument = New XmlDocument


'Read the document in Aspose.Pdf.Xml format into Aspose.Pdf.

Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf

pdf.BindXML(xmlDoc, Nothing)

'Instruct to delete temporary image files.

pdf.IsImagesInXmlDeleteNeeded = True

'Produce the PDF file.

pdf.Title = “Correction Letter”

pdf.Save(“Document”, Aspose.Pdf.SaveType.OpenInBrowser,

Me.Response) ’ line it breaks on


End If

Catch ex As Exception

lblAppNo.Visible = True

lblAppNo.Text = ex.GetBaseException.ToString

End Try

I have even tried to setting the permissions on the folder, but still no luck.

Any Ideas?


The document contains an image and you export the document to Aspose.Pdf via a memory stream. This is fine, but the image still needs to go via a file so Aspose.Word creates the image file in the temporary folder.

In your case Aspose.Pdf cannot read that image for some reason. It does not look like permissions are at play because the message would say something “access denied”.

The problem could be either the image is not there or Aspose.Pdf has trouble opening image in that location. I will let Aspose.Pdf team know, maybe they can look at this too.

In the meantime you can try a workaround saving the output from Aspose.Word not to a memory stream, but into a file. In this case, the images will be saved in the same folder as the file and you can:
1. Check the image file is really created.
2. You can control the folder where the file is saved and make sure the folder is simple enough for Aspose.Pdf to open the image from it.