Exception converting Office files to PDF using ABCpdf.NET onWindows Server 2008

DrivenDevelopment picture DrivenDevelopment · Oct 5, 2009 · Viewed 9.6k times · Source

Has anyone delt with this exception from ABCpdf? We're running on Server 2008 and only have issues converting Office files (Word and Excel). This all worked well on Server 2003. Because we're only having issues with Office files I wonder if it's related to the XPS support on Server 2008? The code that calls into this function is running as a Windows Service.

Private Overloads Function ConvertMicrosoftOfficeDocToPdf(ByVal inputFile As Byte(), ByVal fileExt As String) As Byte()
    Dim abcDoc As WebSupergoo.ABCpdf7.Doc = Nothing

    Try
        abcDoc = New WebSupergoo.ABCpdf7.Doc()

        Dim xro As New WebSupergoo.ABCpdf7.XReadOptions()
        xro.FileExtension = fileExt

        Try
            abcDoc.Read(inputFile, xro)
        Catch ex As Exception
            System.Diagnostics.Trace.Write(ex.ToString())
            Throw ex
        End Try

        Dim fileBytes As Byte() = abcDoc.GetData()
        Return fileBytes
    Finally
        If Not abcDoc Is Nothing Then
            abcDoc.Clear()
            abcDoc.Dispose()
        End If
    End Try
End Function

WebSupergoo.ABCpdf7.Internal.PDFException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at WebSupergoo.ABCpdf7.Internal.NDoc._InvokeMethod(IntPtr inDoc, Int32 inMethod, Int32 inIndex, Int32 inFlags, String inParams, String& outErr) at WebSupergoo.ABCpdf7.Internal.NDoc.InvokeMethod(IntPtr inDoc, Int32 inMethod, Int32 inIndex, Int32 inFlags, String inParams, String& outErr) at WebSupergoo.ABCpdf7.Doc.PrintToXps(String inputFile, String outputFile, Int32 timeout, String printerName) at WebSupergoo.ABCpdf7.Operations.XpsImportOperation.ImportAny(Doc doc, String path, Int32 timeout) at WebSupergoo.ABCpdf7.XReadOptions.ImportXpsAny(Doc doc, String path, Boolean clear) at WebSupergoo.ABCpdf7.XReadOptions.Read(Doc doc, Byte[] data, ReadModuleType module) at WebSupergoo.ABCpdf7.XReadOptions.Read(Doc doc, Byte[] data)

Answer

DrivenDevelopment picture DrivenDevelopment · Oct 6, 2009

Added a folder called "Desktop" here:

C:\Windows\SysWOW64\config\systemprofile\

http://social.msdn.microsoft.com/Forums/en/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91