Free Support Forum - aspose.com

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

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

Code:
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
vPdf.Save(vPDFStream)

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

vMemoryStream.Close()
vXMLStream.Close()
vPDFStream.Close()

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 3.6.1.0 you might experience problems with temporary files deletion. If you meet this issue please try the attached component. It is Aspose.Pdf 3.6.1.4 published by Hans Zhang specially to fix the mentioned regression.

Regards,

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