# Executing Python 3 Code for PDF Parsing

**URL:** <https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984>\
**Category:** Ignition\
**Tags:** python, scripting\
**Created:** [March 27, 2024, 5:13pm UTC](https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984 "2024-03-27T17:13:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edgar\_Crespo](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@Edgar\_Crespo](https://forum.inductiveautomation.com/u/Edgar_Crespo)\
**Post date:** [March 27, 2024, 5:13pm UTC](https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984/1 "2024-03-27T17:13:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 27, 2024, 5:25pm UTC](https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984/2 "2024-03-27T17:25:41Z")

</div>

Use Java's [ProcessBuilder](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ProcessBuilder.html) (accessible from jython).

---

<div class="post-metadata">

**Author:** ![Edgar\_Crespo](https://avatars.discourse-cdn.com/v4/letter/e/db5fbb/32.png) [@Edgar\_Crespo](https://forum.inductiveautomation.com/u/Edgar_Crespo)\
**Post date:** [March 27, 2024, 7:16pm UTC](https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984/3 "2024-03-27T19:16:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [March 27, 2024, 7:18pm UTC](https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984/4 "2024-03-27T19:18:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 27, 2024, 7:51pm UTC](https://forum.inductiveautomation.com/t/executing-python-3-code-for-pdf-parsing/87984/5 "2024-03-27T19:51:33Z")

</div>

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.
