Formatting
This commit is contained in:
parent
064f375779
commit
96495e07d7
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
143
cpdfmanual.tex
143
cpdfmanual.tex
|
@ -594,14 +594,14 @@ coherentpdf.deletePdf(merged);
|
||||||
Command lines to be typed are shown in \texttt{typewriter\hspace{-1mm} font} in a box.
|
Command lines to be typed are shown in \texttt{typewriter\hspace{-1mm} font} in a box.
|
||||||
For example:
|
For example:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent When describing the general form of a command, rather than a particular
|
\noindent When describing the general form of a command, rather than a particular
|
||||||
example, square brackets \verb|[]| are used to enclose optional parts, and
|
example, square brackets \verb|[]| are used to enclose optional parts, and
|
||||||
angled braces \verb!<>! to enclose general descriptions which may be
|
angled braces \verb!<>! to enclose general descriptions which may be
|
||||||
substituted for particular instances. For example,
|
substituted for particular instances. For example,
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf <operation> in.pdf [<range>] -o out.pdf!
|
\noindent\small\verb!cpdf <operation> in.pdf [<range>] -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent describes a command line which requires an operation and, optionally,
|
\noindent describes a command line which requires an operation and, optionally,
|
||||||
a range. An exception is that we use \texttt{in.pdf} and \texttt{out.pdf}
|
a range. An exception is that we use \texttt{in.pdf} and \texttt{out.pdf}
|
||||||
|
@ -622,17 +622,17 @@ verbosity. Under Microsoft Windows, type \texttt{cpdf.exe} instead of \texttt{cp
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small
|
\small
|
||||||
\noindent\begin{verbatim}
|
\noindent\begin{verbatim}
|
||||||
-help --help -version
|
-help --help -version
|
||||||
-o -i -idir <directory>
|
-o -i -idir <directory>
|
||||||
-recrypt -decrypt-force -stdout
|
-recrypt -decrypt-force -stdout
|
||||||
-stdin -stdin-user <password> -stdin-owner <password>
|
-stdin -stdin-user <password> -stdin-owner <password>
|
||||||
-producer <text> -creator <text> -change-id
|
-producer <text> -creator <text> -change-id
|
||||||
-l -cpdflin <filename> -keep-l
|
-l -cpdflin <filename> -keep-l
|
||||||
-no-preserve-objstm -create-objstm -control <filename>
|
-no-preserve-objstm -create-objstm -control <filename>
|
||||||
-args <filename> -utf8 -stripped
|
-args <filename> -utf8 -stripped
|
||||||
-raw -no-embed-font -gs
|
-raw -no-embed-font -gs
|
||||||
-gs-malformed -gs-malformed-force -gs-quiet
|
-gs-malformed -gs-malformed-force -gs-quiet
|
||||||
-error-on-malformed\end{verbatim}\end{framed}
|
-error-on-malformed\end{verbatim}\end{framed}
|
||||||
|
|
||||||
The Coherent PDF tools provide a wide range of facilities for modifying PDF
|
The Coherent PDF tools provide a wide range of facilities for modifying PDF
|
||||||
files created by other means. There is a single command-line program
|
files created by other means. There is a single command-line program
|
||||||
|
@ -647,12 +647,12 @@ The operation \texttt{-help / --help} prints each operation and option together
|
||||||
\section{Input and Output Files}
|
\section{Input and Output Files}
|
||||||
The typical pattern for usage is
|
The typical pattern for usage is
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf [<operation>] <input file(s)> -o <output file>!
|
\noindent\small\verb!cpdf [<operation>] <input file(s)> -o <output file>!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent and the simplest concrete example, assuming the existence of a file
|
\noindent and the simplest concrete example, assuming the existence of a file
|
||||||
\texttt{in.pdf} is:
|
\texttt{in.pdf} is:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent which copies \texttt{in.pdf} to \texttt{out.pdf}. The input and
|
\noindent which copies \texttt{in.pdf} to \texttt{out.pdf}. The input and
|
||||||
output may be the same file. Of course, we should like to do more interesting
|
output may be the same file. Of course, we should like to do more interesting
|
||||||
|
@ -663,17 +663,17 @@ containing a period. If an input file does not contain a period, it should be
|
||||||
preceded by \verb!-i!. For example:
|
preceded by \verb!-i!. For example:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -i in -o out.pdf!
|
\noindent\small\verb!cpdf -i in -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent A whole directory of files may be added (where a command supports multiple files) by using the \verb!-idir! option:
|
\noindent A whole directory of files may be added (where a command supports multiple files) by using the \verb!-idir! option:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -merge -idir myfiles -o out.pdf!
|
\noindent\small\verb!cpdf -merge -idir myfiles -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent The files in the directory \verb!myfiles! are considered in alphabetical order. They must all be PDF files. If the names of the files are numeric, leading zeroes will be required for the order to be correct (e.g \verb!001.pdf!, \verb!002.pdf! etc).
|
\noindent The files in the directory \verb!myfiles! are considered in alphabetical order. They must all be PDF files. If the names of the files are numeric, leading zeroes will be required for the order to be correct (e.g \verb!001.pdf!, \verb!002.pdf! etc).
|
||||||
|
|
||||||
To restrict cpdf to files ending in \texttt{.pdf} (in upper or lower or mixed case) add the option \texttt{-idir-only-pdfs} \textit{before} \texttt{-idir}:
|
To restrict cpdf to files ending in \texttt{.pdf} (in upper or lower or mixed case) add the option \texttt{-idir-only-pdfs} \textit{before} \texttt{-idir}:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -merge -idir-only-pdfs -idir myfiles -o out.pdf!
|
\noindent\small\verb!cpdf -merge -idir-only-pdfs -idir myfiles -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ To restrict cpdf to files ending in \texttt{.pdf} (in upper or lower or mixed ca
|
||||||
after each input file. This is treated differently by each operation. For
|
after each input file. This is treated differently by each operation. For
|
||||||
instance
|
instance
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf in.pdf 2-5 -o out.pdf!
|
\noindent\small\verb!cpdf in.pdf 2-5 -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent extracts pages two, three, four and five from \texttt{in.pdf},
|
\noindent extracts pages two, three, four and five from \texttt{in.pdf},
|
||||||
writing the result to \texttt{out.pdf}, assuming that \texttt{in.pdf} contains
|
writing the result to \texttt{out.pdf}, assuming that \texttt{in.pdf} contains
|
||||||
|
@ -708,37 +708,37 @@ at least five pages.
|
||||||
|
|
||||||
\noindent For example:
|
\noindent For example:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf in.pdf 1,2,7-end -o out.pdf!
|
\noindent\small\verb!cpdf in.pdf 1,2,7-end -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Remove pages three, four, five and six from a document.
|
\noindent Remove pages three, four, five and six from a document.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf in.pdf 1-16odd -o out.pdf!
|
\noindent\verb!cpdf in.pdf 1-16odd -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Extract the odd pages 1,3,...,13,15.
|
\noindent Extract the odd pages 1,3,...,13,15.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf in.pdf landscape -rotate 90 -o out.pdf!
|
\noindent\verb!cpdf in.pdf landscape -rotate 90 -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Rotate all landscape pages by ninety degrees.
|
\noindent Rotate all landscape pages by ninety degrees.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf in.pdf 1,all -o out.pdf!
|
\noindent\verb!cpdf in.pdf 1,all -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Duplicate the front page of a document, perhaps as a fax cover sheet.
|
\noindent Duplicate the front page of a document, perhaps as a fax cover sheet.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf in.pdf ~3-~1 -o out.pdf!
|
\noindent\verb!cpdf in.pdf ~3-~1 -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Extract the last three pages of a document, in order.
|
\noindent Extract the last three pages of a document, in order.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf in.pdf 2DUP1-10 -o out.pdf!
|
\noindent\verb!cpdf in.pdf 2DUP1-10 -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Produce the pages 1,1,2,2,....10,10.
|
\noindent Produce the pages 1,1,2,2,....10,10.
|
||||||
|
@ -758,14 +758,14 @@ after any range). The document will \textit{not} be re-encrypted upon writing.
|
||||||
example:
|
example:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf in.pdf user=charles -info!\\
|
\noindent\small\verb!cpdf in.pdf user=charles -info!\\
|
||||||
\indent\small\verb!cpdf in.pdf owner=fred reverse -o out.pdf!
|
\noindent\small\verb!cpdf in.pdf owner=fred reverse -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\noindent To re-encrypt the file with its existing encryption upon writing, which is required if only the user password was supplied, but allowed in any case, add the \texttt{-recrypt} option:
|
\noindent To re-encrypt the file with its existing encryption upon writing, which is required if only the user password was supplied, but allowed in any case, add the \texttt{-recrypt} option:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf in.pdf user=charles reverse -recrypt -o out.pdf!
|
\noindent\small\verb!cpdf in.pdf user=charles reverse -recrypt -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\noindent The password required (owner or user) depends upon the operation
|
\noindent The password required (owner or user) depends upon the operation
|
||||||
|
@ -788,9 +788,9 @@ use of intermediate files. Use \texttt{-stdin} to read from standard input, and
|
||||||
multiple programs, or multiple invocations of the same program. For example, this sequence of commands (all typed on one line)
|
multiple programs, or multiple invocations of the same program. For example, this sequence of commands (all typed on one line)
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\begin{verbatim} cpdf in.pdf reverse -stdout |
|
\noindent\small\begin{verbatim}cpdf in.pdf reverse -stdout |
|
||||||
cpdf -stdin 1-5 -stdout |
|
cpdf -stdin 1-5 -stdout |
|
||||||
cpdf -stdin reverse -o out.pdf\end{verbatim}
|
cpdf -stdin reverse -o out.pdf\end{verbatim}
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\noindent extracts the last five pages of \texttt{in.pdf} in the correct order,
|
\noindent extracts the last five pages of \texttt{in.pdf} in the correct order,
|
||||||
|
@ -809,7 +809,7 @@ example, listing fonts). A useful feature of the command line (not specific to
|
||||||
achieved with the \texttt{>} operator:
|
achieved with the \texttt{>} operator:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -info in.pdf > file.txt!
|
\noindent\small\verb!cpdf -info in.pdf > file.txt!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Use the \texttt{-info} operation (See Section \ref{info}), redirecting the
|
\noindent Use the \texttt{-info} operation (See Section \ref{info}), redirecting the
|
||||||
|
@ -826,8 +826,8 @@ To use \texttt{AND}, simply leave off the output specifier (e.g \texttt{-o}) of
|
||||||
one command, and the input specifier (e.g filename) of the next. For instance:
|
one command, and the input specifier (e.g filename) of the next. For instance:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -merge in.pdf in2.pdf AND -add-text "Label"!
|
\noindent \small\verb!cpdf -merge in.pdf in2.pdf AND -add-text "Label"!\\
|
||||||
\noindent\small\verb! AND -merge in3.pdf -o out.pdf!
|
\noindent\small\verb! AND -merge in3.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Merge \texttt{in.pdf} and \texttt{in2.pdf} together, add text to both pages, append \texttt{in3.pdf} and write to \texttt{out.pdf}.
|
\noindent Merge \texttt{in.pdf} and \texttt{in2.pdf} together, add text to both pages, append \texttt{in3.pdf} and write to \texttt{out.pdf}.
|
||||||
|
@ -836,9 +836,8 @@ one command, and the input specifier (e.g filename) of the next. For instance:
|
||||||
\noindent To specify the range for each section, use \texttt{-range}:
|
\noindent To specify the range for each section, use \texttt{-range}:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -merge in.pdf in2.pdf AND -range 2-4 -add-text "Label"!
|
\noindent\small\verb!cpdf -merge in.pdf in2.pdf AND -range 2-4 -add-text "Label"!
|
||||||
\noindent\small\verb! AND -merge in3.pdf -o out.pdf!
|
\noindent\small\verb! AND -merge in3.pdf -o out.pdf!
|
||||||
|
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\section{Units}
|
\section{Units}
|
||||||
|
@ -884,7 +883,7 @@ Simple arithmetic may be performed using the words \texttt{add}, \texttt{sub}, \
|
||||||
The \texttt{-producer} and \texttt{-creator} options may be added to any \texttt{cpdf} command line to set the producer and/or creator of the PDF file. If the file was converted from another format, the \textit{creator} is the program producing the original, the \textit{producer} the program converting it to PDF.
|
The \texttt{-producer} and \texttt{-creator} options may be added to any \texttt{cpdf} command line to set the producer and/or creator of the PDF file. If the file was converted from another format, the \textit{creator} is the program producing the original, the \textit{producer} the program converting it to PDF.
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -merge in.pdf in2.pdf -producer MyMerger -o out.pdf!\\
|
\noindent\small\verb!cpdf -merge in.pdf in2.pdf -producer MyMerger -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Merge \texttt{in.pdf} and \texttt{in2.pdf}, setting the producer to \texttt{MyMerger} and writing the output to \texttt{out.pdf}.\end{framed}
|
\noindent Merge \texttt{in.pdf} and \texttt{in2.pdf}, setting the producer to \texttt{MyMerger} and writing the output to \texttt{out.pdf}.\end{framed}
|
||||||
|
@ -905,7 +904,7 @@ systems to uniquely identify a file. To change the ID, behavior, use the
|
||||||
\texttt{-change-id} operation. This will create a new ID for the output file.
|
\texttt{-change-id} operation. This will create a new ID for the output file.
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -change-id in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -change-id in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Write \texttt{in.pdf} to \texttt{out.pdf}, changing the ID.
|
\noindent Write \texttt{in.pdf} to \texttt{out.pdf}, changing the ID.
|
||||||
|
@ -920,7 +919,7 @@ viewing a multipage PDF over a slow connection is more responsive. By default,
|
||||||
option to the command line, in addition to any other command being used. For example:
|
option to the command line, in addition to any other command being used. For example:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -l in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -l in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Linearize the file \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
\noindent Linearize the file \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
||||||
|
@ -929,7 +928,7 @@ option to the command line, in addition to any other command being used. For exa
|
||||||
\noindent This requires the existence of the external program \texttt{cpdflin} which is provided with commercial versions of \texttt{cpdf}. This must be installed as described in the installation documentation provided with your copy of \texttt{cpdf}. If you are unable to install \texttt{cpdflin}, you must use \texttt{-cpdflin} to let \texttt{cpdf} know where to find it:
|
\noindent This requires the existence of the external program \texttt{cpdflin} which is provided with commercial versions of \texttt{cpdf}. This must be installed as described in the installation documentation provided with your copy of \texttt{cpdf}. If you are unable to install \texttt{cpdflin}, you must use \texttt{-cpdflin} to let \texttt{cpdf} know where to find it:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf.exe -cpdflin "C:\\cpdflin.exe" -l in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf.exe -cpdflin "C:\\cpdflin.exe" -l in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Linearize the file \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
\noindent Linearize the file \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
||||||
|
@ -944,7 +943,7 @@ To keep the existing linearization status of a file (produce linearized output i
|
||||||
PDF 1.5 introduced a new mechanism for storing objects to save space: object streams. by default, \texttt{cpdf} will preserve object streams in input files, creating no more. To prevent the retention of existing object streams, use \texttt{-no-preserve-objstm}:
|
PDF 1.5 introduced a new mechanism for storing objects to save space: object streams. by default, \texttt{cpdf} will preserve object streams in input files, creating no more. To prevent the retention of existing object streams, use \texttt{-no-preserve-objstm}:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -no-preserve-objstm in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -no-preserve-objstm in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Write the file \texttt{in.pdf} to \texttt{out.pdf}, removing any object streams.
|
\noindent Write the file \texttt{in.pdf} to \texttt{out.pdf}, removing any object streams.
|
||||||
|
@ -953,7 +952,7 @@ PDF 1.5 introduced a new mechanism for storing objects to save space: object str
|
||||||
\noindent To create new object streams if none exist, or augment the existing ones, use \texttt{-create-objstm}:
|
\noindent To create new object streams if none exist, or augment the existing ones, use \texttt{-create-objstm}:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -create-objstm in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -create-objstm in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Write the file \texttt{in.pdf} to \texttt{out.pdf}, preserving any existing object streams, and creating any new ones for new objects which have been added.
|
\noindent Write the file \texttt{in.pdf} to \texttt{out.pdf}, preserving any existing object streams, and creating any new ones for new objects which have been added.
|
||||||
|
@ -962,7 +961,7 @@ PDF 1.5 introduced a new mechanism for storing objects to save space: object str
|
||||||
\noindent To create wholly new object streams, use both options together:
|
\noindent To create wholly new object streams, use both options together:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -create-objstm -no-preserve-objstm in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -create-objstm -no-preserve-objstm in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Write the file \texttt{in.pdf} to \texttt{out.pdf} with wholly new object streams.
|
\noindent Write the file \texttt{in.pdf} to \texttt{out.pdf} with wholly new object streams.
|
||||||
|
@ -1001,7 +1000,7 @@ To suppress the output of \texttt{gs} use the \texttt{-gs-quiet} option. If the
|
||||||
\noindent The command line for \texttt{-gs-malformed-force} must be of \textit{precisely} this form. Sometimes, on the other hand, we might wish \texttt{cpdf} to fail immediately on any malformed file, rather than try its own reconstruction process. The option \texttt{-error-on-malformed} achieves this.
|
\noindent The command line for \texttt{-gs-malformed-force} must be of \textit{precisely} this form. Sometimes, on the other hand, we might wish \texttt{cpdf} to fail immediately on any malformed file, rather than try its own reconstruction process. The option \texttt{-error-on-malformed} achieves this.
|
||||||
|
|
||||||
|
|
||||||
\begin{framed}\textit{Note: Use of these commands with \texttt{-gs} is a last resort; they may strip some metadata from PDF files.}\end{framed}
|
\begin{framed}\noindent\textit{Note: Use of these commands with \texttt{-gs} is a last resort; they may strip some metadata from PDF files.}\end{framed}
|
||||||
|
|
||||||
Sometimes old, pre-ISO standardisation files can be technically well-formed but use inefficient PDF constructs. If you are sure the input files you are using are
|
Sometimes old, pre-ISO standardisation files can be technically well-formed but use inefficient PDF constructs. If you are sure the input files you are using are
|
||||||
modern ISO-compliant PDFs, the \texttt{-fast} option may be added to the command line (or, if
|
modern ISO-compliant PDFs, the \texttt{-fast} option may be added to the command line (or, if
|
||||||
|
@ -1063,11 +1062,11 @@ treated specially by the command line interpreter is to be treated literally. Fo
|
||||||
example, Unix-like systems attribute a special meaning to the exclamation mark, so
|
example, Unix-like systems attribute a special meaning to the exclamation mark, so
|
||||||
the command line
|
the command line
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb?cpdf -add-text "Hello!" in.pdf -o out.pdf?
|
\noindent\small\verb?cpdf -add-text "Hello!" in.pdf -o out.pdf?
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent would fail. We must escape the exclamation mark with a backslash:
|
\noindent would fail. We must escape the exclamation mark with a backslash:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb?cpdf -add-text "Hello\!" in.pdf -o out.pdf?
|
\noindent\small\verb?cpdf -add-text "Hello\!" in.pdf -o out.pdf?
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent It follows that backslashes intended to be taken literally must themselves be
|
\noindent It follows that backslashes intended to be taken literally must themselves be
|
||||||
escaped (i.e. written \verb!\\!).
|
escaped (i.e. written \verb!\\!).
|
||||||
|
@ -1182,14 +1181,14 @@ the input pages in the order specified on the command line. Actually, the
|
||||||
\texttt{-merge} can be omitted, since this is the default operation of \cpdf.
|
\texttt{-merge} can be omitted, since this is the default operation of \cpdf.
|
||||||
|
|
||||||
\begin{framed}\small
|
\begin{framed}\small
|
||||||
\verb!cpdf -merge a.pdf 1 b.pdf 2-end -o out.pdf!
|
\noindent\verb!cpdf -merge a.pdf 1 b.pdf 2-end -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Take page one of \texttt{a.pdf} and all but the first page of
|
\noindent Take page one of \texttt{a.pdf} and all but the first page of
|
||||||
\texttt{b.pdf}, merge them and produce \texttt{out.pdf}.
|
\texttt{b.pdf}, merge them and produce \texttt{out.pdf}.
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\verb!cpdf -merge -idir files -o out.pdf!
|
\noindent\verb!cpdf -merge -idir files -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Merge all files from directory \texttt{files}, producing \texttt{out.pdf}.
|
\noindent Merge all files from directory \texttt{files}, producing \texttt{out.pdf}.
|
||||||
|
@ -1216,13 +1215,13 @@ are written to file, their names being generated from a \emph{format}. The
|
||||||
optional \texttt{-chunk} option allows the number of pages written to each
|
optional \texttt{-chunk} option allows the number of pages written to each
|
||||||
output file to be set.
|
output file to be set.
|
||||||
\begin{framed}\small
|
\begin{framed}\small
|
||||||
\verb!cpdf -split a.pdf -o out%%%.pdf!
|
\noindent\verb!cpdf -split a.pdf -o out%%%.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Split \texttt{a.pdf} to the files \texttt{out001.pdf}, \texttt{out002.pdf} etc.
|
\noindent Split \texttt{a.pdf} to the files \texttt{out001.pdf}, \texttt{out002.pdf} etc.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf a.pdf even AND -split -chunk 10 -o dir/out%%%.pdf!
|
\noindent\verb!cpdf a.pdf even AND -split -chunk 10 -o dir/out%%%.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Split the even pages of \texttt{a.pdf} to the files
|
\noindent Split the even pages of \texttt{a.pdf} to the files
|
||||||
|
@ -1256,7 +1255,7 @@ and so on. So \texttt{-split-bookmarks 1} creates breaks on level 0 and level
|
||||||
1 boundaries.
|
1 boundaries.
|
||||||
|
|
||||||
\begin{framed}\small
|
\begin{framed}\small
|
||||||
\verb!cpdf -split-bookmarks 0 a.pdf -o out%%%.pdf!
|
\noindent\verb!cpdf -split-bookmarks 0 a.pdf -o out%%%.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Split \texttt{a.pdf} to the files \texttt{out001.pdf},
|
\noindent Split \texttt{a.pdf} to the files \texttt{out001.pdf},
|
||||||
|
@ -1270,7 +1269,7 @@ one of the output files.
|
||||||
It is possible to use the \texttt{@} operators above, including operator \texttt{@B} which expands to the text of the bookmark:
|
It is possible to use the \texttt{@} operators above, including operator \texttt{@B} which expands to the text of the bookmark:
|
||||||
|
|
||||||
\begin{framed}\small
|
\begin{framed}\small
|
||||||
\verb!cpdf -split-bookmarks 0 a.pdf -o @B.pdf!
|
\noindent\verb!cpdf -split-bookmarks 0 a.pdf -o @B.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Split \texttt{a.pdf} on bookmark boundaries, using the bookmark text as the filename.
|
\noindent Split \texttt{a.pdf} on bookmark boundaries, using the bookmark text as the filename.
|
||||||
|
@ -1509,7 +1508,7 @@ contents and/or the page dimensions (use \texttt{-upright} (described elsewhere
|
||||||
The \texttt{-rotate} operation sets the viewing rotation of the selected pages to
|
The \texttt{-rotate} operation sets the viewing rotation of the selected pages to
|
||||||
the absolute value given.
|
the absolute value given.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -rotate 90 in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -rotate 90 in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Set the rotation of all the pages in the input file to ninety degrees clockwise.
|
\noindent Set the rotation of all the pages in the input file to ninety degrees clockwise.
|
||||||
|
@ -1517,7 +1516,7 @@ the absolute value given.
|
||||||
\noindent The \texttt{-rotateby} operation changes the viewing rotation of all the
|
\noindent The \texttt{-rotateby} operation changes the viewing rotation of all the
|
||||||
given pages by the relative value given.
|
given pages by the relative value given.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -rotateby 90 in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -rotateby 90 in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Rotate all the pages in the input file by ninety degrees clockwise.
|
\noindent Rotate all the pages in the input file by ninety degrees clockwise.
|
||||||
|
@ -1526,7 +1525,7 @@ given pages by the relative value given.
|
||||||
of the page by the given relative value.
|
of the page by the given relative value.
|
||||||
\index{rotate!contents}
|
\index{rotate!contents}
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -rotate-contents 90 in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -rotate-contents 90 in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
|
|
||||||
|
@ -1540,7 +1539,7 @@ ninety degrees clockwise. Does not change the page dimensions.
|
||||||
rotation of the document to zero without altering its appearance. In addition, it makes sure the media box has its origin at (0,0), changing other boxes to compensate. This is important because some operations in CPDF (such as scale-to-fit), and in other PDF-processing programs, work properly only when the origin is (0, 0).
|
rotation of the document to zero without altering its appearance. In addition, it makes sure the media box has its origin at (0,0), changing other boxes to compensate. This is important because some operations in CPDF (such as scale-to-fit), and in other PDF-processing programs, work properly only when the origin is (0, 0).
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -upright in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -upright in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
|
|
||||||
|
@ -1553,13 +1552,13 @@ rotation of the document to zero without altering its appearance. In addition, i
|
||||||
chosen pages horizontally or vertically. No account is taken of the current
|
chosen pages horizontally or vertically. No account is taken of the current
|
||||||
page rotation when considering what "horizontally" and "vertically" mean, so you may like to use \texttt{-upright} (see above) first.
|
page rotation when considering what "horizontally" and "vertically" mean, so you may like to use \texttt{-upright} (see above) first.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -hflip in.pdf even -o out.pdf!
|
\noindent\small\verb!cpdf -hflip in.pdf even -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Flip the even pages in \texttt{in.pdf} horizontally.
|
\noindent Flip the even pages in \texttt{in.pdf} horizontally.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf -vflip in.pdf -o out.pdf!
|
\noindent\verb!cpdf -vflip in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Flip all the pages in \texttt{in.pdf} vertically.
|
\noindent Flip all the pages in \texttt{in.pdf} vertically.
|
||||||
|
@ -1572,7 +1571,7 @@ page rotation when considering what "horizontally" and "vertically" mean, so you
|
||||||
dimensions of the paper. To change these dimensions (without altering the page
|
dimensions of the paper. To change these dimensions (without altering the page
|
||||||
contents in any way), use the \texttt{-mediabox} operation.
|
contents in any way), use the \texttt{-mediabox} operation.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -mediabox "0pt 0pt 500pt 500pt" in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -mediabox "0pt 0pt 500pt 500pt" in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Set the media box to 500 points square.
|
\noindent Set the media box to 500 points square.
|
||||||
|
@ -1585,13 +1584,13 @@ A crop box can be set, changed and removed, without affecting the underlying
|
||||||
media box. To set or change the crop box use \texttt{-cropbox}. To remove any
|
media box. To set or change the crop box use \texttt{-cropbox}. To remove any
|
||||||
existing crop box, use \texttt{-remove-cropbox}.
|
existing crop box, use \texttt{-remove-cropbox}.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -cropbox "0pt 0pt 200mm 200mm" in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -cropbox "0pt 0pt 200mm 200mm" in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Crop pages to the bottom left 200-millimeter square of the page.
|
\noindent Crop pages to the bottom left 200-millimeter square of the page.
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\verb!cpdf -remove-cropbox in.pdf -o out.pdf!
|
\noindent\verb!cpdf -remove-cropbox in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{2.5mm}
|
\vspace{2.5mm}
|
||||||
\noindent Remove cropping.
|
\noindent Remove cropping.
|
||||||
|
@ -1610,14 +1609,14 @@ existing crop box, use \texttt{-remove-cropbox}.
|
||||||
\noindent This operation copies the contents of one box (Media box, Crop box, Trim box etc.) to another. If \texttt{-mediabox-if-missing} is added, the media box will be substituted when the 'from' box is not set for a given page. For example
|
\noindent This operation copies the contents of one box (Media box, Crop box, Trim box etc.) to another. If \texttt{-mediabox-if-missing} is added, the media box will be substituted when the 'from' box is not set for a given page. For example
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -frombox /TrimBox -tobox /CropBox in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -frombox /TrimBox -tobox /CropBox in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent copies the Trim Box of each page to the Crop Box of each page. The possible boxes are \texttt{/MediaBox}, \texttt{/CropBox}, \texttt{/BleedBox}, \texttt{/TrimBox}, \texttt{/ArtBox}.\pagestyle{empty}\thispagestyle{fancy}
|
\noindent copies the Trim Box of each page to the Crop Box of each page. The possible boxes are \texttt{/MediaBox}, \texttt{/CropBox}, \texttt{/BleedBox}, \texttt{/TrimBox}, \texttt{/ArtBox}.\pagestyle{empty}\thispagestyle{fancy}
|
||||||
|
|
||||||
A hard box (one which clips its contents by inserting a clipping rectangle) may be created with the \texttt{-hard-box} operation:
|
A hard box (one which clips its contents by inserting a clipping rectangle) may be created with the \texttt{-hard-box} operation:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -hard-box /TrimBox in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -hard-box /TrimBox in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\noindent This means the resultant file may be used as a stamp without contents outside the given box reappearing. The \texttt{-mediabox-if-missing} option may also be used here.
|
\noindent This means the resultant file may be used as a stamp without contents outside the given box reappearing. The \texttt{-mediabox-if-missing} option may also be used here.
|
||||||
|
@ -1743,20 +1742,20 @@ person:
|
||||||
\section{Encrypting a Document}
|
\section{Encrypting a Document}
|
||||||
To encrypt a document, the owner and user passwords must be given (here, \texttt{fred} and \texttt{charles} respectively):
|
To encrypt a document, the owner and user passwords must be given (here, \texttt{fred} and \texttt{charles} respectively):
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -encrypt 40bit fred charles -no-print in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -encrypt 40bit fred charles -no-print in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\small\verb!cpdf -encrypt 128bit fred charles -no-extract in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -encrypt 128bit fred charles -no-extract in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\small\verb!cpdf -encrypt AES fred "" -no-edit -no-copy in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -encrypt AES fred "" -no-edit -no-copy in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent A blank user password is
|
\noindent A blank user password is
|
||||||
common. In this event, PDF viewers will typically not prompt for a
|
common. In this event, PDF viewers will typically not prompt for a
|
||||||
password for when opening the file or for operations allowable with the user password.
|
password for when opening the file or for operations allowable with the user password.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\small\verb!cpdf -encrypt AES256ISO fred "" -no-forms in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -encrypt AES256ISO fred "" -no-forms in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent In addition, the usual method can be used to give the existing owner
|
\noindent In addition, the usual method can be used to give the existing owner
|
||||||
password, if the document is already encrypted.
|
password, if the document is already encrypted.
|
||||||
|
@ -1769,7 +1768,7 @@ metadata. Add \texttt{-no-encrypt-metadata} to the command line.
|
||||||
\section{Decrypting a Document}
|
\section{Decrypting a Document}
|
||||||
To decrypt a document, the owner password is provided.
|
To decrypt a document, the owner password is provided.
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -decrypt in.pdf owner=fred -o out.pdf!
|
\noindent\small\verb!cpdf -decrypt in.pdf owner=fred -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent The user password cannot decrypt a file.
|
\noindent The user password cannot decrypt a file.
|
||||||
|
|
||||||
|
@ -1833,14 +1832,14 @@ When appropriate passwords are not available, the option \texttt{-decrypt-force}
|
||||||
To decompress the streams in a PDF file, for instance to manually inspect the
|
To decompress the streams in a PDF file, for instance to manually inspect the
|
||||||
PDF, use:
|
PDF, use:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -decompress in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -decompress in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent If \cpdf\ finds a compression type it can't cope with, the stream is left compressed. When using \texttt{-decompress}, object streams are not compressed. It may be easier for manual inspection to also remove object streams, by adding the \texttt{-no-preserve-objstm} option to the command.
|
\noindent If \cpdf\ finds a compression type it can't cope with, the stream is left compressed. When using \texttt{-decompress}, object streams are not compressed. It may be easier for manual inspection to also remove object streams, by adding the \texttt{-no-preserve-objstm} option to the command.
|
||||||
\section{Compressing a Document}
|
\section{Compressing a Document}
|
||||||
\index{compressing}
|
\index{compressing}
|
||||||
To compress the streams in a PDF file, use:
|
To compress the streams in a PDF file, use:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -compress in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -compress in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent\cpdf\ compresses any streams which have no compression using the
|
\noindent\cpdf\ compresses any streams which have no compression using the
|
||||||
\textbf{Flate\-Decode} method, with the exception of Metadata streams, which
|
\textbf{Flate\-Decode} method, with the exception of Metadata streams, which
|
||||||
|
@ -1850,7 +1849,7 @@ PDF, use:
|
||||||
\index{squeeze}
|
\index{squeeze}
|
||||||
To \textit{squeeze} a PDF file, reducing its size by an average of about twenty percent (though sometimes not at all), use:
|
To \textit{squeeze} a PDF file, reducing its size by an average of about twenty percent (though sometimes not at all), use:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -squeeze in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -squeeze in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent Adding \texttt{-squeeze} to the command line when using another operation will \textit{squeeze} the file or files upon output.
|
\noindent Adding \texttt{-squeeze} to the command line when using another operation will \textit{squeeze} the file or files upon output.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue