diff --git a/.dart_tool/version b/.dart_tool/version index 5436ea06..40fc7267 100644 --- a/.dart_tool/version +++ b/.dart_tool/version @@ -1 +1 @@ -3.3.2 \ No newline at end of file +3.32.0 \ No newline at end of file diff --git a/.github/workflows/pubdev-publish.yml b/.github/workflows/pubdev-publish.yml index c3a4145b..70c6fa40 100644 --- a/.github/workflows/pubdev-publish.yml +++ b/.github/workflows/pubdev-publish.yml @@ -7,7 +7,7 @@ on: - master jobs: build: - if: github.repository == 'PDFTron/pdftron-flutter' + if: github.repository == 'ApryseSDK/pdftron-flutter' runs-on: ubuntu-latest container: image: google/dart:latest @@ -27,4 +27,4 @@ jobs: } EOF - name: Publish package - run: pub publish -f \ No newline at end of file + run: pub publish -f diff --git a/.github/workflows/versionBump.yml b/.github/workflows/versionBump.yml index b41bc26c..3d5c2a92 100644 --- a/.github/workflows/versionBump.yml +++ b/.github/workflows/versionBump.yml @@ -18,7 +18,7 @@ jobs: - name: Get Latest pubspec.yaml run: | git fetch - git checkout -m origin/master pubspec.yaml + git checkout origin/master pubspec.yaml git add pubspec.yaml git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" diff --git a/CHANGELOG.md b/CHANGELOG.md index 882c9847..f435df83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,90 @@ -# 1.0.0-56 - Dec 2, 2022 +# 1.0.1-45 - Jun 10, 2025 +- Update Android to embedding v2 + +# 1.0.1-44 - May 28, 2025 +- Update Android to v11.5.0 + +# 1.0.1-43 - April 9, 2025 +- Update Android to v11.4.0 + +# 1.0.1-40 - February 19, 2025 +- Update Android to v11.3.0 + +# 1.0.1-39 - January 6, 2025 +- Update Android to v11.2.0 + +# 1.0.1-37 - November 25, 2024 +- Update Android to v11.1.0 + +# 1.0.1-36 - October 28, 2024 +- Update Android to v11.0.0 +- Update Android targetSDK to 34 + +# 1.0.1-33 - September 4, 2024 +- Update Android to v10.12.0 + +# 1.0.1-32 - July 24, 2024 +- Update Android to v10.11.0 + +# 1.0.1-31 - May 27, 2024 +- Fix bug in `startAnnotationToolbarItemPressedListener` + +# 1.0.1-30 - May 1, 2024 +- Update Android to v10.9.0 + +# 1.0.1-29 - March 20, 2024 +- Update Android to v10.8.0 + +# 1.0.1-27 - February 7, 2024 +- Update Android to v10.7.0 + +# 1.0.1-24 - December 13, 2023 +- expose Pan tool + +# 1.0.1-23 - December 6, 2023 +- Update Android to v10.6.0 + +# 1.0.1-22 - October 25, 2023 +- Update Android to v10.5.0 + +# 1.0.1-21 - September 21, 2023 +- Fix bug in mergeAnnotations() + +# 1.0.1-20 - September 13, 2023 +- Update Android to v10.4.0 + +# 1.0.1-18 - August 23, 2023 +- mergeAnnotations() + +# 1.0.1-17 - August 8, 2023 +- added eraser to PTToolKey (iOS) + +# 1.0.1-16 - August 2, 2023 +- Update Android to v10.3.0 + +# 1.0.1-15 - July 4, 2023 +- Fix bug in Android `saveDocument` + +# 1.0.1-14 - June 21, 2023 +- Update Android to v10.2.0 + +# 1.0.1-13 - May 10, 2023 +- Update Android to v10.1.0 + +# 1.0.1-9 - Mar 27, 2023 +- Update Android to v10.0.0 + +# 1.0.1-8 - Feb 17, 2023 +- Update Android to v9.5.0 + +# 1.0.1-4 - Dec 19, 2022 +- Update Android to v9.4.2 + +# 1.0.1-3 - Dec 16, 2022 +- setFitMode() +- setLayoutMode() + +# 1.0.1-2 - Dec 2, 2022 - Update Android to v9.4.1 # 1.0.0-beta.55 - Oct 13, 2022 @@ -66,7 +152,7 @@ # 1.0.0-beta.3 - November 8, 2021 -- Updated the Android plugin and widget ([#128](https://github.com/PDFTron/pdftron-flutter/issues/128)): +- Updated the Android plugin and widget ([#128](https://github.com/ApryseSDK/pdftron-flutter/issues/128)): - The plugin now supports [Flutter's new embedding engine](https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration). - The widget now uses [hybrid composition](https://flutter.dev/docs/development/platform-integration/platform-views?tab=ios-platform-views-objective-c-tab#hybrid-composition). This update fixes issues such as: https://github.com/flutter/flutter/issues/58273 and in regards to stability, places the widget on parity with the plugin. diff --git a/README.md b/README.md index 42cbe8d0..e58acd95 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ PDFTron's Flutter PDF library brings smooth, flexible, and stand-alone document - Night mode to improve viewing in low-light environments - And much more... -More information can be found at https://www.pdftron.com/documentation/guides/flutter +More information can be found at https://docs.apryse.com/documentation/guides/flutter/ **Android**|**iOS** :--:|:--: @@ -36,7 +36,7 @@ More information can be found at https://www.pdftron.com/documentation/guides/fl Dart now supports [sound null safety](https://dart.dev/null-safety), which is available starting from Dart 2.12.0 and Flutter 2.0.0. Here is a guide to migrate to [null safety](https://dart.dev/null-safety/migration-guide) If you would like to use our null safe SDK, it is available in the following places: -- [GitHub](https://github.com/PDFTron/pdftron-flutter) +- [GitHub](https://github.com/ApryseSDK/pdftron-flutter) - [pub.dev](https://pub.dev/packages/pdftron_flutter) The rest of this README.md contains documentation, installation instructions, and information for the null safe version of our SDK. @@ -45,7 +45,7 @@ The rest of this README.md contains documentation, installation instructions, an Version `0.0.6` is the last stable release for the legacy UI. -The release can be found here: https://github.com/PDFTron/pdftron-flutter/releases/tag/legacy-ui. +The release can be found here: https://github.com/ApryseSDK/pdftron-flutter/releases/tag/legacy-ui. ## Installation @@ -67,7 +67,7 @@ The release can be found here: https://github.com/PDFTron/pdftron-flutter/releas sdk: flutter + pdftron_flutter: + git: - + url: git://github.com/PDFTron/pdftron-flutter.git + + url: git://github.com/ApryseSDK/pdftron-flutter.git ``` 3. In the `myapp` directory, run `flutter packages get`. @@ -80,44 +80,32 @@ The following instructions are only applicable to Android development; click her ```diff defaultConfig { applicationId "com.example.myapp" - - minSdkVersion flutter.minSdkVersion - + minSdkVersion 21 - + multiDexEnabled true - + manifestPlaceholders += [pdftronLicenseKey:PDFTRON_LICENSE_KEY] targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName + + + resValue("string", "PDFTRON_LICENSE_KEY", "\"LICENSE_KEY_GOES_HERE\"") } ``` - -5. In your `myapp/android/gradle.properties` file, add the following line: - ``` diff - # Add the PDFTRON_LICENSE_KEY variable here. - # For trial purposes leave it blank. - # For production add a valid commercial license key. - PDFTRON_LICENSE_KEY= - ``` -6. In your `myapp/android/app/src/main/AndroidManifest.xml` file, add the following lines: +5. In your `myapp/android/app/src/main/AndroidManifest.xml` file, add the following lines: ```diff + + - - + + + + android:largeHeap="true"> + + + android:value="@string/PDFTRON_LICENSE_KEY" /> ... ``` @@ -135,22 +123,20 @@ The following instructions are only applicable to Android development; click her } ``` -7. Follow the instructions outlined [in the Usage section](#usage). -8. Check that your Android device is running by running the command `flutter devices`. If none are available, follow the device set up instructions in the [Install](https://flutter.io/docs/get-started/install) guides for your platform. -9. Run the app with the command `flutter run`. +6. Follow the instructions outlined [in the Usage section](#usage). +7. Check that your Android device is running by running the command `flutter devices`. If none are available, follow the device set up instructions in the [Install](https://flutter.io/docs/get-started/install) guides for your platform. +8. Run the app with the command `flutter run`. ### iOS The following instructions are only applicable to iOS development; click here for the [Android counterpart](#android). -> **Note** -> (August 2022) -> -> There are new podspec files to use when integrating the PDFTron Flutter Wrapper for iOS: -> - `PDFTron` CocoaPod, providing `PDFNet.xcframework`: https://pdftron.com/downloads/ios/flutter/pdftron/latest.podspec -> - `PDFTronTools` CocoaPod, providing `Tools.xcframework`: https://pdftron.com/downloads/ios/flutter/pdftron-tools/latest.podspec +> [!IMPORTANT] +> As of March 2025, use of the `PDFTron` and `PDFTronTools` podspecs distributed specifically for the PDFTron Flutter wrapper (`https://pdftron.com/downloads/ios/flutter/pdftron/latest.podspec` and `https://pdftron.com/downloads/ios/flutter/pdftron-tools/latest.podspec`, respectively) is deprecated. +> +> **All new and existing users are recommended to use the standard [Apryse iOS SDK CocoaPods](https://docs.apryse.com/ios/guides/get-started/integration?tab=cocoapods) instead.** > -> Please update your `ios/Podfile` accordingly. +> Please update your `Podfile` accordingly. 4. Open `myapp/ios/Podfile` file and add: ```diff @@ -161,8 +147,8 @@ The following instructions are only applicable to iOS development; click here fo target 'Runner' do ... + # PDFTron Pods - + pod 'PDFTron', podspec: 'https://pdftron.com/downloads/ios/flutter/pdftron/latest.podspec' - + pod 'PDFTronTools', podspec: 'https://pdftron.com/downloads/ios/flutter/pdftron-tools/latest.podspec' + + pod 'PDFTron', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdftron/latest.podspec' + + pod 'PDFTronTools', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdftron-tools/latest.podspec' end ``` 5. To ensure integration process is successful, run `flutter build ios --no-codesign` @@ -208,7 +194,7 @@ return Scaffold( 1. If you want to use local files on Android, add the following dependency to `myapp/pubspec.yaml`: ```yaml - permission_handler: ^8.1.1 + permission_handler: ^11.3.1 ``` 2. Open `lib/main.dart`, replace the entire file with the following: @@ -433,11 +419,11 @@ return Scaffold( ``` ## Changelog -See [Changelog](https://github.com/PDFTron/pdftron-flutter/blob/publish-prep-nullsafe/CHANGELOG.md) +See [Changelog](https://github.com/ApryseSDK/pdftron-flutter/blob/publish-prep-nullsafe/CHANGELOG.md) ## Contributing -See [Contributing](https://github.com/PDFTron/pdftron-flutter/blob/publish-prep-nullsafe/CONTRIBUTING.md) +See [Contributing](https://github.com/ApryseSDK/pdftron-flutter/blob/publish-prep-nullsafe/CONTRIBUTING.md) ## License -See [License](https://github.com/PDFTron/pdftron-flutter/blob/publish-prep-nullsafe/LICENSE) -![](https://onepixel.pdftron.com/pdftron-flutter) +See [License](https://github.com/ApryseSDK/pdftron-flutter/blob/publish-prep-nullsafe/LICENSE) +![](https://onepixel.pdftron.com/pdftron-flutter) \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 7eab6a6b..e429127d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ group 'com.pdftron.pdftronflutter' -version '2.0' +version '3.0.0' buildscript { repositories { @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.2.0' + classpath 'com.android.tools.build:gradle:8.0.2' } } @@ -25,10 +25,12 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 31 + namespace 'com.pdftron.pdftronflutter' + + compileSdk 34 defaultConfig { - minSdkVersion 19 + minSdk = 21 vectorDrawables.useSupportLibrary = true } lintOptions { @@ -37,7 +39,7 @@ android { } dependencies { - // PDFTron SDK dependencies - implementation "com.pdftron:pdftron:9.4.1" - implementation "com.pdftron:tools:9.4.1" + // Apryse SDK dependencies + implementation "com.pdftron:pdftron:11.5.0" + implementation "com.pdftron:tools:11.5.0" } diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar index f6b961fd..98314ba6 100644 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index be4b5993..ace89def 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -3,6 +3,10 @@ + + pagesMoved, int to, int currentPage) { + + } + @Override public void onPageLabelsChanged() { diff --git a/android/src/main/java/com/pdftron/pdftronflutter/nativeviews/FlutterPdfViewCtrlTabHostFragment.java b/android/src/main/java/com/pdftron/pdftronflutter/nativeviews/FlutterPdfViewCtrlTabHostFragment.java new file mode 100644 index 00000000..cfcca2e0 --- /dev/null +++ b/android/src/main/java/com/pdftron/pdftronflutter/nativeviews/FlutterPdfViewCtrlTabHostFragment.java @@ -0,0 +1,27 @@ +package com.pdftron.pdftronflutter.nativeviews; + +import android.os.Bundle; +import androidx.fragment.app.FragmentActivity; + +import com.pdftron.pdf.controls.PdfViewCtrlTabHostFragment2; + +public class FlutterPdfViewCtrlTabHostFragment extends PdfViewCtrlTabHostFragment2 { + + @Override + public void onCreate(Bundle savedInstanceState) { + FragmentActivity activity = getActivity(); + if (activity != null) { + applyTheme(activity); + } + + super.onCreate(savedInstanceState); + } + + @Override + protected void updateFullScreenModeLayout() { + if (isInFullScreenMode()) { + super.updateFullScreenModeLayout(); + } + // do nothing if not in full screen mode + } +} diff --git a/android/src/main/java/com/pdftron/pdftronflutter/views/DocumentView.java b/android/src/main/java/com/pdftron/pdftronflutter/views/DocumentView.java index a4309542..8e2fb672 100644 --- a/android/src/main/java/com/pdftron/pdftronflutter/views/DocumentView.java +++ b/android/src/main/java/com/pdftron/pdftronflutter/views/DocumentView.java @@ -21,13 +21,13 @@ import com.pdftron.pdf.controls.PdfViewCtrlTabFragment2; import com.pdftron.pdf.controls.PdfViewCtrlTabHostFragment2; import com.pdftron.pdf.tools.ToolManager; -import com.pdftron.pdf.utils.PdfViewCtrlSettingsManager; import com.pdftron.pdf.utils.Utils; import com.pdftron.pdftronflutter.R; import com.pdftron.pdftronflutter.helpers.PluginUtils; import com.pdftron.pdftronflutter.helpers.ViewerComponent; import com.pdftron.pdftronflutter.helpers.ViewerImpl; import com.pdftron.pdftronflutter.nativeviews.FlutterPdfViewCtrlTabFragment; +import com.pdftron.pdftronflutter.nativeviews.FlutterPdfViewCtrlTabHostFragment; import java.io.File; import java.util.ArrayList; @@ -175,6 +175,7 @@ protected void buildViewer() { .usingCustomHeaders(mCustomHeaders) .usingTabTitle(mTabTitle) .usingTabClass(FlutterPdfViewCtrlTabFragment.class) + .usingTabHostClass(FlutterPdfViewCtrlTabHostFragment.class) .usingTheme(R.style.FlutterAppTheme); } @@ -322,11 +323,11 @@ public boolean isAutoSaveEnabled() { return mAutoSaveEnabled; } - public boolean isAnnotationManagerEnabled() { return mAnnotationManagerEnabled; }; + public boolean isAnnotationManagerEnabled() { return mAnnotationManagerEnabled; } - public String getUserId() { return mUserId; }; + public String getUserId() { return mUserId; } - public String getUserName() { return mUserName; }; + public String getUserName() { return mUserName; } public boolean isUseStylusAsPen() { return mUseStylusAsPen; diff --git a/applications.properties b/application.properties similarity index 100% rename from applications.properties rename to application.properties diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle deleted file mode 100644 index af24d697..00000000 --- a/example/android/app/build.gradle +++ /dev/null @@ -1,70 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 31 - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - applicationId "com.pdftron.pdftronflutterexample" - minSdkVersion 21 - targetSdkVersion 31 - multiDexEnabled true - manifestPlaceholders += [pdftronLicenseKey:PDFTRON_LICENSE_KEY] - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "androidx.appcompat:appcompat:1.3.1" - implementation "com.google.android.material:material:1.5.0" - - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts new file mode 100644 index 00000000..a3cef125 --- /dev/null +++ b/example/android/app/build.gradle.kts @@ -0,0 +1,46 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.pdftron.pdftronflutterexample" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.pdftron.pdftronflutterexample" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + + resValue("string", "PDFTRON_LICENSE_KEY", "\"LICENSE_KEY_GOES_HERE\"") + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..399f6981 --- /dev/null +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index a67a2725..d6a49d91 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,30 +1,25 @@ - + - - + android:icon="@mipmap/ic_launcher"> - + android:value="@string/PDFTRON_LICENSE_KEY" /> @@ -33,20 +28,29 @@ while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> - - + + - - + + + + + + + diff --git a/example/android/app/src/main/java/com/pdftron/pdftronflutterexample/MainActivity.java b/example/android/app/src/main/java/com/pdftron/pdftronflutterexample/MainActivity.java deleted file mode 100644 index a4d6d386..00000000 --- a/example/android/app/src/main/java/com/pdftron/pdftronflutterexample/MainActivity.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.pdftron.pdftronflutterexample; - -import androidx.annotation.NonNull; - -import io.flutter.embedding.android.FlutterFragmentActivity; -import io.flutter.embedding.engine.FlutterEngine; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterFragmentActivity { - - @Override - public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } -} diff --git a/example/android/app/src/main/kotlin/com/pdftron/pdftronflutterexample/MainActivity.kt b/example/android/app/src/main/kotlin/com/pdftron/pdftronflutterexample/MainActivity.kt new file mode 100644 index 00000000..826fb74f --- /dev/null +++ b/example/android/app/src/main/kotlin/com/pdftron/pdftronflutterexample/MainActivity.kt @@ -0,0 +1,5 @@ +package com.pdftron.pdftronflutterexample + +import io.flutter.embedding.android.FlutterFragmentActivity + +class MainActivity : FlutterFragmentActivity() diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml index e66c7e97..06952be7 100644 --- a/example/android/app/src/main/res/values-night/styles.xml +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -1,11 +1,18 @@ - - + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml index 746a9bad..cb1ef880 100644 --- a/example/android/app/src/main/res/values/styles.xml +++ b/example/android/app/src/main/res/values/styles.xml @@ -1,17 +1,11 @@ - - - - + + diff --git a/example/android/build.gradle b/example/android/build.gradle deleted file mode 100644 index e29a4431..00000000 --- a/example/android/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/example/android/build.gradle.kts b/example/android/build.gradle.kts new file mode 100644 index 00000000..89176ef4 --- /dev/null +++ b/example/android/build.gradle.kts @@ -0,0 +1,21 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/example/android/gradle.properties b/example/android/gradle.properties index b8de59af..24863d21 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,10 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M - -# If you're using the permission_handler package, also add these two lines +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true -android.enableJetifier=true - -# Add the PDFTRON_LICENSE_KEY variable here. -# For trial purposes leave it blank. -# For production add a valid commercial license key. -PDFTRON_LICENSE_KEY= +android.enableJetifier=true \ No newline at end of file diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index bbe84e82..ac3b4792 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jul 10 15:58:56 PDT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle deleted file mode 100644 index 44e62bcf..00000000 --- a/example/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.kts new file mode 100644 index 00000000..ab39a10a --- /dev/null +++ b/example/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.3" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/example/pubspec.yaml b/example/pubspec.yaml index cf25f171..604cc59c 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -6,13 +6,15 @@ version: 1.0.0+1 publish_to: 'none' environment: - sdk: ">=2.17.5 <3.0.0" - flutter: ">=1.12.0" + sdk: ^3.8.0 dependencies: flutter: sdk: flutter + pdftron_flutter: + path: ../ + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 @@ -21,9 +23,6 @@ dev_dependencies: flutter_test: sdk: flutter - pdftron_flutter: - path: ../ - # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec diff --git a/ios/Classes/PTFlutterDocumentController.m b/ios/Classes/PTFlutterDocumentController.m index b3031178..8363e63d 100644 --- a/ios/Classes/PTFlutterDocumentController.m +++ b/ios/Classes/PTFlutterDocumentController.m @@ -786,6 +786,7 @@ -(PTExtendedAnnotType)convertAnnotationNameToAnnotType:(NSString*)annotationName PTAnnotationCreateRubberStampToolKey: @(PTExtendedAnnotTypeStamp), PTAnnotationCreateRedactionToolKey : @(PTExtendedAnnotTypeRedact), PTAnnotationCreateLinkToolKey : @(PTExtendedAnnotTypeLink), +// @"PTPanToolKey" : @(), // @"FormCreateTextField" : @(), // @"FormCreateCheckboxField" : @(), // @"FormCreateRadioField" : @(), diff --git a/ios/Classes/PdftronFlutterPlugin.h b/ios/Classes/PdftronFlutterPlugin.h index 3072d513..1e6aa42b 100644 --- a/ios/Classes/PdftronFlutterPlugin.h +++ b/ios/Classes/PdftronFlutterPlugin.h @@ -119,6 +119,8 @@ static NSString * const PTFormCreateRadioFieldToolKey = @"FormCreateRadioField"; static NSString * const PTFormCreateComboBoxFieldToolKey = @"FormCreateComboBoxField"; static NSString * const PTFormCreateListBoxFieldToolKey = @"FormCreateListBoxField"; static NSString * const PTPencilKitDrawingToolKey = @"PencilKitDrawing"; +static NSString * const PTAnnotationSmartPenToolKey = @"AnnotationSmartPen"; +static NSString * const PTPanToolKey = @"Pan"; // button static NSString * const PTStickyToolButtonKey = @"stickyToolButton"; @@ -273,6 +275,8 @@ static NSString * const PTStartSearchModeKey = @"startSearchMode"; static NSString * const PTExitSearchModeKey = @"exitSearchMode"; // Hygen Generated Methods +static NSString * const PTSetLayoutModeKey = @"setLayoutMode"; +static NSString * const PTSetFitModeKey = @"setFitMode"; static NSString * const PTGetAnnotationsOnPageKey = @"getAnnotationsOnPage"; // argument @@ -311,6 +315,8 @@ static NSString * const PTMatchWholeWordArgumentKey = @"matchWholeWord"; static NSString * const PTAnimatedArgumentKey = @"animated"; // Hygen Generated Method Parameters +static NSString * const PTLayoutModeArgumentKey = @"layoutMode"; +static NSString * const PTFitModeArgumentKey = @"fitMode"; // event strings static NSString * const PTExportAnnotationCommandEventKey = @"export_annotation_command_event"; diff --git a/ios/Classes/PdftronFlutterPlugin.m b/ios/Classes/PdftronFlutterPlugin.m index 4736d852..4c3d04d6 100644 --- a/ios/Classes/PdftronFlutterPlugin.m +++ b/ios/Classes/PdftronFlutterPlugin.m @@ -1022,6 +1022,9 @@ + (void)disableTools:(NSArray *)toolsToDisable documentController:(PTDocumen else if ([string isEqualToString:PTPencilKitDrawingToolKey]) { toolManager.pencilDrawingAnnotationOptions.canCreate = value; } + else if ([string isEqualToString:PTAnnotationSmartPenToolKey]) { + toolManager.smartPenEnabled = value; + } } } } @@ -1696,6 +1699,12 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [self smartZoom:result call:call]; } // Hygen Generated Method Call Cases + else if ([call.method isEqualToString:PTSetLayoutModeKey]) { + [self setLayoutMode:result call:call]; + } + else if ([call.method isEqualToString:PTSetFitModeKey]) { + [self setFitMode:result call:call]; + } else if ([call.method isEqualToString:PTGetAnnotationsOnPageKey]) { [self getAnnotationsOnPage:result call:call]; } @@ -3012,6 +3021,10 @@ - (void)setToolMode:(NSString *)toolMode resultToken:(FlutterResult)flutterResul // TODO } else if ([toolMode isEqualToString:PTPencilKitDrawingToolKey]) { toolClass = [PTPencilDrawingCreate class]; + } else if ([toolMode isEqualToString:PTAnnotationSmartPenToolKey]) { + toolClass = [PTSmartPen class]; + } else if ([toolMode isEqualToString:PTPanToolKey]) { + toolClass = [PTPanTool class]; } if (toolClass) { @@ -3543,6 +3556,81 @@ -(void)zoomToRect:(FlutterResult)flutterResult call:(FlutterMethodCall*)call { } // Hygen Generated Methods +- (void)setLayoutMode:(FlutterResult)flutterResult call:(FlutterMethodCall*)call +{ + PTDocumentController *documentController = [self getDocumentController]; + PTPDFViewCtrl *pdfViewCtrl = documentController.pdfViewCtrl; + NSString* layoutMode = [PdftronFlutterPlugin PT_idAsNSString:call.arguments[PTLayoutModeArgumentKey]]; + + if(documentController == Nil) + { + // something is wrong, document view controller is not present + NSLog(@"Error: The document view controller is not initialized."); + flutterResult([FlutterError errorWithCode:@"set_layout_mode" message:@"Failed to set page presentation mode" details:@"Error: The document view controller is not initialized."]); + return; + } + + if ([layoutMode isEqualToString:PTSingleKey]) { + [pdfViewCtrl SetPagePresentationMode:e_trn_single_page]; + } + else if ([layoutMode isEqualToString:PTContinuousKey]) { + [pdfViewCtrl SetPagePresentationMode:e_trn_single_continuous]; + } + else if ([layoutMode isEqualToString:PTFacingKey]) { + [pdfViewCtrl SetPagePresentationMode:e_trn_facing]; + } + else if ([layoutMode isEqualToString:PTFacingContinuousKey]) { + [pdfViewCtrl SetPagePresentationMode:e_trn_facing_continuous]; + } + else if ([layoutMode isEqualToString:PTFacingCoverKey]) { + [pdfViewCtrl SetPagePresentationMode:e_trn_facing_cover]; + } + else if ([layoutMode isEqualToString:PTFacingCoverContinuousKey]) { + [pdfViewCtrl SetPagePresentationMode:e_trn_facing_continuous_cover]; + } + [pdfViewCtrl Update:YES]; + flutterResult(nil); +} + +- (void)setFitMode:(FlutterResult)flutterResult call:(FlutterMethodCall*)call +{ + PTDocumentController *documentController = [self getDocumentController]; + PTPDFViewCtrl *pdfViewCtrl = documentController.pdfViewCtrl; + NSString* fitMode = [PdftronFlutterPlugin PT_idAsNSString:call.arguments[PTFitModeArgumentKey]]; + + if(documentController == Nil) + { + // something is wrong, document view controller is not present + NSLog(@"Error: The document view controller is not initialized."); + flutterResult([FlutterError errorWithCode:@"set_fit_mode" message:@"Failed to set page view mode" details:@"Error: The document view controller is not initialized."]); + return; + } + + if (!fitMode) { + return; + } + + if ([fitMode isEqualToString:PTFitPageKey]) { + [pdfViewCtrl SetPageViewMode:e_trn_fit_page]; + [pdfViewCtrl SetPageRefViewMode:e_trn_fit_page]; + } + else if ([fitMode isEqualToString:PTFitWidthKey]) { + [pdfViewCtrl SetPageViewMode:e_trn_fit_width]; + [pdfViewCtrl SetPageRefViewMode:e_trn_fit_width]; + } + else if ([fitMode isEqualToString:PTFitHeightKey]) { + [pdfViewCtrl SetPageViewMode:e_trn_fit_height]; + [pdfViewCtrl SetPageRefViewMode:e_trn_fit_height]; + } + else if ([fitMode isEqualToString:PTZoomKey]) { + [pdfViewCtrl SetPageViewMode:e_trn_zoom]; + [pdfViewCtrl SetPageRefViewMode:e_trn_zoom]; + } + + [pdfViewCtrl Update:YES]; + flutterResult(nil); +} + - (void)getAnnotationsOnPage:(FlutterResult)result call:(FlutterMethodCall*)call { PTDocumentController *documentController = [self getDocumentController]; @@ -3725,6 +3813,18 @@ + (Class)toolClassForKey:(NSString *)key else if ([key isEqualToString:PTAnnotationCreateFreeHighlighterToolKey]) { return [PTFreeHandHighlightCreate class]; } + else if ([key isEqualToString:PTEraserToolKey]) { + return [PTEraser class]; + } + else if ([key isEqualToString:PTPanToolKey]) { + return [PTPanTool class]; + } + else if ([key isEqualToString:PTAnnotationSmartPenToolKey]) { + return [PTSmartPen class]; + } + else if ([key isEqualToString:PTPencilKitDrawingToolKey]) { + return [PTPencilDrawingCreate class]; + } return Nil; } diff --git a/ios/pdftron_flutter.podspec b/ios/pdftron_flutter.podspec index b5700df7..a00f2fb8 100644 --- a/ios/pdftron_flutter.podspec +++ b/ios/pdftron_flutter.podspec @@ -11,6 +11,7 @@ A new flutter plugin project. s.homepage = 'http://example.com' s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } + s.platform = :ios, "11.0" s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' @@ -19,7 +20,5 @@ A new flutter plugin project. s.dependency 'PDFTronTools' s.frameworks = 'PDFNet', 'Tools' - - s.ios.deployment_target = '8.0' end diff --git a/lib/pdftron_flutter.dart b/lib/pdftron_flutter.dart index cfc13d2a..b552ed0e 100644 --- a/lib/pdftron_flutter.dart +++ b/lib/pdftron_flutter.dart @@ -62,6 +62,12 @@ class PdftronFlutter { Functions.importAnnotations, {Parameters.xfdf: xfdf}); } + /// Merges the given XFDF annotation string to the current document. + static Future mergeAnnotations(String xfdf) { + return _channel.invokeMethod( + Functions.mergeAnnotations, {Parameters.xfdf: xfdf}); + } + /// Exports the specified annotations in the current document as a XFDF annotation string. /// /// ```dart @@ -371,7 +377,7 @@ class PdftronFlutter { /// [path] specifies the file name of the image resource. The button will use /// the specified icon if [Config.showLeadingNavButton], which is true by /// default, is true in the config. To add an image file to your application, - /// please follow the steps in the [wiki page](https://github.com/PDFTron/pdftron-flutter/wiki/Adding-an-Image-Resource-To-Your-Application). + /// please follow the steps in the [wiki page](https://github.com/ApryseSDK/pdftron-flutter/wiki/Adding-an-Image-Resource-To-Your-Application). static Future setLeadingNavButtonIcon(String path) { return _channel.invokeMethod(Functions.setLeadingNavButtonIcon, {Parameters.leadingNavButtonIcon: path}); @@ -749,6 +755,20 @@ class PdftronFlutter { } // Hygen Generated Methods + /// Sets the page presentation mode in the viewer + static Future setLayoutMode(String layoutMode) { + return _channel.invokeMethod(Functions.setLayoutMode, { + Parameters.layoutMode: layoutMode + }); + } + + /// Sets the page view mode in the viewer + static Future setFitMode(String fitMode) { + return _channel.invokeMethod(Functions.setFitMode, { + Parameters.fitMode: fitMode + }); + } + /// Gets the list of annotations on the given page. static Future?> getAnnotationsOnPage(int pageNumber) { return _channel.invokeMethod(Functions.getAnnotationsOnPage, { diff --git a/lib/src/constants.dart b/lib/src/constants.dart index ac496644..0c17d2bc 100644 --- a/lib/src/constants.dart +++ b/lib/src/constants.dart @@ -11,6 +11,7 @@ class Functions { /// Android only static const getSavedSignatureJpgFolder = "getSavedSignatureJpgFolder"; static const importAnnotations = "importAnnotations"; + static const mergeAnnotations = "mergeAnnotations"; static const exportAnnotations = "exportAnnotations"; static const flattenAnnotations = "flattenAnnotations"; static const deleteAnnotations = "deleteAnnotations"; @@ -79,6 +80,8 @@ class Functions { static const getVisiblePages = "getVisiblePages"; // Hygen Generated Methods + static const setLayoutMode = "setLayoutMode"; + static const setFitMode = "setFitMode"; static const getAnnotationsOnPage = "getAnnotationsOnPage"; } @@ -120,6 +123,8 @@ class Parameters { static const animated = "animated"; // Hygen Generated Method Parameters + static const layoutMode = "layoutMode"; + static const fitMode = "fitMode"; } /// Parameters of events. @@ -237,13 +242,12 @@ class Tools { static const formCreateRadioField = 'FormCreateRadioField'; static const formCreateComboBoxField = 'FormCreateComboBoxField'; static const formCreateListBoxField = 'FormCreateListBoxField'; + static const annotationSmartPen = 'AnnotationSmartPen'; + static const pan = 'Pan'; /// iOS only. static const pencilKitDrawing = 'PencilKitDrawing'; - /// Android only. - static const annotationSmartPen = 'AnnotationSmartPen'; - /// Android only. static const annotationLasso = 'AnnotationLasso'; } diff --git a/lib/src/document_view.dart b/lib/src/document_view.dart index 00d7d67f..59f0946a 100644 --- a/lib/src/document_view.dart +++ b/lib/src/document_view.dart @@ -90,6 +90,12 @@ class DocumentViewController { Functions.importAnnotations, {Parameters.xfdf: xfdf}); } + /// Merges the given XFDF annotation string to the current document. + Future mergeAnnotations(String xfdf) { + return _channel.invokeMethod( + Functions.mergeAnnotations, {Parameters.xfdf: xfdf}); + } + /// Exports the specified annotations in the current document as a XFDF annotation string. /// /// ```dart @@ -401,7 +407,7 @@ class DocumentViewController { /// [path] specifies the file name of the image resource. The button will use /// the specified icon if [Config.showLeadingNavButton], which is true by /// default, is true in the config. To add an image file to your application, - /// please follow the steps in the [wiki page](https://github.com/PDFTron/pdftron-flutter/wiki/Adding-an-Image-Resource-To-Your-Application). + /// please follow the steps in the [wiki page](https://github.com/ApryseSDK/pdftron-flutter/wiki/Adding-an-Image-Resource-To-Your-Application). Future setLeadingNavButtonIcon(String path) { return _channel.invokeMethod(Functions.setLeadingNavButtonIcon, {Parameters.leadingNavButtonIcon: path}); @@ -767,6 +773,18 @@ class DocumentViewController { } // Hygen Generated Methods + Future setLayoutMode(String layoutMode) { + return _channel.invokeMethod(Functions.setLayoutMode, { + Parameters.layoutMode: layoutMode + }); + } + + Future setFitMode(String fitMode) { + return _channel.invokeMethod(Functions.setFitMode, { + Parameters.fitMode: fitMode + }); + } + /// Gets the list of annotations on the given page. Future?> getAnnotationsOnPage(int pageNumber) { return _channel.invokeMethod(Functions.getAnnotationsOnPage, { diff --git a/pubspec.yaml b/pubspec.yaml index a36d9f37..4dbc9e90 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,9 +1,9 @@ name: pdftron_flutter description: A convenience wrapper to build Flutter apps that use the PDFTron mobile SDK for smooth, flexible, and stand-alone document viewing. -version: 1.0.1-2 -homepage: https://www.pdftron.com -repository: https://github.com/PDFTron/pdftron-flutter -issue_tracker: https://github.com/PDFTron/pdftron-flutter/issues +version: 1.0.1-45 +homepage: https://www.apryse.com +repository: https://github.com/ApryseSDK/pdftron-flutter +issue_tracker: https://github.com/ApryseSDK/pdftron-flutter/issues documentation: https://pub.dev/documentation/pdftron_flutter/latest/pdftron/pdftron-library.html environment: sdk: ">=2.12.0 <3.0.0"