Hi,

I know that crystal reports is an obsolete class and not recommended, but I have several users who use it and it becomes unfeasible at the moment to migrate them to DR. So I'm having problems exporting CR 8.5 reports to pdf automatically, I already had the report and it exports normally without this snippet that I implemented, does anyone have any ideas?

Code:
    Object GerBolBradesco is a CrystalRep        
        Set Report_Name to "BolBradesco.rpt"
        Set WindowTitle to ('Geração de boletos - bolreal')
        Set WindowStyle to (WS_MAXIMIZE ior WS_VISIBLE ior WS_THICKFRAME ior WS_SYSMENU ior WS_MAXIMIZEBOX ior WS_MINIMIZEBOX)

        Procedure OnDeInitializeReport
            Set ZoomPreviewWindow to 100
        End_Procedure


        Procedure OnInitializeReport
            String strSql
            Integer iTables iCounter


            Forward Send OnInitializeReport
            
            Set Output_Destination to CRW_PRINT_TO_FILE
            Set ExportFormatType to CRW_AcrobatType
            Set ExportFileName to "C:\ArquivosCTeNFe_GOE\PDFs\bolbradesco.pdf"

            Set SearchButton_prn to True
            Set PrintSetupButton_prn  to True


            Get NTables to iTables
            For iCounter from 0 to (iTables-1)
                Set NthTableLogOnServerName iCounter     to strGlobalServidor   1
                Set NthTableLogOnDatabaseName iCounter   to strGlobalNome_BD    1
                Set NthTableLogOnUserId iCounter         to strGlobalUsuario_BD 1
                Set NthTableLogOnPassword iCounter       to strGlobalSenha_BD   1
            Loop


            Set SelectionFormula to (psSelBanco_237(oButtonPrint1(Self)))
            Get SQLQuery to strSql
            Move (Replaces(", AND", strSql, " AND")) to strSql
            Set SQLQuery to strSql


            Set Formula "fcarteira" to ('(Trim({BANCO.CARTEIRA}))')
            Set Formula "faceite" to (Winql_String(String('N')))
            Set Formula "finstr1" to (Winql_String(String(Value(oForm3))))
            Set Formula "finstr2" to (Winql_String(String(Value(oForm4))))
            Set Formula "finstr3" to (Winql_String(String(Value(oForm5))))
            Set Formula "finstr4" to (Winql_String(String(Value(oForm6))))
            Set Formula "finstr5" to (Winql_String(String(Value(oForm7))))
            Set Formula "finstr6" to (Winql_String(String(Value(oForm8))))
            Set Formula "finstr7" to (Winql_String(String(Value(oForm9))))


        End_Procedure


    End_Object