Stop Printing
How do I keep someone from actually printing what is in the previewer. My
attempt at doing such is to disable printing to paper capabilities when my
program is functioning in demo mode. I have tried the OnPrintDialogClose
event, but this doesn't do anything when the user presses the Print button
in the top left corner of the previewer. Or am I just doing something
wrong.
Jeff Kreider
attempt at doing such is to disable printing to paper capabilities when my
program is functioning in demo mode. I have tried the OnPrintDialogClose
event, but this doesn't do anything when the user presses the Print button
in the top left corner of the previewer. Or am I just doing something
wrong.
Jeff Kreider
This discussion has been closed.
Comments
it. The previewer is replaceable. See ppPreview.pas in ..\RBuilder\Source
for an example of creating a TppCustomPreview descendent. Don't forget to
register this new previewer in the initialization section.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Three things:
1) Is there a simple example somewhere on creating a previewer. I haven't
had to do what you said that I need to do.
2) I found what was looking for in dm0124.pas. I believe there is a type-o
on line 193. It says,
ppTextToPageList('1,30', Report.PrinterDevice.PageList, True);
but I believe it should read,
ppTextToPageList('1,30', ppReport.PrinterDevice.PageList, True);
3) The other problem I got was an EAccessViolation at runtime when the
following line is executed in my program,
ppReport1.PrinterDevice.PageSetting := psPageList;
I took the copied and pasted the BeforePrint event code from dm0124.pas and
put it into my BeforePrint event. Any ideas as to why this would occur?
Thanks for your help.
controls and such. By registering your TppCustomPreview class, it will get
created for you by RB. All you have to do is create a copy of the
TppPreview class in your project, and rename it. Then make an unregister
call to unregister the current preview, and register your new preview class,
as shown at the bottom of the ppPreview.pas file in our source.
2. Yep, that's a typo, however, it works the same. Thanks for pointing it
out.
3. As far as the AV, you'll need to check for nil as the code in the demo
does:
{note: PrinterDevice will be nil if NOT printing to printer }
if (Report.PrinterDevice <> nil) then
begin
Report.PrinterDevice.PageSetting := psPageList;
{note: this is a useful routine for converting the page list text
to the list of strings}
{print pages 1 and 30 }
ppTextToPageList('1,30', Report.PrinterDevice.PageList, True);
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com