Free Support Forum -

Access to the path 'C:\WINDOWS\TEMP\...png' is denied

Hmm using Aspose.Pdf - and Aspose.Words - versions I get error when word is converted to pdf.

Dim vMemoryStream As MemoryStream = New MemoryStream()
Dim vXMLStream As MemoryStream = New MemoryStream()
Dim vPDFStream As MemoryStream = New MemoryStream()

FileStore.GetFile(vMemoryStream, "atbv_DocCtrl_DocDwgs_RevisionsFiles", vRow("PrimKey").ToString)
Dim vDoc As Document = New Document(vMemoryStream, String.Empty)
vDoc.Save(vXMLStream, SaveFormat.AsposePdf)
vMemoryStream.Seek(0, SeekOrigin.Begin)

Dim vPdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
vPdf.BindXML(vXMLStream, Nothing)
vPdf.IsImagesInXmlDeleteNeeded = True

vPDFStream.Seek(0, SeekOrigin.Begin)
FileStore.InsertFile(vPDFStream, vFile + ".pdf", "atbv_DocCtrl_DocDwgs_RevisionsFiles", vPrimKey)


Any idea what could be wrong? As I sow in related post this bug has been already solved.

Hello Lina.

Thank you for your interest in Aspose components.

This is an environmental issue. “Access denied” means that current Windows account has no permission to write to the temporary folder. If you are developing a Web service try adding the following line before you are calling Save method:

vDoc.SaveOptions.ExportImagesFolder = Server.MapPath(String.Empty)

This will redirect image output to the root site folder. In general you can specify any accessible location and don’t need to change permission model. Let me know whether this helps.

I also would like to warn you that on Aspose.Pdf version you might experience problems with temporary files deletion. If you meet this issue please try the attached component. It is Aspose.Pdf published by Hans Zhang specially to fix the mentioned regression.


Thank you very much for your help.
vDoc.SaveOptions.ExportImagesFolder = Server.MapPath(String.Empty) solved this environment issue.