# How to combine .pdf pages into one document?

**URL:** <https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496>\
**Category:** Ignition\
**Created:** [June 17, 2018, 12:17am UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496 "2018-06-17T00:17:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kstofcho](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kstofcho](https://forum.inductiveautomation.com/u/Kstofcho)\
**Post date:** [June 17, 2018, 12:17am UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/1 "2018-06-17T00:17:59Z")

</div>

Is there a simple way to combine individual .pdf pages into one document? Are there any included libraries to pull from to accomplish this? Thanks!

---

<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:** [June 17, 2018, 1:21am UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/2 "2018-06-17T01:21:40Z")

</div>

I generally do this via a command shell and the pdftk binary. (Now called [PTFtk Server](https://www.pdflabs.com/tools/pdftk-server/).)

---

<div class="post-metadata">

**Author:** ![Kstofcho](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kstofcho](https://forum.inductiveautomation.com/u/Kstofcho)\
**Post date:** [June 22, 2018, 4:57pm UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/3 "2018-06-22T16:57:17Z")

</div>

That was much easier than I expected. Thanks!

---

<div class="post-metadata">

**Author:** ![Kstofcho](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kstofcho](https://forum.inductiveautomation.com/u/Kstofcho)\
**Post date:** [July 3, 2018, 6:45pm UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/4 "2018-07-03T18:45:31Z")

</div>

I’m finally getting around to writing the code in Ignition to make this work. How do you execute pdftk? I’ve tried subprocess and setting the directory to where my files are and os.chdir(directory) to set the directory then os.system(command). Both are returning errors. Subprocess returns “Cannot run program “pdftk” (in directory…” and system returns “‘pdftk’ is not recognized as an internal or external command,  
operable program or batch file.”

I’m generating temp files using the system.file.getTempFile command and I want to combine some of these so the directory is the user’s temp directory. Not sure if thats the issue or I’m just not calling pdftk correctly. Thanks!

---

<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:** [July 3, 2018, 7:17pm UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/5 "2018-07-03T19:17:28Z")

</div>

> [@Kstofcho](#):
>
> Subprocess returns "Cannot run program "pdftk" (in directory...." and system returns "'pdftk' is not recognized as an internal or external command,operable program or batch file."

This generally means you aren't calling pdftk correctly. Supply the complete path to SubProcess.

---

<div class="post-metadata">

**Author:** ![Kstofcho](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kstofcho](https://forum.inductiveautomation.com/u/Kstofcho)\
**Post date:** [July 3, 2018, 9:10pm UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/6 "2018-07-03T21:10:23Z")

</div>

Yep, that was the only issue. Works now. Thanks!

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [October 5, 2022, 2:46pm UTC](https://forum.inductiveautomation.com/t/how-to-combine-pdf-pages-into-one-document/18496/7 "2022-10-05T14:46:48Z")

</div>

I'am looking to do it. Can you tell me how you solved it
