Adding blank pages at the end
Hello everyone;
I want to print a booklet and I've looked at TechTips/Booklet.zip. Great
example. It works fine until the number of pages is evenly divisible by 4
(not by 2 as the example suggests). In example there is a code to add a page
if total number of pages is odd (in order to make it even). What I need (I
think) is the code to make number of pages not only even, but also evenly
divisible by 4.
If I simply run code to add a page in a loop (to add let's say 3 pages), it
adds only the first one. It goes through the loop without complaining, but
at the end only one page is added.
Right now I have a report of 15 pages. Code from example add one page to
make it 16, and all prints fine.
If my report has 14 pages, code from example doesn't add anything (number of
pages is already even), but printing fails. I get "List out of bounds (7)
error. That '(7)' is the last page number after booklet formatting.
How can I add more than one blank page at the end of the report? I was not
able to find the answer on Tamaracka. In one thread while ago Nico suggested
to specify a group on some static field and use OnGetBreakValue event, but
how it works at the end of the report when I want to add, for example, 3
more pages?
Or, am I missing something?
Thanks
Zoran
I want to print a booklet and I've looked at TechTips/Booklet.zip. Great
example. It works fine until the number of pages is evenly divisible by 4
(not by 2 as the example suggests). In example there is a code to add a page
if total number of pages is odd (in order to make it even). What I need (I
think) is the code to make number of pages not only even, but also evenly
divisible by 4.
If I simply run code to add a page in a loop (to add let's say 3 pages), it
adds only the first one. It goes through the loop without complaining, but
at the end only one page is added.
Right now I have a report of 15 pages. Code from example add one page to
make it 16, and all prints fine.
If my report has 14 pages, code from example doesn't add anything (number of
pages is already even), but printing fails. I get "List out of bounds (7)
error. That '(7)' is the last page number after booklet formatting.
How can I add more than one blank page at the end of the report? I was not
able to find the answer on Tamaracka. In one thread while ago Nico suggested
to specify a group on some static field and use OnGetBreakValue event, but
how it works at the end of the report when I want to add, for example, 3
more pages?
Or, am I missing something?
Thanks
Zoran
This discussion has been closed.
Comments
Your Booklet.zip example prints 8 pages and all works fine. Try to print
several records more so that report expands to 9 pages. You'll see what I
mean.
Thanks.
Zoran
Thanks for pointing this out. I am unsure when and for whom the Booklet
example was created but I think it was some time close to April of 2001. It
seemed that there were two bugs in the example rather than one.
1. The reason the reports only worked when the page count was a number
divisible by 4 is that there was an issue with the way the final number of
pages need was calculated. The example divided the AbsolutePageCount by 2
which works fine until you try to reorder the pages for duplexing with an
odd number as the final page count. This has been addressed.
2. The example was using the "div" operator to divide the AbsolutePageCount
by 2 which always rounds down. In our case we need to round up so a
complete new page will be added for odd page counts. This has been
addressed.
Here is the link for the updated example. If you find anything else wrong,
please let me know, I didn't have much time to test the changes thoroughly.
http://www.digital-metaphors.com/tips/booklet.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks for the revised code. I made additional 2 changes: I made sure that
even number of pages is created in PrintToCache (the code to do that was
there in the old example, and it works), and in ReorderPages I've changed
lRightPage := lPublisher.Pages[(ppReport1.AbsolutePageCount - 1) -
liIndex];
to
lRightPage := lPublisher.Pages[(ppReport1.AbsolutePageCount) -
liIndex];
Now it works great, exactly the way expected.
Thanks.
Zoran.