A terminal tool for PDF?

Is there any terminal tool to merge two PDF files (or more) into a single one?
Install the print/pdftk.package:
Code:
# pkg install pdftk

Then download this:
https://github.com/vermaden/scripts/blob/master/pdf-concat.sh

Usage:
Code:
% pdf-concat.sh FILE1.pdf FILE2.pdf *.pdf

You will get ALL.pdf file with all PDF file concatenated.

Other PDF scripts from my page:

- pdf-decrypt.sh
- pdf-extract.sh
- pdf-rotate-left.sh
- pdf-rotate-right.sh
- pdf-split.sh


Regards.
 
I also use pdftdk. Very simple to use. I see vermaden offers a script (and several other typically useful ones) but even without, it's just
Code:
pdftk file1.pdf file2.pdf cat output newfile.pdf
 
I am using qpdf.
Code:
pkg info qpdf | grep Comment
Comment        : Command-line tools for transforming and inspecting PDF documents

I am usually using it to separate pages to new pdf:
Code:
qpdf input.pdf --pages . 1-10 -- output.pdf
It can be used for merging pages also, but I don't have example right now.
 
Well, your loss helps all the people who make use of your scripts, so there's the bright side. :)
To be honest, I usually have to websearch the syntax the few times I have to make use of it.
 
I use ghostscript. Even on Windows (gswin32.exe) since all of the PDF printers I've come across use ghostscript.
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=outfile.pdf infile1.pdf infile2.pdf
 
Printers use Postscript.
Ghostscript generates Postscript.
But not if you use pdfwrite 😁

But your solution certainly works here.

Nothing wrong with ghostscript. It's super useful albeit slow if you work with lots of PDFs and pages.
 
With pdfcpu you should be able to do all sorts of useful things with pdf files. You will need Go.
git clone https://github.com/pdfcpu/pdfcpu
cd pdfcpu/cmd/pdfcpu
go install

pdfcpu help
pdfcpu help merge
pdfcpu merge out.pdf in1.pdf in2.pdf ...
 
The convert(1) tool from graphics/ImageMagick7 can also be used to mangle pdf files.
Apart from concatenating multiple files it can also convert from various formats into pdf and shrink/resize/compress, add watermarks or backgrounds, rotate, crop or filter images etc. pp... It may be total overkill for your task, but as ImageMagick is a dependency of several other programs, chances are that it's already installed anyways.
 
Back
Top