Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Table with many rows - many pages
  FAQ FAQ  Forum Search   Register Register  Login Login

Table with many rows - many pages

 Post Reply Post Reply
Author
Message
Slawek View Drop Down
Beginner
Beginner


Joined: 05 Aug 09
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Slawek Quote  Post ReplyReply Direct Link To This Post Topic: Table with many rows - many pages
    Posted: 05 Aug 09 at 8:19AM
Hi

I have table with 1000 rows
TabId:= CreateTable(1000, 5);
SetTableRowHeight(TabId, 1, 1000, 0);
...

I need draw table on many pages so I do something like this:

aPageCount := 0;
 repeat
   DrawTableRows(TabId, 0.2, PageHeight - 0.2, PageHeight - 0.4, aPageCount + 1, FPDFApp.GetTableLastDrawnRow(TabId));
   aRowPage := GetTableLastDrawnRow(TabId); //aRowPage = 50
   Inc(aPageCount,aRowPage);
   if aPageCount < 1000 then
     SelectPage(NewPage);
   until aPageCount >= 1000;

But it isn't working, I have many pages but table is only on first page with first 50 rows.
How I can draw table on next page?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 05 Aug 09 at 9:33AM
Hi!
I don't see that "NewPage" is served?
SelectPage(aPageCount) should work.
If you want to create 1000 pages with a table and your document doesn't have these 1000 pages then you have to create them ... in this case have a look at "NewPage".
What you can do, too is creating the table one time and copy this single page on the other pages. Have a look in the page management functions of QuickPDF.

Cheers, Ingo

Back to Top
Slawek View Drop Down
Beginner
Beginner


Joined: 05 Aug 09
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Slawek Quote  Post ReplyReply Direct Link To This Post Posted: 05 Aug 09 at 12:24PM
I want print 1000 rows on X pages. On one page I can print about 50 rows (sometimes 40 or 60, GetTableLastDrawnRow result).

I create new page and select it here:

if aPageCount < 1000 then
     SelectPage(NewPage);

aPageCount  - it's total row count from first page to current:

page - aPageCount
1 - 50 rows (from 1 to 50)
2 - 100 (from 51 to 100)
3 - 150 (from 101 to 150)
...
when aPageCount >=1000 I finish.
After that I have 20 pages but only first have table, other are clear.

I think when I do
DrawTableRows(TabId, 0.2, PageHeight - 0.2, PageHeight - 0.4, aPageCount + 1, GetTableLastDrawnRow(TabId));

table is draw on currently selected page. Is this true?


Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 05 Aug 09 at 9:31PM
Hi!

What's the returning value from "SelectPage(NewPage);"... error or okay?
In your loop you can try something like:
// ...
QP.NewPage;
QP.SelectPage(aPageCount);
// ... now your table
// ...

Cheers, Ingo

Back to Top
Slawek View Drop Down
Beginner
Beginner


Joined: 05 Aug 09
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Slawek Quote  Post ReplyReply Direct Link To This Post Posted: 06 Aug 09 at 6:22AM
>QP.NewPage;
>QP.SelectPage(aPageCount);
>

I don't do aPageCount := QP.NewPage
aPageCount - isn't a new page id, it should be aPrintedRecordCount, it's total row count from first page to current

SelectPage it's ok

I know what it's wrong: GetTableLastDrawnRow returns last printed row, not rowcount from last page.

It should be:
DrawTableRows(aTableId, 0.2, PageHeight - 0.2, PageHeight - 0.4, aPrintedRecordCount + 1, 0);
aPrintedRecordCount := GetTableLastDrawnRow(aTableId); //not Inc(aPrintedRecordCount ,GetTableLastDrawnRow(aTableId));
...

Thank you very much for help.



Back to Top
Michel_K17 View Drop Down
Newbie
Newbie
Avatar
www.exp-systems.com

Joined: 25 Jan 03
Status: Offline
Points: 297
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michel_K17 Quote  Post ReplyReply Direct Link To This Post Posted: 06 Aug 09 at 3:31PM
Great job Slawek! Thanks for posting an update.
Michel
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store