views:

1610

answers:

4

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)

+2  A: 

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

A: 

Hi,

I am facing a bit different error but very similar to the above mentioned error. ERROR

Following error is thrown by wcfService when reading document on line dd.Read()…

WebSupergoo.ABCpdf7.Internal.PDFException was caught

Message="Unable to convert OpenOffice.org document."

Source="ABCpdf"

StackTrace:

   at WebSupergoo.ABCpdf7.Doc.ReadOfficeDoc(String path, Boolean checkExt, XReadOptions options)

   at WebSupergoo.ABCpdf7.Doc.ReadOtherDoc(String path, Boolean isTempFile)

   at WebSupergoo.ABCpdf7.XReadOptions.Read(Doc doc, Byte[] data)

   at WebSupergoo.ABCpdf7.Doc.Read(Byte[] data, XReadOptions options)

   at HrManager.Services.Pdf.CandidateReport.CreateHtml(Doc& doc, Department department, Project project, List`1 candidateIds, List`1 whatToPrint, String cssContent) in D:\hrmanager\dev\hrmanager_v3\trunk\PDF\PdfServices\CandidateReport.cs:line 544

InnerException: System.NullReferenceException

   Message="Object reference not set to an instance of an object."

   Source="ABCpdf"

   StackTrace:

        at WebSupergoo.ABCpdf7.Internal.OfficeDocument.CreateProperty(String propertyName, Object propertyValue)

        at WebSupergoo.ABCpdf7.Internal.OfficeDocument.OpenDocument(String inUrl)

        at WebSupergoo.ABCpdf7.Internal.OfficeDocument.ConvertDocument(String inputFilePath, String outputFilePath)

        at WebSupergoo.ABCpdf7.Doc.ReadOfficeDoc(String path, Boolean checkExt, XReadOptions options)

   InnerException

My Code is

byte[] officeDoc = System.IO.File.ReadAllBytes(s);                                    
WebSupergoo.ABCpdf7.XReadOptions xr = new XReadOptions();
xr.FileExtension = GetFileExtension(s);
Doc dd = new Doc();
dd.Read(officeDoc, xr);
dd.Dispose();
dd = null;

My system configuration

1) Windows Vista

2) IIS-7

3) AbcPdf 7.0.0.8 (also tried using 7.0.1.9)

4) Visual studo 2008 with SP1

5) OpenOffice.org installed

My code works fine, if I use it with a new sample web application. BUT if I use same code with WCF service and deploy it on my local machine IIS (IIS-7) then it fails to load openOffice.Org documents (but merges txt, html etc)

Thanks Surjit

Surjit
From the guys at WebSupergoo:"There can be issues in running MS Office from a non-interactive account. ... We also recommend running ABCpdf code in a COM+ application, such as PdfEnterpriseServices. This is to bypass any IIS configuration issues, but if you can get it to run in an IIS account all the better. Let us know if you need an example web site - there is already an example embedded in the document attached that uses a COM+ application. However it's a windows service, not a web site."
A: 

Hi,

This code has resolved my above mentioned problem.

Doc pdf = new Doc();
                try
                {
                    pdf.Read(s);
                }
                catch
                {
                    //for txt files
                    WebSupergoo.ABCpdf7.Operations.XpsImportOperation import = new WebSupergoo.ABCpdf7.Operations.XpsImportOperation();
                    import.ImportAny(pdf, s, 10000);
                }
Surjit
A: 

Actual problem is that the folder where you are trying write the file, give the write permission to IIS_IUSR. Then it should work.

Sukanta