diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c2487c..5059753f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Newest Release +### 2.9.1 - 12 Apr 2024 + +- Adds the ability to import and export annotations from XFDF files. (J#HYB-293) +- Updates for PSPDFKit 2024.2.1 for Android. +- Fixes issue where password input UI for password-protected documents wasn't shown on Android. (J#HYB-285) + +## Previous Releases + ### 2.9.0 - 22 Mar 2024 - Adds new getConfiguration method to retrieve current PSPDFKitView configuration options. (J#HYB-192) @@ -14,8 +22,6 @@ - Fixes signatureSavingStrategy configuration option to save signature if enabled. (J#HYB-210) - Fixes `spreadFitting` configuration option behaviour on iOS. (J#HYB-222) -## Previous Releases - ### 2.8.1 - 27 Feb 2024 - Updates for PSPDFKit 13.3.1 for iOS. (#43565) diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 00000000..16754904 --- /dev/null +++ b/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=../../../android +eclipse.preferences.version=1 diff --git a/android/build.gradle b/android/build.gradle index dca47b98..f57a5014 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -15,7 +15,7 @@ * Contains gradle configuration constants */ ext { - PSPDFKIT_VERSION = '2024.1.2' + PSPDFKIT_VERSION = '2024.2.1' } buildscript { @@ -70,13 +70,7 @@ dependencies { api("com.pspdfkit:pspdfkit:${PSPDFKIT_VERSION}") { exclude group: 'com.google.auto.value', module: 'auto-value' } - - implementation "androidx.compose.material:material:1.5.4" - implementation "androidx.constraintlayout:constraintlayout:2.1.4" - implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1" - implementation "androidx.compose.foundation:foundation:1.5.4" - implementation "androidx.compose.ui:ui:1.5.4" - + implementation "com.facebook.react:react-native:+" implementation 'com.squareup.okhttp3:okhttp:4.9.2' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" diff --git a/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java b/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java index 2c8b9d17..21ed8163 100644 --- a/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java +++ b/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java @@ -267,66 +267,6 @@ public void processAnnotations(@NonNull final String processingMode, }); } - @ReactMethod - public void setMeasurementScale(@Nullable final Scale scale) { - if (resumedActivity instanceof PdfActivity) { - final PdfActivity activity = (PdfActivity) resumedActivity; - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - PdfDocument document = activity.getDocument(); - if (document != null && scale != null) { - document.setMeasurementScale(scale); - } else { - activity.getPdfFragment().addDocumentListener(new SimpleDocumentListener() { - @Override - public void onDocumentLoaded(@NonNull PdfDocument document) { - activity.getPdfFragment().removeDocumentListener(this); - } - }); - } - } - }); - } else { - onPdfActivityOpenedTask = new Runnable() { - @Override - public void run() { - setMeasurementScale(scale); - } - }; - } - } - @ReactMethod - public void setMeasurementPrecision(@Nullable final MeasurementPrecision floatPrecision) { - if (resumedActivity instanceof PdfActivity) { - final PdfActivity activity = (PdfActivity) resumedActivity; - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - PdfDocument document = activity.getDocument(); - MeasurementPrecision precision = floatPrecision; - if (document != null && precision != null) { - document.setMeasurementPrecision(precision); - } else { - activity.getPdfFragment().addDocumentListener(new SimpleDocumentListener() { - @Override - public void onDocumentLoaded(@NonNull PdfDocument document) { - activity.getPdfFragment().removeDocumentListener(this); - } - }); - } - } - }); - } else { - onPdfActivityOpenedTask = new Runnable() { - @Override - public void run() { - setMeasurementPrecision(floatPrecision); - } - }; - } - } - private static PdfProcessorTask.AnnotationProcessingMode getProcessingModeFromString(@NonNull final String mode) { if ("print".equalsIgnoreCase(mode)) { return PdfProcessorTask.AnnotationProcessingMode.PRINT; diff --git a/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java b/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java index 5e4272f5..86aa4939 100644 --- a/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java +++ b/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java @@ -71,6 +71,8 @@ public class ReactPdfViewManager extends ViewGroupManager { public static final int COMMAND_SET_TOOLBAR = 19; public static final int COMMAND_SET_MEASUREMENT_VALUE_CONFIGURATIONS = 21; public static final int COMMAND_GET_MEASUREMENT_VALUE_CONFIGURATIONS = 22; + public static final int COMMAND_IMPORT_XFDF = 23; + public static final int COMMAND_EXPORT_XFDF = 24; private final CompositeDisposable annotationDisposables = new CompositeDisposable(); @@ -123,6 +125,8 @@ public Map getCommandsMap() { commandMap.put("getMeasurementValueConfigurations", COMMAND_GET_MEASUREMENT_VALUE_CONFIGURATIONS); commandMap.put("getConfiguration", COMMAND_GET_CONFIGURATION); commandMap.put("setToolbar", COMMAND_SET_TOOLBAR); + commandMap.put("importXFDF", COMMAND_IMPORT_XFDF); + commandMap.put("exportXFDF", COMMAND_EXPORT_XFDF); return commandMap; } @@ -421,6 +425,18 @@ public void accept(List annotations) { setToolbar(root,args.getMap(0)); } break; + case COMMAND_IMPORT_XFDF: + if (args != null && args.size() == 2) { + final int requestId = args.getInt(0); + root.importXFDF(requestId, args.getString(1)); + } + break; + case COMMAND_EXPORT_XFDF: + if (args != null && args.size() == 2) { + final int requestId = args.getInt(0); + root.exportXFDF(requestId, args.getString(1)); + } + break; } } diff --git a/android/src/main/java/com/pspdfkit/views/PdfView.java b/android/src/main/java/com/pspdfkit/views/PdfView.java index 31093c15..23c7c85f 100644 --- a/android/src/main/java/com/pspdfkit/views/PdfView.java +++ b/android/src/main/java/com/pspdfkit/views/PdfView.java @@ -38,6 +38,7 @@ import com.facebook.react.uimanager.events.EventDispatcher; import com.pspdfkit.PSPDFKit; import com.pspdfkit.annotations.Annotation; +import com.pspdfkit.annotations.AnnotationProvider; import com.pspdfkit.annotations.AnnotationType; import com.pspdfkit.annotations.configuration.AnnotationConfiguration; import com.pspdfkit.annotations.configuration.FreeTextAnnotationConfiguration; @@ -49,10 +50,14 @@ import com.pspdfkit.document.PdfDocument; import com.pspdfkit.document.PdfDocumentLoader; import com.pspdfkit.document.formatters.DocumentJsonFormatter; +import com.pspdfkit.document.formatters.XfdfFormatter; +import com.pspdfkit.document.providers.ContentResolverDataProvider; import com.pspdfkit.document.providers.DataProvider; +import com.pspdfkit.exceptions.InvalidPasswordException; import com.pspdfkit.forms.ChoiceFormElement; import com.pspdfkit.forms.ComboBoxFormElement; import com.pspdfkit.forms.EditableButtonFormElement; +import com.pspdfkit.forms.FormField; import com.pspdfkit.forms.TextFormElement; import com.pspdfkit.listeners.OnVisibilityChangedListener; import com.pspdfkit.listeners.SimpleDocumentListener; @@ -90,6 +95,8 @@ import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileNotFoundException; +import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -226,7 +233,7 @@ public void inject(FragmentManager fragmentManager, EventDispatcher eventDispatc public void setFragmentTag(String fragmentTag) { this.fragmentTag = fragmentTag; - setupFragment(); + setupFragment(false); } public void setInitialConfiguration(PdfActivityConfiguration configuration) { @@ -253,7 +260,7 @@ public void setConfiguration(PdfActivityConfiguration configuration) { removeFragment(false); } this.configuration = configuration; - setupFragment(); + setupFragment(false); } public PdfActivityConfiguration getConfiguration() { @@ -271,7 +278,7 @@ public void setCustomToolbarItems(final ArrayList toolbarItems) { public void setAnnotationConfiguration(final Map annotationsConfigurations) { this.annotationsConfigurations = annotationsConfigurations; - setupFragment(); + setupFragment(false); } public void setDocumentPassword(@Nullable String documentPassword) { @@ -307,10 +314,10 @@ public void setDocument(@Nullable String documentPath) { .observeOn(AndroidSchedulers.mainThread()) .subscribe(imageDocument -> { PdfView.this.document = imageDocument.getDocument(); - setupFragment(); + setupFragment(false); }, throwable -> { PdfView.this.document = null; - setupFragment(); + setupFragment(false); eventDispatcher.dispatchEvent(new PdfViewDocumentLoadFailedEvent(getId(), throwable.getMessage())); }); } else { @@ -319,18 +326,21 @@ public void setDocument(@Nullable String documentPath) { .observeOn(AndroidSchedulers.mainThread()) .subscribe(pdfDocument -> { PdfView.this.document = pdfDocument; - setupFragment(); + setupFragment(false); }, throwable -> { - PdfView.this.document = null; - setupFragment(); - eventDispatcher.dispatchEvent(new PdfViewDocumentLoadFailedEvent(getId(), throwable.getMessage())); + // The Android SDK will present password UI, do not emit an error. + if (!(throwable instanceof InvalidPasswordException)) { + PdfView.this.document = null; + eventDispatcher.dispatchEvent(new PdfViewDocumentLoadFailedEvent(getId(), throwable.getMessage())); + } + setupFragment(true); }); } } public void setPageIndex(int pageIndex) { this.pageIndex = pageIndex; - setupFragment(); + setupFragment(false); } public void setDisableDefaultActionForTappedAnnotations(boolean disableDefaultActionForTappedAnnotations) { @@ -440,8 +450,8 @@ public void setHideDefaultToolbar(boolean hideDefaultToolbar) { })); } - private void setupFragment() { - if (fragmentTag != null && configuration != null && document != null) { + private void setupFragment(boolean recreate) { + if (fragmentTag != null && configuration != null && (document != null || recreate == true)) { PdfUiFragment pdfFragment = (PdfUiFragment) fragmentManager.findFragmentByTag(fragmentTag); if (pdfFragment != null && (pdfFragment.getArguments() == null || @@ -454,10 +464,16 @@ private void setupFragment() { } if (pdfFragment == null) { - pdfFragment = PdfUiFragmentBuilder.fromDocumentDescriptor(getContext(), DocumentDescriptor.fromDocument(document)) + if (recreate == true) { + pdfFragment = PdfUiFragmentBuilder.fromUri(getContext(), Uri.parse(documentPath)).fragmentClass(ReactPdfUiFragment.class).build(); + } else if (document != null) { + pdfFragment = PdfUiFragmentBuilder.fromDocumentDescriptor(getContext(), DocumentDescriptor.fromDocument(document)) .configuration(configuration) .fragmentClass(ReactPdfUiFragment.class) .build(); + } else { + return; + } // We put our internal id so we can track if this fragment belongs to us, used to handle orphaned fragments after hot reloads. pdfFragment.getArguments().putInt(ARG_ROOT_ID, internalId); prepareFragment(pdfFragment, true); @@ -710,8 +726,6 @@ public Single> getAllAnnotations(@Nullable final String type) { .toList(); } - - public Disposable addAnnotation(final int requestId, ReadableMap annotation) { return getCurrentPdfFragment().map(PdfFragment::getDocument).subscribeOn(Schedulers.io()) .map(pdfDocument -> { @@ -881,6 +895,65 @@ public Maybe setFormFieldValue(@NonNull String formElementName, @NonNul }); } + public Disposable importXFDF(final int requestId, String filePath) { + + if (Uri.parse(filePath).getScheme() == null) { + filePath = FILE_SCHEME + filePath; + } + if (fragment == null || fragment.getDocument() == null) { + return null; + } + + return XfdfFormatter.parseXfdfAsync(fragment.getDocument(), new ContentResolverDataProvider(Uri.parse(filePath))) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(annotations -> { + for (Annotation annotation : annotations) { + fragment.getDocument().getAnnotationProvider().addAnnotationToPage(annotation); + } + JSONObject result = new JSONObject(); + result.put("success", true); + eventDispatcher.dispatchEvent(new PdfViewDataReturnedEvent(getId(), requestId, result)); + }, throwable -> { + eventDispatcher.dispatchEvent(new PdfViewDataReturnedEvent(getId(), requestId, throwable)); + }); + } + + public Disposable exportXFDF(final int requestId, String filePath) { + + if (Uri.parse(filePath).getScheme() == null) { + filePath = FILE_SCHEME + filePath; + } + if (fragment == null || fragment.getDocument() == null) { + return null; + } + + try { + final OutputStream outputStream = getContext().getContentResolver().openOutputStream(Uri.parse(filePath)); + if (outputStream == null) return null; + + List annotations = fragment.getDocument().getAnnotationProvider().getAllAnnotationsOfType(AnnotationProvider.ALL_ANNOTATION_TYPES); + List formFields = fragment.getDocument().getFormProvider().getFormFields(); + + String finalFilePath = filePath; + return XfdfFormatter.writeXfdfAsync(fragment.getDocument(), annotations, formFields, outputStream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(() -> { + JSONObject result = new JSONObject(); + result.put("success", true); + result.put("filePath", finalFilePath); + eventDispatcher.dispatchEvent(new PdfViewDataReturnedEvent(getId(), requestId, result)); + }, throwable -> { + eventDispatcher.dispatchEvent(new PdfViewDataReturnedEvent(getId(), requestId, throwable)); + } + ); + } catch (final FileNotFoundException ignored) { + eventDispatcher.dispatchEvent(new PdfViewDataReturnedEvent(getId(), requestId, ignored)); + } + return null; + } + public JSONObject convertConfiguration() { try { JSONObject config = new JSONObject(); diff --git a/index.js b/index.js index f11d1068..8d196f99 100644 --- a/index.js +++ b/index.js @@ -503,6 +503,78 @@ class PSPDFKitView extends React.Component { } }; + /** + * Imports the supplied XFDF file into the current document. + * + * @method importXFDF + * @memberof PSPDFKitView + * @param { string } filePath The path to the XFDF file to import. + * @example + * const result = await this.pdfRef.current.importXFDF('path/to/XFDF.xfdf'); + * + * @returns { Promise } A promise containing an object with the result. ```true``` if the xfdf file was imported successfully, and ```false``` if an error occurred. + */ + importXFDF = function (filePath) { + if (Platform.OS === 'android') { + let requestId = this._nextRequestId++; + let requestMap = this._requestMap; + + // We create a promise here that will be resolved once onDataReturned is called. + let promise = new Promise(function (resolve, reject) { + requestMap[requestId] = { resolve: resolve, reject: reject }; + }); + + UIManager.dispatchViewManagerCommand( + findNodeHandle(this.refs.pdfView), + this._getViewManagerConfig('RCTPSPDFKitView').Commands.importXFDF, + [requestId, filePath], + ); + + return promise; + } else if (Platform.OS === 'ios') { + return NativeModules.PSPDFKitViewManager.importXFDF( + filePath, + findNodeHandle(this.refs.pdfView), + ); + } + }; + + /** + * Exports the annotations from the current document to a XFDF file. + * + * @method exportXFDF + * @memberof PSPDFKitView + * @param { string } filePath The path where the XFDF file should be exported to. + * @example + * const result = await this.pdfRef.current.exportXFDF('path/to/XFDF.xfdf'); + * + * @returns { Promise } A promise containing an object with the exported file path and result. ```true``` if the xfdf file was exported successfully, and ```false``` if an error occurred. + */ + exportXFDF = function (filePath) { + if (Platform.OS === 'android') { + let requestId = this._nextRequestId++; + let requestMap = this._requestMap; + + // We create a promise here that will be resolved once onDataReturned is called. + let promise = new Promise(function (resolve, reject) { + requestMap[requestId] = { resolve: resolve, reject: reject }; + }); + + UIManager.dispatchViewManagerCommand( + findNodeHandle(this.refs.pdfView), + this._getViewManagerConfig('RCTPSPDFKitView').Commands.exportXFDF, + [requestId, filePath], + ); + + return promise; + } else if (Platform.OS === 'ios') { + return NativeModules.PSPDFKitViewManager.exportXFDF( + filePath, + findNodeHandle(this.refs.pdfView), + ); + } + }; + /** * @typedef FormFieldResult * @property { string } [formElement] The form field value @@ -756,7 +828,7 @@ class PSPDFKitView extends React.Component { * * @method setMeasurementValueConfigurations * @memberof PSPDFKitView - * @param { MeasurementValueConfiguration[] } configurations The array of MeasurementValueConfiguration objects that should be applied to the document. + * @param { MeasurementValueConfiguration[] } configurations The array of ```MeasurementValueConfiguration``` objects that should be applied to the document. * @example * const scale: MeasurementScale = { * unitFrom: Measurements.ScaleUnitFrom.INCH, diff --git a/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.h b/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.h index f53465a5..8b686952 100644 --- a/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.h +++ b/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.h @@ -14,5 +14,6 @@ @interface RCTConvert (PSPDFDocument) + (PSPDFDocument *)PSPDFDocument:(NSString *)string; ++ (NSURL*)parseURL:(NSString*)urlString; @end diff --git a/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.m b/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.m index e6657af9..dca26051 100644 --- a/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.m +++ b/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.m @@ -25,7 +25,7 @@ + (PSPDFDocument *)PSPDFDocument: (NSString *)urlString { return [[PSPDFDocument alloc] initWithURL: url]; } -+ (NSURL*) parseURL: (NSString*) urlString { ++ (NSURL*)parseURL:(NSString*)urlString { NSURL* url; if ([urlString hasPrefix: @"/"] || [urlString containsString: @"file:/"]) { diff --git a/ios/RCTPSPDFKit/RCTPSPDFKitView.h b/ios/RCTPSPDFKit/RCTPSPDFKitView.h index 7c4e3c41..73e734dd 100644 --- a/ios/RCTPSPDFKit/RCTPSPDFKitView.h +++ b/ios/RCTPSPDFKit/RCTPSPDFKitView.h @@ -56,12 +56,16 @@ NS_ASSUME_NONNULL_BEGIN - (NSDictionary *)getFormFieldValue:(NSString *)fullyQualifiedName; - (BOOL)setFormFieldValue:(NSString *)value fullyQualifiedName:(NSString *)fullyQualifiedName; -// Toolbar buttons customizations +/// Toolbar buttons customizations - (void)setLeftBarButtonItems:(nullable NSArray *)items forViewMode:(nullable NSString *) viewMode animated:(BOOL)animated; - (void)setRightBarButtonItems:(nullable NSArray *)items forViewMode:(nullable NSString *) viewMode animated:(BOOL)animated; - (NSArray *)getLeftBarButtonItemsForViewMode:(NSString *)viewMode; - (NSArray *)getRightBarButtonItemsForViewMode:(NSString *)viewMode; +/// XFDF +- (NSDictionary *)importXFDF:(NSString *)filePath withError:(NSError *_Nullable *)error; +- (NSDictionary *)exportXFDF:(NSString *)filePath withError:(NSError *_Nullable *)error; + @end NS_ASSUME_NONNULL_END diff --git a/ios/RCTPSPDFKit/RCTPSPDFKitView.m b/ios/RCTPSPDFKit/RCTPSPDFKitView.m index 9b11d918..146dfb98 100644 --- a/ios/RCTPSPDFKit/RCTPSPDFKitView.m +++ b/ios/RCTPSPDFKit/RCTPSPDFKitView.m @@ -12,6 +12,7 @@ #import "RCTConvert+PSPDFAnnotation.h" #import "RCTConvert+PSPDFViewMode.h" #import "RCTConvert+UIBarButtonItem.h" +#import "RCTConvert+PSPDFDocument.h" #define VALIDATE_DOCUMENT(document, ...) { if (!document.isValid) { NSLog(@"Document is invalid."); if (self.onDocumentLoadFailed) { self.onDocumentLoadFailed(@{@"error": @"Document is invalid."}); } return __VA_ARGS__; }} @@ -300,6 +301,43 @@ - (BOOL)addAnnotations:(id)jsonAnnotations error:(NSError *_Nullable *)error { [self.pdfController reloadData]; return success; } +// MARK: - XFDF + +- (NSDictionary *)importXFDF:(NSString *)filePath withError:(NSError *_Nullable *)error { + + NSURL *externalAnnotationsFile = [RCTConvert parseURL:filePath]; + PSPDFDocument *document = self.pdfController.document; + VALIDATE_DOCUMENT(document, nil) + + PSPDFDocumentProvider *documentProvider = document.documentProviders.firstObject; + PSPDFFileDataProvider *dataProvider = [[PSPDFFileDataProvider alloc] initWithFileURL:externalAnnotationsFile]; + + PSPDFXFDFParser *parser = [[PSPDFXFDFParser alloc] initWithDataProvider:dataProvider documentProvider:documentProvider]; + NSArray *annotations = [parser parseWithError:error]; + + BOOL result = [document addAnnotations:annotations options:nil]; + NSDictionary *response = @{@"success" : @(result)}; + return response; +} + +- (NSDictionary *)exportXFDF:(NSString *)filePath withError:(NSError *_Nullable *)error { + + NSURL *externalAnnotationsFile = [RCTConvert parseURL:filePath]; + PSPDFDocument *document = self.pdfController.document; + VALIDATE_DOCUMENT(document, nil) + + PSPDFDocumentProvider *documentProvider = document.documentProviders.firstObject; + + NSMutableArray *annotations = [NSMutableArray array]; + for (NSArray *pageAnnotations in [document allAnnotationsOfType:PSPDFAnnotationTypeAll].allValues) { + [annotations addObjectsFromArray:pageAnnotations]; + } + + PSPDFFileDataSink *dataSink = [[PSPDFFileDataSink alloc] initWithFileURL:externalAnnotationsFile options:PSPDFDataSinkOptionNone error:error]; + BOOL result = [[PSPDFXFDFWriter new] writeAnnotations:annotations toDataSink:dataSink documentProvider:documentProvider error:error]; + NSDictionary *response = @{@"success" : @(result), @"filePath" : filePath}; + return response; +} // MARK: - Forms diff --git a/ios/RCTPSPDFKit/RCTPSPDFKitViewManager.m b/ios/RCTPSPDFKit/RCTPSPDFKitViewManager.m index 08a3400d..057c277b 100644 --- a/ios/RCTPSPDFKit/RCTPSPDFKitViewManager.m +++ b/ios/RCTPSPDFKit/RCTPSPDFKitViewManager.m @@ -384,6 +384,32 @@ - (void)postProcessConfigurationOptionsWithJSON:(id)json forPDFViewController:(P }); } +RCT_EXPORT_METHOD(importXFDF:(id)filePath reactTag:(nonnull NSNumber *)reactTag resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { + dispatch_async(dispatch_get_main_queue(), ^{ + RCTPSPDFKitView *component = (RCTPSPDFKitView *)[self.bridge.uiManager viewForReactTag:reactTag]; + NSError *error; + NSDictionary *result = [component importXFDF:filePath withError:&error]; + if (result) { + resolve(result); + } else { + reject(@"error", @"Failed to import XFDF.", error); + } + }); +} + +RCT_EXPORT_METHOD(exportXFDF:(id)filePath reactTag:(nonnull NSNumber *)reactTag resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { + dispatch_async(dispatch_get_main_queue(), ^{ + RCTPSPDFKitView *component = (RCTPSPDFKitView *)[self.bridge.uiManager viewForReactTag:reactTag]; + NSError *error; + NSDictionary *result = [component exportXFDF:filePath withError:&error]; + if (result) { + resolve(result); + } else { + reject(@"error", @"Failed to export XFDF.", error); + } + }); +} + RCT_EXPORT_METHOD(getFormFieldValue:(NSString *)fullyQualifiedName reactTag:(nonnull NSNumber *)reactTag resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { dispatch_async(dispatch_get_main_queue(), ^{ RCTPSPDFKitView *component = (RCTPSPDFKitView *)[self.bridge.uiManager viewForReactTag:reactTag]; diff --git a/package.json b/package.json index 2bc28961..e261c303 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-pspdfkit", - "version": "2.9.0", + "version": "2.9.1", "description": "React Native PDF Library by PSPDFKit", "keywords": [ "react native", diff --git a/samples/Catalog/.tool-versions b/samples/Catalog/.tool-versions index f6efb75c..a40c147f 100644 --- a/samples/Catalog/.tool-versions +++ b/samples/Catalog/.tool-versions @@ -1 +1,2 @@ nodejs 18.17.1 +onchange diff --git a/samples/Catalog/Catalog.tsx b/samples/Catalog/Catalog.tsx index 2ed5a803..181456a3 100644 --- a/samples/Catalog/Catalog.tsx +++ b/samples/Catalog/Catalog.tsx @@ -32,6 +32,7 @@ import { StateChange } from './examples/StateChange'; import { ToolbarCustomization } from './examples/ToolbarCustomization'; import { GetConfiguration } from './examples/GetConfiguration'; import { PasswordProtectedDocument } from './examples/PasswordProtectedDocument'; +import { XFDF } from './examples/XFDF'; import { PSPDFKit } from './helpers/PSPDFKit'; // By default, this example doesn't set a license key, but instead runs in trial mode (which is the default, @@ -105,6 +106,7 @@ class Catalog extends React.Component { /> + ); diff --git a/samples/Catalog/ExamplesNavigationMenu.tsx b/samples/Catalog/ExamplesNavigationMenu.tsx index a8c6f317..a52beab2 100644 --- a/samples/Catalog/ExamplesNavigationMenu.tsx +++ b/samples/Catalog/ExamplesNavigationMenu.tsx @@ -4,6 +4,8 @@ import { exampleDocumentName, exampleDocumentPath, exampleImagePath, + exampleReportName, + exampleXFDFName, tiffImagePath, } from './configuration/Constants'; import exampleDocumentConfiguration, { @@ -245,6 +247,19 @@ export default [ }); }, }, + { + key: 'item23', + name: 'XFDF Import and Export', + description: 'Import and export annotations from XFDF files', + action: (component: any) => { + extractFromAssetsIfMissing(exampleXFDFName, function () { + component.props.navigation.push('XFDF', { + title: 'XFDF Import and Export', + }); + }); + }, + + }, ]; const generatePDFMenu = [ diff --git a/samples/Catalog/configuration/Constants.ts b/samples/Catalog/configuration/Constants.ts index 155086f1..efe068e3 100644 --- a/samples/Catalog/configuration/Constants.ts +++ b/samples/Catalog/configuration/Constants.ts @@ -7,6 +7,8 @@ export const formDocumentName = 'Form_example.pdf'; const measurementsName = 'Measurements.pdf'; export const exampleDocumentName = 'PSPDFKit_Quickstart_Guide.pdf'; export const examplePasswordDocumentName = 'PSPDFKit_Quickstart_Guide_Password.pdf'; +export const exampleReportName = 'JKHF-AnnualReport.pdf'; +export const exampleXFDFName = 'XFDFTest.xfdf'; export const exampleImage = 'PSPDFKit_Image_Example.jpg'; export const exampleImagePath = @@ -30,6 +32,16 @@ export const examplePasswordDocumentPath = ? 'PDFs/' + examplePasswordDocumentName : 'file:///android_asset/' + examplePasswordDocumentName; +export const exampleReportPath = + Platform.OS === 'ios' + ? 'PDFs/' + exampleReportName + : 'file:///android_asset/' + exampleReportName; + +export const exampleXFDFPath = + Platform.OS === 'ios' + ? 'PDFs/' + exampleXFDFName + : 'file:///android_asset/' + exampleXFDFName; + export const tiffImagePath = Platform.OS === 'ios' ? 'PDFs/' + tiffImageName @@ -51,3 +63,8 @@ export const writableFormDocumentPath = Platform.OS === 'ios' ? fileSystem.DocumentDirectoryPath + '/' + formDocumentName : 'file://' + fileSystem.DocumentDirectoryPath + '/' + formDocumentName; + +export const writableXFDFPath = + Platform.OS === 'ios' + ? fileSystem.DocumentDirectoryPath + '/' + exampleXFDFName + : 'file://' + fileSystem.DocumentDirectoryPath + '/' + exampleXFDFName; diff --git a/samples/Catalog/examples/XFDF.tsx b/samples/Catalog/examples/XFDF.tsx new file mode 100644 index 00000000..1618a0a9 --- /dev/null +++ b/samples/Catalog/examples/XFDF.tsx @@ -0,0 +1,89 @@ +import React from 'react'; +import { Alert, Button, Platform, processColor, SafeAreaView, Text, TouchableOpacity, View } from 'react-native'; +import PSPDFKitView from 'react-native-pspdfkit'; + +import { pspdfkitColor, exampleReportPath, writableXFDFPath } from '../configuration/Constants'; +import { BaseExampleAutoHidingHeaderComponent } from '../helpers/BaseExampleAutoHidingHeaderComponent'; +import { hideToolbar } from '../helpers/NavigationHelper'; +import { getOutputPath } from '../helpers/FileHelper'; +import RNFS from 'react-native-fs'; + +export class XFDF extends BaseExampleAutoHidingHeaderComponent { + pdfRef: React.RefObject; + + constructor(props: any) { + super(props); + const { navigation } = this.props; + this.pdfRef = React.createRef(); + hideToolbar(navigation); + } + + override render() { + const { navigation } = this.props; + + return ( + + navigation.goBack()} + style={styles.pdfColor} + /> + + + + + { + const result = await this.pdfRef.current?.importXFDF(writableXFDFPath); + Alert.alert('PSPDFKit', 'Import XFDF result: ' + JSON.stringify(result)); + console.log('Import XFDF result:', result); + }}> + {'Import XFDF'} + + { + const outputFile = RNFS.TemporaryDirectoryPath + '/test.xfdf'; + const result = await this.pdfRef.current?.exportXFDF(outputFile); + Alert.alert('PSPDFKit', 'Export XFDF result:' + JSON.stringify(result)); + console.log('Export XFDF result:', result); + }}> + {'Export XFDF'} + + + + + + + ); + } +} + +const styles = { + flex: { flex: 1 }, + pdfColor: { flex: 1, color: pspdfkitColor }, + column: { + flexDirection: 'column' as 'column', + alignItems: 'center' as 'center', + }, + horizontalContainer: { + flexDirection: 'row' as 'row', + minWidth: '70%' as '70%', + height: 50, + justifyContent: 'space-between' as 'space-between', + alignItems: 'center' as 'center', + }, + button: { + padding: 15, + flex: 1, + fontSize: 16, + color: pspdfkitColor, + textAlign: 'center' as 'center', + }, +}; diff --git a/samples/Catalog/ios/Podfile.lock b/samples/Catalog/ios/Podfile.lock index 678e7419..b0e756d3 100644 --- a/samples/Catalog/ios/Podfile.lock +++ b/samples/Catalog/ios/Podfile.lock @@ -948,7 +948,7 @@ PODS: - React-Mapbuffer (0.73.6): - glog - React-debug - - react-native-pspdfkit (2.9.0): + - react-native-pspdfkit (2.9.1): - Instant (= 13.3.3) - PSPDFKit (= 13.3.3) - React @@ -1366,7 +1366,7 @@ SPEC CHECKSUMS: Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 FlipperKit: 37525a5d056ef9b93d1578e04bc3ea1de940094f fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 035f1e36e53b355cf70f6434d161b36e7d21fecd + glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0 Instant: 04c0f0f49669d0125a858d2748cfa00429bcc92e libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 @@ -1393,7 +1393,7 @@ SPEC CHECKSUMS: React-jsinspector: 85583ef014ce53d731a98c66a0e24496f7a83066 React-logger: 3eb80a977f0d9669468ef641a5e1fabbc50a09ec React-Mapbuffer: 84ea43c6c6232049135b1550b8c60b2faac19fab - react-native-pspdfkit: d247c15a37d231ef4e105d4b8e4be3d85c23110e + react-native-pspdfkit: d63089e9b6e7ccc4ce32fed72fa57ab5beb18526 react-native-safe-area: e8230b0017d76c00de6b01e2412dcf86b127c6a3 react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89 React-nativeconfig: b4d4e9901d4cabb57be63053fd2aa6086eb3c85f diff --git a/samples/Catalog/package.json b/samples/Catalog/package.json index ffe6bfa9..fd6b8513 100644 --- a/samples/Catalog/package.json +++ b/samples/Catalog/package.json @@ -1,6 +1,6 @@ { "name": "catalog", - "version": "2.9.0", + "version": "2.9.1", "private": true, "scripts": { "android": "npx react-native run-android", diff --git a/samples/Catalog/yarn.lock b/samples/Catalog/yarn.lock index 7e6b16c0..847275d6 100644 --- a/samples/Catalog/yarn.lock +++ b/samples/Catalog/yarn.lock @@ -7062,7 +7062,7 @@ react-native-gradle-plugin@^0.71.19: integrity sha512-1dVk9NwhoyKHCSxcrM6vY6cxmojeATsBobDicX0ZKr7DgUF2cBQRTKsimQFvzH8XhOVXyH8p4HyDSZNIFI8OlQ== "react-native-pspdfkit@file:../..": - version "2.9.0" + version "2.9.1" react-native-safe-area-context@^4.8.0: version "4.8.2" diff --git a/samples/NativeCatalog/package.json b/samples/NativeCatalog/package.json index a9123410..19497a0b 100644 --- a/samples/NativeCatalog/package.json +++ b/samples/NativeCatalog/package.json @@ -1,6 +1,6 @@ { "name": "native-catalog", - "version": "2.9.0", + "version": "2.9.1", "private": true, "scripts": { "android": "react-native run-android", diff --git a/samples/NativeCatalog/yarn.lock b/samples/NativeCatalog/yarn.lock index 0f3f9ba8..16e62e77 100644 --- a/samples/NativeCatalog/yarn.lock +++ b/samples/NativeCatalog/yarn.lock @@ -6807,7 +6807,7 @@ react-native-gradle-plugin@^0.71.19: integrity sha512-1dVk9NwhoyKHCSxcrM6vY6cxmojeATsBobDicX0ZKr7DgUF2cBQRTKsimQFvzH8XhOVXyH8p4HyDSZNIFI8OlQ== "react-native-pspdfkit@file:../..": - version "2.9.0" + version "2.9.1" react-native-safe-area-context@^4.8.0: version "4.8.0" diff --git a/samples/PDFs/JKHF-AnnualReport.pdf b/samples/PDFs/JKHF-AnnualReport.pdf new file mode 100644 index 00000000..df9add52 Binary files /dev/null and b/samples/PDFs/JKHF-AnnualReport.pdf differ diff --git a/samples/PDFs/XFDFTest.xfdf b/samples/PDFs/XFDFTest.xfdf new file mode 100644 index 00000000..f9a890aa --- /dev/null +++ b/samples/PDFs/XFDFTest.xfdf @@ -0,0 +1,15 @@ + +Hello XFDF World! +

