Printing a report twice

edited July 2017 in General
Hi list,

we have a workflow, where a report is first printed to a printer and
then printed directly to a file (dvArchive).
This worked fine in RBuilder 5.56, but now in 18.00 our printing to
dvArchive results in an empty file.
After debugging I found out, that report.publisher.busy is true when
calling report.printtodevices. This causes a direct exit in
tppProcuder.printtodevice and no file is created. Same behaviour on
using report.print.

Even tried to cancel or reset report before calling print again.
This caused an accesviolation on ppthreadedpagecache.pas@710 called
from ppdevice.pas@2159

Is there any thread usage in 18.00 which was not in 5.56?

Tia Carsten

--


Hint: We altered the sources!Hint: We altered the sources!

Comments

  • edited July 2017
    Obviously I found a workaround.
    Waiting actively with a loop of sleep(10) and
    application.processmessages until busy=false solves my problem but is
    not very good.

    Which is the correct property to look for whether a report is finished?
    Can thread-usage be disabled?

    Carsten Eider formulierte Donnerstag :

    --


    Hint: We altered the sources!Hint: We altered the sources!
  • edited July 2017
    Hi Carsten,

    The ThreadedPageCache is only used for Viewing/Previewing reports. My
    guess is that you are viewing/previewing a report while printing and
    exporting your report.

    When manually printing or exporting with an active viewer or preview,
    you need to be sure to disconnect the screen device before calling
    Print. You can see that ReportBuilder does this in the Viewer.Print
    routine.

    Viewer.ScreenDevice.Publisher := nil;

    Report.Print;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2017
    Just to follow up. For RB 18, we added the Viewer.ExportToFile routines
    which take care of the above for you. See the TppViewer.ExportToFile
    topic for more information.

    These routines should now be used when exporting to file from and active
    viewer.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2017
    On 20/07/2017 17:05, Nico Cizik (Digital Metaphors) wrote:

    Hello Nico/Nard,

    I was excited by TppViewer.ExportToFile, hoping that it would be
    generating the file output from all the work that has already been done
    by running the report to Preview; but it seems to run the entire report
    again and thus take just as long to generate the output file.

    I already do this using the TppReport.PrintToDevices from a custom
    button on a custom preview form, and for complex, big data, reports that
    run to 40 pages and which take 30 seconds to complete, users are often
    frustrated when a PDF file is then needed for email (our own custom
    email solution) and the whole report has to be run again. Is it out of
    the question for TppViewer.ExportToFile to grab what's already been
    generated and spit out to file in a fraction of the time?

    TIA - Paul
  • edited September 2017
    Hi Paul,

    Try setting Report.CachePages to True. This will avoid the need to
    re-access data and regenerate page objects when printing/exporting.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2017
    On 14/09/2017 16:49, Nico Cizik (Digital Metaphors) wrote:

    Nico,

    After all the years of using RB (and doing some very clever things with
    it), I can't believe I didn't make use of that! I just tested here and
    it works a treat. Thank you :)
This discussion has been closed.