0

I am trying to print a document in flutter but getting the issue, ' Exception: This widget created more than 20 pages. This may be an issue in the widget or the document.'

Any solutions for that??

` pdf.addPage(pw.MultiPage(

      // maxPages: 100,
      pageFormat: PdfPageFormat.a4,
      build: (pw.Context context) {
        return <pw.Widget>[
        
          pw.Divider(height: 10, thickness: 3),
          pw.SizedBox(
            height: 20,
          ),
          pw.Text(
            'FYP Proposal',
            textAlign: pw.TextAlign.center,
            style: pw.TextStyle(
              fontSize: 20,
              font: font_bold,
            ),
          ),
          pw.SizedBox(height: 20),
          pw.Text(
            topic,
            textAlign: pw.TextAlign.center,
            style: pw.TextStyle(
              fontSize: 18,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 10,
          ),
          pw.Text(
            'A- Basic Information',
            textAlign: pw.TextAlign.center,
            style: pw.TextStyle(
              fontSize: 20,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 20,
          ),
         
                  
          pw.SizedBox(height: 20),
          pw.Text(
            'B- Detail of FYP Idea',
            textAlign: pw.TextAlign.center,
            style: pw.TextStyle(
              fontSize: 18,
              font: font_bold,
            ),
          ),
          pw.SizedBox(height: 20),
          pw.Text(
            'PROBLEM STATEMENT',
            textAlign: pw.TextAlign.center,
            style: pw.TextStyle(
              fontSize: 13,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['problem-statement'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'OBJECTIVES',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['objectives'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'PROBLEM BACKGROUND',
            style: pw.TextStyle(fontSize: 14, font: font_bold),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['problem-background'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'PROPOSED SOLUTION',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['proposed-solution'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'PROPOSED TOOLS',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['proposed-tools'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'RELATED TECHNOLOGIES',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['related-technologies'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'PROJECT RATIONALE',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['project-rationale'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          ),
          pw.SizedBox(
            height: 15,
          ),
          pw.Text(
            'PROPOSED METHODOLOGY',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
       
            pw.Text(
              snap['proposed-methodology'],
              style: pw.TextStyle(
                fontSize: 13,
                font: font,
              ),
            ),
         
//  pw.Imag

//                         child: image : NetworkImage('https://upload.wikimedia.org/wikipedia/en/e/e4/National_Textile_University_Logo.png'),
//                             width: 350,
//                             height: 200,),
          //         // ),
          // ImageNetwork(
          //         image: snap['proposed-methodology-url'], height: 300, width: 200),
          pw.SizedBox(
            height: 15,
          ),

          pw.Text(
            'GANTT CHART',
            style: pw.TextStyle(
              fontSize: 14,
              font: font_bold,
            ),
          ),
          pw.SizedBox(
            height: 8,
          ),
          pw.Text(
            snap['schedule'],
            style: pw.TextStyle(
              fontSize: 13,
              font: font,
            ),
          )
        ];

        //     ),
        //   )
        // ]; // Center
      }));`

I am trying to print a document in flutter but getting the issue, ' Exception: This widget created more than 20 pages. This may be an issue in the widget or the document.

0 Answers0