-
-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to split large data table into multiple pages #1799
Labels
Comments
I am also getting same issue..You find any solution of this issue..? |
I'm also the facing the same issue , i would love to know if you found a solution ? |
@DktPhl2019 |
For example: Future<Uint8List> _builPdfPreview(final PdfPageFormat format) async {
final pdf = pw.Document();
pdf.addPage(
pw.MultiPage( // pw.Page(
pageFormat: format,
build: (final pw.Context context) {
return [ // pw.Column( children: [
pw.Table( border: pw.TableBorder.all(),
children: [
pw.TableRow(children: [
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('Name',style: pw.TextStyle(fontSize: 9, fontWeight: pw.FontWeight.bold))),
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('Salary',style: pw.TextStyle(fontSize: 9, fontWeight: pw.FontWeight.bold))),
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('Department',style: pw.TextStyle(fontSize: 9, fontWeight: pw.FontWeight.bold))),
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('Location',style: pw.TextStyle(fontSize: 9, fontWeight: pw.FontWeight.bold))),
] ),
for( int k = 0; k < 20; k++ )
pw.TableRow( children: [
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('row $k')),
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('row $k')),
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('row $k')),
pw.Padding(padding: const pw.EdgeInsets.all(8),child: pw.Text('row $k'))
] ),
] ),
pw.Spacer(), // Dynamic spacing to move content up
pw.Align(alignment: pw.Alignment.bottomCenter,child: pw.Text('Page 1',style: const pw.TextStyle(fontSize: 9, color: PdfColors.grey))),
// ] )
];
},
),
);
return pdf.save();
} Output: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello
I am using flutter pdf on Windows 11.
Describe the bug
Table data with more than 10 records shows blank pdf.
I need to split large table data into multiple pages.
To Reproduce - Please see code below:
Expected behavior
I should see table split into multiple pages.
Screenshots
None
Flutter Doctor
N/A
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: