open method

Future<CPDFDocumentError> open(
  1. String filePath, {
  2. String password = '',
})

Implementation

Future<CPDFDocumentError> open(
  String filePath, {
  String password = '',
}) async {
  try {
    var error = await _channel.invokeMethod('open_document', {
      'filePath': filePath,
      'password': password,
    });
    var type = CPDFDocumentError.values.where((e) => e.name == error).first;
    if (type == CPDFDocumentError.success) {
      _isValid = true;
      _isClosed = false;
    }
    return type;
  } on PlatformException {
    return CPDFDocumentError.unknown;
  }
}