genPdfThumbnail method

Future<void> genPdfThumbnail({
  1. required List<SrcDestType> pathList,
  2. int iconSize = 300,
  3. bool isOverride = false,
})

Implementation

Future<void> genPdfThumbnail({
  required List<SrcDestType> pathList,
  int iconSize = 300,
  bool isOverride = false,
}) async {
  try {
    for (final pdfPath in pathList) {
      final imageFile = File(pdfPath.dest);

      if (isOverride == false && await imageFile.exists()) {
        continue;
      }
      await Process.run('pdftoppm', [
        '-png',
        '-f',
        '1',
        '-singlefile',
        pdfPath.src,
        imageFile.path.replaceAll('.png', ''),
      ]);
    }
  } catch (e) {
    debugPrint("genPdfCover: ${e.toString()}");
  }
}