• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 834
  • Last Modified:

PDF export gives error -2147417848 Method '~' of object '~'

From my ASP application, I am trying to export my Crystal Reports to PDF (so that I do not have to use a viewer).  It works great on my XP development machine.  But on the Windows 2003 server production machine, I get this error

Err:-2147417848 Descrip:Method '~' of object '~' failed

It happens at "oRpt.Export False".  I see that the file is starting to be created (it has the sessionID.pdf but is zero bytes big).  The file is actually "in use" if I try to do a second report in the same session.   I suspect the problem could be that the oRpt and CrExportOptions are defined as an Objects instead specifics types.  My google search says that it is an MDAC issue, but I'm not making any MDAC call.  Any ideas?


Public Function PrintToPDF()
    Dim strErrMsg As String
    Dim sSql As String
    Dim sFile As String
    sFile = modObjSession.SessionID & ".PDF"
    If fnblnExportReport(modObjSession("oRpt"), "PDF", GetPath, sFile, strErrMsg) = False Then
        modObjResponse.Write "Failed to write PDF." & strErrMsg
      Else
        sSql = "<SCRIPT LANGUAGE=""JavaScript"">"
        sSql = sSql & "  window.open(""" & sFile & ""","""",""menubar=no toolbar=no resizable=yes scrollbars=yes"")"
        sSql = sSql & "</script>"
        modObjResponse.Write sSql
        modObjResponse.Flush
    End If
End Function
Function fnblnExportReport(oRpt As Object, strFormat, strpath, strfilename, strErrMsg) As Boolean
    Dim lngStartTime As Long
    Dim sFunction As String
    Dim sError As String
    Dim iErrCount As Integer
    sFunction = "fnblnExportReport"
    If gLogLevel > 5 Then lngStartTime = GetTickCount
    On Error GoTo ErrorHandler
    '------
    Dim CrExportOptions As Object
    Set CrExportOptions = oRpt.ExportOptions
    With CrExportOptions
       Select Case strFormat
          Case "PDF"
            .FormatType = 31
            .PDFExportAllPages = True
            .DestinationType = 1 'crEDTDiskFile
            .DiskFileName = strpath & "\" & strfilename
            .UseReportNumberFormat = False
            .UseReportDateFormat = False
       End Select
     End With
    oRpt.Export False
    strErrMsg = ""
    fnblnExportReport = True
    Set CrExportOptions = Nothing
    '------
GetOut:
    On Error Resume Next
    Exit Function
ErrorHandler:
    sError = "**Error in Function:[" & sFunction & "] Source:" & Err.Source & " Err:" & Err.Number & " Descrip:" & Err.Description & " Time:" & Now()
    fnblnExportReport = False
    strErrMsg = sError
    modObjResponse.Write "<p><font Color=red>" & sError & "</font></p>"
    Resume Next
End Function
Private Function GetPath() As String
    Dim path As String
    Dim iLen As Integer
    path = modObjRequest.ServerVariables("PATH_TRANSLATED")
    While (Right(path, 1) <> "\" And Len(path) <> 0)
        iLen = Len(path) - 1
        path = Left(path, iLen)
    Wend
    GetPath = path
End Function
0
LanWorks
Asked:
LanWorks
  • 9
  • 8
1 Solution
 
mlmccCommented:
You probably are using MDAC.  MDAC is the Microsoft Data Access Components.  Most database access on Windows machines is done through MDAC calls from the database drivers.

It could very easily be an MDAC problem.  What machine are you building the VB application on?  What version of MDAC is included in the VB application?

mlmcc
0
 
LanWorksAuthor Commented:
I've MDAC 2.8 on both the development and the server.  I know I use MDAC, did I don't see how that can be the problem because everything works, including the Crystal reports that use the JVM browser ... everything except when I try to export the Crystal Report to PDF
0
 
mlmccCommented:
What version of Crystal?

mlmcc
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LanWorksAuthor Commented:
Version 8.5 developer
0
 
mlmccCommented:
What Crystal controls are included in your ASP application>

If you are using crystl32.ocx as it appears, I don't think it can export to PDF.

mlmcc
0
 
LanWorksAuthor Commented:
I don't know how to confirm if I am using crystl32.ocx.  However, niether my development machine nor the server has u2fPDF.dll (remember my development machine does export OK).  Both the server and development machines have the same version of CRXF_pdf.dll in both the c:\program files\...pathes\cr8.5\ directories and both have the same version in the c:\WIndows\Crystal directory.   The exception is that the development machine has a 7/10/02 version in the c:\Program files\common\Crystal decisions\1.0\bin directory and the server does not even have this directory.  Is this relevent?
0
 
mlmccCommented:
CRXF_PDF.dll is the newer version of u2fPDF.dll.

I don't know how in ASP to verify references but in VB it is under the project menu.

mlmcc
0
 
LanWorksAuthor Commented:
I have the following references in my VB activeX.dll project:

C:\Program Files\Seagate Software\Viewers\ActiveXViewer\xqviewer.dll
C:\Program Files\Common Files\Crystal Decisions\1.0\Bin\Cdo32.dll
C:\Program Files\Seagate Software\Report Designer Component\craxdrt.dll
C:\Program Files\Seagate Software\Report Designer Component\crystalwizard.dll
C:\WINDOWS\System32\cpeaut32.dll
C:\Program Files\Seagate Software\Viewers\ActiveXViewer\sviewhlp.dll
C:\Program Files\Seagate Software\Viewers\ActiveXViewer\crviewer.dll
C:\Program Files\Seagate Software\Report Designer Component\craxdui.dll

everything seems to be in sync EXCEPT cdo32.dll.  To ward off this pending doom of a DLL hell,  what is the best/easiest way for me to get 52 DLL's from the development machine's C:\Program Files\Common Files\Crystal Decisions\1.0\Bin\ to the server?

I'm not sure what I installed to get these Crystal Decisions\1.0 files, but the server has 2 files in Crystal Decisions\2.0.

Are we barking up the right tree?
0
 
mlmccCommented:
Check the versions of the various dlls.

You don't need all 52 dlls on the server.  You need only install theones you are using.

mlmcc
0
 
LanWorksAuthor Commented:
I copied Cdo32.dll and registered it (regsvr32), but it still gives the Method '~' of object '~' failed.   All other files are in sync.  I of course stopped and restarted the web services as part of re-registering the dll that uses the PDF export.
0
 
mlmccCommented:
Almost sounds like Crystal is insisting they be in the same place on the server as they are in thedev mavhine.

mlmcc
0
 
LanWorksAuthor Commented:
I did put it in the same place.  Although I didn't register them, I went ahead and copied all 52 of the remaining DLLs to the same location as the development machine ... still no joy.
0
 
jrmnCommented:
Hi LanWorks,

Please verify this link. I had an export to PDF problem before and this link helped me solve it.
Maybe this can help you one way or the other.

http://support.businessobjects.com/library/kbase/articles/c2009165.asp

goodluck,
jrmn
0
 
LanWorksAuthor Commented:
I've confirmed I have the correct ATL.DLL on the server and that EportModeller and crtslv.dll are the same.  Any other suggestions?
0
 
mlmccCommented:
None.

It is possible that CR8.5 and Win 2003 have some incompatability.

mlmcc
0
 
LanWorksAuthor Commented:
I am still interested in a resolution as it is still a major pain in the neck for the users that cannot print from XP sp1 (and above) that does not have MSVJM.

Should I close this and open a new question?
0
 
mlmccCommented:
Your call.  We need more information if we are to proceed.

mlmcc
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now