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

When do they really print to the printer?

edited August 2001 in General
D5EE, RB5.56 Pro

Hi RB team,

I have to track any printing of documents (i.e. every page of a multipage
report) in Report Builder.
Until now I could not find any event where I could hook into to be sure that
our endusers really have printed one, many or all pages of a report. Also
we need the info if printing was cancelled after a number of printed pages.

Do you havew any suggestion?

Thanks
Robbi

Comments

  • edited August 2001
    Sorry, I forgot one additional question:

    I configured the report to always print a page, even an empty page
    ([ndMessageDialog,ndBlankPage]). I hooked into the OnNoData event of the
    report , but it is not fired when our report supresses printing an empty
    detailband. We need all empty pages for documentation, so what's going
    wrong?

    Thanks again,

    Robbi
  • edited August 2001
    From the tech-tips newsgroup:

    ------------------------------------------
    Tech Tip: Detecting whether Report was
    Printed to the Printer
    ------------------------------------------

    The Report.AfterPrint event can be used to
    determine whether the report was printed
    to the printer (rather than preview, ...).


    Example:


    procedure TForm1.ppReport1AfterPrint(Sender: TObject);
    begin

    if (ppReport1.PrinterDevice <> nil) then
    ShowMessage('Report was printed to the printer');

    end;



    Note: If the user cancels the report while it
    is running, then the Report.OnCancel event will
    fire, followed by the Report.AfterPrint event.

    Example:

    procedure TForm1.ppReport1Cancel(Sender: TObject);
    begin
    ShowMessage('Printing cancelled by user');

    end;

    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com


  • edited August 2001
    Jim,

    Thanks for your hint, I read it already before I came to this NG.
    This document contains no answer to any of my questions!

    So I ask you again for an real advice!

    Robbi
  • edited August 2001
    Jim,

    Thanks for your hint, I read it already before I came to this NG.
    This document contains no answer to any of my questions!

    So I ask you again for an real advice!

    Robbi
  • edited August 2001
    Reminder,

    this question still is not answered :-((

    We need an event to track the printing of every single page until printing
    is finished or printing is cancelled by the user (i.e OnPagePrint(APage:
    TppPage...)
    Again I appreciate your assistance.

    Thanks

    Robbi
  • edited August 2001
    RB's Cancel will stop the current page from being generated. Once a page
    has been sent to the printer spool, it will print. Use the OnEndPage event
    of the report. This event is triggered when the current page is about to be
    sent to the output device. In this event, you can check the
    Report.DeviceType = dtPrinter (uses ppTypes unit) to see if the report is
    printing to the printer.


    When the print dialog is displayed to the user, you can determine whether
    the Cancel button was selected by using the Report.OnPrintDialogClose event.

    Example:

    procedure TForm1.ppReport1PrintDialogClose(Sender: TObject);
    begin

    if ppReport1.PrintDialog.ModalResult = mrCancel then
    ShowMessage('Use chose to cancel the print request');

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2001
    Thanks Jim,

    cancelling was not the problem why I aksed for your support. It get's more
    difficulty if the user selecets various single pages or page groups in the
    printer dialog (like "1,3,5-7").
    With the cancelling information I could not figure out, at which page he
    cancelled printing.

    I'll try the OnEndPage event, probably I have to suppress this event while
    the first pass is active on a two pass report.

    Thanks again
    Robbi
  • edited August 2001
    There are two handy boolean properties Report.FirstPass and
    Report.SecondPass if you want to skip some code in event handlers for a
    given pass.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.