# PDF parsing and Extracting Data

**URL:** <https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529>\
**Category:** KNIME Analytics Platform\
**Tags:** text-processing\
**Created:** [March 9, 2022, 7:20am UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529 "2022-03-09T07:20:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivani\_soni](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@shivani\_soni](https://forum.knime.com/u/shivani_soni)\
**Post date:** [March 9, 2022, 7:20am UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/1 "2022-03-09T07:20:10Z")

</div>

Hi,  
I want to extract the table from multiple pdf files and write it to excel. The first page of the pdf contains some text and from 2nd page onwards the table, while in some pdfs the table starts from page one itself. The issue is that from all the records present in the table some records are not extracted i.e. from 6000 rows only 4000 rows are extracted rest are omitted. What can be done to get all the present records? Can anyone guide me with this. For different pdfs the column orders can be different and also extra column can also be there. I can’t seem to find standard solution for this.

---

<div class="post-metadata">

**Author:** ![elsamuel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/b4bc9f/32.png) [@elsamuel](https://forum.knime.com/u/elsamuel)\
**Post date:** [March 9, 2022, 7:29am UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/2 "2022-03-09T07:29:51Z")

</div>

What approach have you taken? Can you post your workflow and/or the pdfs? What’s your desired outcome?

I’ve had great success extracting tables with thousands of rows from multi-page pdfs, containing preamble text on the first page and other information like footnotes, using the Tika Parser node in combination with manipulation nodes like the Row Filter, Transpose, Cell Splitter, Regex Extractor, and String Manipulation nodes.

---

<div class="post-metadata">

**Author:** ![shivani\_soni](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@shivani\_soni](https://forum.knime.com/u/shivani_soni)\
**Post date:** [March 9, 2022, 9:19am UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/3 "2022-03-09T09:19:57Z")

</div>

I have used Tika Parser node to read all the pdf files present in a folder, followed by cell splitter for splitting cell by \n-new line as delimiter, filtering nodes to filter out blank columns and rows. And than regex split for splitting rows into column. First column contains Serial number-numerical format, Second column contains alphanumeric values where the value starts with U followed by number and than mixed characters with the specific length of 24 characters. And last column should contain words i.e. names only characters no numbers.  
I want the S/N, CIN, & Company name from these.

Sample pdf screen shots attached here with different table format and number of column are attached herewith:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/c/1c50d55c071765da59f9a53a201e9d4b5d0c4991.png)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/5/e55f5d861f9c906ef474e32d4ad1c12c98c56d04.png)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/4/f4b61dd18159c073b0cff98362c80128a7dd052d.jpeg)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/c/e/ced929a26ac45d664ae70d069fad9243a4d85868.jpeg)

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [March 9, 2022, 9:40am UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/4 "2022-03-09T09:40:45Z")

</div>

@shivani_soni you could try and use the R package tabulizer. Maybe you could provide us with an example.

> [@Automate pdf reader and convert data to excel table with correct column mappings](https://forum.knime.com/t/automate-pdf-reader-and-convert-data-to-excel-table-with-correct-column-mappings/26384/10):
>
> I had problems with the mentioned KNIME only approaches so I tried something with KNIME and R. It has these steps: run and configure R’s “tabulizer” it seems the settings ‘stream’ and GUESS are working best in your case it would extract one table from each page and try to find headers and bring them to a table not all information would be in the same columns (we come to that later) the tables are saved as single CSVs (with their varying structure) then they would be imported into KNIME forcing…

How to install R: [KNIME guide](https://docs.knime.com/latest/r_installation_guide/index.html#_introduction) and [collection](https://kni.me/w/tj5tS_6gYvqOSPlk).

---

<div class="post-metadata">

**Author:** ![shivani\_soni](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@shivani\_soni](https://forum.knime.com/u/shivani_soni)\
**Post date:** [March 21, 2022, 11:59am UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/5 "2022-03-21T11:59:27Z")

</div>

Can we solve this without using any external libraries or packages i.e. R tabulizer package or tabula library of java? Plus there are some errors in recognizing the characters in the data parsed by the tikka parser for example for some of the entries in the column CIN number letters such as M is recognized as 1V1, J as 1 or /, H as 1-1 etc. What can be done for such cases?

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [March 21, 2022, 12:21pm UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/6 "2022-03-21T12:21:36Z")

</div>

@shivani_soni there was an example and a discussion doing this with just KNIME nodes. But I think I was not able to use that whith the example I have cited. Maybe you could give it a try or provide us with an example:

> [@Extract Tables from PDF](https://forum.knime.com/t/extract-tables-from-pdf/12354/6):
>
> Hello everyone, It is possible if the PDF allows it, meaning if the string we get from the PDF represents the table so that we can manipulate the String, to extract the table. I took @JAGBI’s example and parsed the first three pages as an example. In order to extract the whole table/document, some more string manipulation would have to be done. The magic happens in the Extract Table metanode, where the string is parsed to an actual table. The workflow would have to be adapted to other PDFs/tab…

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 19, 2022, 12:21pm UTC](https://forum.knime.com/t/pdf-parsing-and-extracting-data/40529/7 "2022-06-19T12:21:49Z")

</div>

Closed on June 19, 2022, 12:21pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
