How to know report has been printed in fastreport?

I want to implement 'one print time allowed' in authorization user(In my application).

The Question is: How to know report in fastreport has been printed?

Thanks

Comments

  • edited 5:55AM
    deepsee wrote: »
    I want to implement 'one print time allowed' in authorization user(In my application).

    The Question is: How to know report in fastreport has been printed?

    Thanks

    The only thing that comes to my mind is to use OnReportPrint event of TfrxReport. But ...
    1. That event is fired just after a user presses OK button on the print dialog, so you don't know if it really goes to a printer.
    2. User can export the preview to PDF file or FP3 file and then print it many times from Acrobate Reader or from your application after loading from FP3, so you shouldn't allow him to export preview ...

    Regards
    Mick



  • edited January 2013
    I use the following code in the TfrxReport.AfterPrintReport() to automatically close the preview after printing.
    TfrxReport.AfterPrintReport( .. )
    begin
      if frxUse <> nil then
      begin
        if frxUse.Preview <> nil then
        begin
          if frxUse.Preview.Parent <> nil then
          begin
            TForm(frxUse.Preview.Parent).Close;
          end;
        end;
      end;
    end;
    

    this code could be modified to deal with your query and would also take care of Mick.pl's point 1
    Point 2's problem also applies to cases where a standard printer selection box is displayed as they usually allow the number of copies to be set.

    Also be aware that once the print job has been handed over to Windows you can never be sure that is has been printed, e.g. the printer may be off-line causing the job to get stuck in the spooler and someone then deletes the print file from the spooler.

    The code above is based on some post posted in this forum a long time ago.
  • edited 5:55AM
    thanks for the solution. I will try it.
  • edited 5:55AM
    Deepsee,

    Consider what may be easier for you to implement:
    - To control sending prepared report from PreView to a printer.
    - To control user access to the report, I mean after running a report once end user wouldn't be able to run it again.


    Sure it depends on what do you really mean by "to print report only once" - sending it to printer or just running it (from a menu or so).

    Regards
    Mick

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.