From c6de697fd0482acf6e742e4dff7d350f6cd9d3c2 Mon Sep 17 00:00:00 2001 From: David Luco Date: Wed, 15 Oct 2025 10:00:46 -0700 Subject: [PATCH 1/5] Use FDFUpdate directly for importing annotations --- ios/Classes/PdftronFlutterPlugin.m | 48 ++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/ios/Classes/PdftronFlutterPlugin.m b/ios/Classes/PdftronFlutterPlugin.m index 4c3d04d6..636cdf3b 100644 --- a/ios/Classes/PdftronFlutterPlugin.m +++ b/ios/Classes/PdftronFlutterPlugin.m @@ -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); @@ -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]; From 7ed018c5c17a15ce038507b483519f69b09d3cb1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:30:53 +0000 Subject: [PATCH 2/5] Updating package version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 866ac706..0a68cabc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 From 762dfca28258c7c0f991eb2246a30062d01645ea Mon Sep 17 00:00:00 2001 From: David Luco Date: Wed, 15 Oct 2025 13:39:17 -0700 Subject: [PATCH 3/5] Add changelog entry. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1db7e1cf..afc8a113 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From 632cc5dd0f1924f358829a117850eb9ae01835df Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:39:39 +0000 Subject: [PATCH 4/5] Updating pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 0a68cabc..866ac706 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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-49 +version: 1.0.1-48 homepage: https://www.apryse.com repository: https://github.com/ApryseSDK/pdftron-flutter issue_tracker: https://github.com/ApryseSDK/pdftron-flutter/issues From b22baa98ecd300ae378564ea3de26e0bda5b6eb2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:40:07 +0000 Subject: [PATCH 5/5] Updating package version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 866ac706..0a68cabc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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