Merge multiple PDFs in Windows using Linux!!!

Docker on Windows is a boon to the developer community. Apart from the regular Linux based development I got a chance to use it today for something that I could not easily do directly on Windows (without a new third party software)

I had to merge a number of PDFs to create a single PDF. Searching the Web gave me a number of options like online tools, ghostscript, pdftk etc.

pdftk caught my attention as it was a perfect choice for my needs. But, I did not want to install it on my Windows desktop. I had docker desktop installed on my system. Hence I tried the following to achieve PDF merge:

1. Started a docker container with "ubuntu" image as follows:

docker run --name ubuntu -d -it -v C:/temp:/var/mnt/pdf --entrypoint bash ubuntu -c tail -f /dev/null

2. Installed pdftk
apt upgrade -y apt install pdftk -y

3. Executed pdftk to merge the pdfs. For e.g.:
pdftk Aug2020.pdf Sep2020.pdf Oct2020.pdf Nov2020.pdf Dec2020.pdf Jan2021.pdf cat output
 output.pdf

4. Now my merged pdf (output.pdf) is ready on Windows

Comments

Popular posts from this blog

Graylog - an easy solution for log management

HPUX Tips