PDFTRON and Django

I currently have a project in which you want to integrate sdk with django.
The compilation of the files and the test of their execution was done based on the link

And its execution is satisfactory.

You want to integrate this library to the project in the django framework


import site
import sys
from pdf_tron.PDFNetPython import *

def index(request):
doc = PDFDoc()
page = doc.PageCreate() # Start a new page
doc.PagePushBack(page) # Add the page to the document
doc.Save(“output.pdf”, SDFDoc.e_linearized); # Save the document as a linearized PDF
print(“Hello World!”)
return HttpResponse(“PDF TRON Hello World!”)


Which generates the following error


Django Version: 3.0.3
Exception Type: NameError
Exception Value:
name ‘PDFNet’ is not defined


I would like to know if this type of integration has been carried out and the information is missing.

if this type of integration has been carried out and the information is missing.
We rarely get all the deployment details since customers deploy on-premises, so while we have customers asking about Django, we don’t have exact steps for integration.

from pdf_tron.PDFNetPython import *

In our samples this is just

from PDFNetPython import *

Also, if you look at RunTest.sh the following script.

export LD_LIBRARY_PATH=../../../PDFNetC/Lib

Finally, PDFNetC comes in 32 and 64 bit versions, which have to match the Python bitness, not your OS. Following shows how to check at runtime if your python is 32 or 64 bit.