views:

240

answers:

3

Ok, so I can print a pdf doing:

pdf2ps file.pdf - | lp -s

But now I want to use convert to merge several pdf files, I can do this with:

convert file1.pdf file2.pdf merged.pdf

which merges file1.pdf and file2.pdf into merged.pdf, target can be replaced with '-'.

Question

How could I pipe convert into pdf2ps and then into lp though?

+4  A: 

convert file1.pdf file2.pdf - | pdf2ps - - | lp -s should do the job.

You send the output of the convert command to psf2ps, which in turn feeds its output to lp.

tonio
This works indeed. However, I just found out convert doesn't properly merge my pdf files. Argh. The content is empty. So, onto posting my next question I guess : >
Bor
Final solution:`pdftk file1.pdf file2.pdf cat output - | pdf2ps - - | lp -s` (after installing pdftk)
Bor
A: 
convert file1.pdf file2.pdf merged.pdf
pdf2ps merged.pdf - | lp -s
A: 

You can use /dev/stdout like a file:

convert file1.pdf file2.pdf /dev/stdout | ...

I use gs for merging pdfs like:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/dev/stdout -f ...
fgb