how can i convert a flutter screen to pdf?

You can capture the screen using this package screenshot

then add that image to pdf document and save it

import 'dart:io';
import 'dart:typed_data';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart ' as pw;

Future getPdf(Uint8List screenShot) async {
  pw.Document pdf = pw.Document();
      pageFormat: PdfPageFormat.a4,
      build: (context) {
        return pw.Expanded(
          child: pw.Image(PdfImage.file(pdf.document, bytes: screenShot), fit: pw.BoxFit.contain)
  File pdfFile = File('Your path + File name');

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top