Formatting
This commit is contained in:
parent
064f375779
commit
96495e07d7
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
113
cpdfmanual.tex
113
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.
|
||||
For example:
|
||||
\begin{framed}
|
||||
\small\verb!cpdf in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf in.pdf -o out.pdf!
|
||||
\end{framed}
|
||||
\noindent When describing the general form of a command, rather than a particular
|
||||
example, square brackets \verb|[]| are used to enclose optional parts, and
|
||||
angled braces \verb!<>! to enclose general descriptions which may be
|
||||
substituted for particular instances. For example,
|
||||
\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}
|
||||
\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}
|
||||
|
@ -647,12 +647,12 @@ The operation \texttt{-help / --help} prints each operation and option together
|
|||
\section{Input and Output Files}
|
||||
The typical pattern for usage is
|
||||
\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}
|
||||
\noindent and the simplest concrete example, assuming the existence of a file
|
||||
\texttt{in.pdf} is:
|
||||
\begin{framed}
|
||||
\small\verb!cpdf in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf in.pdf -o out.pdf!
|
||||
\end{framed}
|
||||
\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
|
||||
|
@ -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:
|
||||
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -i in -o out.pdf!
|
||||
\noindent\small\verb!cpdf -i in -o out.pdf!
|
||||
\end{framed}
|
||||
\noindent A whole directory of files may be added (where a command supports multiple files) by using the \verb!-idir! option:
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -merge -idir myfiles -o out.pdf!
|
||||
\noindent\small\verb!cpdf -merge -idir myfiles -o out.pdf!
|
||||
\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).
|
||||
|
||||
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}
|
||||
\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}
|
||||
|
||||
|
||||
|
@ -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
|
||||
instance
|
||||
\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}
|
||||
\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
|
||||
|
@ -708,37 +708,37 @@ at least five pages.
|
|||
|
||||
\noindent For example:
|
||||
\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}
|
||||
\noindent Remove pages three, four, five and six from a document.
|
||||
|
||||
\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}
|
||||
\noindent Extract the odd pages 1,3,...,13,15.
|
||||
|
||||
\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}
|
||||
\noindent Rotate all landscape pages by ninety degrees.
|
||||
|
||||
\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}
|
||||
\noindent Duplicate the front page of a document, perhaps as a fax cover sheet.
|
||||
|
||||
\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}
|
||||
\noindent Extract the last three pages of a document, in order.
|
||||
|
||||
\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}
|
||||
\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:
|
||||
|
||||
\begin{framed}
|
||||
\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 user=charles -info!\\
|
||||
\noindent\small\verb!cpdf in.pdf owner=fred reverse -o out.pdf!
|
||||
\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:
|
||||
|
||||
\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}
|
||||
|
||||
\noindent The password required (owner or user) depends upon the operation
|
||||
|
@ -788,7 +788,7 @@ 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)
|
||||
|
||||
\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 reverse -o out.pdf\end{verbatim}
|
||||
\end{framed}
|
||||
|
@ -809,7 +809,7 @@ example, listing fonts). A useful feature of the command line (not specific to
|
|||
achieved with the \texttt{>} operator:
|
||||
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -info in.pdf > file.txt!
|
||||
\noindent\small\verb!cpdf -info in.pdf > file.txt!
|
||||
|
||||
\vspace{2.5mm}
|
||||
\noindent Use the \texttt{-info} operation (See Section \ref{info}), redirecting the
|
||||
|
@ -826,7 +826,7 @@ 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:
|
||||
|
||||
\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!
|
||||
|
||||
\vspace{2.5mm}
|
||||
|
@ -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}:
|
||||
|
||||
\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!
|
||||
|
||||
\end{framed}
|
||||
|
||||
\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.
|
||||
|
||||
\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}
|
||||
\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.
|
||||
|
||||
\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}
|
||||
\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:
|
||||
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -l in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf -l in.pdf -o out.pdf!
|
||||
|
||||
\vspace{2.5mm}
|
||||
\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:
|
||||
|
||||
\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}
|
||||
\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}:
|
||||
|
||||
\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}
|
||||
\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}:
|
||||
|
||||
\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}
|
||||
\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:
|
||||
|
||||
\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}
|
||||
\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.
|
||||
|
||||
|
||||
\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
|
||||
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
|
||||
the command line
|
||||
\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}
|
||||
\noindent would fail. We must escape the exclamation mark with a backslash:
|
||||
\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}
|
||||
\noindent It follows that backslashes intended to be taken literally must themselves be
|
||||
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.
|
||||
|
||||
\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}
|
||||
\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}.
|
||||
|
||||
\vspace{1.5mm}
|
||||
\verb!cpdf -merge -idir files -o out.pdf!
|
||||
\noindent\verb!cpdf -merge -idir files -o out.pdf!
|
||||
|
||||
\vspace{2.5mm}
|
||||
\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
|
||||
output file to be set.
|
||||
\begin{framed}\small
|
||||
\verb!cpdf -split a.pdf -o out%%%.pdf!
|
||||
\noindent\verb!cpdf -split a.pdf -o out%%%.pdf!
|
||||
|
||||
\vspace{2.5mm}
|
||||
\noindent Split \texttt{a.pdf} to the files \texttt{out001.pdf}, \texttt{out002.pdf} etc.
|
||||
|
||||
\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}
|
||||
\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.
|
||||
|
||||
\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}
|
||||
\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:
|
||||
|
||||
\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}
|
||||
\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 absolute value given.
|
||||
\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}
|
||||
\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
|
||||
given pages by the relative value given.
|
||||
\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}
|
||||
\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.
|
||||
\index{rotate!contents}
|
||||
\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}
|
||||
|
||||
|
@ -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).
|
||||
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -upright in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf -upright in.pdf -o out.pdf!
|
||||
|
||||
\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
|
||||
page rotation when considering what "horizontally" and "vertically" mean, so you may like to use \texttt{-upright} (see above) first.
|
||||
\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}
|
||||
\noindent Flip the even pages in \texttt{in.pdf} horizontally.
|
||||
|
||||
\vspace{2.5mm}
|
||||
\verb!cpdf -vflip in.pdf -o out.pdf!
|
||||
\noindent\verb!cpdf -vflip in.pdf -o out.pdf!
|
||||
|
||||
\vspace{2.5mm}
|
||||
\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
|
||||
contents in any way), use the \texttt{-mediabox} operation.
|
||||
\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}
|
||||
\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
|
||||
existing crop box, use \texttt{-remove-cropbox}.
|
||||
\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}
|
||||
\noindent Crop pages to the bottom left 200-millimeter square of the page.
|
||||
|
||||
\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}
|
||||
\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
|
||||
|
||||
\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}
|
||||
\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:
|
||||
|
||||
\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}
|
||||
|
||||
\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}
|
||||
To encrypt a document, the owner and user passwords must be given (here, \texttt{fred} and \texttt{charles} respectively):
|
||||
\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}
|
||||
\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}
|
||||
\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}
|
||||
\noindent A blank user password is
|
||||
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.
|
||||
\begin{framed}
|
||||
\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}
|
||||
\noindent In addition, the usual method can be used to give the existing owner
|
||||
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}
|
||||
To decrypt a document, the owner password is provided.
|
||||
\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}
|
||||
\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
|
||||
PDF, use:
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -decompress in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf -decompress in.pdf -o out.pdf!
|
||||
\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.
|
||||
\section{Compressing a Document}
|
||||
\index{compressing}
|
||||
To compress the streams in a PDF file, use:
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -compress in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf -compress in.pdf -o out.pdf!
|
||||
\end{framed}
|
||||
\noindent\cpdf\ compresses any streams which have no compression using the
|
||||
\textbf{Flate\-Decode} method, with the exception of Metadata streams, which
|
||||
|
@ -1850,7 +1849,7 @@ PDF, use:
|
|||
\index{squeeze}
|
||||
To \textit{squeeze} a PDF file, reducing its size by an average of about twenty percent (though sometimes not at all), use:
|
||||
\begin{framed}
|
||||
\small\verb!cpdf -squeeze in.pdf -o out.pdf!
|
||||
\noindent\small\verb!cpdf -squeeze in.pdf -o out.pdf!
|
||||
\end{framed}
|
||||
\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