# Split multiple page PDF to individual pages

**URL:** <https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734>\
**Category:** KNIME Extensions\
**Created:** [June 2, 2022, 6:22pm UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734 "2022-06-02T18:22:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![srinibash1980](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@srinibash1980](https://forum.knime.com/u/srinibash1980)\
**Post date:** [June 2, 2022, 6:22pm UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/1 "2022-06-02T18:22:30Z")

</div>

Do we have any node in knime to Split multiple page PDF to individual pages ?

---

<div class="post-metadata">

**Author:** ![takbb](https://forum-cdn.knime.com/user_avatar/forum.knime.com/takbb/32/57077_2.png) [@takbb](https://forum.knime.com/u/takbb)\
**Post date:** [June 3, 2022, 7:37am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/2 "2022-06-03T07:37:35Z")

</div>

Hi @srinibash1980

I’m not aware of a specific node but having done something a while ago to _join_ PDFs using the R snippet node, this should be fairly simple to achieve.

Take a look at this thread

> [@Merge multiple PDFs](https://forum.knime.com/t/merge-multiple-pdfs/21853/5):
>
> I did a search on the forum and elsewhere and there was a promising suggestion, re using an R script to do this. I’ve never used R before… so here goes! slight_smile Firstly, you’ll need to have R installed, and configured with Knime, as per the instructions found here: [https://docs.knime.com/latest/r\_installation\_guide/index.html](https://docs.knime.com/latest/r_installation_guide/index.html) Once you’ve done everything there for your environment, you will need to run R outside of Knime (which you will have installed as part of those instructions) just…

I didn’t know any R when I wrote that and this is still the limit of my R experience but I believe the same toolkit used there is capable of splitting pdf files too.

From memory, I think you will need to have the R pdftools package and qpdf. Have a quick look at that and see if that gives sufficient clues. If you need more assistance post back and I’ll have a play when I have some time.

In the meantime somebody else may know another way.

---

<div class="post-metadata">

**Author:** ![eamendola](https://forum-cdn.knime.com/user_avatar/forum.knime.com/eamendola/32/36540_2.png) [@eamendola](https://forum.knime.com/u/eamendola)\
**Post date:** [June 4, 2022, 10:44pm UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/3 "2022-06-04T22:44:12Z")

</div>

Hi @srinibash1980

This is a very difficult question to answer because it really depends on the structure of your file. Is it text only ? Contains images, tables ?

It is possible if the file has any **page number** for example or a **footer** with a significant text, so you cant find with regex that number/footer, and do a split somehow. But if you have a page number, again could be hard to do because you can have numbers on the body of the PDF (advanced/improved regex).

Both of the nodes I know (Default PDF Parser and Tika Paser from the [KNIME Textprocessing – KNIME Hub](https://kni.me/e/PH_ptBLLdL1Mich2) extension) returns the whole PDF as one column, and then you need to make your way by parsing/manipulating that column.

I wanted to show you an example, this could help you in a way. Take a look at both implementations, the Tika Parser would ask you to install the extension.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/d/e/deb6102be5c3a894afa20875eabc996bd277a21d.png)

> **[Split PDF To pages – eamendola](https://hub.knime.com/eamendola/spaces/Public/latest/Split%20PDF%20To%20pages~BXHTq1Dag85hqJQZ)**
>
> Solutions for data science: find workflows, nodes and components, and collaborate in spaces.

---

<div class="post-metadata">

**Author:** ![srinibash1980](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@srinibash1980](https://forum.knime.com/u/srinibash1980)\
**Post date:** [June 8, 2022, 6:57am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/4 "2022-06-08T06:57:26Z")

</div>

Thanks for reply @takbb .  
I do not have any exp in R. it will be really helpful to get some more assistance .

---

<div class="post-metadata">

**Author:** ![srinibash1980](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@srinibash1980](https://forum.knime.com/u/srinibash1980)\
**Post date:** [June 8, 2022, 8:43am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/5 "2022-06-08T08:43:10Z")

</div>

Hi @eamendola  
The PDF , I am using contain around 50 pages. and each page has couple of images and some text related to those images.  
I have tried using both PDF and Tikka parser. but these nodes does not have functionality to split the PDF . It extract all texts from 50 pages as if it is 1 page data. we need to extract data page wise and keep it separate .

---

<div class="post-metadata">

**Author:** ![takbb](https://forum-cdn.knime.com/user_avatar/forum.knime.com/takbb/32/57077_2.png) [@takbb](https://forum.knime.com/u/takbb)\
**Post date:** [June 8, 2022, 8:55am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/6 "2022-06-08T08:55:23Z")

</div>

Hi @srinibash1980 ,

I realised that in my new KNIME environment, I don’t have R installed so I went looking for a quick java based solution. In the interests of expediency, I’ll just drop a workflow here. I created a component which you can find here on the hub:

[knime://My-KNIME-Hub/Users/takbb/Public/Components/Split%20PDF%20to%20pages](https://kni.me/c/piBgGz17D6vjNWpo)

Here is a workflow to demo its use.

In this workflow, I download the analytics\_platform\_best\_practices\_guide.pdf file from the KNIME website, just so I have a pdf available to demo. The component is configured with an input file path, a destination folder path and a “base” file name to be used for creating the output.

If you run the workflow, it will create a folder on your pc called  
c:\temp-pdf-split-demo  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/9/e/9e62442e92f2b194c2f517332973e9840a3fc1dc.png)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/3/5/352d0339e0478d6c6cede25863d0d4e86a7cd389.png)

Hopefully it is self explanatory. Post back if you have any problems, or let me know if it works for you. At some point I’ll try to write up here how it works.

[PDF Split using java.knwf](https://forum.knime.com/uploads/short-url/7eXnOZkxnlLhcJctTmQfQpbOUFs.knwf) (2.6 MB)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/8/f8553e307b7b83ba658d710219d6fa78c391f78a.png)

---

<div class="post-metadata">

**Author:** ![srinibash1980](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@srinibash1980](https://forum.knime.com/u/srinibash1980)\
**Post date:** [June 8, 2022, 10:24am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/7 "2022-06-08T10:24:45Z")

</div>

@takbb Thanks a ton for the help

---

<div class="post-metadata">

**Author:** ![srinibash1980](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@srinibash1980](https://forum.knime.com/u/srinibash1980)\
**Post date:** [June 8, 2022, 10:58am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/8 "2022-06-08T10:58:30Z")

</div>

@takbb , It is working so nicely. Thanks again.  
I do have one more query Brian, the current node works fine when we pass 1 PDF with multiple pages. if we have scenario to extract pages from multiple PDFs ! how we should achieve that.

---

<div class="post-metadata">

**Author:** ![takbb](https://forum-cdn.knime.com/user_avatar/forum.knime.com/takbb/32/57077_2.png) [@takbb](https://forum.knime.com/u/takbb)\
**Post date:** [June 8, 2022, 11:42am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/9 "2022-06-08T11:42:57Z")

</div>

Hi @srinibash1980 , I’m pleased it worked for you and thank you for marking the solution as that will help others find it.

Attached is an updated version demonstrating processing of all pdf files in a folder. It uses a loop and with each iteration adjusts the config of the pdf component using flow variables.

For demo here, I used the file name for each pdf as the basis for creating a new output folder, so the extracted pages for each file go into their own output folder. Obviously you can do that, or you can just leave the output folder alone on the component as before.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/5/5/55dc1486fc9990235a434107df5dea50a3c2c279.png)

I hope that gives you the ideas/help you need for your own use case.

[PDF Split using java with folder processing.knwf](https://forum.knime.com/uploads/short-url/8MeVmBRKwEOCCIMNPYEMTaUMhkF.knwf) (2.6 MB)

[EDIT - I should add the website reference that was the source of the information/java code used in writing this solution:

> **[Java Examples - Split PDF into Many](https://www.tutorialspoint.com/javaexamples/split_pdf_into_many.htm)**
>
> Java Examples - Split PDF into Many, How to split a PDF in to many using Java.

I adapted the code from there to place in the java snippet.

For this to work, it required two java .jar files:

1. pdfbox-2.0.26.jar
2. commons-logging-1.2.jar  
These are open source and were downloaded from:  
[Apache PDFBox | Download](https://pdfbox.apache.org/download.cgi)  
[Apache Commons Logging - Download Apache Commons Logging](https://commons.apache.org/proper/commons-logging/download_logging.cgi)

I created a folder inside the workflow folder itself called “java-classes”

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/4/44a4118dffd89440be520a6c92b42ddd69515fc2.png)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/8/f/8fe96b9774afd9f287ac0a5531309d965d25b481.png)

Then on the java snippet, I added these .jar files as additional libraries using the Add KNIME URL button so that I could add files contained _within_ the workflow folder:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/c/5/c5118dc00ec177d756b71aaaf2115cd1f0384284.png)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/8/4/8462342f6a107c269ca6ed3ad6ae90a4d60c25cb.png)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/4/64ee2875d7298aa463661ba8852c95469379edef.png)

Enjoy! 🙂

---

<div class="post-metadata">

**Author:** ![srinibash1980](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@srinibash1980](https://forum.knime.com/u/srinibash1980)\
**Post date:** [June 9, 2022, 4:29am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/10 "2022-06-09T04:29:12Z")

</div>

@takbb , Thank you for the solution. I will implement as per my process and let you know if any further assistance needed.

---

<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 16, 2022, 4:29am UTC](https://forum.knime.com/t/split-multiple-page-pdf-to-individual-pages/43734/11 "2022-06-16T04:29:54Z")

</div>

Closed on June 16, 2022, 4:29am UTC

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