Hello XFDF World!

+/Helvetica_0 55.9007 Tf 1 1 1 rg +font:55.90pt "Helvetica"; color:#FFFFFF; +
+Hello XFDF Mars! +

Hello XFDF Mars!

+/Helvetica_0 37 Tf 1 0.388235 0.278431 rg +font:37.00pt "Helvetica"; color:#FF6347; +
+
+ + +
diff --git a/types/index.d.ts b/types/index.d.ts index b30525d0..72cbae47 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -908,6 +908,30 @@ declare class PSPDFKitView extends React.Component { * @returns { Promise } A promise resolving to ```true``` if the annotations were added successfully, and ```false``` if an error occurred. */ addAnnotations: (annotations: object) => Promise; + /** + * Imports the supplied XFDF file into the current document. + * + * @method importXFDF + * @memberof PSPDFKitView + * @param { string } filePath The path to the XFDF file to import. + * @example + * const result = await this.pdfRef.current.importXFDF('path/to/XFDF.xfdf'); + * + * @returns { Promise } A promise containing an object with the result. ```true``` if the xfdf file was imported successfully, and ```false``` if an error occurred. + */ + importXFDF: (filePath: string) => Promise; + /** + * Exports the annotations from the current document to a XFDF file. + * + * @method exportXFDF + * @memberof PSPDFKitView + * @param { string } filePath The path where the XFDF file should be exported to. + * @example + * const result = await this.pdfRef.current.exportXFDF('path/to/XFDF.xfdf'); + * + * @returns { Promise } A promise containing an object with the exported file path and result. ```true``` if the xfdf file was exported successfully, and ```false``` if an error occurred. + */ + exportXFDF: (filePath: string) => Promise; /** * @typedef FormFieldResult * @property { string } [formElement] The form field value @@ -1059,7 +1083,7 @@ declare class PSPDFKitView extends React.Component { * * @method setMeasurementValueConfigurations * @memberof PSPDFKitView - * @param { MeasurementValueConfiguration[] } configurations The array of MeasurementValueConfiguration objects that should be applied to the document. + * @param { MeasurementValueConfiguration[] } configurations The array of ```MeasurementValueConfiguration``` objects that should be applied to the document. * @example * const scale: MeasurementScale = { * unitFrom: Measurements.ScaleUnitFrom.INCH, diff --git a/types/index.d.ts.map b/types/index.d.ts.map index 4dc79cba..0664ad29 100644 --- a/types/index.d.ts.map +++ b/types/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";AAwwCA;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AACH;IACE;;;;;;;OAOG;IACH,eAJW,MAAM,CAIH;IAEd;;;;;;;;;;OAUG;IACH,sBALY,MAAM,GAAG,IAAI,KACX,QAAQ,OAAO,CAAC,CAII;IAElC;;;;;;;;;;;OAWG;IACH,8BANY,MAAM,GAAG,IAAI,WACb,MAAM,GAAG,IAAI,KACX,QAAQ,OAAO,CAAC,CAIoB;IAElD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,wBAlBY,MAAM,sCAEJ,QAAQ,OAAO,CAAC,CAgBsB;IAEpD;;;;;;;OAOG;IACH,eAJc,QAAQ,OAAO,CAAC,CAIL;IAEzB;;;;;;;;;OASG;IACH,0BANY,MAAM,YACN,OAAO,KACL,QAAQ,OAAO,CAAC,CAImB;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,uCAZY,MAAM,kBACN,MAAM,sBACN,MAAM,yBACN,MAAM,KACJ,QAAQ,OAAO,CAAC,CAazB;IAEL;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,+BApBY,mBAAmB,sCAEjB,QAAQ,OAAO,CAAC,CAkB6B;IAE3D;;;;;OAKG;IACH,wCAFY,MAAM,UAEmC;IAErD;;;;;OAKG;IACH,kDAFY,OAAO,UAE4C;IAE/D;;;OAGG;IACH,sCAAsC;IAEtC;;;OAGG;IACH,4BAAiC;CAClC;A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