Next: Doing several things at
Up: Basic Usage
Previous: Working with Encrypted Documents
Contents
Index
Standard Input and Standard Output
Thus far, we have assumed that the input PDF will be read from a file on
disk, and the output written similarly. Often it's useful to be able to read
input from stdin (Standard Input) or write output to stdout
(Standard Output) instead. The typical use is to join several programs
together into a pipe, passing data from one to the next without the
use of intermediate files. Use -stdin to read from standard input, and
-stdout to write to standard input, either to pipe data between
multiple programs, or multiple invocations of the same program. For example, this sequence of commands (all typed on one line)
extracts the last five pages of in.pdf in the correct order,
writing them to out.pdf. It does this by reversing the input, taking
the first five pages and then reversing the result.
To supply passwords for a file from -stdin, use -stdin-owner <password> and/or -stdin-user <password>.
Using -stdout on the final command in the pipeline to output the PDF
to screen is not recommended, since PDF files often contain compressed sections
which are not screen-readable.
Several cpdf operations write to standard output by default (for
example, listing fonts). A useful feature of the command line (not specific to
cpdf) is the ability to redirect this output to a file. This is
achieved with the > operator:
Next: Doing several things at
Up: Basic Usage
Previous: Working with Encrypted Documents
Contents
Index
root
2014-11-28