openPDF static method

Future<bool> openPDF(
  1. String filePath,
  2. String title, {
  3. int initialPage = 1,
  4. List<PDFQuote> existingQuotes = const [],
})

Opens a PDF file from a given file path

filePath The path to the PDF file to open title The title to display in the viewer initialPage Optional parameter to specify which page to open first (defaults to 1) existingQuotes Optional list of quotes to highlight when opening the PDF

Returns a Future that completes with true if the PDF was opened successfully or throws a PlatformException if there was an error.

Implementation

static Future<bool> openPDF(
  String filePath,
  String title, {
  int initialPage = 1,
  List<PDFQuote> existingQuotes = const [],
}) async {
  final Map<String, dynamic> params = {
    'filePath': filePath,
    'title': title,
    'initialPage': initialPage,
    'existingQuotes': existingQuotes.map((q) => q.toMap()).toList(),
  };

  return await _channel.invokeMethod('openPDF', params);
}