I do something different which is exporting the created pdf into png files which takes a heavy toll on the main thread. Do you know if there is a way to compute the below?
if (!isPdf) {
int pageIndex = 1;
await for (var page in Printing.raster(pdf.save(), dpi: 300)) {
final image = await page.toPng();
final String pageQty =
(pagesToPrint > 1) ? '$pageIndex-$pagesToPrint' : '1-1';
file = File("${output.path}/$fileName--$pageQty.png");
await file.writeAsBytes(image);
imageList.add(file);
pageIndex++;
}
} else {
file = File("${output.path}/$fileName.pdf");
await file.writeAsBytes(pdf.save());
imageList.add(file);
}
I do something different which is exporting the created pdf into png files which takes a heavy toll on the main thread. Do you know if there is a way to compute the below?
if (!isPdf) { int pageIndex = 1; await for (var page in Printing.raster(pdf.save(), dpi: 300)) { final image = await page.toPng(); final String pageQty = (pagesToPrint > 1) ? '$pageIndex-$pagesToPrint' : '1-1'; file = File("${output.path}/$fileName--$pageQty.png"); await file.writeAsBytes(image); imageList.add(file); pageIndex++; } } else { file = File("${output.path}/$fileName.pdf"); await file.writeAsBytes(pdf.save()); imageList.add(file); }