Executing Python 3 Code for PDF Parsing

I've written code in Python 3.9.13 to search and parse PDFs using PyMuPDF.

How can I execute the code from Ignition, feeding it a PDF Ignition obtained through a web address/uploaded to the gateway, and then receiving an array as the code's output?

I am basically using Python 3 to search key words and phrases and then extract text near those key phrases and save them to an array that also contains the page number where it was found.

I know Jython does not support this library so are there any good methods to run Python 3 code? I am not well versed with any other language but I'm willing to try if it's possible to replicate functionality and makes things simpler for Ignition.

Use Java's ProcessBuilder (accessible from jython).

2 Likes

Do you think I'll have to develop a module with the SDK or is there another way to use ProcessBuilder in Ignition Designer to achieve the same function?

You already have it written in python3? I would just do what Phil said and use process builder to call your existing code/py file with appropriate arguments.

Ignition has jython. It is well-integrated into java, and can use java classes and objects with near-native flexibility. Search this forum for ProcessBuilder for examples that do not require using the SDK.

1 Like