fromFile static method

Future<PDFDocument> fromFile(
  1. File file
)

Load a PDF File from a given File File file, file to be loaded

Implementation

static Future<PDFDocument> fromFile(File file) async {
  final document = PDFDocument();
  document._filePath = file.path;
  try {
    final pageCount = await _channel
        .invokeMethod('getNumberOfPages', {'filePath': file.path});
    document.count = document.count = int.parse(pageCount as String);
  } catch (e) {
    throw Exception('Error reading PDF!');
  }
  return document;
}