• Stars
    star
    227
  • Rank 175,900 (Top 4 %)
  • Language
    Objective-C
  • License
    Other
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A drop-in replacement for Apple PDFKit powered by our PSPDFKit framework under the hood.

PDFXKit

PDFXKit is a drop-in replacement for Apple PDFKit using the industry leading PSPDFKit framework under the hood. The latest version requires PSPDFKit 11.2.4 for iOS and Xcode 13.2.1.

Note: PSPDFKit is a commercial product and requires a paid license for production use.

Introduction

Apple's PDFKit provides a great starting point if you need to integrate PDF support into your macOS or iOS app. It is a system library and as such the easiest to integrate.

PSPDFKit on the other hand goes much further offering you a cross-platform drop-in solution with many additional UI components, advanced PDF features, and first class support directly from the developers.

Migrating the full code base to PSPDFKit can be a major undertaking and a deal breaker for many developers. This is where PDFXKit comes in. It is a drop-in replacement giving you the same API as PDFKit while using PSPDFKit under the hood.

For more details, please consult the announcement blog post as well as the Migrating from Apple PDFKit guide.

Support, Issues and License Questions

PSPDFKit offers support for customers with an active SDK license via https://pspdfkit.com/support/request/

Are you evaluating our SDK? That's great, we're happy to help out! To make sure this is fast, please use a work email and have someone from your company fill out our sales form: https://pspdfkit.com/sales/

Getting Started

You can freely evaluate PSPDFKit without a license. The framework will display a watermark on the opened PDFs. For production use and licensing please refer to the previous section.

Using Swift Package Manager

Add PDFXKit Swift Package to your project:

  • In Xcode 13 or higher, go to File / Add Packagesโ€ฆ and enter the following package repository URL into the search field: https://github.com/PSPDFKit/PDFXKit.
  • Select "Up to Next Major Version" follow the instructions to finish the setup

Using CocoaPods

We assume you are familiar with CocoaPods, otherwise please consult the documentation first.

First, you'll have to add PDFXKit as a dependency to your Podfile:

# Replace `YourAppName` with your app's target name.
target :YourAppName do
  pod 'PDFXKit', :git => "[email protected]:PSPDFKit/PDFXKit.git", :branch => "master"
end

Now run pod install. Afterwards you should be able to build & run your project without errors. Next you'll have to adapt your project to use PDFXKit as described in Section Switch to PDFXKit.

Manual Setup

Note: manual setup is only for experts, we assume you know what you are doing. If you are unsure, please use CocoaPods instead.

First, build the PDFXKit framework:

  • Clone [email protected]:PSPDFKit/PDFXKit.git
  • Open the terminal and cd into the PDFXKit directory
  • Run rake compile

You should now have the PDFXFKit.xcframework in the Build folder. Next, add the PSPDFKit.xcframework, PSPDFKitUI.xcframework, and PDFXKit.xcframework to your project:

You should now be able to build & run your app.

Switch to PDFXKit

First, register the PSPDFKit license for your project as described in Adding the License Key guide.

Now we need to perform a couple of small changes in order to make your project use PDFXKit instead of the system PDFKit.

Update all source files to import PDFXKit instead of the PDFKit framework using Xcode's project-wide search & replace:

  • Open your project in Xcode
  • Bring up the search & replace panel (Menu Find -> Find and Replace in Project...)
  • Search & replace import PDFKit with import PDFXKit
  • Search & replace #import <PDFKit/PDFKit.h> with #import <PDFXKit/PDFXKit.h>

If you are using storyboards or xibs, update all custom classes:

  • Open each storyboard and replace all custom classes set to PDFView and PDFThumbnailView to PDFXView and PDFXThumbnailView.

  • Open each xib and replace all custom classes set to PDFView and PDFThumbnailView to PDFXView and PDFXThumbnailView

If you are using Swift:

  • Build & run your project, it should produce build erros for every use of a PDFKit notification constant, fix those by adding an X to the prefix, i.e. .PDFViewPageChanged should be ranamed to .PDFXViewPageChanged.

