Skip to content

Commit a8b5225

Browse files
committed
compdfkit(rn) - v2.4.1
1 parent eab37e4 commit a8b5225

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2650
-9146
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ android/keystores/debug.keystore
7979
lib/
8080
.github/
8181
/example/ios/Podfile.lock
82+
/example/yarn.lock

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ android/keystores/debug.keystore
7878
# generated by bob
7979
lib/
8080
.github/
81+
/example/yarn.lock

API.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,59 @@ const fontSubset = true;
12501250
const result = await pdfReaderRef.current?._pdfDocument.flattenAllPages(savePath, fontSubset);
12511251
```
12521252

1253+
#### getAnnotationMode
1254+
1255+
Get the type of annotation added to the current touch page. This method is only available in `CPDFViewMode.ANNOTATIONS` mode.
1256+
1257+
Returns a Promise.
1258+
1259+
| Name | Type | Description |
1260+
| ------ | ------------------ | ---------------------------------------------------------- |
1261+
| result | CPDFAnnotationType | Returns the annotation type currently selected for drawing |
1262+
1263+
```tsx
1264+
const annotationMode = await pdfReaderRef.current?.getAnnotationMode();
1265+
```
1266+
1267+
#### setAnnotationMode
1268+
1269+
Used to add a specified annotation type when touching the page in annotation mode, This method is only available in `CPDFViewMode.ANNOTATIONS` mode.
1270+
1271+
Parameters:
1272+
1273+
| Name | Type | Description |
1274+
| ---- | ------------------ | ---------------------------------------- |
1275+
| type | CPDFAnnotationType | type The type of annotation mode to set. |
1276+
1277+
Returns a Promise.
1278+
1279+
| Name | Type | Description |
1280+
| ------ | ---- | ----------- |
1281+
| result | void | |
1282+
1283+
```tsx
1284+
await pdfReaderRef.current?.setAnnotationMode(CPDFAnnotationType.HIGHLIGHT);
1285+
```
1286+
1287+
#### History Manager
1288+
1289+
Manages the undo and redo history for PDF annotation actions within a viewer component. including checking if undo/redo actions are available and performing those actions. It also allows registering a listener to monitor changes in the annotation history state.
1290+
1291+
```tsx
1292+
const historyManager = pdfReader._annotationsHistoryManager;
1293+
historyManager.setOnHistoryStateChangedListener((canUndo, canRedo) => {
1294+
// Update UI based on undo/redo availability
1295+
});
1296+
1297+
await historyManager.canUndo();
1298+
1299+
await historyManager.canRedo();
1300+
1301+
await historyManager.undo();
1302+
1303+
await historyManager.redo();
1304+
```
1305+
12531306
### Forms
12541307

12551308
#### importWidgets

CHANGELOG.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
## Newest Release
22

3+
### 2.4.1 - 19 Jun. 2025
4+
5+
1. Added the features support for ComPDFKit PDF SDK for iOS V2.4.1.
6+
2. Added the features support for ComPDFKit PDF SDK for Android V2.4.1.
7+
3. Added API to switch between different annotation types in annotation mode.
8+
4. Added Undo and Redo APIs for annotation actions.
9+
5. Added configuration option to hide the bottom annotation toolbar in annotation mode.
10+
6. Added support for context menu configuration.
11+
7. Added callback for tapping on the PDF page area.
12+
8. Adapted Android platform to support 16KB page sizes.
13+
9. Fixed an issue where some APIs became unresponsive, causing blocking behavior.
14+
10. Fixed an issue where the read-only (`readOnly`) setting had no effect on Android.
15+
11. Fixed a bug where the `page.removeAnnotation()` API could not delete annotations on Android.
16+
12. Fixed an issue where `getReadBackgroundColor()` returned the wrong color on iOS.
17+
18+
## Previous Release
19+
20+
### 2.4.1-beta.1 - 03 Jun. 2025
21+
22+
1. Fixed a build failure caused by incorrect package name `com.compdfkitpdf` generated during auto-linking.
23+
324
### 2.4.0 - 15 May. 2025
425

5-
1. Added the features support for ComPDFKit PDF SDK for iOS V2.4.0.
26+
1. Added the features support for ComPDFKit PDF SDK for iOS V2.4.0.
627
2. Added the features support for ComPDFKit PDF SDK for Android V2.4.0.
728
3. Added configuration options for signature methods in signature form fields on Android.
829
4. Added a document save reminder when exiting the interface on Android.
@@ -21,10 +42,6 @@
2142
17. Fixed jump behavior of `CPDFReaderView.setScale() `scaling method.
2243
18. Fixed a font inconsistency issue during content editing when adding text to already selected text with an existing device font.
2344

24-
25-
26-
## Previous Release
27-
2845
### 2.3.0 - 21 Mar. 2025
2946

3047
1. Added the features support for ComPDFKit PDF SDK for iOS iOS V2.3.0.

CONFIGURATION.md

Lines changed: 237 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ Configure functions for the top toolbar in the PDF view.
138138
| iosLeftBarAvailableActions | Array | Functions available in the left side of the top toolbar for iOS platform.<br />Defaults: `back`, `thumbnail` |
139139
| iosRightBarAvailableActions | Array | Functions available in the right side of the top toolbar for iOS platform.<br />Defaults: `search`, `bota`, `menu` |
140140
| availableMenus | Array | A list of more functions popped up by the `menu` option on the top toolbar. |
141-
| mainToolbarVisible | boolean | 是否显示主界面视图顶部工具栏 |
141+
| mainToolbarVisible | boolean | Whether to display the toolbar at the top of the main interface view. |
142+
| annotationToolbarVisible | boolean | Shows or hides the annotation toolbar that appears at the bottom of the view when in annotation mode. |
142143

143144
##### **Constants**
144145

@@ -802,7 +803,242 @@ This section is used to configure the types of forms enabled in the view's botto
802803
| dark | The UI is displayed in a dark theme. |
803804
| system | Theme follow system settings. |
804805

806+
#### contextMenuConfig
805807

808+
Used to configure the context menu options that pop up when selecting text, annotations, forms, etc. in different modes.
809+
810+
##### global
811+
812+
Used to configure global context menu items that are not tied to a specific mode (such as annotation, editing, or form mode). Currently, only the screenshot context is supported.
813+
814+
**screenshot**
815+
816+
Defines available actions during screenshot mode (e.g., area capture tools).
817+
818+
```json
819+
"contextMenuConfig" : {
820+
"global": {
821+
"screenshot" : [
822+
{ "key": "exit" },
823+
{ "key": "share" }
824+
]
825+
}
826+
}
827+
```
828+
829+
| **Key** | **Description** |
830+
| ------- | --------------------- |
831+
| exit | Exit screenshot mode. |
832+
| share | Share the screenshot. |
833+
834+
> ✅ Note: The order of the items determines how they appear in the menu. If not set, the default menu options will be used.
835+
836+
##### viewMode
837+
838+
Configures context menu options in **View Mode**, which applies to normal reading scenarios. Currently supports the textSelect context when selecting text.
839+
840+
```json
841+
"contextMenuConfig" : {
842+
"viewMode": {
843+
"textSelect": [
844+
{ "key": "copy" }
845+
]
846+
}
847+
}
848+
```
849+
850+
##### annotationMode
851+
852+
Configures context menu options available in **Annotation Mode**, where different types of annotation targets (e.g., text, markup, stamp) show contextual menu actions.
853+
854+
```json
855+
"contextMenuConfig" : {
856+
"annotationMode": {
857+
"textSelect": [
858+
{ "key": "copy" },
859+
{ "key": "highlight" },
860+
{ "key": "underline" },
861+
{ "key": "strikeout" },
862+
{ "key": "squiggly" }
863+
],
864+
"longPressContent": [
865+
{ "key": "paste" },
866+
{ "key": "note" },
867+
{ "key": "textBox" },
868+
{ "key": "stamp" },
869+
{ "key": "image" }
870+
],
871+
"markupContent": [
872+
{ "key": "properties" },
873+
{ "key": "note" },
874+
{ "key": "reply" },
875+
{ "key": "viewReply" },
876+
{ "key": "delete" }
877+
],
878+
"soundContent": [
879+
{ "key": "reply" },
880+
{ "key": "viewReply" },
881+
{ "key": "play" },
882+
{ "key": "record" },
883+
{ "key": "delete" }
884+
],
885+
"inkContent": [
886+
{ "key": "properties" },
887+
{ "key": "note" },
888+
{ "key": "reply" },
889+
{ "key": "viewReply" },
890+
{ "key": "delete" }
891+
],
892+
"shapeContent": [
893+
{ "key": "properties" },
894+
{ "key": "note" },
895+
{ "key": "reply" },
896+
{ "key": "viewReply" },
897+
{ "key": "delete" }
898+
],
899+
"freeTextContent": [
900+
{ "key": "properties" },
901+
{ "key": "edit" },
902+
{ "key": "reply" },
903+
{ "key": "viewReply" },
904+
{ "key": "delete" }
905+
],
906+
"signStampContent": [
907+
{ "key": "signHere" },
908+
{ "key": "delete" },
909+
{ "key": "rotate" }
910+
],
911+
"stampContent": [
912+
{ "key": "note" },
913+
{ "key": "reply" },
914+
{ "key": "viewReply" },
915+
{ "key": "delete" },
916+
{ "key": "rotate" }
917+
],
918+
"linkContent": [
919+
{ "key": "edit" },
920+
{ "key": "delete" }
921+
]
922+
}
923+
}
924+
```
925+
926+
##### contentEditorMode
927+
928+
The context menu in content editing mode handles the context menu options that pop up for different operations such as selecting text, images, and long pressing the page.
929+
930+
```json
931+
"contextMenuConfig" : {
932+
"contentEditorMode": {
933+
"editTextAreaContent" : [
934+
{ "key": "properties" },
935+
{ "key": "edit" },
936+
{ "key": "cut" },
937+
{ "key": "copy" },
938+
{ "key": "delete" }
939+
],
940+
"editSelectTextContent": [
941+
{ "key": "properties" },
942+
{
943+
"key": "opacity",
944+
"subItems": ["25%", "50%", "75%", "100%"]
945+
},
946+
{ "key": "cut" },
947+
{ "key": "copy" },
948+
{ "key": "delete" }
949+
],
950+
"editTextContent": [
951+
{ "key": "select" },
952+
{ "key": "selectAll" },
953+
{ "key": "paste" }
954+
],
955+
"imageAreaContent": [
956+
{ "key": "properties" },
957+
{ "key": "rotateLeft" },
958+
{ "key": "rotateRight" },
959+
{ "key": "replace" },
960+
{ "key": "export" },
961+
{
962+
"key": "opacity",
963+
"subItems": ["25%", "50%", "75%", "100%"]
964+
},
965+
{ "key": "flipHorizontal" },
966+
{ "key": "flipVertical" },
967+
{ "key": "crop" },
968+
{ "key": "delete" },
969+
{ "key": "copy" },
970+
{ "key": "cut" }
971+
],
972+
"imageCropMode": [
973+
{ "key": "done" },
974+
{ "key": "cancel" }
975+
],
976+
"editPathContent": [
977+
{ "key": "delete" }
978+
],
979+
"longPressWithEditTextMode" : [
980+
{ "key" : "addText"},
981+
{ "key" : "paste"},
982+
{ "key" : "keepSourceFormatingPaste"}
983+
],
984+
"longPressWithEditImageMode" : [
985+
{ "key" : "addImages"},
986+
{ "key" : "paste"}
987+
],
988+
"longPressWithAllMode" : [
989+
{ "key" : "paste"},
990+
{ "key" : "keepSourceFormatingPaste"}
991+
],
992+
"searchReplace": [
993+
{ "key": "replace" }
994+
]
995+
}
996+
}
997+
```
998+
999+
##### formMode
1000+
1001+
The context menu configuration in form mode displays different context menu options according to the object the user operates on (such as text field, list, radio button, etc.)
1002+
1003+
```json
1004+
"contextMenuConfig" : {
1005+
"formMode": {
1006+
"textField": [
1007+
{ "key": "properties" },
1008+
{ "key": "delete" }
1009+
],
1010+
"checkBox": [
1011+
{ "key": "properties" },
1012+
{ "key": "delete" }
1013+
],
1014+
"radioButton": [
1015+
{ "key": "properties" },
1016+
{ "key": "delete" }
1017+
],
1018+
"listBox": [
1019+
{ "key": "options" },
1020+
{ "key": "properties" },
1021+
{ "key": "delete" }
1022+
],
1023+
"comboBox": [
1024+
{ "key": "options" },
1025+
{ "key": "properties" },
1026+
{ "key": "delete" }
1027+
],
1028+
"signatureField": [
1029+
{ "key": "startToSign" },
1030+
{ "key": "delete" }
1031+
],
1032+
"pushButton" : [
1033+
{ "key": "options"},
1034+
{ "key": "properties"},
1035+
{ "key": "delete"}
1036+
]
1037+
}
1038+
}
1039+
```
1040+
1041+
##
8061042

8071043
## Json Example
8081044

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ open ios/Podfile
120120
```diff
121121
target 'MyApp' do
122122
# ...
123-
+ pod "ComPDFKit", podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit/2.4.0.podspec'
124-
+ pod "ComPDFKit_Tools", podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit_tools/2.4.0.podspec'
123+
+ pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.1/ComPDFKit.podspec'
124+
+ pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.1/ComPDFKit_Tools.podspec'
125125
# ...
126126
end
127127
```
@@ -131,8 +131,8 @@ end
131131
```diff
132132
target 'MyApp' do
133133
# ...
134-
+ pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.0'
135-
+ pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.0'
134+
+ pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.1'
135+
+ pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.1'
136136
# ...
137137
end
138138
```

0 commit comments

Comments
 (0)