Some test text!
iOS / Guides
PTDocumentViewController
class. This class is no longer being updated.
For the best viewing experience and to take advantage of new developments, the PTDocumentController
should be used.
Please see this guide for information.
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
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)
navigationController.modalPresentationStyle = .fullScreen
// Open a file from URL.
let fileURL: URL = URL(string:"https://pdftron.s3.amazonaws.com/downloads/pl/sample.pdf")!
documentController.openDocument(with: fileURL)
// Show navigation (and document) controller.
self.present(navigationController, animated: true, completion: nil)
}
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:
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales