Some test text!

menu
search

Quick start - view a document

This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here.

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

  1. Add a PDF to your project:

    • Right click on Resources
    • Click on Add > Add Files
    • Choose a file (in this tutorial, let's say we added a sample.pdf) and confirm add
    • Make sure the Build Action of the file is set to BundleResource
  1. PDFTron must be initialized before using any PDFTron classes. This only needs to be done once. This is done as shown:

    For trial purposes PDFTron is available without the need for a license key, however a valid license key is required to use PDFTron in a production app. If you do not have a valid license key, please contact sales for a commercial license key.

    Your license key is confidential. Please make sure that it is not publicly available (e.g. in your public GitHub).

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

    using pdftron;
    using pdftron.PDF.Controls;
  3. The following shows how to create a document viewer, set the document to display, and present it on screen.

    // Create a PTDocumentViewController
    var documentController = new PTDocumentViewController();
    
    // The PTDocumentViewController must be in a navigation controller before a document can be opened
    var navigationController = new UINavigationController(documentController);
    
    // Open an existing local file URL.
    var fileURL = NSBundle.MainBundle.GetUrlForResource("sample", "pdf");
    
    bool success = documentController.OpenDocumentWithURL(fileURL);
    
    // Show navigation (and document) controller.
    this.PresentViewController(navigationController, true, null);

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.

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

Learn More
close