Skip to content

Commit c955067

Browse files
committed
v2.4.5+1
1 parent 40cf23f commit c955067

File tree

16 files changed

+101
-47
lines changed

16 files changed

+101
-47
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 2.4.5+1
2+
1. Fixed the issue that calling the save() function did not save the text field form being edited.
3+
4+
## 2.4.5
5+
1. Added the features support for ComPDFKit PDF SDK for iOS V2.4.5.
6+
2. Added the features support for ComPDFKit PDF SDK for Android V2.4.5.
7+
3. Fixed the issue where the PDF page was not rendered in some scenarios after calling the save() method.
8+
4. Unified setting of background color of blank area in theme.
9+
5. Added API for setting component background color.
10+
111
## 2.4.4
212
1. Added the features support for ComPDFKit PDF SDK for iOS V2.4.4.
313
2. Added the features support for ComPDFKit PDF SDK for Android V2.4.4.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Alternatively you can update the `AndroidManifest.xml` file to use `FlutterFragm
154154
dependencies:
155155
flutter:
156156
sdk: flutter
157-
+ compdfkit_flutter: ^2.4.4
157+
+ compdfkit_flutter: ^2.4.5+1
158158
```
159159

160160
8. Add the PDF documents you want to display in the project
@@ -200,7 +200,7 @@ cd example
200200
dependencies:
201201
flutter:
202202
sdk: flutter
203-
+ compdfkit_flutter: ^2.4.4
203+
+ compdfkit_flutter: ^2.4.5+1
204204
```
205205

206206
4. Open your project's Podfile in a text editor:
@@ -223,8 +223,8 @@ open ios/Podfile
223223
use_modular_headers!`
224224

