Some test text!


Go & Linux PDF library integration

This guide will help you run PDFTron samples and integrate the PDFTron SDK into Go applications on Linux. Your free trial includes unlimited trial usage and support from solution engineers.

Login/Sign Up to download the SDK


Ubuntu limitations
For Ubuntu 14.0.x, only Go version 1.15 is supported.
Run PDFTron SDK in production
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).

Initial setup

  1. Run our Linux Go installer script located on github:
source <(curl -s
  1. Get your PDFTron trial key.

Login/Sign Up to your account to get access to key

If your OS or Go version is not supported, the installation will fail.

Run the samples

  1. Open a command line console
  2. Change the directory to the samples folder
  3. Run all samples:
cd $HOME/go/src/pdftron/Samples

You can also enter any individual sample folder to run them separately. For example, here's how to run the AddImageTest sample:

cd $HOME/go/src/pdftron/Samples/AddImageTest/GO

The tests will run one by one. Output files will be in /Samples/TestFiles/Output.

Integrate 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 into your /Samples directory and make a new directory called myApp (if it does not exist already). This guide will assume your application is named myApp. For organization, create a new directory inside myApp called GO.

  2. Navigate inside that GO directory and create a new GO file called myApp.go. Open it with your favorite text editor and paste this into it:

    package main
    import (
        . "pdftron"
    func main(){
        PDFNetInitialize()           // PDFNet must be initialized before accessing any PDFTron API
        doc := NewPDFDoc()
        page := doc.PageCreate()     // Start a new page
        doc.PagePushBack(page)       // Add the page to document
        doc.Save("output.pdf", uint(SDFDocE_linearized)); // Save the document as a linearized PDF

    Run your application by executing go run myApp.go. Make sure that your interpreter can find the PDFNetC library. If all goes well, your console 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.

Next step

Guides Samples

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use