The PSPDFKit SDK is a framework that allows you to view, annotate, sign, and fill PDF forms on iOS, Android, Windows, macOS, and Web.
PSPDFKit comes with open source plugins for Cordova on both iOS and Android.
- A development environment setup for running Cordova projects.
- The latest stable version of cordova-lib.
- The latest stable version of cordova-ios.
- The latest stable version of Xcode.
- The latest stable version of CocoaPods.
- A development environment setup for running Ionic projects.
- The latest stable version of Node.js.
- The latest stable version of Ionic CLI.
- The latest stable version of
cordova-res
. - The latest stable version of Xcode.
- The latest stable version of CocoaPods.
Follow these steps to install PSPDFKit-Cordova in your Cordova project.
Follow these steps to install PSPDFKit-Cordova in your Ionic project.
The plugin is accessed via the PSPDFKit singleton. Here are some example calls:
// Set your license key here.
PSPDFKit.setLicenseKey("YOUR KEY");
// Show pdf with in single page mode, with a black background.
PSPDFKit.present("pdf/document.pdf", {
pageMode: "single",
backgroundColor: "black",
});
// Show a PDF document with a callback.
PSPDFKit.present("pdf/document.pdf", function () {
alert("pdf has appeared");
});
// Scroll to page 1.
PSPDFKit.setPage(1, true);
// Get the page number.
PSPDFKit.getPage(function (page) {
alert("Current page: " + page);
});
Follow these steps to install PSPDFKit-Cordova in a newly created Cordova project.
Follow these steps to run the PSPDFKit-Demo Cordova example project.
Follow these steps to install PSPDFKit-Cordova in a newly created Ionic project.
Follow these steps to run the PSPDFKit-Demo Ionic example project.
You can find the API documentation in PSPDFKit.js.
Error: Cannot find plugin.xml for plugin "PSPDFKit-Cordova". Please try adding it again.
Run cordova plugin add https://github.com/PSPDFKit/PSPDFKit-Cordova.git
instead of ionic cordova plugin add https://github.com/PSPDFKit/PSPDFKit-Cordova.git
.
Installing "pspdfkit-cordova" for ios
Running command: pod install --verbose
/Users/yourUsername/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/external_sources/podspec_source.rb:19: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
Failed to install 'pspdfkit-cordova': Error: pod: Command failed with exit code 1 Error output:
/Users/yourUsername/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/external_sources/podspec_source.rb:19: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
at ChildProcess.whenDone (/Users/yourUsername/Downloads/pspdfkit-cordova/examples/ionic/PSPDFKit-Demo/node_modules/cordova-common/src/superspawn.js:136:25)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Socket.<anonymous> (internal/child_process.js:439:11)
at Socket.emit (events.js:315:20)
at Pipe.<anonymous> (net.js:673:12)
pod: Command failed with exit code 1 Error output:
/Users/yourUsername/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cocoapods-1.10.1/lib/cocoapods/external_sources/podspec_source.rb:19: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
[ERROR] An error occurred while running subprocess cordova.
cordova platform add ios exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
- Open your project's Podfile:
open platforms/ios/Podifile
- Modify your Podfile like so:
source 'https://github.com/CocoaPods/Specs.git'
- platform :ios, '11.0'
+ platform :ios, '15.0'
use_frameworks!
target 'MyApp' do
project 'MyApp.xcodeproj'
pod 'PSPDFKit', podspec: 'https://customers.pspdfkit.com/pspdfkit-ios/latest.podspec'
end
- Change your local working directory to
platforms/ios
:
cd platforms/ios/
- Run
pod install
- Change your local working directory back to the root of your project:
cd ../../
- Launch your app:
Cordova:
cordova emulate ios
Ionic:
ionic cordova emulate ios
If you were using the old Cordova-iOS Plugin, please follow the steps below to migrate to this plugin:
- Remove the old plugin:
cordova plugin remove pspdfkit-cordova-ios
- Open your Xcode project or workspace and remove
PSPDFKit.framework
andPSPDFKitUI.framework
from your Target:
- Close your Xcode project or workspace.
- Integrate the new
pspdfkit-cordova
Plugin. See the Install instructions above. - Rename all
PSPDFKitPlugin
calls toPSPDFKit
in your app's JavaScript code:
- PSPDFKitPlugin.setLicenseKey("YOUR KEY");
+ PSPDFKit.setLicenseKey("YOUR KEY");
- PSPDFKitPlugin.present('pdf/document.pdf', {
+ PSPDFKit.present('pdf/document.pdf', {
pageMode: 'single',
});