225225
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
226-
+ pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.4/ComPDFKit.podspec'
227-
+ pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.4/ComPDFKit_Tools.podspec'
226+
+ pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.5/ComPDFKit.podspec'
227+
+ pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.5/ComPDFKit_Tools.podspec'
228228
end
229229
```
230230

@@ -565,8 +565,8 @@ target 'PDFView_RN' do
565565
# Pods for testing
566566
end
567567

568-
+ pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.3'
569-
+ pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.3'
568+
+ pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.5'
569+
+ pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.5'
570570

571571
# Enables Flipper.
572572
#

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939
compileOnly fileTree(include: ['*.jar','*.aar'], dir: 'libs')
4040

4141
// dependencies compdfkit pdf sdk
42-
api 'com.compdf:compdfkit-tools:2.4.4'
42+
api 'com.compdf:compdfkit-tools:2.4.5'
4343

4444
testImplementation 'junit:junit:4.13.2'
4545
testImplementation 'org.mockito:mockito-core:5.0.0'

android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/constants/CPDFConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public static class ChannelMethod {
176176
public static final String ANNOTATION_CAN_REDO = "annotation_can_redo";
177177
public static final String ANNOTATION_UNDO = "annotation_undo";
178178
public static final String ANNOTATION_REDO = "annotation_redo";
179+
public static final String SET_WIDGET_BACKGROUND_COLOR = "set_widget_background_color";
179180

180181

181182
}

android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFViewCtrlPlugin.java

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.IS_VERTICAL_MODE;
3333
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.RELOAD_PAGES;
3434
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.SET_ANNOTATION_MODE;
35+
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.SET_WIDGET_BACKGROUND_COLOR;
3536
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.SHOW_ADD_WATERMARK_VIEW;
3637
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.SHOW_BOTA_VIEW;
3738
import static com.compdfkit.flutter.compdfkit_flutter.constants.CPDFConstants.ChannelMethod.SHOW_DISPLAY_SETTINGS_VIEW;
@@ -103,9 +104,9 @@ public CPDFViewCtrlPlugin(Context context, BinaryMessenger binaryMessenger, int
103104

104105
public void setDocumentFragment(CPDFDocumentFragment documentFragment) {
105106
this.documentFragment = documentFragment;
106-
this.documentFragment.setInitListener((pdfView)->{
107+
this.documentFragment.setInitListener((pdfView) -> {
107108
documentPlugin.setReaderView(pdfView);
108-
if (methodChannel != null){
109+
if (methodChannel != null) {
109110
methodChannel.invokeMethod("onDocumentIsReady", null);
110111
}
111112
pdfView.addReaderViewCallback(new CPDFIReaderViewCallback() {
@@ -140,8 +141,8 @@ public void onTapMainDocArea() {
140141
Map<String, Object> map = new HashMap<>();
141142
map.put("canUndo", cpdfUndoManager.canUndo());
142143
map.put("canRedo", cpdfUndoManager.canRedo());
143-
if (methodChannel != null){
144-
methodChannel.invokeMethod("onAnnotationHistoryChanged" , map);
144+
if (methodChannel != null) {
145+
methodChannel.invokeMethod("onAnnotationHistoryChanged", map);
145146
}
146147
});
147148

@@ -152,7 +153,7 @@ public void onTapMainDocArea() {
152153
}
153154
});
154155
documentFragment.setFillScreenChangeListener(isFillScreen -> {
155-
if (methodChannel != null){
156+
if (methodChannel != null) {
156157
methodChannel.invokeMethod("onFullScreenChanged", isFillScreen);
157158
}
158159
});
@@ -190,12 +191,33 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
190191
break;
191192
case SET_READ_BACKGROUND_COLOR:
192193
String colorHex = call.argument("color");
194+
String displayMode = call.argument("displayMode");
193195
readerView.setReadBackgroundColor(Color.parseColor(colorHex));
194-
if ("#FFFFFFFF".equals(colorHex)){
195-
pdfView.setBackgroundColor(ContextCompat.getColor(context, com.compdfkit.tools.R.color.tools_pdf_view_ctrl_background_color));
196-
} else {
197-
pdfView.setBackgroundColor(
198-
CViewUtils.getColor(Color.parseColor(colorHex), 190));
196+
switch (displayMode) {
197+
case "light":
198+
pdfView.setBackgroundColor(ContextCompat.getColor(context,
199+
com.compdfkit.tools.R.color.tools_pdf_view_ctrl_background_color));
200+
break;
201+
case "dark":
202+
pdfView.setBackgroundColor(ContextCompat.getColor(context,
203+
com.compdfkit.tools.R.color.tools_pdf_view_ctrl_background_color_dark));
204+
break;
205+
case "sepia":
206+
pdfView.setBackgroundColor(ContextCompat.getColor(context,
207+
com.compdfkit.tools.R.color.tools_pdf_view_ctrl_background_color_sepia));
208+
break;
209+
case "reseda":
210+
pdfView.setBackgroundColor(ContextCompat.getColor(context,
211+
com.compdfkit.tools.R.color.tools_pdf_view_ctrl_background_color_reseda));
212+
break;
213+
}
214+
result.success(null);
215+
break;
216+
case SET_WIDGET_BACKGROUND_COLOR:
217+
String widgetColorHex = (String) call.arguments;
218+
try {
219+
pdfView.setBackgroundColor(Color.parseColor(widgetColorHex));
220+
} catch (Exception e) {
199221
}
200222
result.success(null);
201223
break;
@@ -297,9 +319,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
297319
boolean noZoomPage = call.argument("noZoom");
298320
int page = call.argument("pageIndex");
299321
RectF rectF;
300-
if (noZoomPage){
322+
if (noZoomPage) {
301323
rectF = readerView.getPageNoZoomSize(page);
302-
}else {
324+
} else {
303325
rectF = readerView.getPageSize(page);
304326
}
305327
Map<String, Float> pageSizeMap = new HashMap<>();
@@ -354,8 +376,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
354376
String typeStr = call.arguments();
355377

356378
CAnnotationType type;
357-
try{
358-
switch (typeStr){
379+
try {
380+
switch (typeStr) {
359381
case "note":
360382
type = CAnnotationType.TEXT;
361383
break;
@@ -373,18 +395,18 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
373395
result.success(null);
374396
break;
375397
case GET_ANNOTATION_MODE:
376-
CAnnotationType annotationType = documentFragment.annotationToolbar.toolListAdapter.getCurrentAnnotType();
377-
switch (annotationType){
378-
case TEXT:
379-
result.success("note");
380-
break;
381-
case PIC:
382-
result.success("pictures");
383-
break;
384-
default:
385-
result.success(annotationType.name().toLowerCase());
386-
break;
387-
}
398+
CAnnotationType annotationType = documentFragment.annotationToolbar.toolListAdapter.getCurrentAnnotType();
399+
switch (annotationType) {
400+
case TEXT:
401+
result.success("note");
402+
break;
403+
case PIC:
404+
result.success("pictures");
405+
break;
406+
default:
407+
result.success(annotationType.name().toLowerCase());
408+
break;
409+
}
388410
break;
389411
case ANNOTATION_CAN_UNDO: {
390412
CPDFUndoManager annotationUndoManager = documentFragment.pdfView.getCPdfReaderView()
@@ -398,12 +420,12 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
398420
result.success(annotationUndoManager.canRedo());
399421
break;
400422
}
401-
case ANNOTATION_UNDO:{
423+
case ANNOTATION_UNDO: {
402424
documentFragment.annotationToolbar.annotUndo();
403425
result.success(null);
404426
break;
405427
}
406-
case ANNOTATION_REDO:{
428+
case ANNOTATION_REDO: {
407429
documentFragment.annotationToolbar.annotRedo();
408430
result.success(null);
409431
break;

example/android/config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ ext {
33
COMPILESDK: 33,
44
MINSDK: 21,
55
TARGETSDK: 33,
6-
VERSIONCODE: 19
6+
VERSIONCODE: 20
77
]
88
}

example/ios/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ flutter_ios_podfile_setup
3030
target 'Runner' do
3131
use_frameworks!
3232
use_modular_headers!
33-
pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.4/ComPDFKit.podspec'
34-
pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.4/ComPDFKit_Tools.podspec'
33+
pod "ComPDFKit", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.5/ComPDFKit.podspec'
34+
pod "ComPDFKit_Tools", podspec:'https://file.compdf.com/cocoapods/ios/compdfkit_pdf_sdk/2.4.5/ComPDFKit_Tools.podspec'
3535
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3636
target 'RunnerTests' do
3737
inherit! :search_paths

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@
492492
CLANG_ENABLE_MODULES = YES;
493493
CODE_SIGN_IDENTITY = "Apple Development";
494494
CODE_SIGN_STYLE = Automatic;
495-
CURRENT_PROJECT_VERSION = 2.4.1;
495+
CURRENT_PROJECT_VERSION = 2.4.5;
496496
DEVELOPMENT_TEAM = 4GGQPGRTSV;
497497
ENABLE_BITCODE = NO;
498498
FLUTTER_BUILD_NAME = 2.4.1;
@@ -686,7 +686,7 @@
686686
CLANG_ENABLE_MODULES = YES;
687687
CODE_SIGN_IDENTITY = "Apple Development";
688688
CODE_SIGN_STYLE = Automatic;
689-
CURRENT_PROJECT_VERSION = 2.4.1;
689+
CURRENT_PROJECT_VERSION = 2.4.5;
690690
DEVELOPMENT_TEAM = 4GGQPGRTSV;
691691
ENABLE_BITCODE = NO;
692692
FLUTTER_BUILD_NAME = 2.4.1;
@@ -715,7 +715,7 @@
715715
CLANG_ENABLE_MODULES = YES;
716716
CODE_SIGN_IDENTITY = "Apple Development";
717717
CODE_SIGN_STYLE = Automatic;
718-
CURRENT_PROJECT_VERSION = 2.4.1;
718+
CURRENT_PROJECT_VERSION = 2.4.5;
719719
DEVELOPMENT_TEAM = 4GGQPGRTSV;
720720
ENABLE_BITCODE = NO;
721721
FLUTTER_BUILD_NAME = 2.4.1;

example/lib/cpdf_controller_example.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class _CPDFControllerExampleState extends State<CPDFControllerExample> {
4242
'isChanged',
4343
'documentInfo',
4444
'removeSignFileList',
45-
'print'
45+
'print',
46+
'setWidgetBackgroundColor',
4647
];
4748

4849
static const actions1 = [
@@ -195,7 +196,7 @@ class _CPDFControllerExampleState extends State<CPDFControllerExample> {
195196
await controller.showSecurityView();
196197
break;
197198
case 'Thumbnail':
198-
await controller.showThumbnailView(true);
199+
await controller.showThumbnailView(false);
199200
break;
200201
case 'BOTA':
201202
await controller.showBotaView();
@@ -217,6 +218,11 @@ class _CPDFControllerExampleState extends State<CPDFControllerExample> {
217218
return CpdfReaderWidgetDisplaySettingPage(controller: controller);
218219
});
219220
break;
221+
case 'setWidgetBackgroundColor':
222+
Color color = Colors.primaries[Random().nextInt(Colors.primaries.length)];
223+
await controller.setWidgetBackgroundColor(color);
224+
debugPrint('ComPDFKit:setWidgetBackgroundColor:$color');
225+
break;
220226
}
221227
}
222228
}

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: compdfkit_flutter_example
22
description: Demonstrates how to use the compdfkit_flutter plugin.
3-
version: 2.4.4
3+
version: 2.4.5+1
44
homepage: https://www.compdf.com
55
repository: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter
66
issue_tracker: https://www.compdf.com/support

0 commit comments

Comments
 (0)