forked from PSPDFKit/pspdfkit-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpspdfkit_widget_controller.dart
More file actions
89 lines (69 loc) · 4.01 KB
/
pspdfkit_widget_controller.dart
File metadata and controls
89 lines (69 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
///
/// Copyright © 2018-2024 PSPDFKit GmbH. All rights reserved.
///
/// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
/// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
/// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
/// This notice may not be removed from this file.
///
import 'package:flutter/painting.dart';
import '../../pspdfkit.dart';
/// A controller for a PSPDFKit widget.
abstract class PspdfkitWidgetController {
/// Sets the value of a form field by specifying its fully qualified field name.
Future<bool?> setFormFieldValue(String value, String fullyQualifiedName);
/// Gets the form field value by specifying its fully qualified name.
Future<String?> getFormFieldValue(String fullyQualifiedName);
Future<dynamic> getFormFieldProperties(String fullyQualifiedName);
/// Applies Instant document JSON to the presented document.
Future<bool?> applyInstantJson(String annotationsJson);
/// Exports Instant document JSON from the presented document.
Future<String?> exportInstantJson();
/// Adds the given annotation to the presented document.
/// `jsonAnnotation` can either be a JSON string or a valid JSON Dictionary (iOS) / HashMap (Android).
Future<bool?> addAnnotation(Map<String, dynamic> jsonAnnotation);
/// Removes the given annotation from the presented document.
/// `jsonAnnotation` can either be a JSON string or a valid JSON Dictionary (iOS) / HashMap (Android).
Future<bool?> removeAnnotation(dynamic jsonAnnotation);
/// Returns a list of JSON dictionaries for all the annotations of the given `type` on the given `pageIndex`.
Future<dynamic> getAnnotations(int pageIndex, String type);
/// Returns a list of JSON dictionaries for all the unsaved annotations in the presented document.
Future<dynamic> getAllUnsavedAnnotations();
/// Processes annotations of the given type with the provided processing
/// mode and stores the PDF at the given destination path.
Future<bool?> processAnnotations(
AnnotationType type,
AnnotationProcessingMode processingMode,
String destinationPath,
);
/// Imports annotations from the XFDF file at the given path.
Future<bool?> importXfdf(String xfdfPath);
/// Exports annotations to the XFDF file at the given path.
Future<bool?> exportXfdf(String xfdfPath);
/// Saves the document back to its original location if it has been changed.
/// If there were no changes to the document, the document file will not be modified.
Future<bool?> save();
/// Sets the annotation preset configurations for the given annotation tools.
/// @param configurations A map of annotation tools and their corresponding configurations.
/// @param modifyAssociatedAnnotations Whether to modify the annotations associated with the old configuration. Only used for Android.
/// @return True if the configurations were set successfully, false otherwise.
Future<bool?> setAnnotationConfigurations(
Map<AnnotationTool, AnnotationConfiguration> configurations,
);
/// Sets the annotation preset configurations for the given annotation tools.
/// @param eventName The name of the event to listen to.
void addEventListener(String eventName, Function(dynamic) callback);
/// Gets the visible rect of the given page.
/// pageIndex The index of the page. This is a zero-based index.
/// Returns a [Future] that completes with the visible rect of the given page.
Future<Rect> getVisibleRect(int pageIndex);
/// Zooms to the given rect on the given page.
/// pageIndex The index of the page. This is a zero-based index.
/// rect The rect to zoom to.
/// Returns a [Future] that completes when the zoom operation is done.
Future<void> zoomToRect(int pageIndex, Rect rect);
/// Gets the zoom scale of the given page.
/// pageIndex The index of the page. This is a zero-based index.
/// Returns a [Future] that completes with the zoom scale of the given page.
Future<double> getZoomScale(int pageIndex);
}