We are excited to announce new precompiled PDFNet Python3 libraries are available to download -- another small step in making the dev experience with PDFTron the best it can be.
New Python 3 support makes it a snap to install powerful document processing capabilities while enabling your Python developers to leverage the latest Python features with the highest security.
We currently support Python 3.5 - 3.8 on Windows (x64, x86), Linux (x64, x86), and macOS. By using PIP - Python package manager, you can download and install our Python packages published on Python Package Index (PyPI) with ease.
linkHow to Install
Installation is now just a single one-step command. Enter the following -- and that's it!
python -m pip install PDFNetPython3
python3 -m pip install PDFNetPython3
After the installation completes, you can add
import PDFNetPython3 or
from PDFNetPython3 import * and then fully employ our PDFNetPython3 library.
Below is a sample Python script called HelloWorld.py showing how our PDFNetPython3 is integrated.
# 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(): PDFNet.Initialize() # 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() doc.pagePushBack(page1) # 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) doc.close() if __name__ == "__main__": main()
Next, to test that your code works, run the script in the folder containing
HelloWorld.py via the command prompt:
python -u HelloWorld.py
python3 -u HelloWorld.py