RB10.06 D6 Number of Pages printed
Hi
I am printing a report to pdf via code.
This all works fine but I need to know how many pages were produced in the
pdf. Is there a property I can use from TrsClientReport or TppProducer?
Sorry if it is a bit basic but I can't find the solution through the help or
examples.
regards
Andrew
I am printing a report to pdf via code.
This all works fine but I need to know how many pages were produced in the
pdf. Is there a property I can use from TrsClientReport or TppProducer?
Sorry if it is a bit basic but I can't find the solution through the help or
examples.
regards
Andrew
This discussion has been closed.
Comments
The easiest way is to implement the OnPageReceive event of the file device
to keep a running total of the amount of pages generated. You can use the
ClientReport.BeforePrint event to access the Report.FileDevice object and
assign the event handler. Below is the signature of the OnPageReceive
event.
TppPageEvent = procedure (Sender: TObject; aPage: TObject) of object;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks for your help.
I did the following
Private
procedure OnPageReceive(Sender: TObject; aPage: TObject);
..
..
..
procedure TdatMain.OnPageReceive(Sender, aPage: TObject);
begin
inc(FLastPage);
end;
procedure TdatMain.clrMainBeforePrint(Sender: TObject);
begin
// Assign the onPageReceieve event to our
// procedure to count the number of pages
clrMain.FileDevice.OnPageReceive := OnPageReceive;
end;
It worked a treat.
regards
Andrew