Build & run your project, your app is now using PDFXKit with PSPDFKit under the hood.

Now make sure your app works as expected. Specifically, there might be a conflict with your gesture recognizers. If so, implement the gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:) delegate method for the conflicting gesture recognizer and return true.

Limitations

PDFXKit is beta software, many parts aren't implemented yet. Please take a look at the headers, all unimplemented or only partially implemented symbols are annotated with the PDFX_NOT_IMPLEMENTED_PRIORITY_... and PDFX_PARTIALLY_IMPLEMENTED_PRIORITY_... macros.

Run the Example Project

  • Clone [email protected]:PSPDFKit/PDFXKit.git
  • Open PDFXKit.xcworkspace and wait for the Swift package manager to download the dependencies
  • Build & Run PDFXKitExample

Contributing

Please sign our CLA agreement so we can accept your pull requests.

Technical notes

  • All PDFXKit source files live in the Sources directory.

  • Each class has a ...+Swift.h header for Swift-only stuff which isn't exposed to Objective-C. Example: PDFXDocument+Swift.h.

  • Each class has a ...+PSPDFKit.h header for public PSPDFKit stuff, i.e. any interfaces that expose access to PSPDFKit when using PDFXKit. Example: PDFXDocument+PSPDFKit.h.

  • Some of the classes have a ...+Private.h header for internal stuff, i.e. needed by PDFXKit classes internally but shouldn't be exposed publicly. Example: PDFXPage+Private.h, exposes properties only allowed to be accessible by PDFXDocument.

Known Issues

Conflicting gesture recognizers. Your gesture recognizers might be in conflict with some of PSPDFKit's recognizers. If so, implement the gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:) delegate method for the conflicting gesture recognizer and return true.

License

The PDFXKit wrapper is released under a modified version of the BSD license, see LICENSE.md found at the root of this git repo.

More Repositories

1

PSPDFKit-Demo

The leading framework for displaying and annotating PDFs in your iOS apps.
275
star
2

react-native

React Native library for PSPDFKit for iOS, Android and Windows UWP.
Java
133
star
3

pspdfkit-flutter

PSPDFKit library for Flutter. Flutter is Google's mobile UI framework for crafting high-quality native experiences on iOS and Android in record time.
Dart
89
star
4

pspdfkit-web-example-react

Add PDF Support to Your Web App in No Time with PSPDFKit for Web
JavaScript
59
star
5

pspdfkit-web-examples-catalog

PSPDFKit for Web Examples Catalog
JavaScript
59
star
6

Appcelerator-iOS

Appcelerator Titanium Bridge for PSPDFKit for iOS
Objective-C
37
star
7

PSPDFKitSwift

Swift wrapper for PSPDFKit - both for iOS and macOS.
36
star
8

PSPDFKit-SP

Out-of-the-box PDF functionality for your iOS app
Swift
34
star
9

pspdfkit-ios-catalog

Example projects for PSPDFKit, the iOS PDF SDK.
Swift
32
star
10

Cordova-iOS

This is the official plugin to use PSPDFKit with Apache Cordova/PhoneGap/Ionic
29
star
11

pspdfkit-web-example-vue

Use PSPDFKit for Web in a Vue.js application
JavaScript
22
star
12

pspdfkit-server-example-nodejs

Sample for PSPDFKit Server and Instant
JavaScript
19
star
13

Xamarin-Android

PSPDFKit for Android wrapper for the Xamarin platform.
C#
19
star
14

awesome-pspdfkit

A collection of awesome things regarding PSPDFKit ecosystem
TypeScript
16
star
15

Cordova-Android

Cordova Wrapper for PSPDFKit for Android
15
star
16

Xamarin-iOS

PSPDFKit for iOS wrapper for the Xamarin platform.
C#
14
star
17

pspdfkit-electron-example

PSPDFKit for Electron Example Application
JavaScript
13
star
18

pspdfkit-web-example-webpack

