Solved

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

Posted on 2004-09-11
19
798 Views
Last Modified: 2008-01-09
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
Comment
Question by:LanWorks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
19 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12035700
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
 

Author Comment

by:LanWorks
ID: 12036237
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 12036845
What version of Crystal?

mlmcc
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 

Author Comment

by:LanWorks
ID: 12038358
Version 8.5 developer
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 12038870
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 12038876
0
 

Author Comment

by:LanWorks
ID: 12039184
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 12040325
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
 

Author Comment

by:LanWorks
ID: 12040976
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 12041045
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
 

Author Comment

by:LanWorks
ID: 12041174
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 12044530
Almost sounds like Crystal is insisting they be in the same place on the server as they are in thedev mavhine.

mlmcc
0
 

Author Comment

by:LanWorks
ID: 12049893
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
 
LVL 4

Expert Comment

by:jrmn
ID: 12050116
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
 

Author Comment

by:LanWorks
ID: 12053233
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
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 12061388
None.

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

mlmcc
0
 

Author Comment

by:LanWorks
ID: 12271977
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 12272563
Your call.  We need more information if we are to proceed.

mlmcc
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question