getImage function

Future<PdfPageImage?> getImage({
  1. required String imagePPath,
})

Implementation

Future<PdfPageImage?> getImage({required String imagePPath}) async {
  print('[PDF Image]');
  final document = await PdfDocument.openAsset(imagePPath);

  final page = await document.getPage(1);

  final image = await page.render(
    width: page.width * 2, //decrement for less quality
    height: page.height * 2,
    format: PdfPageImageFormat.jpeg,
    backgroundColor: '#ffffff',

    // Crop rect in image for render
    //cropRect: Rect.fromLTRB(left, top, right, bottom),
  );

  return image;
}