Some test text!

2. View a documentkeyboard_arrow_down

View a document using PTDocumentViewController

  1. Initialize PTPDFNet before you use any PDFTron related methods and classes. 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
    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
  2. Open your ViewController file. This is either the ViewController.swift or ViewController.m file in the left pane depending on your choice of language. Import PDFNet and Tools libraries.

    import PDFNet
    import Tools
  3. Override the viewDidAppear() method in the ViewController class and then open the DocumentViewController using:

    override func viewDidAppear(_ animated: Bool) {
        // Create a PTDocumentViewController
        let documentController = PTDocumentViewController()
        // The PTDocumentViewController must be in a navigation controller before a document can be opened
        let navigationController = UINavigationController(rootViewController: documentController)
        // Open a file from URL.
        let fileURL: URL = URL(string:"")!
        documentController.openDocument(with: fileURL)
        // Show navigation (and document) controller.
        self.present(navigationController, animated: true, completion: nil)
  4. Click on the white play button on the top left of your window to launch the application in the Simulator.

Your app should look like this:

Final iOS get started

linkNext step


Get the answers you need: Support


Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more