├── .gitignore ├── .metadata ├── CHANGELOG.md ├── CONFIGURATION.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── compdfkit │ │ │ └── flutter │ │ │ └── compdfkit_flutter │ │ │ ├── CompdfkitFlutterPlugin.java │ │ │ ├── constants │ │ │ └── CPDFConstants.java │ │ │ ├── platformview │ │ │ ├── CPDFViewCtrlFactory.java │ │ │ └── CPDFViewCtrlFlutter.java │ │ │ ├── plugin │ │ │ ├── BaseMethodChannelPlugin.java │ │ │ ├── CPDFDocumentPlugin.java │ │ │ ├── CPDFViewCtrlPlugin.java │ │ │ └── ComPDFKitSDKPlugin.java │ │ │ └── utils │ │ │ ├── CAppUtils.java │ │ │ ├── CPDFPageUtil.java │ │ │ ├── FileUtils.java │ │ │ └── annotation │ │ │ ├── FlutterCPDFAnnotation.java │ │ │ ├── FlutterCPDFBaseAnnotation.java │ │ │ ├── FlutterCPDFCircleAnnotation.java │ │ │ ├── FlutterCPDFFreeTextAnnotation.java │ │ │ ├── FlutterCPDFInkAnnotation.java │ │ │ ├── FlutterCPDFLineAnnotation.java │ │ │ ├── FlutterCPDFLinkAnnotation.java │ │ │ ├── FlutterCPDFMarkupAnnotation.java │ │ │ ├── FlutterCPDFNoteAnnotation.java │ │ │ ├── FlutterCPDFSquareAnnotation.java │ │ │ ├── FlutterCPDFStampAnnotation.java │ │ │ └── forms │ │ │ ├── FlutterCPDFBaseWidget.java │ │ │ ├── FlutterCPDFCheckBoxWidget.java │ │ │ ├── FlutterCPDFComboBoxWidget.java │ │ │ ├── FlutterCPDFListBoxWidget.java │ │ │ ├── FlutterCPDFPushbuttonWidget.java │ │ │ ├── FlutterCPDFRadioButtonWidget.java │ │ │ ├── FlutterCPDFSignatureFieldsWidget.java │ │ │ ├── FlutterCPDFTextFieldWidget.java │ │ │ └── FlutterCPDFWidget.java │ └── res │ │ ├── drawable-v26 │ │ ├── tools_common_btn_corner_ripple_in_widget.xml │ │ └── tools_common_oval_ripple_in_widget.xml │ │ ├── drawable │ │ ├── tools_common_btn_corner_ripple_in_widget.xml │ │ └── tools_common_oval_ripple_in_widget.xml │ │ └── values │ │ └── styles.xml │ └── test │ ├── java │ └── com │ │ └── compdfkit │ │ └── flutter │ │ └── compdfkit_flutter │ │ └── CompdfkitFlutterPluginTest.java │ └── kotlin │ └── com │ └── compdfkit │ └── flutter │ └── compdfkit_flutter │ └── CompdfkitFlutterPluginTest.kt ├── example ├── .gitignore ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ │ └── test.xfdf │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── compdfkit │ │ │ │ │ └── flutter │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── config.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── extraFonts │ ├── Merriweather-Black.ttf │ ├── Merriweather-BlackItalic.ttf │ ├── Merriweather-Bold.ttf │ ├── Merriweather-BoldItalic.ttf │ ├── Merriweather-Italic.ttf │ ├── Merriweather-Light.ttf │ ├── Merriweather-LightItalic.ttf │ └── Merriweather-Regular.ttf ├── images │ ├── ic_home_setting.svg │ ├── ic_home_viewer.svg │ ├── ic_syasarrow.svg │ └── logo.png ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-1024.png │ │ │ │ ├── icon-20-ipad.png │ │ │ │ ├── icon-20@2x-ipad.png │ │ │ │ ├── icon-20@2x.png │ │ │ │ ├── icon-20@3x.png │ │ │ │ ├── icon-29-ipad.png │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-29@2x-ipad.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-57.png │ │ │ │ ├── icon-57@2x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── Contents.json │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── Runner-Bridging-Header.h │ │ ├── en.lproj │ │ │ └── Localizable.strings │ │ └── zh-Hans.lproj │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ └── RunnerTests │ │ └── RunnerTests.swift ├── lib │ ├── cpdf_annotations_example.dart │ ├── cpdf_controller_example.dart │ ├── cpdf_dark_theme_example.dart │ ├── cpdf_document_examples.dart │ ├── cpdf_pages_example.dart │ ├── cpdf_reader_page.dart │ ├── cpdf_reader_widget_example.dart │ ├── cpdf_security_example.dart │ ├── cpdf_widgets_example.dart │ ├── examples.dart │ ├── examples │ │ ├── cpdf_document_annotation_example.dart │ │ ├── cpdf_document_open_pdf_example.dart │ │ └── cpdf_document_widget_example.dart │ ├── main.dart │ ├── page │ │ ├── cpdf_annotations_list_page.dart │ │ ├── cpdf_reader_widget_display_setting_page.dart │ │ ├── cpdf_reader_widget_switch_preview_mode_page.dart │ │ ├── cpdf_widget_list_page.dart │ │ └── settings_page.dart │ ├── theme │ │ └── themes.dart │ ├── utils │ │ └── file_util.dart │ └── widgets │ │ ├── cpdf_app_bar.dart │ │ └── cpdf_fun_item.dart ├── pdfs │ ├── PDF_Document.pdf │ ├── Password_compdfkit_Security_Sample_File.pdf │ ├── annot_test.pdf │ ├── annot_test_widgets.xfdf │ ├── flutter_sample_annotations.json │ ├── flutter_sample_widgets.json │ └── test.xfdf ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── CPDFConstants.swift │ ├── ColorHelper.swift │ ├── CompdfkitFlutterPlugin.swift │ └── reader │ │ ├── CPDFDocumentPlugin.swift │ │ ├── CPDFPageUtil.swift │ │ ├── CPDFViewCtrlFactory.swift │ │ └── CPDFViewCtrlPlugin.swift ├── Framework │ └── ComPDFKit.xcframework │ │ └── Info.plist └── compdfkit_flutter.podspec ├── lib ├── annotation │ ├── cpdf_annotation.dart │ ├── cpdf_annotation_registry.dart │ ├── cpdf_circle_annotation.dart │ ├── cpdf_freetext_annotation.dart │ ├── cpdf_ink_annotation.dart │ ├── cpdf_line_annotation.dart │ ├── cpdf_link_annotation.dart │ ├── cpdf_markup_annotation.dart │ ├── cpdf_square_annotation.dart │ ├── cpdf_text_attribute.dart │ └── form │ │ ├── cpdf_checkbox_widget.dart │ │ ├── cpdf_combobox_widget.dart │ │ ├── cpdf_listbox_widget.dart │ │ ├── cpdf_pushbutton_widget.dart │ │ ├── cpdf_radiobutton_widget.dart │ │ ├── cpdf_signature_widget.dart │ │ ├── cpdf_text_widget.dart │ │ ├── cpdf_widget.dart │ │ ├── cpdf_widget_item.dart │ │ └── cpdf_widget_registry.dart ├── compdfkit.dart ├── configuration │ ├── attributes │ │ └── cpdf_annot_attr.dart │ ├── cpdf_configuration.dart │ └── cpdf_options.dart ├── document │ ├── action │ │ ├── cpdf_action.dart │ │ ├── cpdf_goto_action.dart │ │ └── cpdf_uri_action.dart │ ├── cpdf_document.dart │ └── cpdf_watermark.dart ├── page │ └── cpdf_page.dart ├── util │ ├── cpdf_rectf.dart │ ├── cpdf_uuid_util.dart │ └── extension │ │ └── cpdf_color_extension.dart └── widgets │ ├── cpdf_reader_widget.dart │ └── cpdf_reader_widget_controller.dart ├── pubspec.lock ├── pubspec.yaml └── screenshots └── 1-8.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | **/doc/api/ 27 | .dart_tool/ 28 | .packages 29 | build/ 30 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: 796c8ef79279f9c774545b3771238c3098dbefab 8 | channel: stable 9 | 10 | project_type: plugin 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 17 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 18 | - platform: android 19 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 20 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 21 | - platform: ios 22 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 23 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | No part of this document can be reproduced, transferred, distributed or stored in any 3 | format without the prior written permission of PDF Technologies. 4 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .cxx 10 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.compdfkit.flutter.compdfkit_flutter' 2 | version '1.0' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | mavenCentral() 8 | mavenLocal() 9 | 10 | } 11 | 12 | dependencies { 13 | classpath 'com.android.tools.build:gradle:7.3.0' 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | 26 | android { 27 | compileSdk 33 28 | namespace "com.compdfkit.flutter.compdfkit_flutter" 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | 34 | defaultConfig { 35 | minSdkVersion 21 36 | } 37 | 38 | dependencies { 39 | compileOnly fileTree(include: ['*.jar','*.aar'], dir: 'libs') 40 | 41 | // dependencies compdfkit pdf sdk 42 | api 'com.compdf:compdfkit-tools:2.4.0' 43 | 44 | testImplementation 'junit:junit:4.13.2' 45 | testImplementation 'org.mockito:mockito-core:5.0.0' 46 | api 'com.github.bumptech.glide:glide:4.15.1' 47 | annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1' 48 | api 'androidx.documentfile:documentfile:1.0.1' 49 | } 50 | 51 | testOptions { 52 | unitTests.all { 53 | testLogging { 54 | events "passed", "skipped", "failed", "standardOut", "standardError" 55 | outputs.upToDateWhen {false} 56 | showStandardStreams = true 57 | } 58 | } 59 | } 60 | } 61 | // refresh snapshot implementation 62 | configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } 63 | 64 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'compdfkit_flutter' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/CompdfkitFlutterPlugin.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | */ 9 | 10 | package com.compdfkit.flutter.compdfkit_flutter; 11 | 12 | import androidx.annotation.NonNull; 13 | 14 | import com.compdfkit.flutter.compdfkit_flutter.plugin.ComPDFKitSDKPlugin; 15 | import com.compdfkit.flutter.compdfkit_flutter.platformview.CPDFViewCtrlFactory; 16 | 17 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 18 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 19 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 20 | import io.flutter.plugin.common.BinaryMessenger; 21 | import io.flutter.plugin.platform.PlatformViewRegistry; 22 | 23 | 24 | public class CompdfkitFlutterPlugin implements FlutterPlugin, ActivityAware { 25 | 26 | private BinaryMessenger mMessenger; 27 | 28 | private PlatformViewRegistry mRegistry; 29 | 30 | private static final String PDF_DOCUMENT_VIEW_TYPE_ID = "com.compdfkit.flutter.ui.pdfviewer"; 31 | private FlutterPluginBinding pluginBinding; 32 | 33 | private ActivityPluginBinding activityPluginBinding; 34 | 35 | private ComPDFKitSDKPlugin comPDFKitSDKPlugin; 36 | @Override 37 | public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { 38 | this.pluginBinding = flutterPluginBinding; 39 | mMessenger = flutterPluginBinding.getBinaryMessenger(); 40 | mRegistry = flutterPluginBinding.getPlatformViewRegistry(); 41 | 42 | } 43 | 44 | @Override 45 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { 46 | } 47 | 48 | @Override 49 | public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) { 50 | this.activityPluginBinding = binding; 51 | setUp(); 52 | } 53 | 54 | private void setUp(){ 55 | comPDFKitSDKPlugin = new ComPDFKitSDKPlugin(activityPluginBinding.getActivity(), mMessenger); 56 | comPDFKitSDKPlugin.register(); 57 | activityPluginBinding.addActivityResultListener(comPDFKitSDKPlugin); 58 | if (mRegistry != null) { 59 | mRegistry.registerViewFactory(PDF_DOCUMENT_VIEW_TYPE_ID,new CPDFViewCtrlFactory(mMessenger)); 60 | } 61 | } 62 | 63 | private void clear(){ 64 | this.activityPluginBinding.removeActivityResultListener(comPDFKitSDKPlugin); 65 | this.activityPluginBinding = null; 66 | this.comPDFKitSDKPlugin = null; 67 | } 68 | 69 | @Override 70 | public void onDetachedFromActivityForConfigChanges() { 71 | 72 | } 73 | 74 | @Override 75 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) { 76 | } 77 | 78 | @Override 79 | public void onDetachedFromActivity() { 80 | clear(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/platformview/CPDFViewCtrlFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | package com.compdfkit.flutter.compdfkit_flutter.platformview; 12 | 13 | 14 | import android.content.Context; 15 | 16 | import androidx.annotation.NonNull; 17 | import androidx.annotation.Nullable; 18 | 19 | import java.util.Map; 20 | 21 | import io.flutter.plugin.common.BinaryMessenger; 22 | import io.flutter.plugin.common.StandardMessageCodec; 23 | import io.flutter.plugin.platform.PlatformView; 24 | import io.flutter.plugin.platform.PlatformViewFactory; 25 | 26 | public class CPDFViewCtrlFactory extends PlatformViewFactory { 27 | 28 | private final BinaryMessenger binaryMessenger; 29 | 30 | public CPDFViewCtrlFactory(BinaryMessenger binaryMessenger) { 31 | super(StandardMessageCodec.INSTANCE); 32 | this.binaryMessenger = binaryMessenger; 33 | } 34 | 35 | @NonNull 36 | @Override 37 | public PlatformView create(Context context, int viewId, @Nullable Object args) { 38 | @SuppressWarnings("unchecked") 39 | Map creationParams = (Map) args; 40 | return new CPDFViewCtrlFlutter(context, binaryMessenger, viewId, creationParams); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/BaseMethodChannelPlugin.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | *

