Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quick start - view a document on iOS

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

  1. Apryse must be initialized before using any Apryse classes. This only needs to be done once. This is done as shown:

No trial license key required.

The trial of Apryse Mobile SDK does not require a trial key. A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.

PTPDFNet.initialize("<key-goes-here>")
[PTPDFNet Initialize:@"<key-goes-here>"];
  1. At the top of your source file, import PDFNet and Tools.

import PDFNet
import Tools
#import <PDFNet/PDFNet.h>
#import <Tools/Tools.h>
  1. The following shows how to create a document viewer, set the document to display, and present it on screen.

// Create a PTDocumentController
let documentController = PTDocumentController()

// The PTDocumentController 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)
// Create a PTDocumentController
PTDocumentController *documentController = [[PTDocumentController alloc] init];

// The PTDocumentController must be in a navigation controller before a document can be opened
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:documentController];

// Open an existing local file URL.
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"Sample" withExtension:@"pdf"];

[documentController openDocumentWithURL:fileURL];

// Show navigation (and document) controller.
[self presentViewController:navigationController animated:YES completion:nil];

Last updated

Was this helpful?