Cordova integration with PSPDFKit for Web


Apache Cordova is an open source platform to build native apps using HTML5, CSS and JavaScript.

PSPDFKit for Web Standalone Deployment

PSPDFKit for Web is not currently supported in Cordova projects.

The Standalone Deployment requires an HTTP server and Cordova does not use a localhost server to serve the contents of the www folder (HTML, JavaScript and CSS). Instead, Cordova uses the file:///path/to/resource/ scheme. The cordova-plugin-httpd third party plugin can be used to run a localhost HTTP server in our Cordova project and redirect to the Standalone Deployment example's index.html as soon as the local server is available.

We discovered performance issues, such running out of memory when executing JavaScript in the web views. This is especially noticeable on real iOS devices. It was less of an issue in the iOS simulator. In our tests, it worked acceptably well in iOS 10 but things actually regressed on iOS 11. In-App mobile performance isn't yet good enough.

Our solution

We recommend that you use the currently recommended integration for Cordova projects which is based on the Native SDKs for iOS and Android.

If you absolutely wish to use PSPDFKit for Web, then you can run it on your own remote server and not in localhost. This way, your Cordova app act as a web browser without having to run any high-performance JavaScript in the web view.

Our Long-term Goal

We are constantly working on improving and optimizing PSPDFKit for Web and hopefully future versions of iOS (iOS 11 or iOS 12) will improve JavaScript performance in web views.

Was this page helpful? We're happy to answer any questions.