Android Question Adding next page in PDF

Setlodi

Active Member
Hi friends

I'm using the CPDF class to create PDF from SQLite db. Now I don't have a fixed number of rows that I print, sometimes 2 rows, sometime 50 rows. What I do is get the number of rows from the db query and if it's greater than 50, I want to add a page. For example if my RowCount is 65, I want to add the first 50 in the first page and then the remaining 15 in the second page. I've used the following code but the result is: my PDF has 2 pages, the first page is blank and the second page contains the first 50 items.

B4X:
    If RowCount > 50 Then
        Log("End of page")
        pdf.pageAdd(pdf.pageSizeA4PortraitWidth,pdf.pageSizeA4PortraitHeight)
    End If

How do I ensure that the first 50 is added in the first page and the remaining 15 in the second page.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…