I am building an ASP.NET 2.0 app for our MIS department and we purchased ASPOSE.TOTAL for .NET and I recently upgraded to version 18.104.22.168
I wrote the function that I cut and pasted below to convert MS Word documents to PDF. This function works if the Word document we are converting does NOT contain images. But if the MS Word document has images inserted into it, then I get error messages like "Access to the path ‘\nas-arctic\document\apps\aims\6139\Temp.001.png’ is denied. "
I am attaching a copy of a typical MS Word document that has an image that has been giving me this problem.
The web server uploads the MSWord files to another file server and accesses the file for conversion ot PDF using UNC paths. The server uses impersonation with a fixed identity. If I grant EVERYONE full control to the folder where the Temp.001.png file is being created, then the function works. But, if the user account used for impersonation is given full control on both the “Sharing” and “Security” tabs and it still gives me the "Access to the path
\\[path]\Temp.001.png is denied error message.
Please let me know what the problem is
----Beginning of cut-and-pasted code-----
Private Function ConvertWord(ByVal ItemPath As String, ByVal SourceFile As String, ByRef ErrorMessage As String) As Integer Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf() Try Dim doc As Document = New Document(ItemPath & SourceFile) doc.Save(ItemPath & "\Temp.xml", SaveFormat.AsposePdf) pdf.BindXML(ItemPath & "Temp.xml", Nothing) pdf.IsImagesInXmlDeleteNeeded = True pdf.Save(ItemPath & "Temp.pdf") Catch ex As Exception ErrorMessage = ex.Message Return -1 End Try If ErrorMessage = "" Then 'If ErrorMessage <> "", that means the PDF Files got appended successfully. Then delete the temp and old master file. Try File.Delete(ItemPath & "Temp.xml") Catch ex As Exception ErrorMessage = ex.Message 'I guess there is an error message now. Return -1 Exit Try End Try End If Return 1 End Function
----End of cut-and-pasted code-----