CPDFDocument class
A class to handle PDF documents without using CPDFReaderWidget
example:
var document = CPDFDocument();
document.open('pdf file path', 'password');
/// get pdf document info.
var info = await document.getInfo();
/// get pdf document file name.
var fileName = await document.getFileName();
Constructors
- CPDFDocument.withController(int viewId)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isValid → dynamic
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkOwnerPassword(
String password) → Future< bool> - Whether the owner password is correct.
-
checkOwnerUnlocked(
) → Future< bool> - Check if owner permissions are unlocked
-
close(
) → Future< void> -
createWatermark(
CPDFWatermark watermark) → Future< bool> - Create document watermarks, including text watermarks and image watermarks
-
exportAnnotations(
) → Future< String> - Exports annotations from the current PDF document to an XFDF file.
-
exportWidgets(
) → Future< String> - exports the form data from the current PDF document to an XFDF file.
-
flattenAllPages(
String savePath, bool fontSubset) → Future< bool> - Flatten all pages of the current document.
-
getDocumentPath(
) → Future< String> - Get the path of the current document.
-
getEncryptAlgo(
) → Future< CPDFDocumentEncryptAlgo> - Get the encryption algorithm of the current document
-
getFileName(
) → Future< String> - Gets the file name of the PDF document.
-
getPageCount(
) → Future< int> - Get the total number of pages in the current document
-
getPermissions(
) → Future< CPDFDocumentPermissions> - Gets the current document's permissions. There are three types of permissions: No restrictions: CPDFDocumentPermissions.none If the document has an open password and an owner password, using the open password will grant CPDFDocumentPermissions.user permissions, and using the owner password will grant CPDFDocumentPermissions.owner permissions.
-
hasChange(
) → Future< bool> - Check the document for modifications
-
importAnnotations(
String xfdfFile) → Future< bool> - Imports annotations from the specified XFDF file into the current PDF document.
-
importDocument(
{required String filePath, List< int> pages = const [], int insertPosition = -1, String? password}) → Future<bool> - Imports another PDF document and inserts it at a specified position in the current document.
-
importWidgets(
String xfdfFile) → Future< bool> -
Imports the form data from the specified XFDF file into the current PDF document.
xfdfFile
The path or URI of the XFDF file to import. -
insertBlankPage(
{required int pageIndex, CPDFPageSize pageSize = CPDFPageSize.a4}) → Future< bool> - Inserts a blank page at the specified index in the document.
-
isEncrypted(
) → Future< bool> - Checks if the PDF document is encrypted.
-
isImageDoc(
) → Future< bool> - Checks if the PDF document is an image document. This is a time-consuming operation that depends on the document size.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
String filePath, {String password = ''}) → Future< CPDFDocumentError> -
pageAtIndex(
int pageIndex) → CPDFPage -
Get the page object at the specified index.
pageIndex
The index of the page to retrieve. -
printDocument(
) → Future< void> - Invokes the system's print service to print the current document.
-
removeAllAnnotations(
) → Future< bool> - Delete all comments in the current document
-
removeAllWatermarks(
) → Future< void> - remove all watermark
-
removeAnnotation(
CPDFAnnotation annotation) → Future< bool> - Removes an annotation from the current page.
-
removePassword(
) → Future< bool> - Remove the user password and owner permission password set in the document, and perform an incremental save.
-
removeWidget(
CPDFWidget widget) → Future< bool> - Removes a widget from the current page.
-
save(
) → Future< bool> - Save document
-
saveAs(
String savePath, {bool removeSecurity = false, bool fontSubSet = true}) → Future< bool> - Saves the document to the specified directory.
-
setPassword(
{String? userPassword, String? ownerPassword, bool allowsPrinting = true, bool allowsCopying = true, CPDFDocumentEncryptAlgo encryptAlgo = CPDFDocumentEncryptAlgo.rc4}) → Future< bool> - This method sets the document password, including the user password for access restrictions and the owner password for granting permissions.
-
splitDocumentPages(
String savePath, List< int> pages) → Future<bool> - Splits the specified pages from the current document and saves them as a new document.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited