One liner:
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf [...] lastfile.pdf
One liner:
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf [...] lastfile.pdf
best male masterbator
This made my day!
Yes, it’s May 2015 and once again this did (almost) exactly what I wanted. Fast and easy.
*like* :)
This solutions is so cool. Many thanks to Doei!
I wish I could give you a nice hand shake fine gentleman, thank you for that info worked great on Debian wheezy
Easily banged 40 files together into a reasonable file size. Thanks for sharing what you know.
Works great!
Pingback: Concatenating pdf files the easy way « twm’s blog
to know how, that’s the point …., thank you
DANKE
So, cool ! Thanks ! I just removed the PAPERSIZE option and concatenated pdfs of varying widths beautifully.
I was using
$cat file1.pdf file2.pdf >> output.pdf
in fedora, but in ubuntu it doesn’t work as expected.
But, this page helped me a lot to save my time.
Thanks.
perfect ;-)
papers + SI never alone anymore ;-)
works fine for me
I have used same command several times, google always bring me here.
Command works great.
Thanks for your time posting it!
Why not:
pdftk file_a.pdf file_b.pdf file_c.pdf cat file_d.pdf output file_abc.pdf
or even, with the classic bash trick
pdftk file_[a-d].pdf output file_abcd.pdf
PS: unfortunately xpdf does not work well in release 12-X
Thanks a lot!!! :):)
Obrigado. Got me out of a hole
Being an amature with Linux I am a bit nervous of command line work however I tried this to concat 8.pdf pages and it worked very well. Thank you
Thank you. This is a big help to me because one of pdftk’s requirements requires an older version of gcc be compile. This helps quite a bit. I ended putting this in my
.bashrc
in case I needed it later:In comments someone suggest pdftk.
It’s great but if we have protected pdf files it doesn’t work while gs does.
coolest so far on merging pdf!!! wow
David D Short -> wanker.
It does produce selectable text depending on input files. Text input from latex generated files -> selectable text.
Thanks!
Valeu, funcionou muito bem! / Thanks, worked like a charm!
Thanks so much! This worked perfectly.
Dear Davids,
You can get A4 paper size by changing the appropriate variable (-sPAPERSIZE=a4). In my case I didn’t really need specific paper size, I only wanted a few plots glued together.
As for not working, likely there was a problem with your installation. Regarding quality, it again depends on what you are looking for. My threshold was pretty low ;)
But it seems you figured it out already so, great! Thanks for the pdftk example!
David, you still haven’t said what the problem was, but that’s ok; seems you found the solution; great!
So the problem was with your installation?!?
Meaning that your comment “Doesn’t work. Plus, it should use A4 by default. This is 2011.” was just a … what? Rhetorical rant?
Ok!
What the hell is wrong with it indeed?
Let’s answer that question (pretending that it wasn’t purely rhetorical, and ignoring your silly copycat insults).
First solution: reinstall GhostScript. Result: it does now generate a PDF!
However, the text is no longer selectable, implying that it has been converted to vector graphics. The lossiness of the JPEG graphics seems much higher (as can be seen from the reduced filesize).
Second solution: use convert from ImageMagick. Results: horrible. The text is converted to bitmap.
Third solution: install pdftk.
pdftk file1.pdf file2.pdf file3.pdf […] lastfile.pdf cat output output.pdf
Results: perfect.
Since April 2009, a lot of people had put it to work, so what the hell is wrong with it? If you can’t put it to work, ask for help but don’t blame the post. So, if you’re not half-brained you’re certainly “an enormous, presumptuous wanker”.
What an enormous, presumptuous wanker.
@David, yes it does; try to use that part of the body that some call brain.
Doesn’t work.
Plus, it should use A4 by default. This is 2011.
The quality using gs is hundred times greater than using convert.
Thanks, really works, and save me a lot of hassle
Thanks very much, it worked perfectly. Muito obrigado!
BIoquímicos representando o país? Fico tranquilo =)
ótimo tutorial, me ajudou muito!
Formidable! Y no hay que instalar nada. Gracias!
tnx, also nice mustaches
Pingback: Concatenating PDFs « Linux Sagas
That was simple – thank you!
Just to complement, it allows to process well-formed file names. I had slides named MMM1 thru MMM16, and it accepted MMM*.pdf .
Thanks a lot for the tip!
Thanks!
Muchas Gracias!
works for me thank you!
cool! thanks.
works!
Uma solução ainda mais simples:
convert -page a4 page1.pdf page2.pdf …. all_pages.pdf
(o “convert” faz parte do ImageMagik)
Não ponhas esta cena no Whathaveidone que não é preciso! Que cena altamente man. Acabei de fazer o comando e urinei o dito boxerzinho 3 vezes.
ALTAMENTE C******
freak!!!!!!!!!!!!!!!!!!!!!!!!!!!!
já meteste no what have i done?
TA ALTAMENTE!!