question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Number of rows per page

See original GitHub issue

Hi!..how i can set the number of rows in each page?.. i have this but doesn’t work fine:

var columns = ['Cuota','Fecha', 'Monto', 'Forma de Pago']
        var height = 0;
        pdf.autoTable({
          columns,
          body: rows, 
            startY: 350, 
            theme: 'striped',
            //tableWidth: 'auto', 
            //columnWidth: 'wrap', 
            showHead: 'everyPage',
            headStyles: {
              0: {minCellWidth: '5', halign: 'center'},
              1: {minCellWidth: '10', halign: 'center'},
              2: {minCellWidth: '10', halign: 'center'},
              3: {minCellWidth: '10', halign: 'center'}
            },
            columnStyles: {
                0: {minCellWidth: '5', halign: 'center'},
                1: {minCellWidth: '10', halign: 'center'},
                2: {minCellWidth: '10', halign: 'center'},
                3: {minCellWidth: '10', halign: 'center'}
            },
            headStyles: {theme: 'grid'},
            
            didDrawPage: function(data) {
               // footer
                pdf.setFontSize(8);
                var yFooter = pageSize - 20
                pdf.text(footer, 300, yFooter, "center");
            },
            willDrawCell: function(rows) {
              if (rows.row.index > 0 && rows.row.index % 20 == 0) {
                  pdf.addPage();
              }
            }
        })


but the result is this doc1 doc2 doc3 doc4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stale[bot]commented, Oct 30, 2019

This issue has been automatically closed since the issues in this project are mainly used for bugs and feature requests. Questions are directed to stackoverflow.

0reactions
redleon00commented, Oct 22, 2019

Hi again… i need in this moment do this…if i have for example 15 register in my data, i want to put 12 rows in the first page table, and the rest of rows in the next page…how i can do that?

I do this, but only work in the first page


var columns = ['Cuota','Fecha', 'Monto', 'Forma de Pago']
        var height = 0;
        pdf.autoTable({
          columns,
          body: rows, 
            startY: 350, 
            theme: 'grid',
            //tableWidth: 'auto', 
            //columnWidth: 'wrap', 
            //showHead: 'everyPage',
            headStyles: {
              0: {minCellWidth: '5', halign: 'center'},
              1: {minCellWidth: '10', halign: 'center'},
              2: {minCellWidth: '10', halign: 'center'},
              3: {minCellWidth: '10', halign: 'center'}
            },
            columnStyles: {
                0: {minCellWidth: '5', halign: 'center'},
                1: {minCellWidth: '10', halign: 'center'},
                2: {minCellWidth: '10', halign: 'center'},
                3: {minCellWidth: '10', halign: 'center'}
            },
            
            willDrawCell: function(rows) {
              var pageNumber = pdf.internal.getCurrentPageInfo().pageNumber;
              
              if(numRows > 12){
                if(pageNumber == 1){
                    if (rows.row.index > 0 && rows.row.index % 16 === 0 && rows.column.index === rows.table.columns.length - 1) {
                        pdf.addPage();
                    }    
                }else{
                  if (rows.row.index > 0 && rows.row.index % 30 === 0 && rows.column.index === rows.table.columns.length - 1) {

                       pdf.addPage();
                    }
                }
              }

            }, 
            didDrawPage: function(data) {
               // footer
                pdf.setFontSize(8);
                var yFooter = pageSize - 20
                pdf.text(footer, 300, yFooter, "center");
            },
        })
![11](https://user-images.githubusercontent.com/36481173/67318512-96682900-f4d9-11e9-9d61-d0907236db86.PNG)
![12](https://user-images.githubusercontent.com/36481173/67318514-96682900-f4d9-11e9-91b5-3727f79e4ce3.PNG)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify the Rows Per Page - IBM
Open a report in Query Studio. · From the Change Layout menu, click Set Web Page Size. · In the Number of Rows...
Read more >
Display a fixed number of rows per page in SSRS - SqlSkull
This article demonstrate how to display a fixed number of rows per page in SSRS. Lets see step by step implementation of how...
Read more >
Display a fixed number of rows per page for an SSRS report
In this article we will demonstrate how to display a fixed number of rows on each page of an SSRS report using a...
Read more >
How to Limit the Number of Rows Per Report Page
This article explains the simplest way to limit the number of rows or records per report page using Bold Report Designer.
Read more >
SSRS Number of Rows per Page - UpScale Analytics
SSRS Number of Rows per Page. This presentation covers the following topics : Using RowNumber; Changing the Page Size; Creating a Group Using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found