# Merge PDFs with the Similar name

**URL:** <https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [December 15, 2021, 12:17pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145 "2021-12-15T12:17:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![urvishmehta92](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@urvishmehta92](https://forum.inductiveautomation.com/u/urvishmehta92)\
**Post date:** [December 15, 2021, 12:17pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/1 "2021-12-15T12:17:53Z")

</div>

Hello Everyone,  
I have bunch of files in single folder. Now, out of those files,I will have to find a files with similar name and that would look like “Filename\_invoice” and “Filename\_return”. Basically I will have to find those files(PDFs). Merge them and print them. Do you think merging can be done in ignition without any external module? Let me know if anyone have done this before.  
Thank you

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 15, 2021, 12:30pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/2 "2021-12-15T12:30:38Z")

</div>

Why would you need to merge them? The only advantage I can see is that you may save some paper by double-sided printing if any of the PDFs have an odd number of pages.

I wouldn’t think that Ignition could merge the PDFs and create a new file “Filename\_merged”.

---

<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:** [December 15, 2021, 1:20pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/3 "2021-12-15T13:20:24Z")

</div>

> Do you think merging can be done in ignition without any external module?

I doubt it to be honest.

You have two options as I see it -

1. Find or make an external web service that merges pdf's for you and then use `system.net.*` functions to send your pdf's over and get the merged result back.

2. Make a python file you run via `system.util.execute` - could be something as simple as this - [python - Merge PDF files - Stack Overflow](https://stackoverflow.com/questions/3444645/merge-pdf-files) . Note you'd need to incorporate command line arguments - probably the file paths of your pdfs either absolute or relative in some way that makes sense, and then call your file with the paths of the pdf's you want merged when you need to do it.

---

<div class="post-metadata">

**Author:** ![SKA](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ska/32/29528_2.png) [@SKA](https://forum.inductiveautomation.com/u/SKA)\
**Post date:** [December 15, 2021, 2:28pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/4 "2021-12-15T14:28:11Z")

</div>

If its sensetive documents, you might not want to do this, since i do not doubt they save all files and most likely harvest info from them to sell to advertisers and others.

---

<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:** [December 15, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/5 "2021-12-15T14:43:57Z")

</div>

Regarding option 1) yes that is definitely something you should be wary of, unless you make your own Flask server that can do this for yourself.

---

<div class="post-metadata">

**Author:** ![urvishmehta92](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@urvishmehta92](https://forum.inductiveautomation.com/u/urvishmehta92)\
**Post date:** [December 15, 2021, 3:04pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/6 "2021-12-15T15:04:42Z")

</div>

Great. Thank you for responses. I will try method 2 as it seems more secure and I have heard about PyPDF2 in past. Let me know if anyone find easier way to do it.

Thank you

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 15, 2021, 3:22pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/7 "2021-12-15T15:22:10Z")

</div>

The easiest way is a library like PyPDF2 i guess. just be sure to get a version that is works for python 2.7  
copy pylib folder of the igntion gateway and you can import it in your scripts

Though i dont really see why you would want to do this

---

<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:** [December 15, 2021, 3:30pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/8 "2021-12-15T15:30:20Z")

</div>

I didn’t mean it that way. I meant to put it in it’s own py file that you would tell the OS to run using system.execute. Will require python to be installed on your computer but this way does give you a lot more flexibility in that you don’t need it to be a jython version.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 15, 2021, 3:39pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/9 "2021-12-15T15:39:16Z")

</div>

Ah yea that can too,  
if there is a good version avaible, it would be easier to use that than `system.util.execute` tho

---

<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:** [December 15, 2021, 3:41pm UTC](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145/10 "2021-12-15T15:41:01Z")

</div>

Yea fair enough if its possible definitely easier to do directly. I always operate under the assumption any modern python package most likely doesn’t have a jython version and so you must shell it out or put it into it’s own little server etc.
