Some test text!
Welcome to PDFTron. This guide will help you integrate a free trial of the PDFTron iOS SDK into your Xcode projects for iOS applications. You can either integrate PDFTron frameworks automatically using Swift Package Manager, CocoaPods, or install them manually by downloading the SDK. Pick whichever your option you prefer, but integrating with Swift Package Manager is the recommended approach. Your free trial includes unlimited trial usage and support from solution engineers.
Create a new Xcode Project. Call it pdfhello
. For the purposes of this guide, select a single view application.
Create a new Podfile by running the following in the project directory pdfhello/
:
pod init
This guide will use the latest versions of PDFNet.xcframework
and Tools.xcframework
. To do this, modify your PodFile to include the PDFNet
pod:
target 'pdfhello' do
use_frameworks!
pod 'PDFNet', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdfnet/latest.podspec'
end
Then run pod install
in your project directory. You should be able to use PDFNet and Tools after this process.
You can find out more about other integration options for PDFTron SDK with CocoaPods here.
PDFTron uses a select number AppStore permissions to allow certain functionality such as adding image stamps and detecting the Apple Pencil. Your app's plist must include the following keys (with whatever description is appropriate for your app), or it will be rejected from the AppStore.
<key>NSCameraUsageDescription</key>
<string>This will allow you to use the image from your camera.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This will allow you to add images to your photo library.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This will allow you to create signatures and annotations from images in your photo library.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>This will allow us to detect if an Apple Pencil is paired, enabling palm rejection and the ability to scroll with one finger while annotating.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>This will allow us detect if an Apple Pencil is paired, enabling palm rejection and the ability to scroll with one finger while annotating.</string>
Initialize PDFTron before you use any PDFTron related classes or methods. This only needs to be done once.
The best practice to do this is to use the optional application:willFinishLaunchingWithOptions:
method in the AppDelegate
class found in either the AppDelegate.swift
or AppDelegate.m
file in the left pane depending on your choice of language:
// In AppDelegate.swift
import UIKit
import PDFNet
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
//... Any methods already here
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
PTPDFNet.initialize("Insert Commercial License Key Here After Purchase")
return true
}
}
While you are trialing PDFTron, you can pass any string to the initialize method. A string that is not a license key will enable demo mode, where all pages are lightly watermarked.
You can now use PDFTron SDK to view, annotate and edit documents .
You have 4 options to explore while adding PDFTron SDK using CocoaPods for iOS:
Option | Type | PDFNet.xcframework | Tools.xcframework |
---|---|---|---|
The method used above in this guide, Option 1, is the standard way to install PDFTron SDK using CocoaPods.
Click on the option number to go to the PodFile code.
For the latest release of bothPDFNet.xcframework
and Tools.xcframework
, add the following to your Podfile:
target '<Your-Target-Name>' do
use_frameworks!
pod 'PDFNet', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdfnet/latest.podspec'
end
Then, run pod install
.
For a specific release of bothPDFNet.xcframework
and Tools.xcframework
, add the following to your Podfile:
target '<Your-Target-Name>' do
use_frameworks!
pod 'PDFNet', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdfnet/9.2.2.79502.podspec'
end
Then, run pod install
.
For the latest release of PDFNet.xcframework
only (for if you are using a customized version of Tools.xcframework
), add the following to your Podfile:
target '<Your-Target-Name>' do
use_frameworks!
pod 'PDFNet', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdfnet-no-tools/latest.podspec'
end
Then, run pod install
.
For a specific release of PDFNet.xcframework
only (for if you are using a customized version of Tools.xcframework
), add the following to your Podfile:
target '<Your-Target-Name>' do
use_frameworks!
pod 'PDFNet', podspec: 'https://www.pdftron.com/downloads/ios/cocoapods/xcframeworks/pdfnet-no-tools/9.2.2.79502.podspec'
end
Then, run pod install
.
Note: CocoaPods distributes the dynamic framework only. If you wish to use the static framework, you will have to integrate it manually.
Get the answers you need: Support
PDFTron SDK
COMPANY