Some test text!

menu
2. View a documentkeyboard_arrow_down

View a document using PTDocumentViewController

  1. 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
  2. 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:"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)
    }
  3. 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

Customize

Get the answers you need: Support

close

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.

Join our upcoming webinar to find out about built-in, full-functioning document capabilities directly in Salesforce.

Save your seat
close