Merge all pdf files from one folder
31,488
Solution 1
I would use pdfunite
. It is nice and simple. cd
to your directory. Then use something like this:
pdfunite *.pdf all.pdf
(Before running, make sure you don't already have a file called all.pdf
in that directory.)
Solution 2
Thanks to steeldriver who showed me that this is doing the job:
pdftk *.pdf cat output mergedfiles.pdf
Solution 3
You can use qpdf as pdftk is not available in Ubuntu Bionic:
qpdf --empty --pages *.pdf -- out.pdf
Solution 4
sudo apt-get install gs
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=target.pdf -dBATCH xx.pdf xx.pdf xx.pdf ...
- you can get all filenames through
ls -l *.pdf | awk
command
Wish it helps . ^_^
Solution 5
You can use pdftools:
pdftools --input-dir dir_with_pdfs --output output.pdf
Related videos on Youtube
Author by
Adam
Updated on September 18, 2022Comments
-
Adam over 1 year
I have 250 pdf files in one folder that I want to merge in one document. The order does not matter. Is there a simple way of doing it?
I can use PDF-Shuffler as suggested here https://askubuntu.com/a/2805/247771 but the progam hangs for 10 minutes befor it has loaded all the pdfs.
Can I achive this maybe with an inline command like
pdftk *.pdf output mergedfiles.pdf
?
-
steeldriver over 7 yearsYour pdftk command is just missing a
cat
I think:pdftk *.pdf cat output mergedfiles.pdf
-
Adam about 6 years@steeldriver if you write an answer I would mark it as chekced.
-
-
MERose almost 7 yearsOn Ubuntu 16.04 I get
E: Package 'gs' has no installation candidate
. -
edesz about 5 yearsUsing
pdfunite version 0.68.0
with Ubuntu 18.10, I had to usepdfunite * all.pdf
. When I triedpdfunite *.pdf all.pdf
, it gave me the following errorI/O Error: Couldn't open file '*.pdf': No such file or directory. Syntax Error: Could not merge damaged documents ('*.pdf')
. -
parisa almost 5 yearsWorked in Ubuntu 18.04. Thanks.
-
rob grune over 4 yearsI have Kubuntu 19.10. this pdftk does not work.