Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.1-49 - October 15, 2025
- Performance update for the `importAnnotations()` API on iOS

# 1.0.1-48 - September 25, 2025
- Update Android to v11.8.0

Expand Down
48 changes: 46 additions & 2 deletions ios/Classes/PdftronFlutterPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -1958,8 +1958,9 @@ - (void)importAnnotations:(NSString *)xfdf resultToken:(FlutterResult)flutterRes
PTAnnotationManager * const annotationManager = documentController.toolManager.annotationManager;

NSError *updateError = nil;
const BOOL updateSuccess = [annotationManager updateAnnotationsWithXFDFString:xfdf
error:&updateError];
const BOOL updateSuccess = [self updateAnnotationsWithXFDFString:xfdf
error:&updateError
annotationManager:annotationManager];
if (!updateSuccess) {
if (updateError) {
NSLog(@"Error: There was an error while trying to import annotation command. %@", updateError.localizedDescription);
Expand All @@ -1970,6 +1971,49 @@ - (void)importAnnotations:(NSString *)xfdf resultToken:(FlutterResult)flutterRes
}
}

- (BOOL)updateAnnotationsWithXFDFString:(NSString *)xfdfString
error:(NSError * _Nullable __autoreleasing * _Nullable)error
annotationManager:(PTAnnotationManager *)annotationManager
{
PTPDFViewCtrl * const pdfViewCtrl = annotationManager.pdfViewCtrl;
if (!pdfViewCtrl) {
return NO;
}

[annotationManager willUpdateAnnotationsWithXFDFString:xfdfString];

NSError *writeError = nil;
const BOOL writeSuccess = [pdfViewCtrl DocLock:YES
withBlock:^(PTPDFDoc * _Nullable doc) {

PTFDFDoc * const fdfDoc = [PTFDFDoc CreateFromXFDF:xfdfString];
if (!fdfDoc) {
return;
}

[doc FDFUpdate:fdfDoc];

// Allow non-standard annotation rotations.
PTRefreshOptions * const refreshOptions = [[PTRefreshOptions alloc] init];
[refreshOptions SetUseNonStandardRotation:YES];

[doc RefreshAnnotAppearances:refreshOptions];

[pdfViewCtrl Update:YES];
} error:&writeError];
if (!writeSuccess) {
NSLog(@"Error: %@", writeError);
if (error) {
*error = writeError;
}
return NO;
}

[annotationManager didUpdateAnnotationsWithXFDFString:xfdfString];

return YES;
}

- (void)exportAnnotations:(NSString *)annotationList resultToken:(FlutterResult)flutterResult
{
PTDocumentController *documentController = [self getDocumentController];
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pdftron_flutter
description: A convenience wrapper to build Flutter apps that use the PDFTron mobile SDK for smooth, flexible, and stand-alone document viewing.
version: 1.0.1-48
version: 1.0.1-49
homepage: https://www.apryse.com
repository: https://github.com/ApryseSDK/pdftron-flutter
issue_tracker: https://github.com/ApryseSDK/pdftron-flutter/issues
Expand Down