initializePdfRenderer method

  1. @override
Future<String> initializePdfRenderer(
  1. Uint8List documentBytes,
  2. String documentID
)

Initializes the PDF renderer instance in respective platform by loading the PDF from the specified path.

Implementation

@override
Future<String> initializePdfRenderer(
    Uint8List documentBytes, String documentID) async {
  Settings documentData = Settings()..data = documentBytes;
  final documentLoader = PdfJs.getDocument(documentData);
  final PdfJsDoc pdfJsDoc =
      await promiseToFuture<PdfJsDoc>(documentLoader.promise);
  final int pagesCount = pdfJsDoc.numPages;
  _documentRepo[documentID] = pdfJsDoc;
  return pagesCount.toString();
}