Some test text!

platform
search

Quick start - view a document

This guide demonstrates how to display a PDF. To begin working with PDFTron SDK, you must have first added it to your project.

  1. PDFTron must be initialized with a key that is provided during trial registration or after licensing. This only needs to be done once, and must be done before using any PDFTron classes. This is done as shown:

    PTPDFNet.initialize("<key-goes-here>")
  2. At the top of your source file, import PDFNet and Tools.

    import PDFNet
    import Tools
  3. The following shows how to create a document viewer, set the document to display, and present it on screen.

    // 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 an existing local file URL.
    let fileURL: URL! = Bundle.main.url(forResource: "sample", withExtension: "pdf")
    
    documentController.openDocument(with: fileURL)
    
    // Show navigation (and document) controller.
    self.present(navigationController, animated: true, completion: nil)

Get the anwsers you need: Support