Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Printing from out a TService

edited March 2004 in General
I have some problems using the reportbuilder 7 enterprise in combination
with an TService. The windows service needs to print a report,but when the
printing starts (using a aReport.Print instruction) the print thread
freezes. Has somebody an idea how can I solve this problem?

Thierry Van Schoote
ITM-Software

Comments

  • edited March 2004

    -----------------------------------------------------------------
    Tech Tip: Executing Reports in a Windows Service environment
    ------------------------------------------------------------------

    1. Configure that report to suppress all dialogs

    Report.ShowPrintDialog := False;
    Report.ShowCancelDialog := False;
    Report.ShowAutoSearchDialog := False;

    2. Provide a thread-safe environment/container in which the report can
    execute. See the RBuilder.hlp on the Background printing feature fpr
    details.

    3. Typically a Windows service application executes under a special user
    account. To Print to the printer, you will need to install applicable
    printer drivers excplicity to the user account.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2004
    Thanks,

    It's working better now. I missed these new Background printing settings.
    But I still have some problems.

    1.After loading the report from a stream, I assigned programmatically
    onFormat events for some TppText and TppVariable components. Untill now at
    printing these events were fired as expected. When I start printing in
    Background the events seems not to be fired anymore. If I disable the
    Background printing with "ppReport.BackgroundPrintSettings.Enabled := false"
    and "ppReport.BackgroundPrintSettings.Active := false" everything works
    again. Have you an explanation therefore?

    2.When can the thread-safe environement be freed? I mean, it's safe to write
    something like this:
    dm := TThreadSafeDataModule.create(nil);
    dm.ppReport.Print;
    dm.Free;

    So the question is: Is the Print instruction synchrone when printing in
    Background?

    Thanks

    Thierry Van Schoote
    ITM-Software


  • edited March 2004

    1. See the RBuilder.hlp topic for TppProducer.BackgroundPrintSettings. It
    explains that a new instance of the report container is created when
    printing to the background.

    2. See the same topic as one above. I think you can free your report
    instance without affecting the instance use in the background thread.
    However, you do not want to quit the application - that will cause an issue.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.