PDF Export Error

Posted by: the-merg on 4 August 2017, 2:50 pm EST

  • Posted 4 August 2017, 2:50 pm EST

    I am trying to export the data for a report to a PDF file using the AR PDF Export filter, but am running into an error. I am using the same code to create the report as I do when I show it (and it will show fine). When I try to export it, I get the following error:


    Error: ActiveReports PDF export DLL error
    Page collection contains 0 pages. Export Fails. [-2147467259]


    I have the AR PDF Export Filter referenced in my project. The code I am using to create the PDF is as follows:


       Set obj_PDF = New ARExportPDF
       lstr_PDFPath = gstr_DatafilePath & "\" & lstr_ReportTitle & ".pdf"
       obj_PDF.FileName = lstr_PDFPath
       rep_ActiveReport.Export obj_PDF


    Any ideas would be appreciated.


    Thanks,
    The Merg


    --
    Today's problems don't worry me,
    I haven't solved yesterday's yet.

  • Replied 4 August 2017, 2:50 pm EST

    The Show method will auto invoke the Run method if the report has not already been run, the same is NOT true of any Export methods. I am guessing that your pages collection contains 0 pages because the report has not yet be run.


    Set obj_PDF = New ARExportPDF
    lstr_PDFPath = gstr_DatafilePath & "\" & lstr_ReportTitle & ".pdf"
    obj_PDF.FileName = lstr_PDFPath
    rep_ActiveReport.Run False
    obj_PDF.Export rep_ActiveReport.Pages

  • Replied 4 August 2017, 2:50 pm EST

    Yup. That was the issue. I had just figured it out when I saw your post. I had found the Export Sample project on the website here and when I opened up the code, the first line was the Run method. As soon as I saw that, I slapped myself on the head! Works great now.


    Thanks,
    The Merg

Need extra support?

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

Learn More

Forum Channels