genPdfCoverList method
Implementation
Future<void> genPdfCoverList({
required String outDirPath,
required List<String> pdfPathList,
int iconSize = 300,
}) async {
try {
for (final pdfPath in pdfPathList) {
final name = pdfPath.split('/').last;
final outputPath = '$outDirPath/${name.split('.').first}';
final outImageFile = File(outputPath);
final oldImagePath = '${outImageFile.path}.png';
if (await File(oldImagePath).exists()) {
continue;
}
await Process.run('pdftoppm', [
'-png',
'-f',
'1',
'-singlefile',
pdfPath,
outImageFile.path,
]);
}
} catch (e) {
debugPrint("genPdfCover: ${e.toString()}");
}
}