Flutter creat pdf file with different page size and font size Flutter creat pdf file with different page size and font size flutter flutter

Flutter creat pdf file with different page size and font size


I recommend you to update to the latest version pdf: ^1.4. as a lot has changed on how to build a pdf.

  • For the format size I would try PdfPageFormat.undefined or in your case PdfPageFormat(75, double.infinity)

https://github.com/DavBfr/dart_pdf/blob/78232de1f962ea04c7e950d0f737417a35863071/pdf/lib/src/page_format.dart#L49

  • For the multiline with different size I would use the new way of creating a pdf that uses widgets. See the example:

https://github.com/DavBfr/dart_pdf/blob/master/pdf/example/main.dart

As simple as

pdf.addPage(Page(    pageFormat: PdfPageFormat.a4,    build: (Context context) {      return Center(        child: Text('Hello World', style: TextStyle(fontSize: 40)),      ); // Center    })); // Page