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

Disabling Print to File

edited August 2004 in End User
I am using D7.1 and RB 704.

I am trying to enable/disable the print to file option that is available on
the print dialog. I added the following code to the
ppReport.Template.OnLoadEnd event.

(Sender as TppReport).AllowPrintToFile := UserAllowPrintToFile

This works great when the user previews the report then prints it, but if
the user chooses to print the report without previewing, they are allowed to
print to file. Is there another event that I should be using to set this
value?

You replied to the above question by getting me to check the demo. The demo
works perfectly, but my project does not.

I stepped though the code and it is executing and setting it to false, but
the print to file is still shown. I recently upgraded from D5 RB 603 to D7
RB 704.

I have a custom report explorer. I started with the RB 603 version and added
some extra stuff (security). Do you have any ideas on what I would look for?
Can I access the print dialog directly and hide the groupbox? If so how? I
tried the OnPrintDialogCreate event with no luck.

Comments

  • edited August 2004

    Very strange indeed. You could try tracing the code in ppProd.pas for the
    PrintToPrinter method.

    I just tried using the OnPrintDialogCreate event and it worked fine (see
    code below). I tried a simple test. To use with the your solution, you need
    to assign the event-handler in the Report.Template.OnLoadEndEvent.




    procedure TForm1.ppReport1PrintDialogCreate(Sender: TObject);
    begin
    ppReport1.PrintDialog.AllowPrintToFile := False;
    end;


    --


    Best regards,

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