123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- import 'package:compdfkit_flutter/configuration/cpdf_options.dart';
- import 'package:flutter/services.dart';
- class CPDFDocument {
- late final MethodChannel _channel;
- bool _isValid = false;
- get isValid => _isValid;
- CPDFDocument.withController(int viewId)
- : _channel = MethodChannel('com.compdfkit.flutter.document_$viewId'),
- _isValid = true;
- Future<CPDFDocumentError> open(String filePath, String password) async {
- var errorCode = await _channel.invokeMethod(
- 'open_document', {'filePath': filePath, 'password': password});
- var error = CPDFDocumentError.values[errorCode];
- _isValid = error == CPDFDocumentError.success;
- return error;
- }
-
-
-
-
-
-
- Future<String> getFileName() async {
- return await _channel.invokeMethod('get_file_name');
- }
-
-
-
-
-
-
- Future<bool> isEncrypted() async {
- return await _channel.invokeMethod('is_encrypted');
- }
-
-
-
-
-
-
-
- Future<bool> isImageDoc() async {
- return await _channel.invokeMethod('is_image_doc');
- }
-
-
-
-
-
-
-
-
-
-
- Future<CPDFDocumentPermissions> getPermissions() async {
- int permissionId = await _channel.invokeMethod('get_permissions');
- return CPDFDocumentPermissions.values[permissionId];
- }
-
-
-
-
-
-
- Future<bool> checkOwnerUnlocked() async {
- return await _channel.invokeMethod('check_owner_unlocked');
- }
-
-
-
-
-
-
- Future<bool> checkOwnerPassword(String password) async {
- return await _channel.invokeMethod('check_owner_password',
- {'password': password});
- }
-
-
-
-
-
-
- Future<bool> hasChange() async {
- return await _channel.invokeMethod('has_change');
- }
-
-
-
-
-
-
-
-
-
-
-
-
- Future<bool> importAnnotations(String xfdfFile) async {
- return await _channel.invokeMethod('import_annotations', xfdfFile);
- }
-
-
-
-
-
-
-
-
-
- Future<String> exportAnnotations() async {
- return await _channel.invokeMethod('export_annotations');
- }
-
-
-
-
-
-
- Future<bool> removeAllAnnotations() async {
- return await _channel.invokeMethod('remove_all_annotations');
- }
-
-
-
-
-
-
- Future<int> getPageCount() async {
- return await _channel.invokeMethod('get_page_count');
- }
-
- }
|