PDF page convert into image in flutter

Viewed 82

My requirement is display PiChart in flutter_local_notification for this i try

screenshotController.captureFromWidget(); // but i get error in captureFromWidget()

then i try pdf package

 final pdf = pw.Document();
pdf.addPage(
  pw.Page(
    build: (pw.Context context) => pw.Center(
      child: pw.Text('Hello World!'),
    ),
  ),
);   // but here is no option to draw piechart
final directory = await getApplicationDocumentsDirectory();
File saveFile = File(directory.path + "/notificattion.pdf");
await saveFile.writeAsBytes(pdf.save());

AndroidBitmap androidBitmap = ByteArrayAndroidBitmap.fromBase64String(
    base64.encode(saveFile.readAsBytesSync()));
var bigPicture = BigPictureStyleInformation(
    FilePathAndroidBitmap("images/logo.png"),
    //DrawableResourceAndroidBitmap("@drawable/iconsensenut"),
    largeIcon: FilePathAndroidBitmap(
        directory.path + "/notificattion.pdf"), //androidBitmap,
    // DrawableResourceAndroidBitmap("@drawable/iconsensenut"),
    contentTitle: "${title}",
    summaryText: "${message}",
    htmlFormatContent: true,
    htmlFormatContentTitle: true);
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
    'channel_id', 'channel_name',
    importance: Importance.max,
    priority: Priority.high,
    styleInformation: bigPicture);

and i try convert this pdf into image. but i don't know how it is possible.

and till now i have't any solution.

Thank-you

0 Answers
Related