我正在尝试将屏幕截图图像转换为 pdf 然后保存...但卡在转换步骤
Future getPdf(Uint8List screenShot) async {
pw.Document pdf = pw.Document();
pdf.addPage(
pw.Page(
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');
pdfFile.writeAsBytesSync(pdf.save());
}
}