# PDF Parser scripting

**URL:** <https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [June 11, 2024, 9:59am UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675 "2024-06-11T09:59:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmadariaga](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmadariaga/32/63201_2.png) [@mmadariaga](https://forum.inductiveautomation.com/u/mmadariaga)\
**Post date:** [June 11, 2024, 9:59am UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675/1 "2024-06-11T09:59:36Z")

</div>

I want to extract data from a pdf file. I was able to get the data I wanted using **PyPDF2** on a python 3.8 environment. Could I install this package in Ignition and use the same code in Ignition scripting? Is there a better approach to get what I want?

This is the code I used, for reference.

```python
import PyPDF2 as pdflib
import re

pdf = pdflib.PdfReader('data.PDF')
txt = u'\n'.join(pg.extract_text() for pg in pdf.pages)

pattern = r'Dnia:.*?\n'
data = re.findall(pattern, txt)

# Regular expression to find dates and numbers
pattern_datesnum = re.compile(r'\d{2}\.\d{2}\.\d{4}|\+?\d[\d\.]*')

result = []
for line in data:
    a = line.split()[1].replace('.', '/')
    b = [string.replace('.', '') for string in line.split()[2:]]
    c = a + " " + " ".join(b)
    result.append(c)

new_list = []
for element in result:
    # Remove numbers preceded by "Page:"
    element_without_page = re.sub(r'Page:\s*\d+/\d+\s*', '', element)
    # Keep only numbers and "-"
    numbers_and_hyphens = re.findall(r'[-/\d]+', element_without_page)
    # Join the numbers and hyphens found
    new_list.append(' '.join(numbers_and_hyphens))

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [June 11, 2024, 10:06am UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675/2 "2024-06-11T10:06:26Z")

</div>

According to [the PyPDF documentation](https://nanonets.com/blog/pypdf2-library-working-with-pdf-files-in-python/#:~:text=PyPDF2%20has%20no%20dependencies%20other,some%20algorithms%20to%20improve%20performance.), this has C dependencies, so the prospect of using it in Jython seems problematic.

> it does use C extensions for some algorithms to improve performance.

---

<div class="post-metadata">

**Author:** ![mmadariaga](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmadariaga/32/63201_2.png) [@mmadariaga](https://forum.inductiveautomation.com/u/mmadariaga)\
**Post date:** [June 11, 2024, 10:08am UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675/3 "2024-06-11T10:08:37Z")

</div>

Ok thanks, I'll try another package then.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [February 26, 2026, 4:53pm UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675/4 "2026-02-26T16:53:39Z")

</div>

How did you get this working in ignition? I am about to do the same thing and looking for pointers.

---

<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:** [February 26, 2026, 5:50pm UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675/5 "2026-02-26T17:50:58Z")

</div>

Since it requires C dependencies he didn’t. You could set up a python flask server that runs your c-dependent python scripts and talk to that from ignition via web verbs and respond to Ignition via web dev module (or by putting results in a place igniton knows to look like a db, or a file in a known directory).

You could also shell out to a script via `ProcessBuilder` and call a batch/shell script that runs your python script with arguments.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [February 26, 2026, 6:07pm UTC](https://forum.inductiveautomation.com/t/pdf-parser-scripting/91675/6 "2026-02-26T18:07:59Z")

</div>

I just started looking at process Builder from another thread, thanks!
