Some test text!

Python 3.xkeyboard_arrow_down

Get started with Python3

Welcome to PDFTron. Python3 for the PDFTron SDK is supported on Windows, Linux and macOS and has precompiled wrappers available. To get started, choose your preferred platform from the tabs below.

Precompiled Python3 & Windows PDF library integration

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

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).


  • Python 3.5 - 3.8 and pip.

    Make sure the executable name is python.exe (default on Windows) and Python is added to your path environment variable.

There are TWO steps needed before you can use PDFNetPython3 library.

Step 1

Use pip to install PDFNetPython3 library from Python Package Index (PyPI) in command prompt:

python -m pip install PDFNetPython3

If no errors occur, Successfully installed PDFNetPython3 ... will display in command prompt.

Step 2

Download PDFNetPython3 Samples. Unzip the package and run the Samples.

linkRun the Samples

Find and enter the PDFNetPython3/Samples folder.

Run a specific sample

  1. Find the sample you want to run and navigate into the PYTHON folder inside.
  2. Find RunTest.bat and double click on it to run it. Alternatively, you can use the following command to run AddImageTest in command prompt:

    cd PDFNetPython3\Samples\AddImageTest\PYTHON
    python -u


The output files are stored in Samples/TestFiles/output/

Run all samples

Find runall_python.bat in the samples folder and double click on it to run it. The output files from all tests are stored in Samples/TestFiles/output/.

linkIntegrate into your application

It is easy to integrate PDFNetPython3 into your application. After you have installed PDFNetPython3 via pip, all you need to do is add from PDFNetPython3 import * to your Python script.

Below is an example called

# You can add the following line to integrate PDFNetPython3
# into your solution from anywhere on your system so long as
# the library was installed successfully via pip

from PDFNetPython3 import *

def main():

    # You need to initialize the PDFNet library 
    # Before calling any PDF related methods

    # This example creates a new document
    # and a new page, then adds the page
    # in the page sequence of the document
    doc = PDFDoc()

    page1 = doc.PageCreate()

    # We save the document in a linearized
    # format which is the most popular and 
    # effective way to speed up viewing PDFs
    doc.Save(("linearized_output.pdf"), SDFDoc.e_linearized)


if __name__ == "__main__":

To test that your code works, run the script in the folder containing in command prompt:

python.exe -u

Once you have successfully run this, you should see an output file in the working directory of this program.

linkNext step



  1. If you successfully install our PDFNetPython3 library via pip but run into errors when running a sample, it may be that your Python version is not fully compatible.

    For Windows, we recommmend using Python 3.5.4, 3.6.8, 3.7.9, 3.8.5 to guarantee 100% compatibility.

    You can check your python version by using the command:

    python --version

    and update your Python to the recommended versions. If errors still occur, please contact our support team.

  2. If you cannot install PDFNetPython3 library via pip, you need to check whether python and pip are installed in your system.

    You can test it by using the following command:

    python -m pip --version

    If no errors occur and your python version is within 3.5 - 3.8, it may be that no precompiled PDFnetPython3 library is compatible with your system. Please contact our support team. You might need to build your own PDFNetPython3 wrapper using SWIG and our PDFNetC library.

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