Some test text!


Objective-C & macOS PDF library integration

This guide will help you run PDFTron samples and integrate a free trial of the PDFTron SDK into Obj-C applications on macOS. Your free trial includes unlimited trial usage and support from solution engineers.


  • Xcode
  • PDFTron's Objective-C PDF library for macOS:

No trial license key required.
The trial of PDFTron SDK works without a license key. A commercial license key is required for use in a production environment. Please fill out our licensing form if you do not have a valid license key.
Keep your commercial license key confidential.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).

linkInitial setup

  1. Download the PDFTron SDK.
  2. Extract the downloaded zip file and navigate to it.

linkRun the samples

Run a specific sample

  1. Navigate to the OBJC folder in a sample project, for example /Samples/AddImageTest/OBJC and run the sample with

Run all samples

  1. Navigate to /Samples and run

The tests will run one by one.

Output files will be in /Samples/TestFiles/Output

linkIntegrate into your application

This section will show you how to use our SDK to create a simple PDFTron "Hello World!" application. It will create a document with one blank page and save it as a linearized PDF in its running directory.

  1. Navigate to the /Samples directory of the PDFTron SDK and create a directory called myApp if it does not exist already. This guide will assume your project is named myApp.
  2. Enter your myApp directory and create a OBJC directory for organization. Then create a myApp.m file. Open this file in your favorite text editor and paste:

    #import <OBJC/PDFNetOBJC.h>
    #import <Foundation/Foundation.h>
    int main (int argc, const char * argv[])
        @autoreleasepool {
            int ret = 0;
            [PTPDFNet Initialize: 0];  // PDFNet must be initialized before accessing any PDFTron API
            PTPDFDoc* doc = [[PTPDFDoc alloc] init];
            PTPDFRect * rect = [[PTPDFRect alloc] init];
            [rect Set: 0 y1: 0 x2: 612 y2: 792];
            PTPage* page = [doc PageCreate: rect];  // Start a new page
            [doc PagePushBack: page];   // Add the page to the document
            [doc SaveToFile: @"output.pdf" flags: e_ptlinearized];
            NSLog(@"Hello World!");
            return ret;
  3. In that same OBJC directory inside your myApp project folder add a makefile called Makefile and paste this inside:

    CFLAGS=-fobjc-exceptions -fobjc-arc
    LIBS=-L../../../Lib -lPDFNetC -framework Foundation
    $(TARGET): $(TARGET).m.o
        @echo "Linking target: $(TARGET)"
        $(CC) -o $@ $< $(LIBS) $(LDFLAGS)
    $(TARGET).m.o: $(TARGET).m
        @echo "Compiling target: $(TARGET)"
        $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES)
    all: $(TARGET)
        rm -fr $(TARGET) *.o
    rebuild: clean all
    .PHONY: all clean rebuild
  4. Run the project by executing:


    followed by:


    If all goes well, your terminal should output:

    PDFNet is running in demo mode.
    Permission: write
    Hello World!

Check the output.pdf that the program output in the same directory. It should be a PDF with one blank page.

linkNext step

GuidesAPI docsSamples

Get the answers you need: Support


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 live demo to learn about use cases & capabilities for WebViewer

Learn more