buildPDF method

Future<Uint8List> buildPDF(
  1. PdfPageFormat pageFormat,
  2. DocumentOptions options
)

Implementation

Future<Uint8List> buildPDF(PdfPageFormat pageFormat, DocumentOptions options) async {
  final doc = pw.Document(); // Create a PDF document.
  //_bgShape = await rootBundle.loadString('assets/invoice.svg');

  // Add page to the PDF
  doc.addPage(
    pw.MultiPage(
      pageTheme: _buildTheme(
        pageFormat,
        await PdfGoogleFonts.robotoRegular(),
        await PdfGoogleFonts.robotoBold(),
        await PdfGoogleFonts.robotoItalic(),
      ),
      header: (context)=>_buildHeader(context, options),
      footer: (context)=>_buildFooter(context, options),
      build: (context) => [
        _contentHeader(context, options),
        _contentTable(context, options),
        pw.SizedBox(height: 20),
        _contentFooter(context, options),
        /* pw.SizedBox(height: 20),
        _termsAndConditions(context, options), */
      ],
    ),
  );

  return doc.save(); // Return the PDF file content
}