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

Posted by drivendevelopment on Stack Overflow See other posts from Stack Overflow or by drivendevelopment
Published on 2009-10-05T17:58:29Z Indexed on 2010/05/20 5:20 UTC
Read the original article Hit count: 1226

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)

© Stack Overflow or respective owner

Related posts about abcpdf

Related posts about xps