\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).
\section{Input Ranges}
An \index{input range}\index{range}\textit{input range} may be specified
after each input file. This is treated differently by each operation. For
\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
at least five pages.
\index{page!range}
\index{reversing}
Here are the rules for building input ranges:
\begin{itemize}
\item A dash (\texttt{-}) defines ranges, e.g. \texttt{1-5} or \texttt{6-3}.
\item A comma (\texttt{,}) allows one to specify several ranges, e.g. \texttt{1-2,4-5}.
\item The word \texttt{end} represents the last page number.
\item The words \texttt{odd} and \texttt{even} can be used in place of or at the end of a page range to restrict to just the odd or even pages.
\item The words \texttt{portrait} and \texttt{landscape} can be used in place of or at the end of a page range to restrict to just those pages which are portrait or landscape. Note that the meaning of ``portrait'' and ``landscape'' does not take account of any viewing rotation in place (use \texttt{-upright} first, if required). A page with equal width and height is considered neither portrait nor landscape.
\item The word \texttt{reverse} is the same as \texttt{end-1}.
\item The word \texttt{all} is the same as \texttt{1-end}.
\item A range must contain no spaces.
\item A tilde (\texttt{\~{}}) defines a page number counting from the end of the document rather than the beginning. Page \texttt{\~{}1} is the last page, \texttt{\~{}2} the penultimate page etc.
\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 For example, one may write \texttt{14mm} or \texttt{21.6in}. In addition, the following letters stand, in some operations (\texttt{-scale-page}, \texttt{-scale-to-fit}, \texttt{-scale-contents}, \texttt{-shift}, \texttt{-mediabox},\\\texttt{-crop}) for various page dimensions:
\begin{table}[h]
\centering
\begin{tabular}{rl}
\texttt{PW}& Page width\\
\texttt{PH}& Page height\\
\texttt{PMINX}& Page minimum x coordinate\\
\texttt{PMINY}& Page minimum y coordinate\\
\texttt{PMAXX}& Page maximum x coordinate\\
\texttt{PMAXY}& Page maximum y coordinate\\
\texttt{CW}& Crop box width\\
\texttt{CH}& Crop box height\\
\texttt{CMINX}& Crop box minimum x coordinate\\
\texttt{CMINY}& Crop box minimum y coordinate\\
\texttt{CMAXX}& Crop box maximum x coordinate\\
\texttt{CMAXY}& Crop box maximum y coordinate
\end{tabular}
\end{table}
\noindent For example, we may write \texttt{PMINX PMINY} to stand for the coordinate of the lower left corner of the page.
Simple arithmetic may be performed using the words \texttt{add}, \texttt{sub}, \texttt{mul} and \texttt{div} to stand for addition, subtraction, multiplication and division. For example, one may write \texttt{14in\hspace{-1mm} sub\hspace{-1mm} 30pt} or \texttt{PMINX\hspace{-1mm} mul\hspace{-1mm} 2}
\section{Setting the Producer and Creator}
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.
\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:
In extremis, you may place \texttt{cpdflin} and its resources in the current working directory, though this is not recommended. For further help, refer to the installation instructions for your copy of \texttt{cpdf}.
To keep the existing linearization status of a file (produce linearized output if the input is linearized and the reverse), use \texttt{-keep-l} instead of \texttt{-l}.
\section{Object Streams}
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}:
\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.
Some operating systems have a limit on the length of a command line. To
circumvent this, or simply for reasons of flexibility, a control file may be
specified from which arguments are drawn. This file does not support the full
syntax of the command line. Commands are separated by whitespace, quotation
marks may be used if an argument contains a space, and the sequence \verb!\"!
may be used to introduce a genuine quotation mark in such an argument.
Several \verb!-control! arguments may be specified, and may be mixed in with
conventional command-line arguments. The commands in each control file are
considered in the order in which they are given, after all conventional
arguments have been processed. It is recommended to use \texttt{-args} in all new applications. However, \texttt{-control} will be supported for legacy applications.
To avoid interference between \texttt{-control} and \texttt{AND}, a new mechanism has been added. Using \texttt{-args} in place of \texttt{-control} will perform direct textual substitution of the file into the command line, prior to any other processing.
\section{String Arguments}
Command lines are handled differently on each operating system. Some
characters are reserved with special meanings, even when they occur inside
quoted string arguments. To avoid this problem, \cpdf\ performs processing on
string arguments as they are read.
A backslash is used to indicate that a character which would otherwise be
treated specially by the command line interpreter is to be treated literally. For
example, Unix-like systems attribute a special meaning to the exclamation mark, so
\noindent The bookmark text used for a name is converted from unicode to 7 bit ASCII, and the following characters are removed, in addition to any character with ASCII code less than 32:
\section{Encrypting with Split and Split Bookmarks}
The encryption parameters described in Chapter \ref{encryption} may be added to the command line to encrypt each split PDF. Similarly, the \texttt{-recrypt} switch described in \ref{basicusage} may by given to re-encrypt each file with the existing encryption of the source PDF.
Any time when a page size is required, instead of writing, for instance \texttt{"210mm 197mm"} one can instead write \texttt{a4portrait}. Here is a list of supported page sizes:
The \texttt{-scale-page} operation scales each page in the range by the X and
Y factors given. This scales both the page contents, and the page size itself. It also scales any Crop Box and other boxes (Art Box, Trim Box etc). As with several of these commands, remember to take into account any page rotation when considering what the X and Y axes relate to.
\noindent Scale a file's pages to fit A4 portrait.
\end{framed}
%The \texttt{-scale-to-fit-best} and \texttt{-scale-to-fit-minus} are similar, but will rotate a page by $90^\circ$ or $-90^\circ$ respectively on any page where doing so would maximise the scale.
\noindent The scale can optionally be set to a percentage of the available area, instead of filling it.
\noindent Rotate all the page contents in the input file by
ninety degrees clockwise. Does not change the page dimensions.
\end{framed}
\label{upright}
\noindent The \texttt{-upright} operation does whatever combination of
\texttt{-rotate} and \texttt{-rotate-contents} is required to change the
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.
\section{Flipping Pages}
\index{flip pages}
The \texttt{-hflip} and \texttt{-vflip} operations flip the contents of the
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} first.
\begin{framed}
\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!
\vspace{2.5mm}
\noindent Flip all the pages in \texttt{in.pdf} vertically.
\end{framed}
\section{Boxes and Cropping}
\index{crop pages}
\index{media box}
All PDF files contain a \textit{media box} for each page, giving the
dimensions of the paper. To change these dimensions (without altering the page
contents in any way), use the \texttt{-mediabox} option.
\noindent Copy the contents of one box to another.
\end{framed}
\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 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}
\cpdf\ provides basic facilities for decompressing and compressing PDF streams.
\section{Decompressing a Document}
\index{decompressing}
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!
\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.
\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!
\end{framed}
\noindent\cpdf\ compresses any streams which have no compression using the
\textbf{Flate\-Decode} method, with the exception of Metadata streams, which
are left uncompressed.
\section{Squeezing a Document}
\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!
\end{framed}
\noindent Adding \texttt{-squeeze} to the command line when using another operation will \textit{squeeze} the file or files upon output.
The \texttt{-squeeze} operation writes some information about the squeezing process to standard output. The squeezing process involves several processes which losslessly attempt to reduce the file size. It is slow, so should not be used without thought.
\begin{verbatim}
$ ./cpdf -squeeze in.pdf -o out.pdf
Beginning squeeze: 123847 objects
Squeezing... Down to 114860 objects
Squeezing... Down to 114842 objects
Squeezing page data
Recompressing document
\end{verbatim}
The \texttt{-squeeze-log-to <filename>} option writes the log to the given file instead of to standard output.
\noindent The position commands in Section \ref{position} can be used to locate the stamp more precisely (they are calculated relative to the crop box of the stamp). Or, preprocess the stamp with \texttt{-shift} first.
The \texttt{-scale-stamp-to-fit} option can be added to scale the stamp to fit the page before applying it. The use of positioning commands together with \texttt{-scale-stamp-to-fit} is not recommended.
The \texttt{-combine-pages} operation takes two PDF files and stamps each
page of one over each page of the other. The length of the output is the same
as the length of the ``under'' file. For instance:
\noindent The default is black 12pt Times New Roman text in the top left of each page. The text can be placed underneath rather than over the page by adding the \texttt{-underneath} option.
Text previously added by \cpdf\ may be removed by the \texttt{-remove-text} operation.
\index{removing text}
\begin{framed}
\small\verb!cpdf -remove-text in.pdf -o out.pdf!
\end{framed}
\subsection{Page Numbers}
\index{page!numbers}
There are various special codes to include the page number in the text:
\vspace{2mm}
\begin{tabular}{ll}
\texttt{\%Page}& Page number in arabic notation (1, 2, 3\ldots) \\
\texttt{\%roman}& Page number in lower-case roman notation (i, ii, iii\ldots) \\
\texttt{\%Roman}& Page number in upper-case roman notation (I, II, III\ldots) \\
\texttt{\%EndPage}& Last page of document in arabic notation \\
\texttt{\%Label}& The page label of the page \\
\texttt{\%EndLabel}& The page label of the last page \\
\texttt{\%filename}& The full file name of the input document \\
\end{tabular}
\vspace{2mm}
\noindent For example, the format \texttt{"Page~\%Page~of~\%EndPage"} might become "Page~5~of~17".
NB: In some circumstances (e.g in batch files) on Microsoft Windows, \verb!%! is a special character, and must be escaped (written as \verb$%%$). Consult your local documentation for details.
\subsection{Date and Time Formats}
\begin{tabular}{ll}
\texttt{\%a}& Abbreviated weekday name (Sun, Mon etc.)\\
\texttt{\%A}& Full weekday name (Sunday, Monday etc.)\\
\texttt{\%b}& Abbreviated month name (Jan, Feb etc.)\\
\texttt{\%B}& Full month name (January, February etc.)\\
\texttt{\%d}& Day of the month (01--31) \\
\texttt{\%e}& Day of the month (1--31) \\
\texttt{\%H}& Hour in 24-hour clock (00--23)\\
\texttt{\%I}& Hour in 12-hour clock (01--12)\\
\texttt{\%j}& Day of the year (001--366)\\
\texttt{\%m}& Month of the year (01--12)\\
\texttt{\%M}& Minute of the hour (00--59)\\
\texttt{\%p}& "a.m" or "p.m"\\
\texttt{\%S}& Second of the minute (00--61)\\
\texttt{\%T}& Same as \%H:\%M:\%S\\
\texttt{\%u}& Weekday (1--7, 1 = Monday)\\
\texttt{\%w}& Weekday (0--6, 0 = Monday)\\
\texttt{\%Y}& Year (0000--9999)\\
\texttt{\%\%}& The \% character.
\end{tabular}
\subsection{Bates Numbers}
\index{bates numbers}
Unique page identifiers can be specified by putting \verb!%Bates! in the format.
The starting point can be set with the \texttt{-bates} option. For example:
To specify that bates numbering begins at the first page of the range, use \texttt{-bates-at-range} instead. This option must be specified after the range is specified. To pad the bates number up to a given number of leading zeros, use \texttt{-bates-pad-to} in addition to either \texttt{-bates} or \texttt{-bates-at-range}.
\subsection{Position}
\label{position}
The position of the text may be specified either in absolute terms:
\begin{framed}
\small\verb!-pos-center "200 200"!
\vspace{2.5mm}
\noindent Position the center of the baseline text at (200pt, 200pt)
\vspace{2.5mm}
\small\verb!-pos-left "200 200"!
\vspace{2.5mm}
\noindent Position the left of the baseline of the text at (200pt, 200pt)
\vspace{2.5mm}
\small\verb!-pos-right "200 200"!
\vspace{2.5mm}
\noindent Position the right of the baseline of the text at (200pt, 200pt)
\end{framed}
\noindent Positions relative to certain common points can be set:
\begin{framed}
\noindent\begin{tabular}{ll}
\small\verb!-top 10! & Center of baseline 10 pts down from the top center \\
\small\verb!-topleft 10! & Left of baseline 10 pts down and in from top left \\
\small\verb!-topright 10! & Right of baseline 10 pts down and left from top right\\
\small\verb!-left 10! & Left of baseline 10 pts in from center left \\
\small\verb!-bottomleft 10! & Left of baseline 10 pts in and up from bottom left \\
\small\verb!-bottom 10! & Center of baseline 10 pts up from bottom center\\
\small\verb!-bottomright 10! & Right of baseline 10 pts up and in from bottom right \\
\small\verb!-right 10! & Right of baseline 10 pts in from the center right \\
\small\verb!-diagonal! & Diagonal, bottom left to top right, centered on page\\
\small\verb!-reverse-diagonal! & Diagonal, top left to bottom right, centered on page\\
\small\verb!-center! & Centered on page\\
\end{tabular}
\end{framed}
\noindent No attempt is made to take account of the page rotation when interpreting the
position, so \texttt{-prerotate} must be added to the command line if the file
contains pages with a non-zero viewing rotation. This is equivalent to
pre-processing the document with \texttt{-upright}.
%The \texttt{-shorter-side} modifier can be used to indicate that all the
%positions above are relative to the shorter side of the page, any rotation
%required being automatic. In other words, \texttt{top, topleft, topright} are
%either on the top or left, depending upon which is the shorter side, and
%\texttt{bottom, bottomleft, bottomright} are either on the bottom or right
%similarly. This flag has no effect on \texttt{-diagonal}.
The \texttt{-relative-to-cropbox} modifier can be added to the command line to
make these measurements relative to the crop box instead of the media box.
The default position is equivalent to \texttt{-topleft 100}.
The \texttt{-midline} option may be added to specify that the positioning
commands above are to be considered relative to the midline of the text, rather
than its baseline. Similarly, the \texttt{-topline} option may be used to specify that the position is taken relative to the top of the text.
\subsection{Font and Size}
\index{font}
The font may be set with the \texttt{-font} option. The 14 Standard PDF fonts are available:
\vspace{2mm}
\begin{tabular}{l}
Times-Roman\\
Times-Bold\\
Times-Italic\\
Times-BoldItalic\\
Helvetica\\
Helvetica-Bold\\
Helvetica-Oblique\\
Helvetica-BoldOblique\\
Courier\\
Courier-Bold\\
Courier-Oblique\\
Courier-BoldOblique\\
Symbol\\
ZapfDingbats
\end{tabular}
\noindent For example, page numbers in Times Italic can be achieved by:
For example, a German sharp s (\ss) may be introduced by \verb!\337!.
\section{Stamping Graphics}
A rectangle may be placed on one or more pages by using the \texttt{-add-rectangle <size>} command. Most of the options discussed above for text placement apply in the same way. For example:
\begin{framed}
\small\begin{verbatim}cpdf -add-rectangle "200 300" -pos-right 30 -color red -outline
in.pdf -o out.pdf\end{verbatim}
\end{framed}
This can be used to blank out or highlight part of the document. The following positioning options work as you would expect: \texttt{-topleft}, \texttt{-top}, \texttt{-topright}, \texttt{-right}, \texttt{-bottomright}, \texttt{-bottom}, \texttt{-bottomleft}, \texttt{-left}, \texttt{-center}. When using the option \texttt{-pos-left "x y"}, the point (x, y) refers to the bottom-left of the rectangle. When using the option \texttt{-pos-right "x y"}, the point (x, y) refers to the bottom-right of the rectangle. When using the option \texttt{-pos-center "x y"}, the point (x, y) refers to the center of the rectangle. The options \texttt{-diagonal} and \texttt{-reverse-diagonal} have no meaning.\pagestyle{empty}\thispagestyle{fancy}
This facility puts multiple logical pages on a single physical page. The \texttt{-twoup-stack} operation puts two logical pages on each physical
page, rotating them 90 degrees to do so. The new mediabox is thus larger. The \texttt{-twoup} operation does the same, but scales the new sides down so
that the media box is unchanged.
\section{Inserting Blank Pages}
\index{blank pages!inserting}
Sometimes, for instance to get a printing arrangement right, it's useful to
be able to insert blank pages into a PDF file. \cpdf\ can add blank pages
before a given page or pages, or after. The pages in question are specified by
a range in the usual way:
\begin{framed}
\small\verb!cpdf -pad-before in.pdf 1 -o out.pdf!
\vspace{2.5mm}
\noindent Add a blank page before page 1 (i.e. at the beginning of the document.)
\noindent Add a blank page after pages 2, 16, 38, 84, 121 and 147 (for
instance, to add a clean page between chapters of a document.)
\end{framed}
\noindent The dimensions of the padded page are derived from the boxes (media box, crop box etc.) of the page after or before which the padding is to be applied.
The \verb!-pad-every n! operation places a blank page after every n pages, excluding any last one. For example\ldots
\begin{framed}
\small\verb!cpdf -pad-every 3 in.pdf -o out.pdf!
\vspace{2.5mm}
\noindent Add a blank page after every three pages
\end{framed}
\noindent\ldots on a 9 page document adds a blank page after pages 3 and 6.
The \verb!-pad-multiple n! operation adds blank pages so the document has a multiple of \verb!n! pages. For example:
\noindent The first column gives the page number, the second the internal unique font
name, the third the type of font (Type1, TrueType etc), the fourth the PDF font
name, the fifth the PDF font encoding.
\section{Reading Document Information}
\label{info}
The \texttt{-info} option prints entries from the document information
dictionary, and from any XMP metadata to standard output.
\begin{framed}
{\small\begin{verbatim}
$cpdf -info pdf_reference.pdf
Encryption: 40bit
Linearized: true
Permissions: No edit
Version: 1.6
Pages: 1310
Title: PDF Reference, version 1.7
Author: Adobe Systems Incorporated
Subject: Adobe Portable Document Format (PDF)
Keywords:
Creator: FrameMaker 7.2
Producer: Acrobat Distiller 7.0.5 (Windows)
Created: D:20061017081020Z
Modified: D:20061118211043-02'30'
XMP pdf:Producer: Adobe PDF library 7.77
XMP xmp:CreateDate: 2006-12-21T18:19:09+01:00
XMP xmp:CreatorTool: Adobe Illustrator CS2
XMP xmp:MetadataDate: 2006-12-21T18:19:09Z
XMP xmp:ModifyDate: 2006-12-21T18:19:09Z
XMP dc:title: AI6\end{verbatim}}\end{framed}
\noindent The details of the format for creation and modification dates can be found in
Appendix~\ref{dates}.
By default, cpdf strips to ASCII, discarding character codes in excess of 127. In order to preserve the original unicode, add the \texttt{-utf8} option. To disable all postprocessing of the string, add \texttt{-raw}.
\vspace{4mm}
The \texttt{-page-info} option prints the page label, media box and other boxes
page-by-page to standard output, for all pages in the current range.
Creation Date &\texttt{cpdf -set-create "D:19970915110347-08'00'"}\\
Modification Date &\texttt{cpdf -set-modify "D:19970915110347-08'00'"}\\
Mark as Trapped &\texttt{cpdf -set-trapped}\\
Mark as Untrapped &\texttt{cpdf -set-untrapped}\\
\end{tabular}
\end{framed}}
\noindent (The details of the format for creation and modification dates can be found
in Appendix~\ref{dates}. Using the date \texttt{"now"} uses the time and date
at which the command is executed. Note also that \texttt{-producer} and \texttt{-creator} may be used to set the producer and/or the creator when writing any file, separate from the operations described in this chapter.)
\vspace{2mm}
For example, to set the title, the full command line would be
\begin{framed}
\small\verb!cpdf -set-title "A Night in London" in.pdf -o out.pdf!
\end{framed}
\noindent The text string is considered to be in UTF8 format, unless the \texttt{-raw}
option is added---in which case, it is unprocessed, save for the replacement of any octal escape sequence such as \texttt{\textbackslash 017}, which is replaced by a character of its value (here, 15).
\section{Upon Opening a Document}
\subsection{Page Layout}
\index{page!layout}
The \texttt{-set-page-layout} option specifies the page layout to be used
when a document is opened in, for instance, Acrobat. The possible
(case-sensitive) values are:
\vspace{2mm}
{\small\begin{tabular}{ll}
\texttt{SinglePage}&\vspace{2mm}\parbox{8cm}{Display one page at a time}\\
\texttt{OneColumn}&\vspace{2mm}\parbox{8cm}{Display the pages in one column}\\
\texttt{TwoColumnLeft}&\vspace{2mm}\parbox{8cm}{Display the pages in two columns, odd numbered pages on the left}\\
\texttt{TwoColumnRight}&\vspace{2mm}\parbox{8cm}{Display the pages in two columns, even numbered pages on the left}\\
\texttt{TwoPageLeft}&\vspace{2mm}\parbox{8cm}{(PDF 1.5 and above) Display the pages two at a time, odd numbered pages on the left}\\
\texttt{TwoPageRight}&\vspace{2mm}\parbox{8cm}{(PDF 1.5 and above) Display the pages two at a time, even numbered pages on the left}
\noindent To print the current metadata to standard output:
\begin{framed}
\small\verb!cpdf -print-metadata in.pdf!
\end{framed}
\section{Page Labels}
\index{page labels}\index{page!labels}
It is possible to add \textit{page labels} to a document. These are not the printed on the page, but may be displayed alongside thumbnails or in print dialogue boxes by PDF readers. We use \texttt{-add-page-labels} to do this, by default with decimal arabic numbers (1,2,3\ldots). We can add \texttt{-label-style} to choose what type of labels to add from these kinds:
\texttt{NoLabelPrefixOnly}& No number, but a prefix will be used if defined.
\end{tabular}}
\vspace{4mm}
\noindent We can use \texttt{-label-prefix} to add a textual prefix to each label.
Consider a file with twenty pages and no current page labels (a PDF reader will assume 1,2,3\ldots if there are none). We will add the following page labels:
\vspace{4mm}
i, ii, iii, iv, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, A-0, A-1, A-2, A-3, A-4, A-5
\noindent By default the labels begin at page number 1 for each range. To override this, we can use \texttt{-label-startval} (we used $0$ in the final command), where we want the numbers to begin at zero rather than one.
Page labels may be removed altogether by using \texttt{-remove-page-labels} command. To print the page labels from an existing file, use \texttt{-print-page-labels}. For example:
\noindent attaches the Excel spreadsheet \texttt{sheet.xls} to the input file. If the file already has attachments, the new file is added to their number. You can specify multiple files to be attached by using \verb!-attach-file! multiple times. They will be attached in the given order.
The \texttt{-to-page} option can be used to specify that the files will be attached to the given page, rather than at the document level. The \texttt{-to-page} option may be specified at most once.
\section{Listing Attachments}
\index{attachments!listing}
To list all document- and page-level attachments, use the \texttt{-list-attached-files} operation. The page number and filename of each attachment is given, page 0 representing a document-level attachment.
\begin{framed}
{\small\begin{verbatim}
$cpdf -list-attached-files 14psfonts.pdf
0 utility.ml
0 utility.mli
4 notes.xls
\end{verbatim}}
\end{framed}
\section{Removing Attachments}
\index{attachments!removing}
To remove all document-level and page-level attachments from a file, use the \texttt{-remove-files} operation:
\noindent The format is \textit{page number, image name, x pixels, y pixels, x resolution, y resolution}. The resolutions refer to the image's effective resolution at point of use (taking account of scaling, rotation etc).
%The Tools can extract images from PDF files to JPEG, JPEG2000, JBIG2 and PNM (Portable Any Map) files. Images which are already in JPEG/JPEG2000/JBIG2 format in the PDF are written in those formats, unaltered. All other images are decoded and written as PNM files (unless the decoding method is unknown). If the command line tool \textsf{pnm2png} is present, PNG files are output instead.
%might generate \texttt{img001.jpg}, \texttt{img002.png}, \texttt{img003.jpg} etc. from the images on pages two to six. The number of percentage characters in the output format indicate the width of the numbering system for the output file names.