Is this possible to add new page at run-time ?
Hello,
We are using RB for quite long now, created hundreds of reports and always
where able to do what we want to do.
This time I spend 2 days (!) and gave up.
Our customer wants to print disclaimer on the back of each page when
printing invoices in duplex mode.
I have read all tech-tips and other messages but nothing could solve our
problem, even RBAddon component, as it only adds page break where I need to
insert new page and add some text on it. Adding group doesn't work either as
if there is invoice witch prints in more than one page then group brake
occurs after details being printed - I need this to happen when page is
printed.
Also, tried all possible variations with Subreport which has set as Section
type. Problem is where should I put this subreport ? In header it doesn't
work (produces some strange results), footer is fixed so it does not print
subreport at all, cannot put in details.
For me logical place would be to do something in RAP on Report.EndPage event
so I can check if current page number is
odd then I can add disclaimer page. The problem is - how can I add new page
?
It would be so nice if RB could have something like Crystal reports where
you can have report made out of 2 or more pages.
So on 1st page I can put invoice details and on second page disclaimer info.
Please help !
Ernest Jaraminas
www.happenbiz.com
We are using RB for quite long now, created hundreds of reports and always
where able to do what we want to do.
This time I spend 2 days (!) and gave up.
Our customer wants to print disclaimer on the back of each page when
printing invoices in duplex mode.
I have read all tech-tips and other messages but nothing could solve our
problem, even RBAddon component, as it only adds page break where I need to
insert new page and add some text on it. Adding group doesn't work either as
if there is invoice witch prints in more than one page then group brake
occurs after details being printed - I need this to happen when page is
printed.
Also, tried all possible variations with Subreport which has set as Section
type. Problem is where should I put this subreport ? In header it doesn't
work (produces some strange results), footer is fixed so it does not print
subreport at all, cannot put in details.
For me logical place would be to do something in RAP on Report.EndPage event
so I can check if current page number is
odd then I can add disclaimer page. The problem is - how can I add new page
?
It would be so nice if RB could have something like Crystal reports where
you can have report made out of 2 or more pages.
So on 1st page I can put invoice details and on second page disclaimer info.
Please help !
Ernest Jaraminas
www.happenbiz.com
This discussion has been closed.
Comments
cache and send them to the device. You'll need to create a disclaimer page
object and send it after every invoice page from the report. Here is an
example:
http://www.digital-metaphors.com/tips/DisclaimerOnBack.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Thanks for replay. Thats was what I was looking for ! Now I'm trying to
make it work, but thats
another story - we are saving all reports and code in database and calling
them from scripts. For some
reason if my report is more then one page than I have list out of bounds
error when its trying to read page
2, it happens in code (AbsolutePageCount is correct = 2):
lGeneratedPage := lPublisher.Pages[liIndex];
If report is 1 page then it works but no disclaimer printed.
I did exactly as in you example... I think it has something to do that we
are using scripting but note yet
sure whats going on.
Anyway, I'll try to play a little more ...
Thanks,
Ernest Jaraminas
the report properties for the current report, ie. CachePages could be set to
false on the template. This could be causing the publisher to not have any
pages cached. After the tempalte is loaded, you'll need to set
Report.CachePages to true.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
thanks for your help ! I found where problem was - if report has set as Two
Pass then it fails - even on the
example project you send. By the way, why does it fails ?
But I have another question - in your example in procedure DrawCommandToPage
you drawing some text
and shape on newly created page. My question is - how can assign region to
this page ? We are saving
disclaimers in a region on another report. Then when I need disclaimer I can
find in on another report using
Band.Objects and assign to new page. Pleas help me how
Regards,
Ernest Jaraminas
page, before the call to PrintToDevices in the PrintToCache method of the
demo.
lDevice.PageSetting := psLastPage;
2. The draw commands are on the output page objects which get sent to the
devices (printer, screen, file...). You cannot add a region, as this is a
component in the layout. You should create a rectangle shape draw command as
shown in the demo to draw the region on a page.
Page Objects
-------------
When a report prints it generates Page objects. Each Page object contains an
array of DrawCommand objects (Page.DrawCommands[]) that describe what needs
to be rendered for the page.
Report --> Pages.DrawCommands[] ---> Device (Printer, Screen, ..) --> final
output
DrawCommands Objects
--------------------
Component --> DrawCommand
Each TppComponent generates a DrawCommand object each time
it prints on a page. For example if the component is a TppLabel and prints
at the top of the page - one draw command object will be created for each
page. If the Label is in the detail band, many draw commands will be created
for each page.
A DrawCommand contains a complete description of the location and content to
draw. See ppDrwCmd.pas for the existing DrawCommand class descendants
(DrawText, DrawImage, etc.)
Some of the basic DrawCommand classes such as DrawImage and DrawText, rely
on the ScreenDevice and PrinterDevice classes to render their content. Other
DrawCommand classes such as TppDrawBarCode and TppDrawRichText render
themselves to the appropriate device canvas directly.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
in the example project you have sent me there is already line
lDevice.PageSetting := psLastPage
in procedure PrintToCache, just before calling PrintToDevices method.
But if I set your report to Two Pass then it fails. Can you please look in
your example and try
setting it to Two Pass ?
Thank you,
Ernest Jaraminas
psLastPage.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com