Use PSPDFKit for Web in a Webpack setup
JavaScript
13
star
19

PSPDFKit-Cordova

Cordova / Ionic PDF Library by PSPDFKit
Objective-C
11
star
20

pspdfkit-web-example-pwa

Create a progressive web app (PWA) with PSPDFKit for Web
JavaScript
10
star
21

pspdfkit-android-catalog

PSPDFKit for Android Catalog app
Kotlin
10
star
22

pspdfkit-server-example-rails

Sample for PSPDFKit Server and Instant
Ruby
9
star
23

PSPDFKitOCR-SP

Convert scanned documents to searchable text
Swift
7
star
24

pspdfkit-web-example-nextjs

JavaScript
7
star
25

pspdfkit-android-simple-example

Simple PSPDFKit for Android example app
Java
7
star
26

pspdfkit-ios-swiftui-document-browser-example

PSPDFKit for iOS - SwiftUIDocumentBrowser Example
Swift
7
star
27

Tutorials

Tutorials around using PSPDFKit
Swift
6
star
28

pspdfkit-web-example-typescript

Use PSPDFKit for Web with TypeScript in a Webpack setup
JavaScript
5
star
29

pspdfkit-web-example-angular

Example of how to integrate PSPDFKit for Web in an Angular project
TypeScript
5
star
30

pspdfkit-web-signing-service-example

Example of a PSPDFKit Web (Server and Standalone) compatible digital signature signing server
JavaScript
5
star
31

pspdfkit-server-example-asp-net

HTML
4
star
32

ai-document-assistant-demo

AI Document Assistant for PSPDFKit Demo showcases how to interact with PDFs using natural language commands powered by AI, integrated with PSPDFKit for Web.
JavaScript
3
star
33

pspdfkit-jetpack-compose-pdf-viewer

Example project demonstrating how to build a PDF Viewer for Jetpack Compose with PSPDFKit for Android.
Kotlin
3
star
34

Instant-SP

Enable document collaboration in your app
Swift
3
star
35

Xamarin-UWP

Xamarin example app for PSPDFKit for Windows UWP. (Windows PDF SDK)
C#
3
star
36

open-pdf-with-reasonml

Open PDF with ReasonML example
Reason
2
star
37

pspdfkit-web-example-nuxtjs

This example shows how to integrate PSPDFKit for Web into a Nuxt.js app. pspdfkit.com
Vue
2
star
38

pspdfkit-android-instant-example

Instant for PSPDFKit for Android client example app
Java
2
star
39

pspdfkit-android-customfonts-example

Example app showing how to embed custom fonts into an app for rendering PDFs with PSPDFKit for Android
Kotlin
2
star
40

pspdfkit-sp-online-filehandler

Sample project of a PSPDFKit SharePoint Online Filehandler
TypeScript
2
star
41

pspdfkit-ios-instant-example

PSPDFKit for iOS - Instant example
Swift
1
star
42

pspdfkit-web-example-laravel

Example project demonstrating how to integrate PSPDFKit with the Laravel Framework
JavaScript
1
star
43

pspdfkit-web-cloudhsm-signing-example

Example that shows how to integrate AWS CloudHSM to produce signatures for PSPDFKit for Web
JavaScript
1
star
44

pspdfkit-web-example-svelte

This example shows how to integrate PSPDFKit for Web into an Svelte app. https://pspdfkit.com/
JavaScript
1
star
45

pspdfkit-web-example-gatsbyjs

This example shows how to integrate PSPDFKit for Web into an GatsbyJS app. https://pspdfkit.com/
JavaScript
1
star
46

pspdfkit-sp-online-webpart

Sample SPFx project showing of a PSPDFKit SharePoint Online webpart
TypeScript
1
star
47

dotnet-pdf-library-for-ios

How to build a PDF Viewer and Editor for iOS using .NET (C#) with PSPDFKit.NET (iOS).
C#
1
star
48

pspdfkit-web-example-nextjs-15

TypeScript
1
star