Unable to use PDFNet Python in my own project


I am trying to use your Python wrapper on latest Ubuntu, but get the following error.

CRITICAL libPDFNetC.so: cannot open shared object file: No such file or directory

There is a workaround; if I try to import libPDFNetC, catch the exception, and then try to import PDFNetPython, it will work. Meaning this code works:

site.addsitedir(configwrapper.pdftron_path) try: import libPDFNetC except: pass from PDFNetPython import PDFDoc, Annot


It looks like you are trying to import the libPDFNet.so file from Python, which you don’t want to do. Here is the first lines of code from all our Python samples.

import site site.addsitedir("../../../PDFNetC/Lib") import sys from PDFNetPython import *

Where PDFNetC/Lib contains both libPDFNet.so and PDFNetPython.py.

Note, it does not try to import libPDFNetC.so.

libPDFNetC.so has a pure C interface, which PDFNetPython.py communicates with. Your python code just communicates with PDFNetPython.py.


The error persists. I noticed if I run

ldd _PDFNetPython.so

I get the following.

a@b:~/wrappers_build/PDFNetWrappers/PDFNetC/Lib$ ldd _PDFNetPython.so
linux-vdso.so.1 => (0x00007fff0a5fe000)
libPDFNetC.so => not found
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9d40179000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9d3ff62000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d3fb9a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9d3f896000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9d40c8e000)


libPDFNetC.so is in the same folder.


This is not the typical result, it should be finding libPDFNetC.so, but a workaround is to add this folder to your LD_LIBRARY_PATH environment variable.