Closed mame306 closed 3 years ago
You can do this just by saving a file with the extension .pdf
.
Hi,
SignatureController
allows you to export signature as pdf image by calling toPngBytes()
Quick idea (i have not tested it, there may be errors, but it should point you to right direction):
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
//...
var pngBytes = signatureController.toPngBytes();
final pdf = pw.Document();
final image = pw.MemoryImage(
pngBytes,
);
pdf.addPage(pw.Page(build: (pw.Context context) {
return pw.Center(
child: pw.Image(image),
); // Center
})); // Page
// On Flutter, use the [path_provider](https://pub.dev/packages/path_provider) library:
final output = await getTemporaryDirectory();
final file = File("${output.path}/example.pdf");
await file.writeAsBytes(await pdf.save());
Hi,
I want to export the signature to a pdf file. Is it possible to do that? And how could I implement it?
Thanks for helping me