Automatically Export Report to PDF

Posted by: tskelley on 8 August 2022, 4:29 pm EST

    • Post Options:
    • Link

    Posted 8 August 2022, 4:29 pm EST

    Below is a generic version of my VB6 code:

    Sub Main()
    
            rpt.Show 
            DoEvents
            Call Timeout(5)
            DoEvents
            PDF_Export_SaveFile rpt
            DoEvents
            Unload rpt
            DoEvents
    
    End Sub
    
    Public Sub PDF_Export_SaveFile(actReport As ActiveReport)
    
        Dim pdf As New ActiveReportsPDFExport.ARExportPDF
        Dim sFile As String
        Dim bSave As Boolean
        
        pdf.FileName = "F:\Projects\Report.pdf"
        
        If actReport.Pages.Count > 0 Then
          pdf.Export actReport.Pages
        End If
        Set pdf = Nothing
    
    End Sub
    
    
    
  • Posted 8 August 2022, 4:32 pm EST

    Hello, I have been requested to automatically generate PDF’s from a printed report. I have not been able to successfully tie an reporting event (like ReportEnd) to ensure the report finishes completely. Therefore, I put in a timer function to provide enough time to export the PDF. Unfortunately, I am concerned this may not always work based on amount of time generating the full report. For example, I have seen some reports where only a partial amount of pages get exported to PDF. Any suggestions on a better way to handle this?

    Sorry for the multiple postings. The Captcha was junking up on me, and I was also getting flagged for spam content…

  • Posted 9 August 2022, 10:43 am EST - Updated 15 February 2023, 10:47 am EST

    Hi Thomas,

    As per my understanding, you are facing this issue when rendering the report using the ActiveReports Viewer. Instead of using the ReportEnd event please use the Viewer1.LoadCompleted event to get the loaded document using the Viewer1.Document property which then can be used to export the report to pdf in this event.

    For more information on this please refer to the following page of our documentation:

    https://www.grapecity.com/activereportsnet/docs/latest/online/GrapeCity.ActiveReports.Viewer.Win~GrapeCity.ActiveReports.Viewer.Win.Viewer~LoadDocument.html

    If you are previewing the report in any of the JSViewer then you can call the report method in the reportLoaded or the documentLoaded method.

    For more information on these JSViewer methods and other APIs please refer to the following page of our documentation:

    https://www.grapecity.com/activereportsnet/docs/versions/v16/online/using-js-viewer.html

    Please let us know if I have misunderstood your requirement. If yes, then could you please elaborate your issue and share a sample application replicating this issue so we can reproduce this behavior at our end.

    Regards,

    Akshay

  • Posted 9 August 2022, 11:59 am EST

    Thanks, I appreciate the quick feedback. I am using an old VB6 version (AR v2), and it appears to be the standard WinForms viewer. I open the report with the .Show method, so do not really know how else to engage with the viewer.

  • Posted 12 August 2022, 11:21 am EST

    Sorry for any confusion with my reply. It does not appear your reply addresses my issue. Can you please offer a solution or ideas for the VB6 version of AR v2?

  • Posted 17 August 2022, 5:49 am EST

    Hi Thomas,

    Apologies for the delay. Unfortunately, ActiveReports 2 is a legacy product and we no longer provide support for it. It is recommended to upgrade to the latest version of ActiveReports, i.e. ActiveReports 16.

    You can download the latest version of ActiveReports using the following link:

    https://www.grapecity.com/activereportsnet/download

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels