Intercept the printing event (default rbuilder preview form)
is that possible to intercept the print event handler called when the user
clicks the print button on the default preview form?
let me try to explain what I need:
** the report is pre-viewed (default rbuilder preview);
** the user clicks the 'print button';
** the print dialogbox apperars;
** the user sets some options. Ex.: the user choose the printer, copy
number...
** I want to abort the work and manipulate by myself;
for example, I want get the chosen printer and print each page to one
archive (I'll manipulate destination and file names), so I'll send each
archive to the printer...
I will appreciate any help....
cheers
andre luiz mota
clicks the print button on the default preview form?
let me try to explain what I need:
** the report is pre-viewed (default rbuilder preview);
** the user clicks the 'print button';
** the print dialogbox apperars;
** the user sets some options. Ex.: the user choose the printer, copy
number...
** I want to abort the work and manipulate by myself;
for example, I want get the chosen printer and print each page to one
archive (I'll manipulate destination and file names), so I'll send each
archive to the printer...
I will appreciate any help....
cheers
andre luiz mota
This discussion has been closed.
Comments
I'm a bit unclear about your ultimate goal. Do you want to print to archive
and print to the printer at the same time? If you would like to prevent
your users from using the built-in print dialog to print to the printer, you
can completely replace the dialog with your own custom dialog. There is an
example of replacing dialogs in the Tutorials directory.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
basically, I want to manipulate what happens when the user clicks the print
button on the default rbuilder form preview;
For example, abort the print process, show custom dialog boxes and other
things, include print each page to one archive (1 archieve per page)....
I'll be satisfied if I stop the processes and generate one archieve per
page.
thanks and forgive my bad english.
andre luiz mota
You can take control over the print button by implementing its OnClick
event. Access the event from the OnPreviewFormCreate event.
procedure TForm2.ppReport1PreviewFormCreate(Sender: TObject);
begin
TppPrintPreview(ppReport1.PreviewForm).PrintButton.OnClick :=
PrintButtonClickEvent;
end;
Then inside the PrintButtonClickEvent routine, you can completely take over
how the report is printed. Take a look at the following article on how to
print each page of the report to a separate file. The same concepts apply
for printing to archives.
http://www.digital-metaphors.com/rbWiki/Output/PDF/How_To...Send_Each_Page_as_a_PDF
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
custom preview)?
andre luiz mota
All you need to do is implement the OnClick event of the PrintButton
property as I described in my previous post.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Focusing on the ' print each page of the report to a separate file', the
cited article below uses the TppPDFDevice...
I'm trying to modify it to print each page to a raf archive (*.raf)
** The original code is:
lFileDevice: TppPDFDevice;
** I'm trying:
lFileDevice: TppArchiveDevice; {ppFilDev.pas}
but an 'Access violation' occurs!!!
Is 'TppPDFDevice' the correct device to be used ?
thanks,
andre luiz mota
That's the modifyed code:
-------------------
var
lPage: TppPage;
//lFileDevice: TppPDFDevice;
lFileDevice: TppArchiveDevice; {ppFilDev.pas}
begin
lPage := TppPage(aPage);
lFileDevice := TppArchiveDevice.Create(self);
try
lFileDevice.FileName := 'c:\'+IntToStr(lPage.AbsolutePageNo)+'.pdf';
lFileDevice.StartJob;
lFileDevice.ReceivePage(lPage);
lFileDevice.EndJob;
finally
lFileDevice.Free;
end;
end;
----------------------
In my testing with ReportBuilder 11.06 and (most of) your code below, this
worked as expected. Which version of ReportBuilder/Delphi are you using?
You are not going to want to export your reports to a .pdf file any more.
Although this shouldn't have any effect on the error, try changing the file
name to have a ".raf" extension rather than ".pdf".
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
RBuilder versions are the problem. The version here is 7.01 and there is no
'TppPDFDevice' I guess. I chose raf format becouse it preserves the report
layout and I intend to use these archives for another intention.
Wich class may I use to substitute the 'TppPDFDevice' to get raf archives
(*.raf)?
thaks,
Unfortunately I am not sure if this example will work with RB 7 and the
Archive device nor am I able to test with such an old version.
Theoretically it should work if you change TppPDFDevice to TppArchiveDevice
and change the file extension to .raf.
Please consider upgrading your version of ReportBuilder to the latest
version. We have added hundreds of new and exciting features since RB 7
that make the process of reporting easier and more enjoyable.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com