4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | */ 9 | 10 | package com.compdfkit.flutter.compdfkit_flutter.plugin; 11 | 12 | 13 | 14 | import android.content.Context; 15 | import android.util.Log; 16 | 17 | import io.flutter.plugin.common.BinaryMessenger; 18 | import io.flutter.plugin.common.MethodChannel; 19 | 20 | 21 | public abstract class BaseMethodChannelPlugin implements MethodChannel.MethodCallHandler { 22 | 23 | public static final String LOG_TAG = "ComPDFKit-Plugin"; 24 | 25 | protected MethodChannel methodChannel = null; 26 | 27 | protected Context context; 28 | 29 | protected BinaryMessenger binaryMessenger; 30 | 31 | public BaseMethodChannelPlugin(Context context, BinaryMessenger binaryMessenger) { 32 | this.context = context; 33 | this.binaryMessenger = binaryMessenger; 34 | } 35 | 36 | public abstract String methodName(); 37 | 38 | public void register(){ 39 | Log.e(LOG_TAG, "create MethodChannel:" + methodName()); 40 | methodChannel = new MethodChannel(binaryMessenger, methodName()); 41 | methodChannel.setMethodCallHandler(this); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/CAppUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | package com.compdfkit.flutter.compdfkit_flutter.utils; 12 | 13 | 14 | import androidx.annotation.ColorInt; 15 | 16 | public class CAppUtils { 17 | 18 | 19 | public static String toHexColor(@ColorInt int color){ 20 | return "#" + Integer.toHexString(color).toUpperCase(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/FileUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | package com.compdfkit.flutter.compdfkit_flutter.utils; 12 | 13 | import android.content.Context; 14 | import android.content.Intent; 15 | import android.net.Uri; 16 | import com.compdfkit.tools.common.pdf.CPDFDocumentActivity; 17 | import com.compdfkit.tools.common.utils.CFileUtils; 18 | import com.compdfkit.tools.common.utils.CUriUtil; 19 | import java.io.File; 20 | 21 | 22 | public class FileUtils { 23 | 24 | public static final String ASSETS_SCHEME = "file:///android_asset"; 25 | 26 | public static final String CONTENT_SCHEME = "content://"; 27 | public static final String FILE_SCHEME = "file://"; 28 | 29 | public static void parseDocument(Context context, String document, Intent intent) { 30 | if (document.startsWith(ASSETS_SCHEME)) { 31 | String assetsPath = document.replace(ASSETS_SCHEME + "/",""); 32 | String[] strs = document.split("/"); 33 | String fileName = strs[strs.length -1]; 34 | String samplePDFPath = CFileUtils.getAssetsTempFile(context, assetsPath, fileName); 35 | intent.putExtra(CPDFDocumentActivity.EXTRA_FILE_PATH, samplePDFPath); 36 | } else if (document.startsWith(CONTENT_SCHEME)) { 37 | Uri uri = Uri.parse(document); 38 | intent.setData(uri); 39 | } else if (document.startsWith(FILE_SCHEME)) { 40 | Uri uri = Uri.parse(document); 41 | intent.setData(uri); 42 | } else { 43 | intent.putExtra(CPDFDocumentActivity.EXTRA_FILE_PATH, document); 44 | } 45 | } 46 | 47 | public static String getImportFilePath(Context context, String xfdf) { 48 | if (xfdf.startsWith(ASSETS_SCHEME)) { 49 | String assetsPath = xfdf.replace(ASSETS_SCHEME + "/",""); 50 | String[] strs = xfdf.split("/"); 51 | String fileName = strs[strs.length -1]; 52 | return CFileUtils.getAssetsTempFile(context, assetsPath, fileName); 53 | } else if (xfdf.startsWith(CONTENT_SCHEME)) { 54 | Uri uri = Uri.parse(xfdf); 55 | String fileName = CUriUtil.getUriFileName(context, uri); 56 | String dir = new File(context.getCacheDir(), CFileUtils.CACHE_FOLDER + File.separator + "xfdfFile").getAbsolutePath(); 57 | // Get the saved file path 58 | return CFileUtils.copyFileToInternalDirectory(context, uri, dir, fileName); 59 | } else if (xfdf.startsWith(FILE_SCHEME)) { 60 | return xfdf; 61 | } else { 62 | return xfdf; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFAnnotation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | */ 9 | 10 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 11 | 12 | 13 | import java.util.HashMap; 14 | 15 | public interface FlutterCPDFAnnotation { 16 | 17 | public HashMap getAnnotation( 18 | com.compdfkit.core.annotation.CPDFAnnotation annotation); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFBaseAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import android.graphics.RectF; 5 | import android.util.Log; 6 | import com.compdfkit.core.common.CPDFDate; 7 | import com.compdfkit.tools.common.utils.date.CDateUtil; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public abstract class FlutterCPDFBaseAnnotation implements FlutterCPDFAnnotation { 12 | 13 | @Override 14 | public HashMap getAnnotation(com.compdfkit.core.annotation.CPDFAnnotation annotation) { 15 | HashMap map = new HashMap<>(); 16 | map.put("type", annotation.getType().name().toLowerCase()); 17 | map.put("page", annotation.pdfPage.getPageNum()); 18 | map.put("title", annotation.getTitle()); 19 | map.put("content", annotation.getContent()); 20 | map.put("uuid", annotation.getAnnotPtr()+""); 21 | RectF rect = annotation.getRect(); 22 | Map rectMap = new HashMap<>(); 23 | rectMap.put("left", rect.left); 24 | rectMap.put("top", rect.top); 25 | rectMap.put("right", rect.right); 26 | rectMap.put("bottom", rect.bottom); 27 | map.put("rect", rectMap); 28 | 29 | CPDFDate modifyDate = annotation.getRecentlyModifyDate(); 30 | CPDFDate createDate = annotation.getCreationDate(); 31 | if (modifyDate != null) { 32 | map.put("modifyDate", CDateUtil.transformToTimestamp(modifyDate)); 33 | } 34 | if (createDate != null) { 35 | map.put("createDate", CDateUtil.transformToTimestamp(createDate)); 36 | } 37 | covert(annotation, map); 38 | return map; 39 | } 40 | 41 | public abstract void covert(com.compdfkit.core.annotation.CPDFAnnotation annotation, HashMap map); 42 | } 43 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFCircleAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.core.annotation.CPDFAnnotation.CPDFBorderEffectType; 6 | import com.compdfkit.core.annotation.CPDFCircleAnnotation; 7 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 8 | import java.util.HashMap; 9 | 10 | public class FlutterCPDFCircleAnnotation extends FlutterCPDFBaseAnnotation { 11 | 12 | 13 | @Override 14 | public void covert(CPDFAnnotation annotation, HashMap map) { 15 | CPDFCircleAnnotation circleAnnotation = (CPDFCircleAnnotation) annotation; 16 | map.put("borderColor", CAppUtils.toHexColor(circleAnnotation.getBorderColor())); 17 | map.put("borderAlpha", (double) circleAnnotation.getBorderAlpha()); 18 | map.put("fillColor", CAppUtils.toHexColor(circleAnnotation.getFillColor())); 19 | map.put("fillAlpha", (double) circleAnnotation.getFillAlpha()); 20 | map.put("borderWidth", circleAnnotation.getBorderWidth()); 21 | map.put("bordEffectType", circleAnnotation.getBordEffectType() == CPDFBorderEffectType.CPDFBorderEffectTypeSolid ? "solid" : "cloudy"); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFFreeTextAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import android.text.TextUtils; 5 | import android.util.Log; 6 | import com.compdfkit.core.annotation.CPDFAnnotation; 7 | import com.compdfkit.core.annotation.CPDFFreetextAnnotation; 8 | import com.compdfkit.core.annotation.CPDFTextAttribute; 9 | import com.compdfkit.core.font.CPDFFont; 10 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 11 | import java.util.HashMap; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | public class FlutterCPDFFreeTextAnnotation extends FlutterCPDFBaseAnnotation { 16 | 17 | @Override 18 | public void covert(CPDFAnnotation annotation, HashMap map) { 19 | CPDFFreetextAnnotation freetextAnnotation = (CPDFFreetextAnnotation) annotation; 20 | map.put("alpha", (double) freetextAnnotation.getAlpha()); 21 | CPDFTextAttribute textAttribute = freetextAnnotation.getFreetextDa(); 22 | Map textAttributeMap = new HashMap<>(); 23 | textAttributeMap.put("color", CAppUtils.toHexColor(textAttribute.getColor())); 24 | 25 | String fontName = textAttribute.getFontName(); 26 | String familyName = CPDFFont.getFamilyName(textAttribute.getFontName()); 27 | String styleName = "Regular"; 28 | if (TextUtils.isEmpty(familyName)){ 29 | familyName = textAttribute.getFontName(); 30 | }else { 31 | List styleNames = CPDFFont.getStyleName(familyName); 32 | if (styleNames != null) { 33 | for (String styleNameItem : styleNames) { 34 | if (fontName.endsWith(styleNameItem)){ 35 | styleName = styleNameItem; 36 | } 37 | } 38 | } 39 | } 40 | 41 | textAttributeMap.put("familyName", familyName); 42 | textAttributeMap.put("styleName", styleName); 43 | textAttributeMap.put("fontSize", textAttribute.getFontSize()); 44 | 45 | switch (freetextAnnotation.getFreetextAlignment()){ 46 | case ALIGNMENT_RIGHT: 47 | map.put("alignment", "right"); 48 | break; 49 | case ALIGNMENT_CENTER: 50 | map.put("alignment", "center"); 51 | break; 52 | default: 53 | map.put("alignment", "left"); 54 | break; 55 | } 56 | 57 | map.put("textAttribute", textAttributeMap); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFInkAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.core.annotation.CPDFInkAnnotation; 6 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 7 | import java.util.HashMap; 8 | 9 | public class FlutterCPDFInkAnnotation extends FlutterCPDFBaseAnnotation { 10 | 11 | 12 | @Override 13 | public void covert(CPDFAnnotation annotation, HashMap map) { 14 | CPDFInkAnnotation inkAnnotation = (CPDFInkAnnotation) annotation; 15 | map.put("color", CAppUtils.toHexColor(inkAnnotation.getColor())); 16 | map.put("alpha", (double) inkAnnotation.getAlpha()); 17 | map.put("borderWidth", inkAnnotation.getBorderWidth()); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFLineAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.core.annotation.CPDFLineAnnotation; 6 | import com.compdfkit.core.annotation.CPDFLineAnnotation.LineType; 7 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 8 | import java.util.HashMap; 9 | 10 | public class FlutterCPDFLineAnnotation extends FlutterCPDFBaseAnnotation { 11 | 12 | 13 | @Override 14 | public void covert(CPDFAnnotation annotation, HashMap map) { 15 | CPDFLineAnnotation lineAnnotation = (CPDFLineAnnotation) annotation; 16 | if (lineAnnotation.getLineHeadType() == LineType.LINETYPE_NONE 17 | && lineAnnotation.getLineTailType() == LineType.LINETYPE_NONE) { 18 | map.put("type", "line"); 19 | } else { 20 | map.put("type", "arrow"); 21 | } 22 | map.put("borderColor", CAppUtils.toHexColor(lineAnnotation.getBorderColor())); 23 | map.put("borderAlpha", (double) lineAnnotation.getBorderAlpha()); 24 | map.put("fillColor", CAppUtils.toHexColor(lineAnnotation.getFillColor())); 25 | map.put("fillAlpha", (double) lineAnnotation.getFillAlpha()); 26 | map.put("borderWidth", lineAnnotation.getBorderWidth()); 27 | map.put("lineHeadType", getLineType(lineAnnotation.getLineHeadType())); 28 | map.put("lineTailType", getLineType(lineAnnotation.getLineTailType())); 29 | } 30 | 31 | private String getLineType(CPDFLineAnnotation.LineType lineType) { 32 | switch (lineType) { 33 | case LINETYPE_ARROW: 34 | return "openArrow"; 35 | case LINETYPE_CIRCLE: 36 | return "circle"; 37 | case LINETYPE_DIAMOND: 38 | return "diamond"; 39 | case LINETYPE_SQUARE: 40 | return "square"; 41 | case LINETYPE_CLOSEDARROW: 42 | return "closedArrow"; 43 | case LINETYPE_NONE: 44 | return "none"; 45 | default: 46 | return "unknown"; 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFLinkAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import static com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms.FlutterCPDFPushbuttonWidget.getActionType; 5 | 6 | import com.compdfkit.core.annotation.CPDFAnnotation; 7 | import com.compdfkit.core.annotation.CPDFInkAnnotation; 8 | import com.compdfkit.core.annotation.CPDFLinkAnnotation; 9 | import com.compdfkit.core.document.CPDFDestination; 10 | import com.compdfkit.core.document.CPDFDocument; 11 | import com.compdfkit.core.document.action.CPDFAction; 12 | import com.compdfkit.core.document.action.CPDFAction.ActionType; 13 | import com.compdfkit.core.document.action.CPDFGoToAction; 14 | import com.compdfkit.core.document.action.CPDFUriAction; 15 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | public class FlutterCPDFLinkAnnotation extends FlutterCPDFBaseAnnotation { 20 | 21 | private CPDFDocument document; 22 | 23 | public void setDocument(CPDFDocument document) { 24 | this.document = document; 25 | } 26 | 27 | @Override 28 | public void covert(CPDFAnnotation annotation, HashMap map) { 29 | CPDFLinkAnnotation linkAnnotation = (CPDFLinkAnnotation) annotation; 30 | CPDFAction action = linkAnnotation.getLinkAction(); 31 | if (action != null){ 32 | Map actionMap = new HashMap<>(); 33 | actionMap.put("actionType", getActionType(action)); 34 | if (action.getActionType() == ActionType.PDFActionType_URI){ 35 | CPDFUriAction uriAction = (CPDFUriAction) action; 36 | String uri = uriAction.getUri(); 37 | actionMap.put("uri", uri); 38 | } else if (action.getActionType() == ActionType.PDFActionType_GoTo){ 39 | CPDFGoToAction goToAction = (CPDFGoToAction) action; 40 | if (document != null){ 41 | CPDFDestination destination = goToAction.getDestination(document); 42 | actionMap.put("pageIndex", destination.getPageIndex()); 43 | } 44 | } 45 | map.put("action", actionMap); 46 | } 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFMarkupAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 6 | import java.util.HashMap; 7 | 8 | public class FlutterCPDFMarkupAnnotation extends FlutterCPDFBaseAnnotation { 9 | 10 | @Override 11 | public void covert(CPDFAnnotation annotation, HashMap map) { 12 | if (annotation instanceof com.compdfkit.core.annotation.CPDFMarkupAnnotation){ 13 | com.compdfkit.core.annotation.CPDFMarkupAnnotation markupAnnotation = (com.compdfkit.core.annotation.CPDFMarkupAnnotation) annotation; 14 | map.put("markedText", markupAnnotation.getMarkedText()); 15 | map.put("color", CAppUtils.toHexColor(markupAnnotation.getColor())); 16 | map.put("alpha", (double) markupAnnotation.getAlpha()); 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFNoteAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import java.util.HashMap; 6 | 7 | public class FlutterCPDFNoteAnnotation extends FlutterCPDFBaseAnnotation { 8 | 9 | 10 | @Override 11 | public void covert(CPDFAnnotation annotation, HashMap map) { 12 | map.put("type", "note"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFSquareAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.core.annotation.CPDFAnnotation.CPDFBorderEffectType; 6 | import com.compdfkit.core.annotation.CPDFSquareAnnotation; 7 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 8 | import java.util.HashMap; 9 | 10 | public class FlutterCPDFSquareAnnotation extends FlutterCPDFBaseAnnotation { 11 | 12 | @Override 13 | public void covert(CPDFAnnotation annotation, HashMap map) { 14 | CPDFSquareAnnotation squareAnnotation = (CPDFSquareAnnotation) annotation; 15 | map.put("borderColor", CAppUtils.toHexColor(squareAnnotation.getBorderColor())); 16 | map.put("borderAlpha", (double) squareAnnotation.getBorderAlpha()); 17 | map.put("fillColor", CAppUtils.toHexColor(squareAnnotation.getFillColor())); 18 | map.put("fillAlpha", (double) squareAnnotation.getFillAlpha()); 19 | map.put("borderWidth", squareAnnotation.getBorderWidth()); 20 | map.put("bordEffectType", squareAnnotation.getBordEffectType() == CPDFBorderEffectType.CPDFBorderEffectTypeSolid ? "solid" : "cloudy"); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/FlutterCPDFStampAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation; 2 | 3 | 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.core.annotation.CPDFStampAnnotation; 6 | import java.util.HashMap; 7 | 8 | public class FlutterCPDFStampAnnotation extends FlutterCPDFBaseAnnotation { 9 | 10 | @Override 11 | public void covert(CPDFAnnotation annotation, HashMap map) { 12 | CPDFStampAnnotation stampAnnotation = (CPDFStampAnnotation) annotation; 13 | if (stampAnnotation.isStampSignature()) { 14 | map.put("type", "signature"); 15 | } else { 16 | switch (stampAnnotation.getStampType()) { 17 | case STANDARD_STAMP: 18 | case TEXT_STAMP: 19 | map.put("type", "stamp"); 20 | break; 21 | case IMAGE_STAMP: 22 | map.put("type", "pictures"); 23 | break; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFBaseWidget.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | *

4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. This notice 7 | * may not be removed from this file. 8 | */ 9 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 10 | 11 | 12 | import android.graphics.RectF; 13 | import com.compdfkit.core.annotation.CPDFAnnotation; 14 | import com.compdfkit.core.annotation.form.CPDFWidget; 15 | import com.compdfkit.core.common.CPDFDate; 16 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 17 | import com.compdfkit.tools.common.utils.date.CDateUtil; 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | public abstract class FlutterCPDFBaseWidget implements FlutterCPDFWidget { 22 | 23 | 24 | @Override 25 | public HashMap getWidget(CPDFAnnotation annotation) { 26 | HashMap map = new HashMap<>(); 27 | CPDFWidget widget = (CPDFWidget) annotation; 28 | map.put("page", widget.pdfPage.getPageNum()); 29 | map.put("title", widget.getFieldName()); 30 | map.put("uuid", widget.getAnnotPtr()+""); 31 | 32 | RectF rect = annotation.getRect(); 33 | Map rectMap = new HashMap<>(); 34 | rectMap.put("left", rect.left); 35 | rectMap.put("top", rect.top); 36 | rectMap.put("right", rect.right); 37 | rectMap.put("bottom", rect.bottom); 38 | map.put("rect", rectMap); 39 | 40 | CPDFDate modifyDate = annotation.getRecentlyModifyDate(); 41 | CPDFDate createDate = annotation.getCreationDate(); 42 | if (modifyDate != null) { 43 | map.put("modifyDate", CDateUtil.transformToTimestamp(modifyDate)); 44 | } 45 | if (createDate != null) { 46 | map.put("createDate", CDateUtil.transformToTimestamp(createDate)); 47 | } 48 | 49 | map.put("borderColor", CAppUtils.toHexColor(widget.getBorderColor())); 50 | map.put("borderWidget", widget.getBorderWidth()); 51 | map.put("fillColor", CAppUtils.toHexColor(widget.getFillColor())); 52 | 53 | covert(widget, map); 54 | return map; 55 | } 56 | 57 | public abstract void covert(com.compdfkit.core.annotation.form.CPDFWidget widget, HashMap map); 58 | } 59 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFCheckBoxWidget.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 2 | 3 | import com.compdfkit.core.annotation.form.CPDFCheckboxWidget; 4 | import com.compdfkit.core.annotation.form.CPDFWidget; 5 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 6 | import java.util.HashMap; 7 | 8 | 9 | public class FlutterCPDFCheckBoxWidget extends FlutterCPDFBaseWidget { 10 | 11 | @Override 12 | public void covert(CPDFWidget widget, HashMap map) { 13 | CPDFCheckboxWidget checkboxWidget = (CPDFCheckboxWidget) widget; 14 | map.put("type", "checkBox"); 15 | map.put("isChecked", checkboxWidget.isChecked()); 16 | map.put("checkStyle", 17 | checkboxWidget.getCheckStyle().name().replaceAll("CK_", "").toLowerCase()); 18 | map.put("checkColor", CAppUtils.toHexColor(checkboxWidget.getCheckColor())); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFComboBoxWidget.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 2 | 3 | import android.text.TextUtils; 4 | import com.compdfkit.core.annotation.form.CPDFComboboxWidget; 5 | import com.compdfkit.core.annotation.form.CPDFWidget; 6 | import com.compdfkit.core.annotation.form.CPDFWidgetItem; 7 | import com.compdfkit.core.font.CPDFFont; 8 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 9 | import java.util.ArrayList; 10 | import java.util.HashMap; 11 | import java.util.List; 12 | 13 | 14 | public class FlutterCPDFComboBoxWidget extends FlutterCPDFBaseWidget { 15 | @Override 16 | public void covert(CPDFWidget widget, HashMap map) { 17 | CPDFComboboxWidget comboBoxWidget = (CPDFComboboxWidget) widget; 18 | map.put("type", "comboBox"); 19 | ArrayList> options = new ArrayList<>(); 20 | CPDFWidgetItem[] items = comboBoxWidget.getOptions(); 21 | if (items != null && items.length > 0){ 22 | for (CPDFWidgetItem item : items) { 23 | HashMap option = new HashMap<>(); 24 | option.put("text", item.text); 25 | option.put("value", item.value); 26 | options.add(option); 27 | } 28 | } 29 | map.put("options", options); 30 | map.put("selectedIndexes", comboBoxWidget.getSelectedIndexes()); 31 | map.put("fontColor", CAppUtils.toHexColor(comboBoxWidget.getFontColor())); 32 | map.put("fontSize", comboBoxWidget.getFontSize()); 33 | 34 | String fontName = comboBoxWidget.getFontName(); 35 | String familyName = CPDFFont.getFamilyName(comboBoxWidget.getFontName()); 36 | String styleName = "Regular"; 37 | if (TextUtils.isEmpty(familyName)){ 38 | familyName = comboBoxWidget.getFontName(); 39 | }else { 40 | List styleNames = CPDFFont.getStyleName(familyName); 41 | if (styleNames != null) { 42 | for (String styleNameItem : styleNames) { 43 | if (fontName.endsWith(styleNameItem)){ 44 | styleName = styleNameItem; 45 | } 46 | } 47 | } 48 | } 49 | 50 | map.put("familyName", familyName); 51 | map.put("styleName", styleName); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFListBoxWidget.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 2 | 3 | import android.text.TextUtils; 4 | import com.compdfkit.core.annotation.form.CPDFListboxWidget; 5 | import com.compdfkit.core.annotation.form.CPDFWidget; 6 | import com.compdfkit.core.annotation.form.CPDFWidgetItem; 7 | import com.compdfkit.core.font.CPDFFont; 8 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 9 | import java.util.ArrayList; 10 | import java.util.HashMap; 11 | import java.util.List; 12 | 13 | 14 | public class FlutterCPDFListBoxWidget extends FlutterCPDFBaseWidget { 15 | 16 | @Override 17 | public void covert(CPDFWidget widget, HashMap map) { 18 | CPDFListboxWidget listboxWidget = (CPDFListboxWidget) widget; 19 | map.put("type", "listBox"); 20 | ArrayList> options = new ArrayList<>(); 21 | CPDFWidgetItem[] items = listboxWidget.getOptions(); 22 | if (items != null && items.length > 0){ 23 | for (CPDFWidgetItem item : items) { 24 | HashMap option = new HashMap<>(); 25 | option.put("text", item.text); 26 | option.put("value", item.value); 27 | options.add(option); 28 | } 29 | } 30 | map.put("options", options); 31 | map.put("selectedIndexes", listboxWidget.getSelectedIndexes()); 32 | map.put("fontColor", CAppUtils.toHexColor(listboxWidget.getFontColor())); 33 | map.put("fontSize", listboxWidget.getFontSize()); 34 | 35 | String fontName = listboxWidget.getFontName(); 36 | String familyName = CPDFFont.getFamilyName(listboxWidget.getFontName()); 37 | String styleName = "Regular"; 38 | if (TextUtils.isEmpty(familyName)){ 39 | familyName = listboxWidget.getFontName(); 40 | }else { 41 | List styleNames = CPDFFont.getStyleName(familyName); 42 | if (styleNames != null) { 43 | for (String styleNameItem : styleNames) { 44 | if (fontName.endsWith(styleNameItem)){ 45 | styleName = styleNameItem; 46 | } 47 | } 48 | } 49 | } 50 | 51 | 52 | map.put("familyName", familyName); 53 | map.put("styleName", styleName); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFRadioButtonWidget.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 2 | 3 | import com.compdfkit.core.annotation.form.CPDFRadiobuttonWidget; 4 | import com.compdfkit.core.annotation.form.CPDFWidget; 5 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 6 | import java.util.HashMap; 7 | 8 | 9 | public class FlutterCPDFRadioButtonWidget extends FlutterCPDFBaseWidget { 10 | 11 | @Override 12 | public void covert(CPDFWidget widget, HashMap map) { 13 | CPDFRadiobuttonWidget radiobuttonWidget = (CPDFRadiobuttonWidget) widget; 14 | map.put("type", "radioButton"); 15 | map.put("isChecked", radiobuttonWidget.isChecked()); 16 | map.put("checkStyle", 17 | radiobuttonWidget.getCheckStyle().name().replaceAll("CK_", "").toLowerCase()); 18 | map.put("checkColor", CAppUtils.toHexColor(radiobuttonWidget.getCheckColor())); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFSignatureFieldsWidget.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import com.compdfkit.core.annotation.CPDFAnnotation; 6 | import com.compdfkit.core.annotation.CPDFImageScaleType; 7 | import com.compdfkit.core.annotation.form.CPDFSignatureWidget; 8 | import com.compdfkit.core.annotation.form.CPDFWidget; 9 | import com.compdfkit.flutter.compdfkit_flutter.utils.FileUtils; 10 | import com.compdfkit.tools.common.utils.image.CBitmapUtil; 11 | import java.util.HashMap; 12 | 13 | 14 | public class FlutterCPDFSignatureFieldsWidget extends FlutterCPDFBaseWidget { 15 | 16 | @Override 17 | public void covert(CPDFWidget widget, HashMap map) { 18 | CPDFSignatureWidget signatureWidget = (CPDFSignatureWidget) widget; 19 | map.put("type", "signaturesFields"); 20 | } 21 | 22 | public boolean addImageSignatures(Context context, CPDFAnnotation widget, String imagePath){ 23 | CPDFSignatureWidget signatureWidget = (CPDFSignatureWidget) widget; 24 | try{ 25 | String path = FileUtils.getImportFilePath(context, imagePath); 26 | Bitmap bitmap = CBitmapUtil.decodeBitmap(path); 27 | if (bitmap != null){ 28 | return signatureWidget.updateApWithBitmap(bitmap, CPDFImageScaleType.SCALETYPE_fitCenter); 29 | } 30 | }catch (Exception e){ 31 | e.printStackTrace(); 32 | return false; 33 | } 34 | return false; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFTextFieldWidget.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 2 | 3 | import android.text.TextUtils; 4 | import com.compdfkit.core.annotation.CPDFAnnotation; 5 | import com.compdfkit.core.annotation.form.CPDFTextWidget; 6 | import com.compdfkit.core.annotation.form.CPDFWidget; 7 | import com.compdfkit.core.font.CPDFFont; 8 | import com.compdfkit.flutter.compdfkit_flutter.utils.CAppUtils; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | 12 | 13 | public class FlutterCPDFTextFieldWidget extends FlutterCPDFBaseWidget { 14 | 15 | 16 | @Override 17 | public void covert(CPDFWidget widget, HashMap map) { 18 | CPDFTextWidget textWidget = (CPDFTextWidget) widget; 19 | map.put("type", "textField"); 20 | map.put("text", textWidget.getText()); 21 | map.put("isMultiline", textWidget.isMultiLine()); 22 | map.put("fontColor", CAppUtils.toHexColor(textWidget.getFontColor())); 23 | map.put("fontSize", textWidget.getFontSize()); 24 | switch (textWidget.getTextAlignment()){ 25 | case ALIGNMENT_RIGHT: 26 | map.put("alignment", "right"); 27 | break; 28 | case ALIGNMENT_CENTER: 29 | map.put("alignment", "center"); 30 | break; 31 | default: 32 | map.put("alignment", "left"); 33 | break; 34 | } 35 | 36 | String fontName = textWidget.getFontName(); 37 | String familyName = CPDFFont.getFamilyName(textWidget.getFontName()); 38 | String styleName = "Regular"; 39 | if (TextUtils.isEmpty(familyName)){ 40 | familyName = textWidget.getFontName(); 41 | }else { 42 | List styleNames = CPDFFont.getStyleName(familyName); 43 | if (styleNames != null) { 44 | for (String styleNameItem : styleNames) { 45 | if (fontName.endsWith(styleNameItem)){ 46 | styleName = styleNameItem; 47 | } 48 | } 49 | } 50 | } 51 | 52 | map.put("familyName", familyName); 53 | map.put("styleName", styleName); 54 | } 55 | 56 | public void setText(CPDFAnnotation annotation, String text) { 57 | CPDFTextWidget textWidget = (CPDFTextWidget) annotation; 58 | textWidget.setText(text); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/annotation/forms/FlutterCPDFWidget.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | */ 9 | package com.compdfkit.flutter.compdfkit_flutter.utils.annotation.forms; 10 | 11 | import com.compdfkit.core.annotation.CPDFAnnotation; 12 | import java.util.HashMap; 13 | 14 | 15 | public interface FlutterCPDFWidget { 16 | 17 | 18 | public HashMap getWidget(CPDFAnnotation annotation); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /android/src/main/res/drawable-v26/tools_common_btn_corner_ripple_in_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /android/src/main/res/drawable-v26/tools_common_oval_ripple_in_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/src/main/res/drawable/tools_common_btn_corner_ripple_in_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/src/main/res/drawable/tools_common_oval_ripple_in_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | -------------------------------------------------------------------------------- /android/src/test/java/com/compdfkit/flutter/compdfkit_flutter/CompdfkitFlutterPluginTest.java: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter; 2 | 3 | import static org.mockito.Mockito.mock; 4 | import static org.mockito.Mockito.verify; 5 | 6 | import io.flutter.plugin.common.MethodCall; 7 | import io.flutter.plugin.common.MethodChannel; 8 | import org.junit.Test; 9 | 10 | /** 11 | * This demonstrates a simple unit test of the Java portion of this plugin's implementation. 12 | * 13 | * Once you have built the plugin's example app, you can run these tests from the command 14 | * line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or 15 | * you can run them directly from IDEs that support JUnit such as Android Studio. 16 | */ 17 | 18 | public class CompdfkitFlutterPluginTest { 19 | @Test 20 | public void onMethodCall_getPlatformVersion_returnsExpectedValue() { 21 | CompdfkitFlutterPlugin plugin = new CompdfkitFlutterPlugin(); 22 | 23 | final MethodCall call = new MethodCall("getPlatformVersion", null); 24 | MethodChannel.Result mockResult = mock(MethodChannel.Result.class); 25 | // plugin.onMethodCall(call, mockResult); 26 | 27 | verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /android/src/test/kotlin/com/compdfkit/flutter/compdfkit_flutter/CompdfkitFlutterPluginTest.kt: -------------------------------------------------------------------------------- 1 | package com.compdfkit.flutter.compdfkit_flutter 2 | 3 | import io.flutter.plugin.common.MethodCall 4 | import io.flutter.plugin.common.MethodChannel 5 | import kotlin.test.Test 6 | import org.mockito.Mockito 7 | 8 | /* 9 | * This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation. 10 | * 11 | * Once you have built the plugin's example app, you can run these tests from the command 12 | * line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or 13 | * you can run them directly from IDEs that support JUnit such as Android Studio. 14 | */ 15 | 16 | internal class CompdfkitFlutterPluginTest { 17 | @Test 18 | fun onMethodCall_getPlatformVersion_returnsExpectedValue() { 19 | val plugin = CompdfkitFlutterPlugin() 20 | 21 | val call = MethodCall("getPlatformVersion", null) 22 | val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java) 23 | plugin.onMethodCall(call, mockResult) 24 | 25 | Mockito.verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .build/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .swiftpm/ 13 | migrate_working_dir/ 14 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # The .vscode folder contains launch configuration and tasks you configure in 22 | # VS Code which you may wish to be included in version control, so this line 23 | # is commented out by default. 24 | #.vscode/ 25 | 26 | # Flutter/Dart/Pub related 27 | **/doc/api/ 28 | **/ios/Flutter/.last_build_id 29 | .dart_tool/ 30 | .flutter-plugins 31 | .flutter-plugins-dependencies 32 | .packages 33 | .pub-cache/ 34 | .pub/ 35 | /build/ 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # ComPDFKit Flutter Example 2 | 3 | This is a brief example of how to use the ComPDFKit with Flutter. 4 | 5 | 6 | ### Requirements 7 | 8 | 9 | **Android** 10 | 11 | Please install the following required packages: 12 | 13 | * The [latest stable version of Flutter](https://docs.flutter.dev/get-started/install) 14 | 15 | * The [latest stable version of Android Studio](https://developer.android.com/studio) 16 | 17 | * The [Android NDK](https://developer.android.com/studio/projects/install-ndk) 18 | 19 | * An [Android Virtual Device](https://developer.android.com/studio/run/managing-avds.html) 20 | 21 | Operating Environment Requirements: 22 | 23 | * A minSdkVersion of `21` or higher. 24 | * A `compileSdkVersion` of `33` or higher. 25 | * A `targetSdkVersion` of `33` or higher. 26 | * Android ABI(s): x86, x86_64, armeabi-v7a, arm64-v8a. 27 | 28 | 29 | **iOS** 30 | 31 | Please install the following required packages: 32 | 33 | * The [latest stable version of Flutter](https://docs.flutter.dev/get-started/install) 34 | 35 | * The [latest stable version of Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) 36 | 37 | * The [latest stable version of CocoaPods](https://github.com/CocoaPods/CocoaPods/releases). Follow the [CocoaPods installation guide](https://guides.cocoapods.org/using/getting-started.html#installation) to install it. 38 | 39 | Operating Environment Requirements: 40 | 41 | * The iOS 12.0 or higher. 42 | * The Xcode 12.0 or newer for Objective-C or Swift. 43 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | 15 | /app/.cxx/ 16 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.compdfkit.flutter.example" 27 | compileSdk flutter.compileSdkVersion 28 | ndkVersion "27.0.12077973" 29 | signingConfigs { 30 | release { 31 | if (project.hasProperty("Keystore.properties")) { 32 | String filePath = project.property("Keystore.properties") 33 | File propsFile = new File(filePath) 34 | if (propsFile.exists()) { 35 | Properties props = new Properties() 36 | props.load(propsFile.newDataInputStream()) 37 | 38 | storeFile file(props['storeFile']) 39 | storePassword props['keystore.password'] 40 | keyAlias props['keyAlias'] 41 | keyPassword props['keyAlias.password'] 42 | } 43 | } 44 | } 45 | } 46 | compileOptions { 47 | sourceCompatibility JavaVersion.VERSION_1_8 48 | targetCompatibility JavaVersion.VERSION_1_8 49 | } 50 | 51 | kotlinOptions { 52 | jvmTarget = '1.8' 53 | } 54 | 55 | 56 | defaultConfig { 57 | applicationId "com.compdfkit.flutter.example" 58 | // You can update the following values to match your application needs. 59 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 60 | minSdkVersion rootProject.ext.android.MINSDK 61 | targetSdkVersion flutter.targetSdkVersion 62 | versionCode rootProject.ext.android.VERSIONCODE 63 | versionName flutterVersionName 64 | } 65 | 66 | buildTypes { 67 | release { 68 | minifyEnabled true 69 | signingConfig signingConfigs.release 70 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 71 | } 72 | } 73 | } 74 | 75 | flutter { 76 | source '../..' 77 | } 78 | 79 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -keep class com.compdfkit.ui.** {*;} 23 | -keep class com.compdfkit.core.** {*;} 24 | -keep class com.compdfkit.tools.** {*;} 25 | -keep interface com.compdfkit.tools.**{*;} 26 | -keep class org.xmlpull.v1.** { *; } 27 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/compdfkit/flutter/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | */ 9 | 10 | package com.compdfkit.flutter.example; 11 | 12 | import android.os.Bundle; 13 | 14 | import androidx.annotation.Nullable; 15 | 16 | import io.flutter.embedding.android.FlutterFragmentActivity; 17 | 18 | public class MainActivity extends FlutterFragmentActivity { 19 | 20 | @Override 21 | protected void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | apply from: "config.gradle" 8 | 9 | rootProject.buildDir = '../build' 10 | subprojects { 11 | project.buildDir = "${rootProject.buildDir}/${project.name}" 12 | } 13 | subprojects { 14 | project.evaluationDependsOn(':app') 15 | } 16 | 17 | tasks.register("clean", Delete) { 18 | delete rootProject.buildDir 19 | } 20 | -------------------------------------------------------------------------------- /example/android/config.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | android = [ 3 | COMPILESDK: 33, 4 | MINSDK: 21, 5 | TARGETSDK: 33, 6 | VERSIONCODE: 16 7 | ] 8 | } -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | Keystore.properties=./key.properties 2 | org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError 3 | android.useAndroidX=true 4 | android.enableJetifier=true -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | } 19 | 20 | plugins { 21 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 22 | id "com.android.application" version '8.7.0' apply false 23 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 24 | } 25 | 26 | include ":app" 27 | -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-Black.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-BlackItalic.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-Bold.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-BoldItalic.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-Italic.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-Light.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-LightItalic.ttf -------------------------------------------------------------------------------- /example/extraFonts/Merriweather-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/extraFonts/Merriweather-Regular.ttf -------------------------------------------------------------------------------- /example/images/ic_home_viewer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/images/ic_syasarrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /example/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/images/logo.png -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | # pod "ComPDFKit", podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit/2.4.0.podspec' 35 | # pod "ComPDFKit_Tools", podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit_tools/2.4.0.podspec' 36 | pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.0' 37 | pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.4.0' 38 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 39 | target 'RunnerTests' do 40 | inherit! :search_paths 41 | end 42 | end 43 | 44 | post_install do |installer| 45 | installer.pods_project.targets.each do |target| 46 | flutter_additional_ios_build_settings(target) 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "icon-20@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "icon-20@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "icon-29.png", 17 | "idiom" : "iphone", 18 | "scale" : "1x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "icon-29@2x.png", 23 | "idiom" : "iphone", 24 | "scale" : "2x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "icon-29@3x.png", 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "29x29" 32 | }, 33 | { 34 | "filename" : "icon-40@2x.png", 35 | "idiom" : "iphone", 36 | "scale" : "2x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "icon-40@3x.png", 41 | "idiom" : "iphone", 42 | "scale" : "3x", 43 | "size" : "40x40" 44 | }, 45 | { 46 | "filename" : "icon-57.png", 47 | "idiom" : "iphone", 48 | "scale" : "1x", 49 | "size" : "57x57" 50 | }, 51 | { 52 | "filename" : "icon-57@2x.png", 53 | "idiom" : "iphone", 54 | "scale" : "2x", 55 | "size" : "57x57" 56 | }, 57 | { 58 | "filename" : "icon-60@2x.png", 59 | "idiom" : "iphone", 60 | "scale" : "2x", 61 | "size" : "60x60" 62 | }, 63 | { 64 | "filename" : "icon-60@3x.png", 65 | "idiom" : "iphone", 66 | "scale" : "3x", 67 | "size" : "60x60" 68 | }, 69 | { 70 | "filename" : "icon-20-ipad.png", 71 | "idiom" : "ipad", 72 | "scale" : "1x", 73 | "size" : "20x20" 74 | }, 75 | { 76 | "filename" : "icon-20@2x-ipad.png", 77 | "idiom" : "ipad", 78 | "scale" : "2x", 79 | "size" : "20x20" 80 | }, 81 | { 82 | "filename" : "icon-29-ipad.png", 83 | "idiom" : "ipad", 84 | "scale" : "1x", 85 | "size" : "29x29" 86 | }, 87 | { 88 | "filename" : "icon-29@2x-ipad.png", 89 | "idiom" : "ipad", 90 | "scale" : "2x", 91 | "size" : "29x29" 92 | }, 93 | { 94 | "filename" : "icon-40.png", 95 | "idiom" : "ipad", 96 | "scale" : "1x", 97 | "size" : "40x40" 98 | }, 99 | { 100 | "filename" : "icon-40@2x.png", 101 | "idiom" : "ipad", 102 | "scale" : "2x", 103 | "size" : "40x40" 104 | }, 105 | { 106 | "filename" : "icon-50.png", 107 | "idiom" : "ipad", 108 | "scale" : "1x", 109 | "size" : "50x50" 110 | }, 111 | { 112 | "filename" : "icon-50@2x.png", 113 | "idiom" : "ipad", 114 | "scale" : "2x", 115 | "size" : "50x50" 116 | }, 117 | { 118 | "filename" : "icon-72.png", 119 | "idiom" : "ipad", 120 | "scale" : "1x", 121 | "size" : "72x72" 122 | }, 123 | { 124 | "filename" : "icon-72@2x.png", 125 | "idiom" : "ipad", 126 | "scale" : "2x", 127 | "size" : "72x72" 128 | }, 129 | { 130 | "filename" : "icon-76.png", 131 | "idiom" : "ipad", 132 | "scale" : "1x", 133 | "size" : "76x76" 134 | }, 135 | { 136 | "filename" : "icon-76@2x.png", 137 | "idiom" : "ipad", 138 | "scale" : "2x", 139 | "size" : "76x76" 140 | }, 141 | { 142 | "filename" : "icon-83.5@2x.png", 143 | "idiom" : "ipad", 144 | "scale" : "2x", 145 | "size" : "83.5x83.5" 146 | }, 147 | { 148 | "filename" : "icon-1024.png", 149 | "idiom" : "ios-marketing", 150 | "scale" : "1x", 151 | "size" : "1024x1024" 152 | } 153 | ], 154 | "info" : { 155 | "author" : "xcode", 156 | "version" : 1 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20-ipad.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x-ipad.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29-ipad.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x-ipad.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-57.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | ComPDFKit_flutter 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | compdfkit_flutter_example 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | NSAppTransportSecurity 30 | 31 | NSAllowsArbitraryLoads 32 | 33 | NSExceptionDomains 34 | 35 | test-store.kdan.cn 36 | 37 | NSIncludesSubdomains 38 | 39 | NSTemporaryExceptionAllowsInsecureHTTPLoads 40 | 41 | 42 | 43 | 44 | NSBluetoothPeripheralUsageDescription 45 | Your consent is required before you could access the function. 46 | NSCameraUsageDescription 47 | Your consent is required before you could access the function. 48 | NSContactsUsageDescription 49 | Your consent is required before you could access the function. 50 | NSLocationAlwaysUsageDescription 51 | Your consent is required before you could access the function. 52 | NSLocationWhenInUseUsageDescription 53 | Your consent is required before you could access the function. 54 | NSMicrophoneUsageDescription 55 | Your consent is required before you could access the function. 56 | NSPhotoLibraryAddUsageDescription 57 | Enable camera access so that you can create scans with your camera. 58 | NSPhotoLibraryUsageDescription 59 | Your consent is required before you could access the function. 60 | UIApplicationSupportsIndirectInputEvents 61 | 62 | UIBackgroundModes 63 | 64 | fetch 65 | remote-notification 66 | 67 | UILaunchStoryboardName 68 | LaunchScreen 69 | UIMainStoryboardFile 70 | Main 71 | UISupportedInterfaceOrientations 72 | 73 | UIInterfaceOrientationPortrait 74 | UIInterfaceOrientationLandscapeLeft 75 | UIInterfaceOrientationLandscapeRight 76 | 77 | UISupportedInterfaceOrientations~ipad 78 | 79 | UIInterfaceOrientationPortrait 80 | UIInterfaceOrientationPortraitUpsideDown 81 | UIInterfaceOrientationLandscapeLeft 82 | UIInterfaceOrientationLandscapeRight 83 | 84 | UISupportsDocumentBrowser 85 | 86 | UIViewControllerBasedStatusBarAppearance 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/zh-Hans.lproj/LaunchScreen.strings: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example/ios/Runner/zh-Hans.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | @testable import compdfkit_flutter 6 | 7 | // This demonstrates a simple unit test of the Swift portion of this plugin's implementation. 8 | // 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | 11 | class RunnerTests: XCTestCase { 12 | 13 | func testGetPlatformVersion() { 14 | let plugin = CompdfkitFlutterPlugin() 15 | 16 | let call = FlutterMethodCall(methodName: "getPlatformVersion", arguments: []) 17 | 18 | let resultExpectation = expectation(description: "result block must be called.") 19 | plugin.handle(call) { result in 20 | XCTAssertEqual(result as! String, "iOS " + UIDevice.current.systemVersion) 21 | resultExpectation.fulfill() 22 | } 23 | waitForExpectations(timeout: 1) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /example/lib/cpdf_dark_theme_example.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart'; 9 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 10 | import 'package:compdfkit_flutter_example/cpdf_reader_page.dart'; 11 | import 'package:flutter/material.dart'; 12 | 13 | class CPDFDarkThemeExample extends StatelessWidget { 14 | final String documentPath; 15 | 16 | const CPDFDarkThemeExample({super.key, required this.documentPath}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return CPDFReaderPage( 21 | title: 'Dark Theme Example', 22 | documentPath: documentPath, 23 | configuration: CPDFConfiguration( 24 | toolbarConfig: const CPDFToolbarConfig( 25 | iosLeftBarAvailableActions: [CPDFToolbarAction.thumbnail]), 26 | globalConfig: 27 | const CPDFGlobalConfig(themeMode: CPDFThemeMode.dark))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /example/lib/cpdf_document_examples.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'package:compdfkit_flutter_example/examples.dart'; 12 | import 'package:compdfkit_flutter_example/examples/cpdf_document_open_pdf_example.dart'; 13 | import 'package:flutter/material.dart'; 14 | 15 | import 'examples/cpdf_document_annotation_example.dart'; 16 | import 'examples/cpdf_document_widget_example.dart'; 17 | 18 | class CPDFDocumentExamples extends StatelessWidget { 19 | const CPDFDocumentExamples({super.key}); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Scaffold( 24 | appBar: AppBar( 25 | leading: IconButton( 26 | onPressed: () { 27 | Navigator.pop(context); 28 | }, 29 | icon: const Icon(Icons.arrow_back)), 30 | title: const Text('CPDFDocument Examples'), 31 | ), 32 | body: ListView.builder( 33 | itemCount: examples(context).length, 34 | itemBuilder: (context, index) { 35 | return examples(context)[index]; 36 | })); 37 | } 38 | 39 | List examples(BuildContext context) => [ 40 | ListTile( 41 | title: const Text('OpenEncryptPDFTest'), 42 | onTap: () { 43 | goTo(const CPDFDocumentOpenPDFExample(), context); 44 | }, 45 | ), 46 | ListTile( 47 | title: const Text('AnnotationsTest'), 48 | onTap: () { 49 | goTo(const CPDFDocumentAnnotationExample(), context); 50 | }, 51 | ), 52 | ListTile( 53 | title: const Text('WidgetsTest'), 54 | onTap: () { 55 | goTo(const CPDFDocumentWidgetExample(), context); 56 | }, 57 | ) 58 | ]; 59 | } 60 | -------------------------------------------------------------------------------- /example/lib/cpdf_pages_example.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'package:compdfkit_flutter/compdfkit.dart'; 9 | import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart'; 10 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 11 | import 'package:compdfkit_flutter/page/cpdf_page.dart'; 12 | import 'package:compdfkit_flutter/widgets/cpdf_reader_widget_controller.dart'; 13 | import 'package:compdfkit_flutter_example/cpdf_reader_page.dart'; 14 | import 'package:flutter/material.dart'; 15 | 16 | class CPDFPagesExample extends StatelessWidget { 17 | final String documentPath; 18 | 19 | const CPDFPagesExample({super.key, required this.documentPath}); 20 | 21 | static const _actions = [ 22 | 'Save', 23 | 'Import Document', 24 | 'Insert Blank Page', 25 | 'Split Document' 26 | ]; 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return CPDFReaderPage( 31 | title: 'Pages Example', 32 | documentPath: documentPath, 33 | configuration: CPDFConfiguration( 34 | toolbarConfig: const CPDFToolbarConfig( 35 | iosLeftBarAvailableActions: [CPDFToolbarAction.thumbnail])), 36 | appBarActions: (controller) => [ 37 | PopupMenuButton( 38 | onSelected: (value) => 39 | _handleAction(context, value, controller), 40 | itemBuilder: (context) => _actions.map((action) { 41 | return PopupMenuItem(value: action, child: Text(action)); 42 | }).toList(), 43 | ), 44 | ]); 45 | } 46 | 47 | void _handleAction(BuildContext context, String value, 48 | CPDFReaderWidgetController controller) async { 49 | switch (value) { 50 | case 'Save': 51 | bool saveResult = await controller.document.save(); 52 | debugPrint('ComPDFKit:save():$saveResult'); 53 | break; 54 | case 'Import Document': 55 | String? path = await ComPDFKit.pickFile(); 56 | if (path != null) { 57 | bool importResult = await controller.document.importDocument( 58 | filePath: path, pages: [0], insertPosition: 0); 59 | debugPrint('ComPDFKit:importDocument():$importResult'); 60 | } 61 | break; 62 | case 'Insert Blank Page': 63 | bool insertResult = await controller.document.insertBlankPage( 64 | pageIndex: 0, pageSize: CPDFPageSize.a4); 65 | debugPrint('ComPDFKit:insertBlankPage():$insertResult'); 66 | break; 67 | case 'Split Document': 68 | List pages = [0]; 69 | 70 | final tempDir = await ComPDFKit.getTemporaryDirectory(); 71 | 72 | String fileNameNoExtension = await controller.document 73 | .getFileName() 74 | .then( 75 | (fileName) => fileName.substring(0, fileName.lastIndexOf('.'))); 76 | 77 | String fileName = '${fileNameNoExtension}_(${pages.join(',')}).pdf'; 78 | String savePath = '${tempDir.path}/$fileName'; 79 | 80 | debugPrint('ComPDFKit:splitDocumentPages() fileName :$fileName'); 81 | debugPrint('ComPDFKit:splitDocumentPages() savePath :$savePath'); 82 | bool splitResult = 83 | await controller.document.splitDocumentPages(savePath, pages); 84 | debugPrint('ComPDFKit:splitDocumentPages():$splitResult'); 85 | if(splitResult){ 86 | ComPDFKit.openDocument(savePath); 87 | } 88 | break; 89 | default: 90 | break; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /example/lib/cpdf_reader_page.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'package:flutter/material.dart'; 12 | import 'package:compdfkit_flutter/widgets/cpdf_reader_widget.dart'; 13 | import 'package:compdfkit_flutter/widgets/cpdf_reader_widget_controller.dart'; 14 | import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart'; 15 | 16 | class CPDFReaderPage extends StatefulWidget { 17 | final String title; 18 | final String documentPath; 19 | final CPDFConfiguration configuration; 20 | final String password; 21 | final void Function(CPDFReaderWidgetController controller)? onCreated; 22 | final void Function(int pageIndex)? onPageChanged; 23 | final void Function()? onSaveCallback; 24 | final void Function(bool isFillScreen)? onFillScreenChanged; 25 | final void Function()? onIOSClickBackPressed; 26 | final List Function(CPDFReaderWidgetController controller)? appBarActions; 27 | 28 | const CPDFReaderPage({ 29 | super.key, 30 | required this.title, 31 | required this.documentPath, 32 | required this.configuration, 33 | this.password = '', 34 | this.onCreated, 35 | this.appBarActions, 36 | this.onPageChanged, 37 | this.onSaveCallback, 38 | this.onFillScreenChanged, 39 | this.onIOSClickBackPressed 40 | }); 41 | 42 | @override 43 | State createState() => _CPDFReaderPageState(); 44 | } 45 | 46 | class _CPDFReaderPageState extends State { 47 | CPDFReaderWidgetController? _controller; 48 | bool _showPDFReader = false; 49 | 50 | @override 51 | void initState() { 52 | super.initState(); 53 | Future.delayed(const Duration(milliseconds: 350), () { 54 | if (mounted) { 55 | setState(() { 56 | _showPDFReader = true; 57 | }); 58 | } 59 | }); 60 | } 61 | 62 | @override 63 | Widget build(BuildContext context) { 64 | return Scaffold( 65 | resizeToAvoidBottomInset: false, 66 | appBar: AppBar( 67 | title: Text(widget.title), 68 | leading: IconButton( 69 | icon: const Icon(Icons.arrow_back), 70 | onPressed: () async { 71 | if (_controller != null) { 72 | bool saveResult = await _controller!.document.save(); 73 | debugPrint('ComPDFKit: saveResult: $saveResult'); 74 | } 75 | if (context.mounted) { 76 | Navigator.pop(context); 77 | } 78 | }, 79 | ), 80 | actions: _controller == null 81 | ? null 82 | : widget.appBarActions?.call(_controller!) ?? [], 83 | ), 84 | body: AnimatedSwitcher( 85 | duration: const Duration(milliseconds: 300), 86 | child: _showPDFReader 87 | ? _buildPDFReader() 88 | : _buildPlaceholder(), 89 | ) 90 | ); 91 | } 92 | 93 | Widget _buildPDFReader(){ 94 | return CPDFReaderWidget( 95 | document: widget.documentPath, 96 | password: widget.password, 97 | configuration: widget.configuration, 98 | onCreated: (controller) { 99 | setState(() { 100 | _controller = controller; 101 | }); 102 | widget.onCreated?.call(controller); 103 | }, 104 | onPageChanged: widget.onPageChanged, 105 | onSaveCallback: widget.onSaveCallback, 106 | onFillScreenChanged: widget.onFillScreenChanged, 107 | onIOSClickBackPressed: widget.onIOSClickBackPressed, 108 | onPageEditDialogBackPress: () { 109 | debugPrint('CPDFReaderWidget: onPageEditDialogBackPress'); 110 | }, 111 | ); 112 | } 113 | 114 | Widget _buildPlaceholder(){ 115 | return const Center(); 116 | } 117 | } -------------------------------------------------------------------------------- /example/lib/cpdf_reader_widget_example.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart'; 9 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 10 | import 'package:flutter/material.dart'; 11 | 12 | import 'cpdf_reader_page.dart'; 13 | class CPDFReaderWidgetExample extends StatelessWidget { 14 | final String documentPath; 15 | 16 | const CPDFReaderWidgetExample({super.key, required this.documentPath}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return CPDFReaderPage( 21 | title: 'CPDFReaderWidget Example', 22 | documentPath: documentPath, 23 | configuration: CPDFConfiguration( 24 | toolbarConfig: const CPDFToolbarConfig( 25 | iosLeftBarAvailableActions: [CPDFToolbarAction.thumbnail], 26 | ), 27 | ), 28 | ); 29 | } 30 | } -------------------------------------------------------------------------------- /example/lib/cpdf_widgets_example.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:io'; 9 | 10 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 11 | import 'package:compdfkit_flutter/compdfkit.dart'; 12 | import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart'; 13 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 14 | import 'package:compdfkit_flutter/page/cpdf_page.dart'; 15 | import 'package:compdfkit_flutter/widgets/cpdf_reader_widget_controller.dart'; 16 | import 'package:compdfkit_flutter_example/cpdf_reader_page.dart'; 17 | import 'package:compdfkit_flutter_example/page/cpdf_widget_list_page.dart'; 18 | import 'package:compdfkit_flutter_example/utils/file_util.dart'; 19 | import 'package:flutter/material.dart'; 20 | 21 | class CPDFWidgetsExample extends StatelessWidget { 22 | final String documentPath; 23 | 24 | const CPDFWidgetsExample({super.key, required this.documentPath}); 25 | 26 | static const _actions = [ 27 | 'Open Document', 28 | 'Import Widgets', 29 | 'Export Widgets', 30 | 'Get Widgets' 31 | ]; 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return CPDFReaderPage( 36 | title: 'Widgets Example', 37 | documentPath: documentPath, 38 | configuration: CPDFConfiguration( 39 | toolbarConfig: const CPDFToolbarConfig( 40 | iosLeftBarAvailableActions: [ 41 | CPDFToolbarAction.thumbnail 42 | ] 43 | ) 44 | ), 45 | appBarActions: (controller) => [ 46 | PopupMenuButton( 47 | onSelected: (value) => 48 | _handleAction(context, value, controller), 49 | itemBuilder: (context) => _actions.map((action) { 50 | return PopupMenuItem(value: action, child: Text(action)); 51 | }).toList(), 52 | ), 53 | ]); 54 | } 55 | 56 | void _handleAction(BuildContext context, String value, 57 | CPDFReaderWidgetController controller) async { 58 | switch (value) { 59 | case 'Open Document': 60 | String? path = await ComPDFKit.pickFile(); 61 | if (path != null) { 62 | var document = controller.document; 63 | var error = await document.open(path); 64 | debugPrint('ComPDFKit:Document: open:$error'); 65 | } 66 | break; 67 | case 'Import Widgets': 68 | File xfdfFile = await extractAsset( 69 | context, 'pdfs/annot_test_widgets.xfdf', 70 | shouldOverwrite: false); 71 | bool importResult = 72 | await controller.document.importWidgets(xfdfFile.path); 73 | debugPrint('ComPDFKit:Document: importWidgets:$importResult'); 74 | break; 75 | case 'Export Widgets': 76 | String xfdfPath = await controller.document.exportWidgets(); 77 | debugPrint('ComPDFKit:Document: exportWidgets:$xfdfPath'); 78 | break; 79 | case 'Get Widgets': 80 | int pageCount = await controller.document.getPageCount(); 81 | List widgets = []; 82 | for(int i = 0; i < pageCount; i++){ 83 | CPDFPage page = controller.document.pageAtIndex(i); 84 | var pageWidgets = await page.getWidgets(); 85 | widgets.addAll(pageWidgets); 86 | } 87 | if (context.mounted) { 88 | Map data = await showModalBottomSheet( 89 | context: context, 90 | builder: (context) => 91 | CpdfWidgetListPage(widgets: widgets)); 92 | String type = data['type']; 93 | CPDFWidget widget = data['widget']; 94 | if (type == 'jump') { 95 | await controller.setDisplayPageIndex(widget.page); 96 | } else if (type == 'remove') { 97 | CPDFPage page = controller.document.pageAtIndex(widget.page); 98 | bool result = await page.removeWidget(widget); 99 | debugPrint('ComPDFKit:Document: removeWidget:$result'); 100 | } 101 | } 102 | break; 103 | default: 104 | break; 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /example/lib/page/cpdf_reader_widget_switch_preview_mode_page.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 11 | import 'package:flutter/material.dart'; 12 | 13 | class CpdfReaderWidgetSwitchPreviewModePage extends StatefulWidget { 14 | final CPDFViewMode viewMode; 15 | 16 | const CpdfReaderWidgetSwitchPreviewModePage( 17 | {super.key, required this.viewMode}); 18 | 19 | @override 20 | State createState() => 21 | _CpdfReaderWidgetSwitchPreviewModePageState(); 22 | } 23 | 24 | class _CpdfReaderWidgetSwitchPreviewModePageState 25 | extends State { 26 | @override 27 | void initState() { 28 | super.initState(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | var textStyle = Theme.of(context).textTheme.labelLarge; 34 | return SizedBox( 35 | height: 336, 36 | width: double.infinity, 37 | child: Column( 38 | children: [ 39 | SizedBox( 40 | width: double.infinity, 41 | height: 56, 42 | child: Stack( 43 | alignment: Alignment.center, 44 | children: [ 45 | Text('Mode', style: Theme.of(context).textTheme.titleMedium), 46 | Positioned( 47 | right: 16, 48 | child: IconButton( 49 | onPressed: () { 50 | Navigator.pop(context); 51 | }, 52 | icon: const Icon(Icons.close))) 53 | ], 54 | ), 55 | ), 56 | Expanded( 57 | child: ListView.builder( 58 | itemCount: CPDFViewMode.values.length, 59 | itemBuilder: (context, index) { 60 | CPDFViewMode mode = CPDFViewMode.values[index]; 61 | return ListTile( 62 | onTap: () async { 63 | Navigator.pop(context, mode); 64 | }, 65 | title: Text(mode.name, style: textStyle), 66 | trailing: widget.viewMode == mode 67 | ? const Icon(Icons.check) 68 | : null); 69 | })) 70 | ], 71 | )); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /example/lib/theme/themes.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter/services.dart'; 10 | 11 | final ThemeData lightTheme = ThemeData( 12 | useMaterial3: true, 13 | brightness: Brightness.light, 14 | colorScheme: const ColorScheme.light( 15 | primary: Colors.blue, 16 | onPrimary: Color(0xFF43474D), 17 | onSecondary: Color(0xFF666666)), 18 | textTheme: const TextTheme( 19 | bodyMedium: TextStyle(), 20 | bodyLarge: TextStyle(), 21 | bodySmall: TextStyle(), 22 | titleMedium: TextStyle()) 23 | .apply( 24 | displayColor: const Color(0xFF43474D), 25 | bodyColor: const Color(0xFF43474D)), 26 | appBarTheme: const AppBarTheme( 27 | elevation: 4.0, 28 | titleTextStyle: TextStyle( 29 | fontSize: 18, 30 | fontWeight: FontWeight.bold, 31 | color: Color(0xFF43474D)), 32 | backgroundColor: Color(0xFFFAFCFF), 33 | foregroundColor: Color(0xFF43474D), 34 | systemOverlayStyle: 35 | SystemUiOverlayStyle(systemNavigationBarColor: Color(0xFFFFFFFF))), 36 | elevatedButtonTheme: ElevatedButtonThemeData( 37 | style: ElevatedButton.styleFrom(foregroundColor: Colors.blue)), 38 | switchTheme: SwitchThemeData( 39 | thumbColor: WidgetStateProperty.resolveWith((status) { 40 | if (status.contains(WidgetState.selected)) { 41 | return Colors.blue; 42 | } 43 | return Colors.grey.shade400; 44 | }), 45 | trackColor: WidgetStateProperty.resolveWith((status) { 46 | if (status.contains(WidgetState.selected)) { 47 | return Colors.blue.shade50; 48 | } 49 | return Colors.grey.shade100; 50 | }), 51 | trackOutlineColor: WidgetStateProperty.resolveWith((status) { 52 | if (status.contains(WidgetState.selected)) { 53 | return Colors.blue.shade50; 54 | } 55 | return Colors.grey.shade100; 56 | }), 57 | )); 58 | 59 | final ThemeData darkTheme = ThemeData( 60 | useMaterial3: true, 61 | brightness: Brightness.dark, 62 | scaffoldBackgroundColor: Colors.black, 63 | colorScheme: const ColorScheme.dark( 64 | primary: Colors.blue, 65 | surface: Color(0xFF222429), 66 | onPrimary: Colors.white, 67 | onSecondary: Colors.white), 68 | textTheme: const TextTheme( 69 | bodyMedium: TextStyle(), 70 | bodyLarge: TextStyle(), 71 | bodySmall: TextStyle(), 72 | titleMedium: TextStyle()) 73 | .apply(displayColor: Colors.white, bodyColor: Colors.white), 74 | appBarTheme: const AppBarTheme( 75 | elevation: 2.0, 76 | titleTextStyle: TextStyle( 77 | fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), 78 | backgroundColor: Color(0xFF222429), 79 | foregroundColor: Colors.white, 80 | systemOverlayStyle: 81 | SystemUiOverlayStyle(systemNavigationBarColor: Color(0xFF222429))), 82 | elevatedButtonTheme: ElevatedButtonThemeData( 83 | style: ElevatedButton.styleFrom(foregroundColor: Colors.blue)), 84 | switchTheme: SwitchThemeData( 85 | thumbColor: WidgetStateProperty.resolveWith((status) { 86 | if (status.contains(WidgetState.selected)) { 87 | return Colors.blue; 88 | } 89 | return Colors.grey.shade400; 90 | }), 91 | trackColor: WidgetStateProperty.resolveWith((status) { 92 | if (status.contains(WidgetState.selected)) { 93 | return Colors.blue.shade50; 94 | } 95 | return Colors.grey.shade100; 96 | }), 97 | trackOutlineColor: WidgetStateProperty.resolveWith((status) { 98 | if (status.contains(WidgetState.selected)) { 99 | return Colors.blue.shade50; 100 | } 101 | return Colors.grey.shade100; 102 | }), 103 | )); 104 | -------------------------------------------------------------------------------- /example/lib/utils/file_util.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:convert'; 9 | import 'dart:io'; 10 | 11 | import 'package:compdfkit_flutter/compdfkit.dart'; 12 | import 'package:flutter/foundation.dart'; 13 | import 'package:flutter/material.dart'; 14 | import 'package:flutter/services.dart'; 15 | 16 | Future extractAsset(BuildContext context, String assetPath, 17 | {bool shouldOverwrite = false, String prefix = ''}) async { 18 | final bytes = await DefaultAssetBundle.of(context).load(assetPath); 19 | final list = bytes.buffer.asUint8List(); 20 | 21 | final tempDir = await ComPDFKit.getTemporaryDirectory(); 22 | final tempDocumentPath = '${tempDir.path}/$prefix$assetPath'; 23 | final file = File(tempDocumentPath); 24 | 25 | if (shouldOverwrite || !file.existsSync()) { 26 | await file.create(recursive: true); 27 | file.writeAsBytesSync(list); 28 | } 29 | return file; 30 | } 31 | 32 | Future extractAssetFolder(BuildContext context, String folder) async { 33 | final tempDir = await ComPDFKit.getTemporaryDirectory(); 34 | final assetPaths = await getAssetPaths(folder); 35 | for (var path in assetPaths) { 36 | if (context.mounted) { 37 | await extractAsset(context, path); 38 | } 39 | } 40 | String dir = '${tempDir.path}/$folder'; 41 | debugPrint('ComPDFKit-fontDir: $dir'); 42 | return dir; 43 | } 44 | 45 | Future> getAssetPaths(String folderPath) async { 46 | final manifestJson = await rootBundle.loadString('AssetManifest.json'); 47 | final Map manifestMap = json.decode(manifestJson); 48 | final assetPaths = 49 | manifestMap.keys.where((key) => key.startsWith(folderPath)).toList(); 50 | return assetPaths; 51 | } 52 | 53 | void printJsonString(String jsonStr) { 54 | try { 55 | final dynamic jsonData = json.decode(jsonStr); 56 | const JsonEncoder encoder = JsonEncoder.withIndent(' '); 57 | final String prettyJson = encoder.convert(jsonData); 58 | _printLongText(prettyJson); 59 | } catch (e) { 60 | if (kDebugMode) { 61 | print('Invalid JSON: $e'); 62 | } 63 | } 64 | } 65 | 66 | void _printLongText(String text, {int chunkSize = 800}) { 67 | final pattern = RegExp('.{1,$chunkSize}', dotAll: true); 68 | for (final match in pattern.allMatches(text)) { 69 | if (kDebugMode) { 70 | print(match.group(0)); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /example/lib/widgets/cpdf_app_bar.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter_svg/svg.dart'; 12 | 13 | import '../page/settings_page.dart'; 14 | 15 | class CAppBar extends StatelessWidget implements PreferredSizeWidget { 16 | const CAppBar({super.key}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return AppBar( 21 | title: const Text('ComPDFKit SDK for Flutter'), 22 | actions: [ 23 | IconButton( 24 | padding: const EdgeInsets.all(16), 25 | onPressed: () { 26 | Navigator.push(context, MaterialPageRoute(builder: (context) { 27 | return const SettingsPage(); 28 | })); 29 | }, 30 | icon: SvgPicture.asset( 31 | 'images/ic_home_setting.svg', 32 | width: 24, 33 | height: 24, 34 | colorFilter: ColorFilter.mode( 35 | Theme.of(context).colorScheme.onPrimary, BlendMode.srcIn), 36 | )) 37 | ], 38 | ); 39 | } 40 | 41 | @override 42 | Size get preferredSize => const Size(double.infinity, 56); 43 | } 44 | -------------------------------------------------------------------------------- /example/lib/widgets/cpdf_fun_item.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_svg/flutter_svg.dart'; 10 | 11 | class FeatureItem extends StatelessWidget { 12 | final String title; 13 | 14 | final String description; 15 | 16 | final GestureTapCallback onTap; 17 | 18 | const FeatureItem( 19 | {super.key, 20 | required this.title, 21 | required this.description, 22 | required this.onTap}); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Ink( 27 | child: InkWell( 28 | borderRadius: BorderRadius.circular(8), 29 | onTap: onTap, 30 | child: Padding( 31 | padding: const EdgeInsets.symmetric(vertical: 12), 32 | child: Row( 33 | mainAxisSize: MainAxisSize.min, 34 | children: [ 35 | SvgPicture.asset( 36 | 'images/ic_home_viewer.svg', 37 | width: 38, 38 | height: 38, 39 | ), 40 | const Padding(padding: EdgeInsets.only(left: 8.0)), 41 | Expanded( 42 | child: Column( 43 | crossAxisAlignment: CrossAxisAlignment.start, 44 | children: [ 45 | Text(title, style: Theme.of(context).textTheme.titleSmall), 46 | Text( 47 | description, 48 | style: const TextStyle(fontSize: 12.0), 49 | ) 50 | ], 51 | )), 52 | SvgPicture.asset( 53 | 'images/ic_syasarrow.svg', 54 | width: 24, 55 | height: 24, 56 | colorFilter: ColorFilter.mode( 57 | Theme.of(context).colorScheme.onPrimary, BlendMode.srcIn), 58 | ) 59 | ], 60 | )), 61 | ), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /example/pdfs/PDF_Document.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/pdfs/PDF_Document.pdf -------------------------------------------------------------------------------- /example/pdfs/Password_compdfkit_Security_Sample_File.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/pdfs/Password_compdfkit_Security_Sample_File.pdf -------------------------------------------------------------------------------- /example/pdfs/annot_test.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/example/pdfs/annot_test.pdf -------------------------------------------------------------------------------- /example/pdfs/annot_test_widgets.xfdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello ComPDFKit 6 | 7 | 8 | Off 9 | 10 | 11 | Off 12 | 13 | 14 | Flutter 15 | 16 | 17 | C-Android 18 | 19 | 20 | Button_2025-03-03 10:19:57 5474 21 | 22 | 23 | Signature__2025-03-07 11:11:15.564 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: compdfkit_flutter_example 2 | description: Demonstrates how to use the compdfkit_flutter plugin. 3 | version: 2.4.0+1 4 | homepage: https://www.compdf.com 5 | repository: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter 6 | issue_tracker: https://www.compdf.com/support 7 | documentation: https://www.compdf.com/guides/pdf-sdk/flutter/overview 8 | publish_to: 'none' 9 | environment: 10 | sdk: '>=3.0.5 <4.0.0' 11 | 12 | # Dependencies specify other packages that your package needs in order to work. 13 | # To automatically upgrade your package dependencies to the latest versions 14 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 15 | # dependencies can be manually updated by changing the version numbers below to 16 | # the latest version available on pub.dev. To see which dependencies have newer 17 | # versions available, run `flutter pub outdated`. 18 | dependencies: 19 | flutter: 20 | sdk: flutter 21 | 22 | compdfkit_flutter: 23 | path: ../ 24 | 25 | # The following adds the Cupertino Icons font to your application. 26 | # Use with the CupertinoIcons class for iOS style icons. 27 | cupertino_icons: ^1.0.2 28 | flutter_svg: ^2.0.9 29 | file_picker: ^8.0.3 30 | url_launcher: ^6.2.3 31 | flutter_localizations: 32 | sdk: flutter 33 | 34 | 35 | 36 | dev_dependencies: 37 | integration_test: 38 | sdk: flutter 39 | flutter_test: 40 | sdk: flutter 41 | 42 | # The "flutter_lints" package below contains a set of recommended lints to 43 | # encourage good coding practices. The lint set provided by the package is 44 | # activated in the `analysis_options.yaml` file located at the root of your 45 | # package. See that file for information about deactivating specific lint 46 | # rules and activating additional ones. 47 | flutter_lints: ^4.0.0 48 | 49 | # For information on the generic Dart part of this file, see the 50 | # following page: https://dart.dev/tools/pub/pubspec 51 | 52 | # The following section is specific to Flutter packages. 53 | flutter: 54 | 55 | # The following line ensures that the Material Icons font is 56 | # included with your application, so that you can use the icons in 57 | # the material Icons class. 58 | uses-material-design: true 59 | generate: true 60 | assets: 61 | - pdfs/ 62 | - images/ 63 | - extraFonts/ 64 | # To add assets to your application, add an assets section, like this: 65 | # assets: 66 | # - images/a_dot_burr.jpeg 67 | # - images/a_dot_ham.jpeg 68 | 69 | # An image asset can refer to one or more resolution-specific "variants", see 70 | # https://flutter.dev/assets-and-images/#resolution-aware 71 | 72 | # For details regarding adding assets from package dependencies, see 73 | # https://flutter.dev/assets-and-images/#from-packages 74 | 75 | # To add custom fonts to your application, add a fonts section here, 76 | # in this "flutter" section. Each entry in this list should have a 77 | # "family" key with the font family name, and a "fonts" key with a 78 | # list giving the asset and other descriptors for the font. For 79 | # example: 80 | # fonts: 81 | # - family: Schyler 82 | # fonts: 83 | # - asset: fonts/Schyler-Regular.ttf 84 | # - asset: fonts/Schyler-Italic.ttf 85 | # style: italic 86 | # - family: Trajan Pro 87 | # fonts: 88 | # - asset: fonts/TrajanPro.ttf 89 | # - asset: fonts/TrajanPro_Bold.ttf 90 | # weight: 700 91 | # 92 | # For details regarding fonts from package dependencies, 93 | # see https://flutter.dev/custom-fonts/#from-packages 94 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:compdfkit_flutter_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => 22 | widget is Text && widget.data!.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/ephemeral/ 38 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/ColorHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ColorHelper.swift 3 | // compdfkit_flutter 4 | // 5 | // Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved. 6 | // 7 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 8 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 9 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 10 | // This notice may not be removed from this file. 11 | 12 | import UIKit 13 | 14 | class ColorHelper { 15 | static func colorWithHexString (hex:String) -> UIColor { 16 | var hexString = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() 17 | 18 | // 检查颜色字符串是否有效 19 | if hexString.hasPrefix("#") { 20 | hexString.remove(at: hexString.startIndex) 21 | } 22 | 23 | // 确保字符串长度是8(包括透明度部分) 24 | if hexString.count == 8 { 25 | var rgba: UInt64 = 0 26 | Scanner(string: hexString).scanHexInt64(&rgba) 27 | 28 | let a = CGFloat((rgba >> 24) & 0xFF) / 255.0 29 | let r = CGFloat((rgba >> 16) & 0xFF) / 255.0 30 | let g = CGFloat((rgba >> 8) & 0xFF) / 255.0 31 | let b = CGFloat(rgba & 0xFF) / 255.0 32 | 33 | return UIColor(red: r, green: g, blue: b, alpha: a) 34 | } else { 35 | // 如果不是合法的8位Hex,返回透明的颜色或其他默认值 36 | return UIColor(white: 0.0, alpha: 0.0) 37 | } 38 | } 39 | } 40 | 41 | extension UIColor { 42 | func toHexString() -> String? { 43 | var red: CGFloat = 0 44 | var green: CGFloat = 0 45 | var blue: CGFloat = 0 46 | var alpha: CGFloat = 0 47 | 48 | guard self.getRed(&red, green: &green, blue: &blue, alpha: &alpha) else { 49 | return nil 50 | } 51 | 52 | let rgb: Int = (Int)(red * 255) << 16 | (Int)(green * 255) << 8 | (Int)(blue * 255) << 0 53 | 54 | return String(format: "#%06x", rgb) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ios/Framework/ComPDFKit.xcframework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AvailableLibraries 6 | 7 | 8 | LibraryIdentifier 9 | ios-arm64_armv7 10 | LibraryPath 11 | ComPDFKit.framework 12 | SupportedArchitectures 13 | 14 | arm64 15 | armv7 16 | 17 | SupportedPlatform 18 | ios 19 | 20 | 21 | LibraryIdentifier 22 | ios-arm64_x86_64-simulator 23 | LibraryPath 24 | ComPDFKit.framework 25 | SupportedPlatform 26 | ios 27 | SupportedArchitectures 28 | 29 | arm64 30 | x86_64 31 | 32 | SupportedPlatformVariant 33 | simulator 34 | 35 | 36 | CFBundlePackageType 37 | XFWK 38 | XCFrameworkFormatVersion 39 | 1.0 40 | 41 | 42 | -------------------------------------------------------------------------------- /ios/compdfkit_flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint compdfkit_flutter.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'compdfkit_flutter' 7 | s.version = '2.4.0' 8 | s.summary = 'Flutter PDF Library by ComPDFKit' 9 | s.description = <<-DESC 10 | A new Flutter plugin project. 11 | DESC 12 | s.homepage = 'https://www.compdf.com' 13 | s.license = { type:'Commercial', file: '../LICENSE' } 14 | s.author = { 'ComPDFKit' => 'compdfkit@gmail.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.dependency("ComPDFKit_Tools") 19 | s.dependency("ComPDFKit") 20 | s.platform = :ios, '11.0' 21 | 22 | # Flutter.framework does not contain a i386 slice. 23 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 24 | s.swift_version = '5.0' 25 | end 26 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:convert'; 9 | 10 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 11 | import 'package:compdfkit_flutter/util/cpdf_rectf.dart'; 12 | 13 | class CPDFAnnotation { 14 | final CPDFAnnotationType type; 15 | 16 | final String title; 17 | 18 | final int page; 19 | 20 | final String content; 21 | 22 | final String uuid; 23 | 24 | final DateTime? createDate; 25 | 26 | final CPDFRectF rect; 27 | 28 | CPDFAnnotation( 29 | {required this.type, 30 | required this.title, 31 | required this.page, 32 | required this.content, 33 | required this.uuid, 34 | this.createDate, 35 | required this.rect}); 36 | 37 | factory CPDFAnnotation.fromJson(Map json) { 38 | return CPDFAnnotation( 39 | type: CPDFAnnotationType.fromString(json['type']), 40 | title: json['title'] ?? '', 41 | page: json['page'] ?? 0, 42 | content: json['content'] ?? '', 43 | uuid: json['uuid'] ?? '', 44 | createDate: json['createDate'] != null 45 | ? DateTime.fromMillisecondsSinceEpoch(json['createDate']) 46 | : null, 47 | rect: CPDFRectF.fromJson(Map.from(json['rect'] ?? {})), 48 | ); 49 | } 50 | 51 | Map toJson() => { 52 | 'type': type.name, 53 | 'title': title, 54 | 'page': page, 55 | 'content': content, 56 | 'uuid': uuid, 57 | 'createDate': createDate?.toString(), 58 | 'rect': rect.toString() 59 | }; 60 | 61 | @override 62 | String toString() => jsonEncode(toJson()); 63 | } 64 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_annotation_registry.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | 9 | import 'package:compdfkit_flutter/annotation/cpdf_circle_annotation.dart'; 10 | import 'package:compdfkit_flutter/annotation/cpdf_freetext_annotation.dart'; 11 | import 'package:compdfkit_flutter/annotation/cpdf_ink_annotation.dart'; 12 | import 'package:compdfkit_flutter/annotation/cpdf_line_annotation.dart'; 13 | import 'package:compdfkit_flutter/annotation/cpdf_link_annotation.dart'; 14 | import 'package:compdfkit_flutter/annotation/cpdf_markup_annotation.dart'; 15 | import 'package:compdfkit_flutter/annotation/cpdf_square_annotation.dart'; 16 | 17 | import '../configuration/cpdf_options.dart'; 18 | import 'cpdf_annotation.dart'; 19 | 20 | typedef CPDFAnnotationFactory = CPDFAnnotation Function(Map json); 21 | 22 | class CPDFAnnotationRegistry { 23 | static final Map _factories = { 24 | CPDFAnnotationType.highlight: (json) => CPDFMarkupAnnotation.fromJson(json), 25 | CPDFAnnotationType.underline: (json) => CPDFMarkupAnnotation.fromJson(json), 26 | CPDFAnnotationType.squiggly: (json) => CPDFMarkupAnnotation.fromJson(json), 27 | CPDFAnnotationType.strikeout: (json) => CPDFMarkupAnnotation.fromJson(json), 28 | CPDFAnnotationType.ink: (json) => CPDFInkAnnotation.fromJson(json), 29 | CPDFAnnotationType.freetext: (json) => CPDFFreeTextAnnotation.fromJson(json), 30 | CPDFAnnotationType.square: (json) => CPDFSquareAnnotation.fromJson(json), 31 | CPDFAnnotationType.circle: (json) => CPDFCircleAnnotations.fromJson(json), 32 | CPDFAnnotationType.line: (json) => CPDFLineAnnotation.fromJson(json), 33 | CPDFAnnotationType.arrow: (json) => CPDFLineAnnotation.fromJson(json), 34 | CPDFAnnotationType.link: (json) => CPDFLinkAnnotation.fromJson(json), 35 | }; 36 | 37 | static CPDFAnnotation fromJson(Map json) { 38 | final type = CPDFAnnotationType.fromString(json['type']); 39 | final factory = _factories[type] ?? CPDFAnnotation.fromJson; 40 | return factory(json); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_circle_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'cpdf_square_annotation.dart'; 9 | 10 | class CPDFCircleAnnotations extends CPDFSquareAnnotation { 11 | CPDFCircleAnnotations({ 12 | required super.type, 13 | required super.title, 14 | required super.page, 15 | required super.content, 16 | required super.uuid, 17 | super.createDate, 18 | required super.rect, 19 | required super.borderWidth, 20 | required super.borderColor, 21 | required super.borderAlpha, 22 | required super.fillColor, 23 | required super.fillAlpha, 24 | required super.effectType, 25 | }); 26 | 27 | factory CPDFCircleAnnotations.fromJson(Map json) { 28 | final square = CPDFSquareAnnotation.fromJson(json); 29 | return CPDFCircleAnnotations( 30 | type: square.type, 31 | title: square.title, 32 | page: square.page, 33 | content: square.content, 34 | uuid: square.uuid, 35 | createDate: square.createDate, 36 | rect: square.rect, 37 | borderWidth: square.borderWidth, 38 | borderColor: square.borderColor, 39 | borderAlpha: square.borderAlpha, 40 | fillColor: square.fillColor, 41 | fillAlpha: square.fillAlpha, 42 | effectType: square.effectType, 43 | ); 44 | } 45 | } -------------------------------------------------------------------------------- /lib/annotation/cpdf_freetext_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | 9 | import 'package:compdfkit_flutter/annotation/cpdf_text_attribute.dart'; 10 | import 'package:compdfkit_flutter/annotation/cpdf_annotation.dart'; 11 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 12 | 13 | import '../util/cpdf_rectf.dart'; 14 | 15 | class CPDFFreeTextAnnotation extends CPDFAnnotation { 16 | final CPDFTextAttribute textAttribute; 17 | 18 | final double alpha; 19 | 20 | final CPDFAlignment alignment; 21 | 22 | CPDFFreeTextAnnotation( 23 | {required CPDFAnnotationType type, 24 | required String title, 25 | required int page, 26 | required String content, 27 | required String uuid, 28 | DateTime? createDate, 29 | required CPDFRectF rect, 30 | required this.textAttribute, 31 | required this.alpha, 32 | required this.alignment}) 33 | : super( 34 | type: type, 35 | title: title, 36 | page: page, 37 | content: content, 38 | uuid: uuid, 39 | createDate: createDate, 40 | rect: rect); 41 | 42 | factory CPDFFreeTextAnnotation.fromJson(Map json) { 43 | final common = CPDFAnnotation.fromJson(json); 44 | return CPDFFreeTextAnnotation( 45 | type: common.type, 46 | title: common.title, 47 | page: common.page, 48 | content: common.content, 49 | uuid: common.uuid, 50 | createDate: common.createDate, 51 | rect: common.rect, 52 | textAttribute: CPDFTextAttribute.fromJson( 53 | Map.from(json['textAttribute'] ?? {})), 54 | alpha: json['alpha'] ?? 255.0, 55 | alignment: CPDFAlignment.fromString(json['alignment']), 56 | ); 57 | } 58 | 59 | @override 60 | Map toJson() { 61 | return { 62 | ...super.toJson(), 63 | 'textAttribute': textAttribute.toJson(), 64 | 'alpha': alpha, 65 | 'alignment': alignment.name, 66 | }; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_ink_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:ui'; 9 | 10 | import 'package:compdfkit_flutter/annotation/cpdf_annotation.dart'; 11 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 12 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 13 | 14 | import '../util/cpdf_rectf.dart'; 15 | 16 | class CPDFInkAnnotation extends CPDFAnnotation { 17 | final Color color; 18 | final double alpha; 19 | final double borderWidth; 20 | 21 | CPDFInkAnnotation( 22 | {required CPDFAnnotationType type, 23 | required String title, 24 | required int page, 25 | required String content, 26 | required String uuid, 27 | DateTime? createDate, 28 | required CPDFRectF rect, 29 | required this.color, 30 | required this.alpha, 31 | required this.borderWidth}) 32 | : super( 33 | type: type, 34 | title: title, 35 | page: page, 36 | content: content, 37 | uuid: uuid, 38 | createDate: createDate, 39 | rect: rect); 40 | 41 | factory CPDFInkAnnotation.fromJson(Map json) { 42 | final common = CPDFAnnotation.fromJson(json); 43 | return CPDFInkAnnotation( 44 | type: common.type, 45 | title: common.title, 46 | page: common.page, 47 | content: common.content, 48 | uuid: common.uuid, 49 | createDate: common.createDate, 50 | rect: common.rect, 51 | color: HexColor.fromHex(json['color'] ?? '#000000'), 52 | alpha: json['alpha'] ?? 255.0, 53 | borderWidth: json['borderWidth'] ?? 0, 54 | ); 55 | } 56 | 57 | @override 58 | Map toJson() { 59 | return { 60 | ...super.toJson(), 61 | 'color': color.toHex(), 62 | 'alpha': alpha, 63 | 'borderWidth': borderWidth, 64 | }; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_line_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:ui'; 9 | 10 | import 'package:compdfkit_flutter/annotation/cpdf_annotation.dart'; 11 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 12 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 13 | 14 | import '../util/cpdf_rectf.dart'; 15 | 16 | class CPDFLineAnnotation extends CPDFAnnotation { 17 | 18 | final double borderWidth; 19 | final Color borderColor; 20 | final double borderAlpha; 21 | final Color fillColor; 22 | final double fillAlpha; 23 | final CPDFLineType lineHeadType; 24 | final CPDFLineType lineTailType; 25 | 26 | CPDFLineAnnotation( 27 | {required CPDFAnnotationType type, 28 | required String title, 29 | required int page, 30 | required String content, 31 | required String uuid, 32 | DateTime? createDate, 33 | required CPDFRectF rect, 34 | required this.borderWidth, 35 | required this.borderColor, 36 | required this.borderAlpha, 37 | required this.fillColor, 38 | required this.fillAlpha, 39 | required this.lineHeadType, 40 | required this.lineTailType}) 41 | : super( 42 | type: type, 43 | title: title, 44 | page: page, 45 | content: content, 46 | uuid: uuid, 47 | createDate: createDate, 48 | rect: rect); 49 | 50 | factory CPDFLineAnnotation.fromJson(Map json) { 51 | final common = CPDFAnnotation.fromJson(json); 52 | return CPDFLineAnnotation( 53 | type: common.type, 54 | title: common.title, 55 | page: common.page, 56 | content: common.content, 57 | uuid: common.uuid, 58 | createDate: common.createDate, 59 | rect: common.rect, 60 | borderWidth: json['borderWidth'] ?? 0, 61 | borderColor: HexColor.fromHex(json['borderColor'] ?? '#000000'), 62 | borderAlpha: json['borderAlpha'] ?? 255.0, 63 | fillColor: HexColor.fromHex(json['fillColor'] ?? '#000000'), 64 | fillAlpha: json['fillAlpha'] ?? 255.0, 65 | lineHeadType: CPDFLineType.fromString(json['lineHeadType']), 66 | lineTailType: CPDFLineType.fromString(json['lineTailType']), 67 | ); 68 | } 69 | 70 | @override 71 | Map toJson() { 72 | return { 73 | ...super.toJson(), 74 | 'borderWidth': borderWidth, 75 | 'borderColor': borderColor.toHex(), 76 | 'borderAlpha': borderAlpha, 77 | 'fillColor': fillColor.toHex(), 78 | 'fillAlpha': fillAlpha, 79 | 'lineHeadType': lineHeadType.name, 80 | 'lineTailType': lineTailType.name, 81 | }; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_link_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | 9 | import 'package:compdfkit_flutter/annotation/cpdf_annotation.dart'; 10 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 11 | 12 | import '../document/action/cpdf_action.dart'; 13 | import '../util/cpdf_rectf.dart'; 14 | 15 | class CPDFLinkAnnotation extends CPDFAnnotation { 16 | final CPDFAction? action; 17 | 18 | CPDFLinkAnnotation( 19 | {required CPDFAnnotationType type, 20 | required String title, 21 | required int page, 22 | required String content, 23 | required String uuid, 24 | DateTime? createDate, 25 | required CPDFRectF rect, 26 | this.action}) 27 | : super( 28 | type: type, 29 | title: title, 30 | page: page, 31 | content: content, 32 | uuid: uuid, 33 | createDate: createDate, 34 | rect: rect); 35 | 36 | factory CPDFLinkAnnotation.fromJson(Map json) { 37 | final common = CPDFAnnotation.fromJson(json); 38 | return CPDFLinkAnnotation( 39 | type: common.type, 40 | title: common.title, 41 | page: common.page, 42 | content: common.content, 43 | uuid: common.uuid, 44 | createDate: common.createDate, 45 | rect: common.rect, 46 | action: json['action'] != null 47 | ? CPDFAction.fromJson( 48 | Map.from(json['action'] ?? {})) 49 | : null); 50 | } 51 | 52 | @override 53 | Map toJson() { 54 | return { 55 | ...super.toJson(), 56 | 'action': action?.toJson() 57 | }; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_markup_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:ui'; 9 | 10 | import 'package:compdfkit_flutter/annotation/cpdf_annotation.dart'; 11 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 12 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 13 | 14 | import '../util/cpdf_rectf.dart'; 15 | 16 | class CPDFMarkupAnnotation extends CPDFAnnotation { 17 | final String markedText; 18 | final Color color; 19 | final double alpha; 20 | 21 | CPDFMarkupAnnotation( 22 | {required CPDFAnnotationType type, 23 | required String title, 24 | required int page, 25 | required String content, 26 | required String uuid, 27 | DateTime? createDate, 28 | required CPDFRectF rect, 29 | required this.markedText, 30 | required this.color, 31 | required this.alpha}) 32 | : super( 33 | type: type, 34 | title: title, 35 | page: page, 36 | content: content, 37 | uuid: uuid, 38 | createDate: createDate, 39 | rect: rect); 40 | 41 | factory CPDFMarkupAnnotation.fromJson(Map json) { 42 | final common = CPDFAnnotation.fromJson(json); 43 | return CPDFMarkupAnnotation( 44 | type: common.type, 45 | title: common.title, 46 | page: common.page, 47 | content: common.content, 48 | uuid: common.uuid, 49 | createDate: common.createDate, 50 | rect: common.rect, 51 | markedText: json['markedText'] ?? '', 52 | color: HexColor.fromHex(json['color'] ?? '#000000'), 53 | alpha: json['alpha'] ?? 255, 54 | ); 55 | } 56 | 57 | @override 58 | Map toJson() { 59 | return { 60 | ...super.toJson(), 61 | 'markedText': markedText, 62 | 'color': color.toHex(), 63 | 'alpha': alpha, 64 | }; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_square_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:ui'; 9 | 10 | import 'package:compdfkit_flutter/annotation/cpdf_annotation.dart'; 11 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 12 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 13 | 14 | import '../util/cpdf_rectf.dart'; 15 | 16 | class CPDFSquareAnnotation extends CPDFAnnotation { 17 | final double borderWidth; 18 | final Color borderColor; 19 | final double borderAlpha; 20 | final Color fillColor; 21 | final double fillAlpha; 22 | final CPDFBorderEffectType effectType; 23 | 24 | CPDFSquareAnnotation( 25 | {required CPDFAnnotationType type, 26 | required String title, 27 | required int page, 28 | required String content, 29 | required String uuid, 30 | DateTime? createDate, 31 | required CPDFRectF rect, 32 | required this.borderWidth, 33 | required this.borderColor, 34 | required this.borderAlpha, 35 | required this.fillColor, 36 | required this.fillAlpha, 37 | required this.effectType}) 38 | : super( 39 | type: type, 40 | title: title, 41 | page: page, 42 | content: content, 43 | uuid: uuid, 44 | createDate: createDate, 45 | rect: rect); 46 | 47 | factory CPDFSquareAnnotation.fromJson(Map json) { 48 | final common = CPDFAnnotation.fromJson(json); 49 | return CPDFSquareAnnotation( 50 | type: common.type, 51 | title: common.title, 52 | page: common.page, 53 | content: common.content, 54 | uuid: common.uuid, 55 | createDate: common.createDate, 56 | rect: common.rect, 57 | borderWidth: json['borderWidth'] ?? 0, 58 | borderColor: HexColor.fromHex(json['borderColor'] ?? '#000000'), 59 | borderAlpha: json['borderAlpha'] ?? 255, 60 | fillColor: HexColor.fromHex(json['fillColor'] ?? '#000000'), 61 | fillAlpha: json['fillAlpha'] ?? 255, 62 | effectType: CPDFBorderEffectType.fromString(json['bordEffectType']) 63 | ); 64 | } 65 | 66 | @override 67 | Map toJson() { 68 | return { 69 | ...super.toJson(), 70 | 'borderWidth': borderWidth, 71 | 'borderColor': borderColor.toHex(), 72 | 'borderAlpha': borderAlpha, 73 | 'fillColor': fillColor.toHex(), 74 | 'fillAlpha': fillAlpha, 75 | 'bordEffectType': effectType.name 76 | }; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/annotation/cpdf_text_attribute.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | 9 | import 'dart:convert'; 10 | import 'dart:ui'; 11 | 12 | import '../util/extension/cpdf_color_extension.dart'; 13 | 14 | class CPDFTextAttribute { 15 | 16 | final Color color; 17 | 18 | final String familyName; 19 | 20 | final String styleName; 21 | 22 | final double fontSize; 23 | 24 | CPDFTextAttribute(this.color, this.familyName, this.styleName, this.fontSize); 25 | 26 | factory CPDFTextAttribute.fromJson(Map json) { 27 | return CPDFTextAttribute( 28 | HexColor.fromHex(json['color'] ?? '#000000'), 29 | json['familyName'], 30 | json['styleName'], 31 | double.parse((json['fontSize'] as double).toStringAsFixed(2)) 32 | ); 33 | } 34 | 35 | Map toJson() { 36 | return { 37 | 'color': color.toHex(), 38 | 'familyName': familyName, 39 | 'styleName': styleName, 40 | 'fontSize': fontSize 41 | }; 42 | } 43 | 44 | @override 45 | String toString() { 46 | return jsonEncode(toJson()); 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_checkbox_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'dart:ui'; 12 | 13 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 14 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 15 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 16 | 17 | import '../../util/cpdf_rectf.dart'; 18 | 19 | class CPDFCheckBoxWidget extends CPDFWidget { 20 | final bool isChecked; 21 | final CPDFCheckStyle checkStyle; 22 | final Color checkColor; 23 | 24 | CPDFCheckBoxWidget({ 25 | required CPDFFormType type, 26 | required String title, 27 | required int page, 28 | required String uuid, 29 | DateTime? createDate, 30 | required CPDFRectF rect, 31 | required borderColor, 32 | required fillColor, 33 | required borderWidth, 34 | required this.isChecked, 35 | required this.checkStyle, 36 | required this.checkColor 37 | }) : super( 38 | type: type, 39 | title: title, 40 | page: page, 41 | uuid: uuid, 42 | createDate: createDate, 43 | rect: rect, 44 | borderColor: borderColor, 45 | borderWidth: borderWidth, 46 | fillColor: fillColor); 47 | 48 | factory CPDFCheckBoxWidget.fromJson(Map json) { 49 | CPDFWidget common = CPDFWidget.fromJson(json); 50 | return CPDFCheckBoxWidget( 51 | type: common.type, 52 | title: common.title, 53 | page: common.page, 54 | uuid: common.uuid, 55 | createDate: common.createDate, 56 | rect: common.rect, 57 | borderColor: common.borderColor, 58 | borderWidth: common.borderWidth, 59 | fillColor: common.fillColor, 60 | isChecked: json['isChecked'], 61 | checkStyle: CPDFCheckStyle.fromString(json['checkStyle']), 62 | checkColor: HexColor.fromHex(json['checkColor'] ?? '#000000') 63 | ); 64 | } 65 | 66 | @override 67 | Map toJson() { 68 | return { 69 | ...super.toJson(), 70 | 'isChecked': isChecked, 71 | 'checkStyle': checkStyle.name, 72 | 'checkColor' : checkColor.toHex(), 73 | }; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_combobox_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | 12 | import 'dart:ui'; 13 | 14 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 15 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget_item.dart'; 16 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 17 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 18 | 19 | import '../../util/cpdf_rectf.dart'; 20 | 21 | class CPDFComboBoxWidget extends CPDFWidget { 22 | 23 | final List? options; 24 | 25 | final List? selectedIndexes; 26 | 27 | final Color fontColor; 28 | 29 | final double fontSize; 30 | 31 | final String familyName; 32 | 33 | final String styleName; 34 | 35 | CPDFComboBoxWidget( 36 | {required CPDFFormType type, 37 | required String title, 38 | required int page, 39 | required String uuid, 40 | DateTime? createDate, 41 | required CPDFRectF rect, 42 | required borderColor, 43 | required fillColor, 44 | required borderWidth, 45 | this.options, 46 | this.selectedIndexes, 47 | required this.fontColor, 48 | required this.fontSize, 49 | required this.familyName, 50 | required this.styleName}) 51 | : super( 52 | type: type, 53 | title: title, 54 | page: page, 55 | uuid: uuid, 56 | createDate: createDate, 57 | rect: rect, 58 | borderColor: borderColor, 59 | fillColor: fillColor, 60 | borderWidth: borderWidth); 61 | 62 | factory CPDFComboBoxWidget.fromJson(Map json) { 63 | CPDFWidget common = CPDFWidget.fromJson(json); 64 | return CPDFComboBoxWidget( 65 | type: common.type, 66 | title: common.title, 67 | page: common.page, 68 | uuid: common.uuid, 69 | createDate: common.createDate, 70 | rect: common.rect, 71 | borderColor: common.borderColor, 72 | fillColor: common.fillColor, 73 | borderWidth: common.borderWidth, 74 | options: json['options'] != null 75 | ? (json['options'] as List) 76 | .map((e) => CPDFWidgetItem.fromJson(Map.from(e))) 77 | .toList() 78 | : null, 79 | selectedIndexes: json['selectedIndexes'] != null 80 | ? List.from(json['selectedIndexes']) 81 | : [], 82 | fontColor: HexColor.fromHex(json['fontColor'] ?? '#000000'), 83 | fontSize: double.parse((json['fontSize'] as double).toStringAsFixed(2)), 84 | familyName: json['familyName'] ?? '', 85 | styleName: json['styleName'] ?? '' 86 | ); 87 | } 88 | 89 | @override 90 | Map toJson() { 91 | return { 92 | ...super.toJson(), 93 | 'options' : options?.map((e) => e.toJson()).toList(), 94 | 'selectedIndexes': selectedIndexes, 95 | 'fontColor': fontColor.toHex(), 96 | 'fontSize': fontSize, 97 | 'familyName': familyName, 98 | 'styleName': styleName 99 | }; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_listbox_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | 12 | import 'dart:ui'; 13 | 14 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 15 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget_item.dart'; 16 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 17 | 18 | import '../../util/cpdf_rectf.dart'; 19 | import '../../util/extension/cpdf_color_extension.dart'; 20 | 21 | class CPDFListBoxWidget extends CPDFWidget { 22 | 23 | final List? options; 24 | 25 | final List? selectedIndexes; 26 | 27 | final Color fontColor; 28 | 29 | final double fontSize; 30 | 31 | final String familyName; 32 | 33 | final String styleName; 34 | 35 | CPDFListBoxWidget( 36 | {required CPDFFormType type, 37 | required String title, 38 | required int page, 39 | required String uuid, 40 | DateTime? modifyDate, 41 | DateTime? createDate, 42 | required CPDFRectF rect, 43 | required borderColor, 44 | required fillColor, 45 | required borderWidth, 46 | this.options, 47 | this.selectedIndexes, 48 | required this.fontColor, 49 | required this.fontSize, 50 | required this.familyName, 51 | required this.styleName}) 52 | : super( 53 | type: type, 54 | title: title, 55 | page: page, 56 | uuid: uuid, 57 | createDate: createDate, 58 | rect: rect, 59 | borderColor: borderColor, 60 | fillColor: fillColor, 61 | borderWidth: borderWidth); 62 | 63 | factory CPDFListBoxWidget.fromJson(Map json) { 64 | CPDFWidget common = CPDFWidget.fromJson(json); 65 | return CPDFListBoxWidget( 66 | type: common.type, 67 | title: common.title, 68 | page: common.page, 69 | uuid: common.uuid, 70 | createDate: common.createDate, 71 | rect: common.rect, 72 | borderColor: common.borderColor, 73 | fillColor: common.fillColor, 74 | borderWidth: common.borderWidth, 75 | options: json['options'] != null 76 | ? (json['options'] as List) 77 | .map((e) => CPDFWidgetItem.fromJson(Map.from(e))) 78 | .toList() 79 | : null, 80 | selectedIndexes: json['selectedIndexes'] != null 81 | ? List.from(json['selectedIndexes']) 82 | : [], 83 | fontColor: HexColor.fromHex(json['fontColor'] ?? '#000000'), 84 | fontSize: double.parse((json['fontSize'] as double).toStringAsFixed(2)), 85 | familyName: json['familyName'] ?? '', 86 | styleName: json['styleName'] ?? 'Regular', 87 | ); 88 | } 89 | 90 | @override 91 | Map toJson() { 92 | return { 93 | ...super.toJson(), 94 | 'options' : options?.map((e) => e.toJson()).toList(), 95 | 'selectedIndexes': selectedIndexes, 96 | 'fontColor': fontColor.toHex(), 97 | 'fontSize' : fontSize, 98 | 'familyName' : familyName, 99 | 'styleName' : styleName 100 | }; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_pushbutton_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'dart:ui'; 12 | 13 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 14 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 15 | import 'package:compdfkit_flutter/document/action/cpdf_action.dart'; 16 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 17 | 18 | import '../../util/cpdf_rectf.dart'; 19 | 20 | class CPDFPushButtonWidget extends CPDFWidget { 21 | final String buttonTitle; 22 | 23 | final CPDFAction? action; 24 | 25 | final Color fontColor; 26 | 27 | final double fontSize; 28 | 29 | final String familyName; 30 | 31 | final String styleName; 32 | 33 | CPDFPushButtonWidget( 34 | {required CPDFFormType type, 35 | required String title, 36 | required int page, 37 | required String uuid, 38 | DateTime? modifyDate, 39 | DateTime? createDate, 40 | required CPDFRectF rect, 41 | required borderColor, 42 | required fillColor, 43 | required borderWidth, 44 | required this.buttonTitle, 45 | this.action, 46 | required this.fontColor, 47 | required this.fontSize, 48 | required this.familyName, 49 | required this.styleName}) 50 | : super( 51 | type: type, 52 | title: title, 53 | page: page, 54 | uuid: uuid, 55 | createDate: createDate, 56 | rect: rect, 57 | borderColor: borderColor, 58 | fillColor: fillColor, 59 | borderWidth: borderWidth); 60 | 61 | factory CPDFPushButtonWidget.fromJson(Map json) { 62 | CPDFWidget common = CPDFWidget.fromJson(json); 63 | return CPDFPushButtonWidget( 64 | type: common.type, 65 | title: common.title, 66 | page: common.page, 67 | uuid: common.uuid, 68 | createDate: common.createDate, 69 | rect: common.rect, 70 | borderColor: common.borderColor, 71 | fillColor: common.fillColor, 72 | borderWidth: common.borderWidth, 73 | buttonTitle: json['buttonTitle'], 74 | action: json['action'] != null 75 | ? CPDFAction.fromJson( 76 | Map.from(json['action'] ?? {})) 77 | : null, 78 | fontColor: HexColor.fromHex(json['fontColor'] ?? '#000000'), 79 | fontSize: double.parse((json['fontSize'] as double).toStringAsFixed(2)), 80 | familyName: json['familyName'] ?? 'Helvetica', 81 | styleName: json['styleName'] ?? 'Regular'); 82 | } 83 | 84 | @override 85 | Map toJson() { 86 | return { 87 | ...super.toJson(), 88 | 'buttonTitle': buttonTitle, 89 | 'action': action?.toJson(), 90 | 'fontColor' : fontColor.toHex(), 91 | 'fontSize' : fontSize, 92 | 'familyName' : familyName, 93 | 'styleName' : styleName 94 | }; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_radiobutton_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'dart:ui'; 12 | 13 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 14 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 15 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 16 | 17 | import '../../util/cpdf_rectf.dart'; 18 | 19 | class CPDFRadioButtonWidget extends CPDFWidget { 20 | final bool isChecked; 21 | final CPDFCheckStyle checkStyle; 22 | final Color checkColor; 23 | 24 | CPDFRadioButtonWidget({ 25 | required CPDFFormType type, 26 | required String title, 27 | required int page, 28 | required String uuid, 29 | DateTime? createDate, 30 | required CPDFRectF rect, 31 | required borderColor, 32 | required fillColor, 33 | required borderWidth, 34 | required this.isChecked, 35 | required this.checkStyle, 36 | required this.checkColor 37 | }) : super( 38 | type: type, 39 | title: title, 40 | page: page, 41 | uuid: uuid, 42 | createDate: createDate, 43 | rect: rect, 44 | borderColor: borderColor, 45 | borderWidth: borderWidth, 46 | fillColor: fillColor); 47 | 48 | factory CPDFRadioButtonWidget.fromJson(Map json) { 49 | CPDFWidget common = CPDFWidget.fromJson(json); 50 | return CPDFRadioButtonWidget( 51 | type: common.type, 52 | title: common.title, 53 | page: common.page, 54 | uuid: common.uuid, 55 | createDate: common.createDate, 56 | rect: common.rect, 57 | borderColor: common.borderColor, 58 | borderWidth: common.borderWidth, 59 | fillColor: common.fillColor, 60 | isChecked: json['isChecked'], 61 | checkStyle: CPDFCheckStyle.fromString(json['checkStyle']), 62 | checkColor: HexColor.fromHex(json['checkColor'] ?? '#000000') 63 | ); 64 | } 65 | 66 | @override 67 | Map toJson() { 68 | return { 69 | ...super.toJson(), 70 | 'isChecked': isChecked, 71 | 'checkStyle': checkStyle.name, 72 | 'checkColor' : checkColor.toHex(), 73 | }; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_signature_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | 12 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 13 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 14 | 15 | import '../../util/cpdf_rectf.dart'; 16 | 17 | class CPDFSignatureWidget extends CPDFWidget { 18 | 19 | CPDFSignatureWidget({ 20 | required CPDFFormType type, 21 | required String title, 22 | required int page, 23 | required String uuid, 24 | DateTime? createDate, 25 | required CPDFRectF rect, 26 | required borderColor, 27 | required fillColor, 28 | required borderWidth 29 | }) : super( 30 | type: type, 31 | title: title, 32 | page: page, 33 | uuid: uuid, 34 | createDate: createDate, 35 | rect: rect, 36 | borderColor: borderColor, 37 | borderWidth: borderWidth, 38 | fillColor: fillColor); 39 | 40 | factory CPDFSignatureWidget.fromJson(Map json) { 41 | CPDFWidget common = CPDFWidget.fromJson(json); 42 | return CPDFSignatureWidget( 43 | type: common.type, 44 | title: common.title, 45 | page: common.page, 46 | uuid: common.uuid, 47 | createDate: common.createDate, 48 | rect: common.rect, 49 | borderColor: common.borderColor, 50 | borderWidth: common.borderWidth, 51 | fillColor: common.fillColor, 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_text_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'dart:ui'; 12 | 13 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 14 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 15 | import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart'; 16 | 17 | import '../../util/cpdf_rectf.dart'; 18 | 19 | class CPDFTextWidget extends CPDFWidget { 20 | final String text; 21 | final Color fontColor; 22 | final double fontSize; 23 | final CPDFAlignment alignment; 24 | final bool isMultiline; 25 | final String familyName; 26 | 27 | final String styleName; 28 | 29 | CPDFTextWidget( 30 | {required CPDFFormType type, 31 | required String title, 32 | required int page, 33 | required String uuid, 34 | DateTime? createDate, 35 | required CPDFRectF rect, 36 | required borderColor, 37 | required fillColor, 38 | required borderWidth, 39 | required this.text, 40 | required this.fontColor, 41 | required this.fontSize, 42 | required this.alignment, 43 | required this.isMultiline, 44 | required this.familyName, 45 | required this.styleName}) 46 | : super( 47 | type: type, 48 | title: title, 49 | page: page, 50 | uuid: uuid, 51 | createDate: createDate, 52 | rect: rect, 53 | borderColor: borderColor, 54 | fillColor: fillColor, 55 | borderWidth: borderWidth); 56 | 57 | factory CPDFTextWidget.fromJson(Map json) { 58 | CPDFWidget common = CPDFWidget.fromJson(json); 59 | return CPDFTextWidget( 60 | type: common.type, 61 | title: common.title, 62 | page: common.page, 63 | uuid: common.uuid, 64 | createDate: common.createDate, 65 | rect: common.rect, 66 | borderColor: common.borderColor, 67 | fillColor: common.fillColor, 68 | borderWidth: common.borderWidth, 69 | text: json['text'] ?? '', 70 | fontColor: HexColor.fromHex(json['fontColor'] ?? '#000000'), 71 | fontSize: json['fontSize'] ?? 0.0, 72 | alignment: CPDFAlignment.fromString(json['alignment'] ?? ''), 73 | isMultiline: json['isMultiline'] ?? false, 74 | familyName: json['familyName'] ?? '', 75 | styleName: json['styleName'] ?? ''); 76 | } 77 | 78 | @override 79 | Map toJson() { 80 | return { 81 | ...super.toJson(), 82 | 'text': text, 83 | 'fontColor': fontColor.toHex(), 84 | 'fontSize': fontSize, 85 | 'alignment': alignment.name, 86 | 'isMultiline': isMultiline, 87 | 'familyName': familyName, 88 | 'styleName': styleName 89 | }; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_widget.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:convert'; 9 | import 'dart:ui'; 10 | 11 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 12 | 13 | import '../../util/cpdf_rectf.dart'; 14 | import '../../util/extension/cpdf_color_extension.dart'; 15 | 16 | class CPDFWidget { 17 | final CPDFFormType type; 18 | final String title; 19 | final int page; 20 | final String uuid; 21 | final DateTime? createDate; 22 | final CPDFRectF rect; 23 | final Color borderColor; 24 | final Color fillColor; 25 | final double borderWidth; 26 | 27 | CPDFWidget( 28 | {required this.type, 29 | required this.title, 30 | required this.page, 31 | required this.uuid, 32 | this.createDate, 33 | required this.rect, 34 | required this.borderColor, 35 | required this.fillColor, 36 | required this.borderWidth}); 37 | 38 | factory CPDFWidget.fromJson(Map json) { 39 | return CPDFWidget( 40 | type: CPDFFormType.fromString(json['type']), 41 | title: json['title'] ?? '', 42 | page: json['page'] ?? 0, 43 | uuid: json['uuid'] ?? '', 44 | createDate: json['createDate'] != null 45 | ? DateTime.fromMillisecondsSinceEpoch(json['createDate']) 46 | : null, 47 | rect: CPDFRectF.fromJson(Map.from(json['rect'] ?? {})), 48 | borderColor: HexColor.fromHex(json['borderColor'] ?? '#000000'), 49 | fillColor: HexColor.fromHex(json['fillColor'] ?? '#000000'), 50 | borderWidth: json['borderWidth'] ?? 0, 51 | ); 52 | } 53 | 54 | Map toJson() => { 55 | 'type': type.name, 56 | 'title': title, 57 | 'page': page, 58 | 'uuid': uuid, 59 | 'createDate': createDate?.toString(), 60 | 'rect': rect.toString(), 61 | 'borderColor': borderColor.toHex(), 62 | 'fillColor': fillColor.toHex(), 63 | 'borderWidth': borderWidth, 64 | }; 65 | 66 | @override 67 | String toString() => jsonEncode(toJson()); 68 | } 69 | -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_widget_item.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'dart:convert'; 12 | 13 | class CPDFWidgetItem { 14 | 15 | final String text; 16 | 17 | final String value; 18 | 19 | CPDFWidgetItem({ 20 | required this.text, 21 | required this.value, 22 | }); 23 | 24 | factory CPDFWidgetItem.fromJson(Map json) { 25 | return CPDFWidgetItem( 26 | text: json['text'], 27 | value: json['value'], 28 | ); 29 | } 30 | 31 | Map toJson() { 32 | return { 33 | 'text': text, 34 | 'value': value, 35 | }; 36 | } 37 | 38 | @override 39 | String toString() { 40 | return jsonEncode(toJson()); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /lib/annotation/form/cpdf_widget_registry.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | 9 | import 'package:compdfkit_flutter/annotation/form/cpdf_checkbox_widget.dart'; 10 | import 'package:compdfkit_flutter/annotation/form/cpdf_combobox_widget.dart'; 11 | import 'package:compdfkit_flutter/annotation/form/cpdf_listbox_widget.dart'; 12 | import 'package:compdfkit_flutter/annotation/form/cpdf_pushbutton_widget.dart'; 13 | import 'package:compdfkit_flutter/annotation/form/cpdf_radiobutton_widget.dart'; 14 | import 'package:compdfkit_flutter/annotation/form/cpdf_signature_widget.dart'; 15 | import 'package:compdfkit_flutter/annotation/form/cpdf_widget.dart'; 16 | import 'package:compdfkit_flutter/configuration/cpdf_options.dart'; 17 | 18 | import 'cpdf_text_widget.dart'; 19 | 20 | 21 | typedef CPDFWidgetFactory = CPDFWidget Function(Map json); 22 | 23 | class CPDFWidgetRegistry { 24 | static final Map _factories = { 25 | CPDFFormType.textField: CPDFTextWidget.fromJson, 26 | CPDFFormType.checkBox: CPDFCheckBoxWidget.fromJson, 27 | CPDFFormType.radioButton: CPDFRadioButtonWidget.fromJson, 28 | CPDFFormType.comboBox: CPDFComboBoxWidget.fromJson, 29 | CPDFFormType.listBox: CPDFListBoxWidget.fromJson, 30 | CPDFFormType.pushButton: CPDFPushButtonWidget.fromJson, 31 | CPDFFormType.signaturesFields: CPDFSignatureWidget.fromJson, 32 | }; 33 | 34 | static CPDFWidget fromJson(Map json) { 35 | final type = CPDFFormType.fromString(json['type']); 36 | final factory = _factories[type] ?? CPDFWidget.fromJson; 37 | return factory(json); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/document/action/cpdf_action.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'package:compdfkit_flutter/document/action/cpdf_uri_action.dart'; 12 | 13 | import 'cpdf_goto_action.dart'; 14 | 15 | class CPDFAction { 16 | 17 | final CPDFActionType actionType; 18 | 19 | CPDFAction({required this.actionType}); 20 | 21 | factory CPDFAction.fromJson(Map json) { 22 | CPDFActionType actionType = CPDFActionType.values.firstWhere((element) => element.name == json["actionType"]); 23 | switch (actionType) { 24 | case CPDFActionType.goTo: 25 | return CPDFGoToAction.fromJson(json); 26 | case CPDFActionType.uri: 27 | return CPDFUriAction.fromJson(json); 28 | default: 29 | return CPDFAction(actionType: actionType); 30 | } 31 | } 32 | 33 | Map toJson() { 34 | return { 35 | "actionType": actionType.name, 36 | }; 37 | } 38 | 39 | } 40 | 41 | enum CPDFActionType { 42 | 43 | unknown, 44 | 45 | goTo, 46 | 47 | goToR, 48 | 49 | goToE, 50 | 51 | launch, 52 | 53 | thread, 54 | 55 | uri, 56 | 57 | sound, 58 | 59 | movie, 60 | 61 | hide, 62 | 63 | named, 64 | 65 | submitForm, 66 | 67 | resetForm, 68 | 69 | importData, 70 | 71 | javaScript, 72 | 73 | setOCGState, 74 | 75 | rendition, 76 | 77 | trans, 78 | 79 | goTo3DView, 80 | 81 | uop, 82 | 83 | error; 84 | 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /lib/document/action/cpdf_goto_action.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'package:compdfkit_flutter/document/action/cpdf_action.dart'; 12 | 13 | class CPDFGoToAction extends CPDFAction { 14 | final int pageIndex; 15 | 16 | CPDFGoToAction({required super.actionType, required this.pageIndex}); 17 | 18 | factory CPDFGoToAction.fromJson(Map json) { 19 | return CPDFGoToAction( 20 | actionType: CPDFActionType.goTo, pageIndex: json["pageIndex"]); 21 | } 22 | 23 | @override 24 | Map toJson() { 25 | return {...super.toJson(), "pageIndex": pageIndex}; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/document/action/cpdf_uri_action.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'package:compdfkit_flutter/document/action/cpdf_action.dart'; 12 | 13 | class CPDFUriAction extends CPDFAction { 14 | final String uri; 15 | 16 | CPDFUriAction({required CPDFActionType actionType, required this.uri}) 17 | : super(actionType: actionType); 18 | 19 | @override 20 | factory CPDFUriAction.fromJson(Map json) { 21 | return CPDFUriAction(actionType: CPDFActionType.uri, uri: json["uri"]); 22 | } 23 | 24 | @override 25 | Map toJson() { 26 | return {...super.toJson(), "uri": uri}; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/util/cpdf_rectf.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | import 'dart:ui'; 11 | 12 | class CPDFRectF { 13 | final double left; 14 | final double top; 15 | final double right; 16 | final double bottom; 17 | 18 | CPDFRectF(this.left, this.top, this.right, this.bottom); 19 | 20 | factory CPDFRectF.fromLTRB( 21 | double left, double top, double right, double bottom) { 22 | return CPDFRectF(left, top, right, bottom); 23 | } 24 | 25 | factory CPDFRectF.fromJson(Map json) { 26 | return CPDFRectF(json['left'], json['top'], json['right'], json['bottom']); 27 | } 28 | 29 | Size get size => Size(right - left, bottom - top); 30 | 31 | Map toJson() { 32 | return { 33 | 'left': left, 34 | 'top': top, 35 | 'right': right, 36 | 'bottom': bottom, 37 | }; 38 | } 39 | 40 | @override 41 | String toString() { 42 | return [left, top, right, bottom].toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/util/cpdf_uuid_util.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved. 3 | * 4 | * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 5 | * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 6 | * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 7 | * This notice may not be removed from this file. 8 | * 9 | */ 10 | 11 | import 'dart:math'; 12 | 13 | class CpdfUuidUtil { 14 | static String generateShortUniqueId() { 15 | final now = DateTime.now().millisecondsSinceEpoch ~/ 1000; 16 | final random = Random().nextInt(1000); 17 | return '$now$random'; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/util/extension/cpdf_color_extension.dart: -------------------------------------------------------------------------------- 1 | // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved. 2 | // 3 | // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW 4 | // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. 5 | // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. 6 | // This notice may not be removed from this file. 7 | 8 | import 'dart:ui'; 9 | 10 | import 'package:flutter/material.dart'; 11 | 12 | /// extension [Color] class 13 | /// toHex: Colors.white.toHex() => '#FFFFFFFF' 14 | /// formHex: '#FFFFFF' => Colors.white 15 | extension HexColor on Color { 16 | /// Colors.white.toHex() => '#FFFFFFFF' 17 | String toHex({bool leadingHashSign = true}) { 18 | final hexA = (a * 255).round().toRadixString(16).padLeft(2, '0'); 19 | final hexR = (r * 255).round().toRadixString(16).padLeft(2, '0'); 20 | final hexG = (g * 255).round().toRadixString(16).padLeft(2, '0'); 21 | final hexB = (b * 255).round().toRadixString(16).padLeft(2, '0'); 22 | return '${leadingHashSign ? '#' : ''}$hexA$hexR$hexG$hexB'; 23 | } 24 | 25 | /// formHex: '#FFFFFF' => Colors.white 26 | static Color fromHex(String hexString) { 27 | final buffer = StringBuffer(); 28 | if (hexString.length == 6 || hexString.length == 7) buffer.write('ff'); 29 | buffer.write(hexString.replaceFirst('#', '')); 30 | return Color(int.parse(buffer.toString(), radix: 16)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: compdfkit_flutter 2 | description: ComPDFKit for Flutter is a comprehensive SDK that allows you to quickly add PDF functionality to Android and iOS Flutter applications. 3 | version: 2.4.0+1 4 | homepage: https://www.compdf.com 5 | repository: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter 6 | issue_tracker: https://www.compdf.com/support 7 | documentation: https://www.compdf.com/guides/pdf-sdk/flutter/overview 8 | 9 | environment: 10 | sdk: '>=3.0.5 <4.0.0' 11 | flutter: ">=3.3.0" 12 | 13 | dependencies: 14 | flutter: 15 | sdk: flutter 16 | plugin_platform_interface: ^2.0.2 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | flutter_lints: ^2.0.3 22 | 23 | 24 | flutter: 25 | 26 | plugin: 27 | platforms: 28 | android: 29 | package: com.compdfkit.flutter.compdfkit_flutter 30 | pluginClass: CompdfkitFlutterPlugin 31 | ios: 32 | pluginClass: CompdfkitFlutterPlugin 33 | -------------------------------------------------------------------------------- /screenshots/1-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComPDFKit/compdfkit-pdf-sdk-flutter/c871d727b63655451e52d4548239b75c8568cdb0/screenshots/1-8.png --------------------------------------------------------------------------------