cpdf-source/html_manual/cpdfmanual.html
John Whitington 9c2d7ffd01 more
2017-01-15 19:52:57 +00:00

2260 lines
121 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<!-- html,pic-fbox,pic-equations,pic-tabular -->
<meta name="src" content="cpdfmanual.tex">
<link rel="stylesheet" type="text/css" href="cpdfmanual.css">
</head><body
>
<!--l. 22--><p class="indent" >
<div class="flushright"
>
<!--l. 25--><p class="noindent" >
<!--l. 27--><p class="noindent" ><span
class="cmssbx-10x-x-248">Coherent PDF</span>
<!--l. 30--><p class="noindent" ><span
class="cmssbx-10x-x-248">Command Line Toolkit</span>
<!--l. 34--><p class="noindent" ><span
class="cmr-17x-x-143">User Manual</span><br />
Version 2.2 (March 2017)
<!--l. 44--><p class="noindent" ><span
class="cmssbx-10x-x-172">Coherent Graphics Ltd</span>
</div>
<!--l. 51--><p class="noindent" >For bug reports, feature requests and comments, email<br
class="newline" /><span
class="cmtt-10">contact@coherentgraphics.co.uk</span>
<!--l. 54--><p class="noindent" ><span
class="tcrm-1000">©</span>2017 Coherent Graphics Limited. All rights reserved. ISBN 978-0957671140
<!--l. 57--><p class="noindent" >Adobe, Acrobat, Adobe PDF, Adobe Reader and PostScript are registered trademarks of Adobe
Systems Incorporated. Windows, Powerpoint and Excel are registered trademarks of Microsoft
Corporation.
<!--l. 63--><p class="indent" >
<h2 class="likechapterHead"><a
id="x1-1000"></a>Contents</h2> <div class="tableofcontents">
<span class="chapterToc" >1 <a
href="#x1-30001" id="QQ2-1-3">Basic Usage</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.1 <a
href="#x1-40001.1" id="QQ2-1-4">Input and Output Files</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.2 <a
href="#x1-50001.2" id="QQ2-1-5">Input Ranges</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.3 <a
href="#x1-60001.3" id="QQ2-1-6">Working with Encrypted Documents</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.4 <a
href="#x1-70001.4" id="QQ2-1-7">Standard Input and Standard Output</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.5 <a
href="#x1-80001.5" id="QQ2-1-8">Doing Several Things at Once with AND</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.6 <a
href="#x1-90001.6" id="QQ2-1-9">Units</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.7 <a
href="#x1-100001.7" id="QQ2-1-10">Setting the Producer and Creator</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.8 <a
href="#x1-110001.8" id="QQ2-1-11">PDF Version Numbers</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.9 <a
href="#x1-120001.9" id="QQ2-1-12">File IDs</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.10 <a
href="#x1-130001.10" id="QQ2-1-13">Linearization</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.11 <a
href="#x1-140001.11" id="QQ2-1-14">Object Streams</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.12 <a
href="#x1-150001.12" id="QQ2-1-15">Malformed Files</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.13 <a
href="#x1-160001.13" id="QQ2-1-16">Error Handling</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.14 <a
href="#x1-170001.14" id="QQ2-1-17">Control Files</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.15 <a
href="#x1-180001.15" id="QQ2-1-18">String Arguments</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.16 <a
href="#x1-190001.16" id="QQ2-1-19">Text Encodings</a></span>
<br /> &#x00A0;<span class="sectionToc" >1.17 <a
href="#x1-200001.17" id="QQ2-1-20">Font Embedding</a></span>
<br /> <span class="chapterToc" >2 <a
href="#x1-210002" id="QQ2-1-21">Merging and Splitting</a></span>
<br /> &#x00A0;<span class="sectionToc" >2.1 <a
href="#x1-220002.1" id="QQ2-1-22">Merging</a></span>
<br /> &#x00A0;<span class="sectionToc" >2.2 <a
href="#x1-230002.2" id="QQ2-1-23">Splitting</a></span>
<br /> &#x00A0;<span class="sectionToc" >2.3 <a
href="#x1-240002.3" id="QQ2-1-24">Splitting on Bookmarks</a></span>
<br /> &#x00A0;<span class="sectionToc" >2.4 <a
href="#x1-250002.4" id="QQ2-1-25">Encrypting with Split and Split Bookmarks</a></span>
<br /> <span class="chapterToc" >3 <a
href="#x1-260003" id="QQ2-1-26">Pages</a></span>
<br /> &#x00A0;<span class="sectionToc" >3.1 <a
href="#x1-270003.1" id="QQ2-1-27">Page Sizes</a></span>
<br /> &#x00A0;<span class="sectionToc" >3.2 <a
href="#x1-280003.2" id="QQ2-1-28">Scale Pages</a></span>
<br /> &#x00A0;<span class="sectionToc" >3.3 <a
href="#x1-290003.3" id="QQ2-1-29">Shift Page Contents</a></span>
<br /> &#x00A0;<span class="sectionToc" >3.4 <a
href="#x1-300003.4" id="QQ2-1-30">Rotating Pages</a></span>
<br /> &#x00A0;<span class="sectionToc" >3.5 <a
href="#x1-310003.5" id="QQ2-1-31">Flipping Pages</a></span>
<br /> &#x00A0;<span class="sectionToc" >3.6 <a
href="#x1-320003.6" id="QQ2-1-32">Boxes and Cropping</a></span>
<br /> <span class="chapterToc" >4 <a
href="#x1-330004" id="QQ2-1-33">Encryption and Decryption</a></span>
<br /> &#x00A0;<span class="sectionToc" >4.1 <a
href="#x1-340004.1" id="QQ2-1-34">Introduction</a></span>
<br /> &#x00A0;<span class="sectionToc" >4.2 <a
href="#x1-350004.2" id="QQ2-1-35">Encrypting a Document</a></span>
<br /> &#x00A0;<span class="sectionToc" >4.3 <a
href="#x1-360004.3" id="QQ2-1-36">Decrypting a Document</a></span>
<br /> <span class="chapterToc" >5 <a
href="#x1-370005" id="QQ2-1-37">Compression</a></span>
<br /> &#x00A0;<span class="sectionToc" >5.1 <a
href="#x1-380005.1" id="QQ2-1-38">Decompressing a Document</a></span>
<br /> &#x00A0;<span class="sectionToc" >5.2 <a
href="#x1-390005.2" id="QQ2-1-39">Compressing a Document</a></span>
<br /> &#x00A0;<span class="sectionToc" >5.3 <a
href="#x1-400005.3" id="QQ2-1-40">Squeezing a Document</a></span>
<br /> <span class="chapterToc" >6 <a
href="#x1-410006" id="QQ2-1-41">Bookmarks</a></span>
<br /> &#x00A0;<span class="sectionToc" >6.1 <a
href="#x1-420006.1" id="QQ2-1-42">List Bookmarks</a></span>
<br /> &#x00A0;<span class="sectionToc" >6.2 <a
href="#x1-430006.2" id="QQ2-1-43">Remove Bookmarks</a></span>
<br /> &#x00A0;<span class="sectionToc" >6.3 <a
href="#x1-440006.3" id="QQ2-1-44">Add Bookmarks</a></span>
<br /> <span class="chapterToc" >7 <a
href="#x1-450007" id="QQ2-1-45">Presentations</a></span>
<br /> <span class="chapterToc" >8 <a
href="#x1-460008" id="QQ2-1-46">Watermarks and Stamps</a></span>
<br /> &#x00A0;<span class="sectionToc" >8.1 <a
href="#x1-470008.1" id="QQ2-1-47">Add a Watermark or Logo</a></span>
<br /> &#x00A0;<span class="sectionToc" >8.2 <a
href="#x1-480008.2" id="QQ2-1-48">Stamp Text, Dates and Times.</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.1 <a
href="#x1-490008.2.1" id="QQ2-1-49">Page Numbers</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.2 <a
href="#x1-500008.2.2" id="QQ2-1-50">Date and Time Formats</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.3 <a
href="#x1-510008.2.3" id="QQ2-1-51">Bates Numbers</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.4 <a
href="#x1-520008.2.4" id="QQ2-1-52">Position</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.5 <a
href="#x1-530008.2.5" id="QQ2-1-53">Font and Size</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.6 <a
href="#x1-540008.2.6" id="QQ2-1-54">Colors</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.7 <a
href="#x1-550008.2.7" id="QQ2-1-55">Outline Text</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.8 <a
href="#x1-560008.2.8" id="QQ2-1-56">Multi-line Text</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >8.2.9 <a
href="#x1-570008.2.9" id="QQ2-1-57">Special Characters</a></span>
<br /> &#x00A0;<span class="sectionToc" >8.3 <a
href="#x1-580008.3" id="QQ2-1-58">Stamping Graphics</a></span>
<br /> <span class="chapterToc" >9 <a
href="#x1-590009" id="QQ2-1-59">Multipage Facilities</a></span>
<br /> &#x00A0;<span class="sectionToc" >9.1 <a
href="#x1-600009.1" id="QQ2-1-60">Two-up</a></span>
<br /> &#x00A0;<span class="sectionToc" >9.2 <a
href="#x1-610009.2" id="QQ2-1-61">Inserting Blank Pages</a></span>
<br /> <span class="chapterToc" >10 <a
href="#x1-6200010" id="QQ2-1-62">Annotations</a></span>
<br /> &#x00A0;<span class="sectionToc" >10.1 <a
href="#x1-6300010.1" id="QQ2-1-63">List Annotations</a></span>
<br /> &#x00A0;<span class="sectionToc" >10.2 <a
href="#x1-6400010.2" id="QQ2-1-64">Copy Annotations</a></span>
<br /> &#x00A0;<span class="sectionToc" >10.3 <a
href="#x1-6500010.3" id="QQ2-1-65">Remove Annotations</a></span>
<br /> <span class="chapterToc" >11 <a
href="#x1-6600011" id="QQ2-1-66">Document Information and Metadata</a></span>
<br /> &#x00A0;<span class="sectionToc" >11.1 <a
href="#x1-6700011.1" id="QQ2-1-67">Listing Fonts</a></span>
<br /> &#x00A0;<span class="sectionToc" >11.2 <a
href="#x1-6800011.2" id="QQ2-1-68">Reading Document Information</a></span>
<br /> &#x00A0;<span class="sectionToc" >11.3 <a
href="#x1-6900011.3" id="QQ2-1-69">Setting Document Information</a></span>
<br /> &#x00A0;<span class="sectionToc" >11.4 <a
href="#x1-7000011.4" id="QQ2-1-70">Upon Opening a Document</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >11.4.1 <a
href="#x1-7100011.4.1" id="QQ2-1-71">Page Layout</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >11.4.2 <a
href="#x1-7200011.4.2" id="QQ2-1-72">Page Mode</a></span>
<br /> &#x00A0;&#x00A0;<span class="subsectionToc" >11.4.3 <a
href="#x1-7300011.4.3" id="QQ2-1-73">Display Options</a></span>
<br /> &#x00A0;<span class="sectionToc" >11.5 <a
href="#x1-7400011.5" id="QQ2-1-74">Metadata</a></span>
<br /> &#x00A0;<span class="sectionToc" >11.6 <a
href="#x1-7500011.6" id="QQ2-1-75">Page Labels</a></span>
<br /> <span class="chapterToc" >12 <a
href="#x1-7600012" id="QQ2-1-76">File Attachments</a></span>
<br /> &#x00A0;<span class="sectionToc" >12.1 <a
href="#x1-7700012.1" id="QQ2-1-77">Adding Attachments</a></span>
<br /> &#x00A0;<span class="sectionToc" >12.2 <a
href="#x1-7800012.2" id="QQ2-1-78">Listing Attachments</a></span>
<br /> &#x00A0;<span class="sectionToc" >12.3 <a
href="#x1-7900012.3" id="QQ2-1-79">Removing Attachments</a></span>
<br /> <span class="chapterToc" >13 <a
href="#x1-8000013" id="QQ2-1-80">Working with Images</a></span>
<br /> &#x00A0;<span class="sectionToc" >13.1 <a
href="#x1-8100013.1" id="QQ2-1-81">Detecting Low-resolution Images</a></span>
<br /> <span class="chapterToc" >14 <a
href="#x1-8200014" id="QQ2-1-82">Fonts</a></span>
<br /> &#x00A0;<span class="sectionToc" >14.1 <a
href="#x1-8300014.1" id="QQ2-1-83">Copying Fonts</a></span>
<br /> &#x00A0;<span class="sectionToc" >14.2 <a
href="#x1-8400014.2" id="QQ2-1-84">Removing Fonts</a></span>
<br /> &#x00A0;<span class="sectionToc" >14.3 <a
href="#x1-8500014.3" id="QQ2-1-85">Listing Missing Fonts</a></span>
<br /> <span class="chapterToc" >15 <a
href="#x1-8600015" id="QQ2-1-86">Miscellaneous</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.1 <a
href="#x1-8700015.1" id="QQ2-1-87">Draft Documents</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.2 <a
href="#x1-8800015.2" id="QQ2-1-88">Blackening Text, Lines and Fills</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.3 <a
href="#x1-8900015.3" id="QQ2-1-89">Hairline Removal</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.4 <a
href="#x1-9000015.4" id="QQ2-1-90">Garbage Collection</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.5 <a
href="#x1-9100015.5" id="QQ2-1-91">Change PDF Version Number</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.6 <a
href="#x1-9200015.6" id="QQ2-1-92">Copy ID</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.7 <a
href="#x1-9300015.7" id="QQ2-1-93">Remove ID</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.8 <a
href="#x1-9400015.8" id="QQ2-1-94">List Spot Colours</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.9 <a
href="#x1-9500015.9" id="QQ2-1-95">Removing Dictionary Entries</a></span>
<br /> &#x00A0;<span class="sectionToc" >15.10 <a
href="#x1-9600015.10" id="QQ2-1-96">Remove Clipping</a></span>
<br /> <span class="appendixToc" >A <a
href="#x1-97000A" id="QQ2-1-97">Dates</a></span>
</div>
<!--l. 65--><p class="indent" >
<!--l. 66--><p class="indent" >
<h2 class="likechapterHead"><a
id="x1-2000"></a>Typographical Conventions</h2> Command lines to be typed are shown in <span
class="cmtt-10">typewriterfont </span>in a box.
For example:
<!--l. 70--><p class="noindent" ><img
src="cpdfmanual0x.png" alt="" class="fbox" >
<!--l. 76--><p class="noindent" >When describing the general form of a command, rather than a particular example, square brackets <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">[]</span></span></span>
are used to enclose optional parts, and angled braces <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;&#x003E;</span></span></span> to enclose general descriptions which may be
substituted for particular instances. For example,
<!--l. 81--><p class="noindent" ><img
src="cpdfmanual1x.png" alt="" class="fbox" >
<!--l. 84--><p class="noindent" >describes a command line which requires an operation and, optionally, a range. An exception is that
we use <span
class="cmtt-10">in.pdf </span>and <span
class="cmtt-10">out.pdf </span>instead of <span
class="cmtt-10">&#x003C;input file&#x003E; </span>and <span
class="cmtt-10">&#x003C;output file&#x003E; </span>to reduce verbosity. Under
Microsoft Windows, type <span
class="cmtt-10">cpdf.exe </span>instead of <span
class="cmtt-10">cpdf</span>.
<!--l. 91--><p class="indent" >
<!--l. 92--><p class="indent" >
<!--l. 96--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;1</span><br /><a
id="x1-30001"></a>Basic Usage</h2>
<!--l. 101--><p class="noindent" ><img
src="cpdfmanual2x.png" alt="" class="fbox" >
<!--l. 110--><p class="indent" > 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 <span
class="cmtt-10">cpdf</span>&#x00A0;(<span
class="cmtt-10">cpdf.exe </span>under
Microsoft Windows). The rest of this manual describes the options that may be given to this
program.
<a
id="dx1-3001"></a>
<a
id="dx1-3002"></a>
<h3 class="sectionHead"><span class="titlemark">1.1 </span> <a
id="x1-40001.1"></a>Input and Output Files</h3>
<!--l. 119--><p class="noindent" >The typical pattern for usage is
<!--l. 121--><p class="noindent" ><img
src="cpdfmanual3x.png" alt="" class="fbox" >
<!--l. 125--><p class="noindent" >and the simplest concrete example, assuming the existence of a file <span
class="cmtt-10">in.pdf </span>is:
<!--l. 128--><p class="noindent" ><img
src="cpdfmanual4x.png" alt="" class="fbox" >
<!--l. 132--><p class="noindent" >which copies <span
class="cmtt-10">in.pdf </span>to <span
class="cmtt-10">out.pdf</span>. The input and output may be the same file. Of course, we should like
to do more interesting things to the PDF file than that!
<!--l. 137--><p class="indent" > Files on the command line are distinguished from other input by their containing a period. If an
input file does not contain a period, it should be preceded by <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-i</span></span></span>. For example:
<!--l. 141--><p class="noindent" ><img
src="cpdfmanual5x.png" alt="" class="fbox" >
<!--l. 145--><p class="noindent" >A whole directory of files may be added (where a command supports multiple files) by using the <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-idir</span></span></span>
option:
<!--l. 147--><p class="noindent" ><img
src="cpdfmanual6x.png" alt="" class="fbox" >
<!--l. 151--><p class="noindent" >The files in the directory <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">myfiles</span></span></span> 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
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">001.pdf</span></span></span>, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">002.pdf</span></span></span> etc).
<!--l. 153--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.2 </span> <a
id="x1-50001.2"></a>Input Ranges</h3>
<!--l. 154--><p class="noindent" >An <a
id="dx1-5001"></a><a
id="dx1-5002"></a> <span
class="cmti-10">input range </span>may be specified after each input file. This is treated differently by each operation.
For instance
<!--l. 158--><p class="noindent" ><img
src="cpdfmanual7x.png" alt="" class="fbox" >
<!--l. 162--><p class="noindent" >extracts pages two, three, four and five from <span
class="cmtt-10">in.pdf</span>, writing the result to <span
class="cmtt-10">out.pdf</span>, assuming that
<span
class="cmtt-10">in.pdf </span>contains at least five pages. <a
id="dx1-5003"></a><a
id="dx1-5004"></a> Here are the rules for building input ranges:
<ul class="itemize1">
<li class="itemize">A dash (<span
class="cmtt-10">-</span>) defines ranges, e.g. <span
class="cmtt-10">1-5 </span>or <span
class="cmtt-10">6-3</span>.
</li>
<li class="itemize">A comma (<span
class="cmtt-10">,</span>) allows one to specify several ranges, e.g. <span
class="cmtt-10">1-2,4-5</span>.
</li>
<li class="itemize">The word <span
class="cmtt-10">end </span>represents the last page number.
</li>
<li class="itemize">The words <span
class="cmtt-10">odd </span>and <span
class="cmtt-10">even </span>can be used in place of or at the end of a page range to restrict
to just the odd or even pages.
</li>
<li class="itemize">The words <span
class="cmtt-10">portrait </span>and <span
class="cmtt-10">landscape </span>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
&#8220;portrait&#8221; and &#8220;landscape&#8221; does not take account of any viewing rotation in place (use
<span
class="cmtt-10">-upright </span>first, if required). A page with equal width and height is considered neither
portrait nor landscape.
</li>
<li class="itemize">The word <span
class="cmtt-10">reverse </span>is the same as <span
class="cmtt-10">end-1</span>.
</li>
<li class="itemize">The word <span
class="cmtt-10">all </span>is the same as <span
class="cmtt-10">1-end</span>.
</li>
<li class="itemize">A range must contain no spaces.
</li>
<li class="itemize">A tilde (<span
class="cmtt-10">~</span>) defines a page number counting from the end of the document rather than the
beginning. Page <span
class="cmtt-10">~1 </span>is the last page, <span
class="cmtt-10">~2 </span>the penultimate page etc.</li></ul>
<!--l. 180--><p class="noindent" >For example:
<!--l. 182--><p class="noindent" ><img
src="cpdfmanual8x.png" alt="" class="fbox" >
<a
id="dx1-5005"></a>
<!--l. 217--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.3 </span> <a
id="x1-60001.3"></a>Working with Encrypted Documents</h3>
<a
id="dx1-6001"></a>
<a
id="dx1-6002"></a>
<a
id="dx1-6003"></a>
<!--l. 221--><p class="noindent" >In order to perform many operations, encrypted input PDF files must be decrypted. Some require the
owner password, some either the user or owner passwords. Either password is supplied
by writing <span
class="cmtt-10">user=&#x003C;password&#x003E; </span>or <span
class="cmtt-10">owner=&#x003C;password&#x003E; </span>following each input file requiring it
(before or after any range). The document will <span
class="cmti-10">not </span>be re-encrypted upon writing. For
example:
<!--l. 228--><p class="noindent" ><img
src="cpdfmanual9x.png" alt="" class="fbox" >
<!--l. 234--><p class="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 <span
class="cmtt-10">-recrypt </span>option:
<!--l. 236--><p class="noindent" ><img
src="cpdfmanual10x.png" alt="" class="fbox" >
<!--l. 241--><p class="noindent" >The password required (owner or user) depends upon the operation being performed. Separate
facilities are provided to decrypt and encrypt files (See Section <a
href="#x1-330004">4<!--tex4ht:ref: crypt --></a>).
<!--l. 245--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.4 </span> <a
id="x1-70001.4"></a>Standard Input and Standard Output</h3>
<a
id="dx1-7001"></a>
<a
id="dx1-7002"></a>
<!--l. 247--><p class="noindent" >Thus far, we have assumed that the input PDF will be read from a file on disk, and the output written
similarly. Often it&#8217;s useful to be able to read input from <span
class="cmtt-10">stdin </span>(Standard Input) or write output to
<span
class="cmtt-10">stdout </span>(Standard Output) instead. The typical use is to join several programs together into a <span
class="cmti-10">pipe</span>,
passing data from one to the next without the use of intermediate files. Use <span
class="cmtt-10">-stdin </span>to read from
standard input, and <span
class="cmtt-10">-stdout </span>to write to standard input, either to pipe data between multiple
programs, or multiple invocations of the same program. For example, this sequence of commands (all
typed on one line)
<!--l. 256--><p class="noindent" ><img
src="cpdfmanual11x.png" alt="" class="fbox" >
<!--l. 264--><p class="noindent" >extracts the last five pages of <span
class="cmtt-10">in.pdf </span>in the correct order, writing them to <span
class="cmtt-10">out.pdf</span>. It does this by
reversing the input, taking the first five pages and then reversing the result.
<!--l. 268--><p class="indent" > To supply passwords for a file from <span
class="cmtt-10">-stdin</span>, use <span
class="cmtt-10">-stdin-owner &#x003C;password&#x003E; </span>and/or <span
class="cmtt-10">-stdin-user</span>
<span
class="cmtt-10">&#x003C;password&#x003E;</span>.
<!--l. 270--><p class="indent" > Using <span
class="cmtt-10">-stdout </span>on the final command in the pipeline to output the PDF to screen is not
recommended, since PDF files often contain compressed sections which are not screen-readable.
<!--l. 274--><p class="indent" > Several <span
class="cmtt-10">cpdf</span>&#x00A0;operations write to standard output by default (for example, listing fonts). A useful
feature of the command line (not specific to <span
class="cmtt-10">cpdf</span>) is the ability to redirect this output to a file. This is
achieved with the <span
class="cmtt-10">&#x003E; </span>operator:
<!--l. 279--><p class="noindent" ><img
src="cpdfmanual12x.png" alt="" class="fbox" >
<!--l. 288--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.5 </span> <a
id="x1-80001.5"></a>Doing Several Things at Once with AND</h3>
<!--l. 290--><p class="noindent" >The keyword <span
class="cmtt-10">AND </span>can be used to string together several commands in one. The advantage compared
with using pipes is that the file need not be repeatedly parsed and written out, saving
time.
<!--l. 294--><p class="indent" > To use <span
class="cmtt-10">AND</span>, simply leave off the output specifier (e.g <span
class="cmtt-10">-o</span>) of one command, and the input specifier
(e.g filename) of the next. For instance:
<!--l. 297--><p class="noindent" ><img
src="cpdfmanual13x.png" alt="" class="fbox" >
<!--l. 306--><p class="noindent" >To specify the range for each section, use <span
class="cmtt-10">-range</span>:
<!--l. 308--><p class="noindent" ><img
src="cpdfmanual14x.png" alt="" class="fbox" >
<!--l. 316--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.6 </span> <a
id="x1-90001.6"></a>Units</h3>
<a
id="dx1-9001"></a>
<!--l. 318--><p class="noindent" >When measurements are given to <span
class="cmtt-10">cpdf</span>, they are in points (1 point = 1/72 inch). They
may optionally be followed by some letters to change the measurement. The following are
supported:
<div class="table">
<!--l. 322--><p class="indent" > <hr class="float"><div class="float"
>
<div class="pic-tabular">
<img
src="cpdfmanual15x.png" alt="pt Points (72 points per inch). The default.
cm Centimeters
mm Millimeters
in Inches
" ></div>
</div><hr class="endfloat" />
</div>
<!--l. 335--><p class="noindent" >For example, one may write <span
class="cmtt-10">14mm </span>or <span
class="cmtt-10">21.6in</span>. In addition, the following letters stand, in some
operations (<span
class="cmtt-10">-scale-page</span>, <span
class="cmtt-10">-scale-to-fit</span>, <span
class="cmtt-10">-scale-contents</span>, <span
class="cmtt-10">-shift</span>, <span
class="cmtt-10">-mediabox</span>, <span
class="cmtt-10">-crop</span>) for various
page dimensions:
<div class="table">
<!--l. 337--><p class="indent" > <hr class="float"><div class="float"
>
<div class="pic-tabular">
<img
src="cpdfmanual16x.png" alt=" PW Page width
PH Page height
PMINX Page minimum x coordinate
PMINY Page minimum y coordinate
PMAXX Page maximum x coordinate
PMAXY Page maximum y coordinate
CW Crop box width
CH Crop box height
CMINX Crop box minimum x coordinate
CMINY Crop box minimum y coordinate
CMAXX Crop box maximum x coordinate
CMAXY Crop box maximum y coordinate
" ></div>
</div><hr class="endfloat" />
</div>
<!--l. 355--><p class="noindent" >For example, we may write <span
class="cmtt-10">PMINX PMINY </span>to stand for the coordinate of the lower left corner of the
page.
<!--l. 357--><p class="indent" > Simple arithmetic may be performed using the words <span
class="cmtt-10">add</span>, <span
class="cmtt-10">sub</span>, <span
class="cmtt-10">mul </span>and <span
class="cmtt-10">div </span>to stand for addition,
subtraction, multiplication and division. For example, one may write <span
class="cmtt-10">14insub30pt </span>or <span
class="cmtt-10">PMINXmul</span>
<span
class="cmtt-10">2</span>
<h3 class="sectionHead"><span class="titlemark">1.7 </span> <a
id="x1-100001.7"></a>Setting the Producer and Creator</h3>
<!--l. 361--><p class="noindent" >The <span
class="cmtt-10">-producer </span>and <span
class="cmtt-10">-creator </span>options may be added to any <span
class="cmtt-10">cpdf </span>command line to set the
producer and/or creator of the PDF file. If the file was converted from another format, the
<span
class="cmti-10">creator </span>is the program producing the original, the <span
class="cmti-10">producer </span>the program converting it to
PDF.
<!--l. 365--><p class="noindent" ><img
src="cpdfmanual17x.png" alt="" class="fbox" >
<!--l. 375--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.8 </span> <a
id="x1-110001.8"></a>PDF Version Numbers</h3>
<a
id="dx1-11001"></a>
<!--l. 377--><p class="noindent" >When an operation which uses a part of the PDF standard which was introduced in a later version
than that of the input file, the PDF version in the output file is set to the later version (most PDF
viewers will try to load any PDF file, even if it is marked with a later version number).
However, this automatic version changing may be suppressed with the <span
class="cmtt-10">-keep-version</span>
flag.
<!--l. 383--><p class="indent" > Here is a list of Acrobat versions together with the maximum PDF version they are intended to
support:
<div class="pic-tabular">
<img
src="cpdfmanual18x.png" alt="PDF 1.2 Acrobat 3.0
PDF 1.3 Acrobat 4.0
PDF 1.4 Acrobat 5.0
PDF 1.5 Acrobat 6.0
PDF 1.6 Acrobat 7.0
PDF 1.7 Acrobat 8.0, 9.0, 10.0 " ></div>
<!--l. 397--><p class="noindent" >If you wish to manually alter the PDF version of a file, use the <span
class="cmtt-10">-set-version </span>option described in
Section <a
href="#x1-9100015.5">15.5<!--tex4ht:ref: setversion --></a>.
<!--l. 400--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.9 </span> <a
id="x1-120001.9"></a>File IDs</h3>
<!--l. 401--><p class="noindent" >PDF files contain an ID (consisting of two parts), used by some workflow systems to uniquely identify
a file. To change the ID, behavior, use the <span
class="cmtt-10">-change-id </span>operation. This will create a new ID for the
output file.
<!--l. 405--><p class="noindent" ><img
src="cpdfmanual19x.png" alt="" class="fbox" >
<!--l. 417--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.10 </span> <a
id="x1-130001.10"></a>Linearization</h3>
<a
id="dx1-13001"></a>
<!--l. 419--><p class="noindent" >Linearized PDF is a version of the PDF format in which the data is held in a special manner to allow
content to be fetched only when needed. This means viewing a multipage PDF over a slow connection
is more responsive. By default, <span
class="cmtt-10">cpdf</span>&#x00A0;does not linearize output files. To make it do so, add
the <span
class="cmtt-10">-l </span>option to the command line, in addition to any other command being used. For
example:
<!--l. 425--><p class="noindent" ><img
src="cpdfmanual20x.png" alt="" class="fbox" >
<!--l. 436--><p class="noindent" >This requires the existence of the external program <span
class="cmtt-10">cpdflin </span>which is provided with commercial
versions of <span
class="cmtt-10">cpdf</span>. This must be installed as described in the installation documentation provided with
your copy of <span
class="cmtt-10">cpdf</span>. If you are unable to install <span
class="cmtt-10">cpdflin</span>, you must use <span
class="cmtt-10">-cpdflin </span>to let <span
class="cmtt-10">cpdf </span>know
where to find it:
<!--l. 438--><p class="noindent" ><img
src="cpdfmanual21x.png" alt="" class="fbox" >
<!--l. 447--><p class="indent" > In extremis, you may place <span
class="cmtt-10">cpdflin </span>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
<span
class="cmtt-10">cpdf</span>.
<!--l. 449--><p class="indent" > To keep the existing linearization status of a file (produce linearized output if the input is
linearized and the reverse), use <span
class="cmtt-10">-keep-l </span>instead of <span
class="cmtt-10">-l</span>.
<!--l. 451--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.11 </span> <a
id="x1-140001.11"></a>Object Streams</h3>
<!--l. 452--><p class="noindent" >PDF 1.5 introduced a new mechanism for storing objects to save space: object streams. by default,
<span
class="cmtt-10">cpdf </span>will preserve object streams in input files, creating no more. To prevent the retention of existing
object streams, use <span
class="cmtt-10">-no-preserve-objstm</span>:
<!--l. 454--><p class="noindent" ><img
src="cpdfmanual22x.png" alt="" class="fbox" >
<!--l. 465--><p class="noindent" >To create new object streams if none exist, or augment the existing ones, use <span
class="cmtt-10">-create-objstm</span>:
<!--l. 467--><p class="noindent" ><img
src="cpdfmanual23x.png" alt="" class="fbox" >
<!--l. 475--><p class="noindent" >To create wholly new object streams, use both options together:
<!--l. 477--><p class="noindent" ><img
src="cpdfmanual24x.png" alt="" class="fbox" >
<!--l. 487--><p class="noindent" >Files written with object streams will be set to PDF 1.5 or higher, unless <span
class="cmtt-10">-keep-version </span>is used (see
above).
<!--l. 492--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.12 </span> <a
id="x1-150001.12"></a>Malformed Files</h3>
<!--l. 494--><p class="noindent" >There are many malformed PDF files in existence, including many produced by otherwise-reputable
applications. <span
class="cmtt-10">cpdf</span>&#x00A0;attempts to correct these problems silently.
<!--l. 498--><p class="indent" > Grossly malformed files will be reconstructed. The reconstruction progress is shown on <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">stderr</span></span></span>
(Standard Error):
<!--l. 501--><p class="noindent" ><img
src="cpdfmanual25x.png" alt="" class="fbox" >
<!--l. 509--><p class="noindent" >Sometimes files can be technically well-formed but use inefficient PDF constructs. If you are sure the
input files you are using are impeccably formed, the <span
class="cmtt-10">-fast </span>option added to the command line (or, if
using <span
class="cmtt-10">AND</span>, to each section of the command line). This will use certain shortcuts which speed up
processing, but would fail on badly-produced files.
<!--l. 515--><p class="indent" > The <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-fast</span></span></span> option may be used with:
<!--l. 517--><p class="noindent" ><img
src="cpdfmanual26x.png" alt="" class="fbox" >
<!--l. 529--><p class="noindent" >If problems occur, refrain from using <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-fast</span></span></span>.
<!--l. 531--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.13 </span> <a
id="x1-160001.13"></a>Error Handling</h3>
<a
id="dx1-16001"></a>
<!--l. 533--><p class="noindent" >When <span
class="cmtt-10">cpdf</span>&#x00A0;encounters an error, it exits with code 2. An error message is displayed on <span
class="cmtt-10">stderr</span>
(Standard Error). In normal usage, this means it&#8217;s displayed on the screen. When a bad or
inappropriate password is given, the exit code is 1.
<!--l. 538--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.14 </span> <a
id="x1-170001.14"></a>Control Files</h3>
<a
id="dx1-17001"></a>
<!--l. 541--><p class="noindent" ><img
src="cpdfmanual27x.png" alt="" class="fbox" >
<!--l. 550--><p class="indent" > 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 <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\"</span></span></span> may be used to
introduce a genuine quotation mark in such an argument.
<!--l. 557--><p class="indent" > Several <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-control</span></span></span> 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 <span
class="cmtt-10">-args </span>in all
new applications. However, <span
class="cmtt-10">-control </span>will be supported for legacy applications.
<!--l. 562--><p class="indent" > To avoid interference between <span
class="cmtt-10">-control </span>and <span
class="cmtt-10">AND</span>, a new mechanism has been added. Using <span
class="cmtt-10">-args</span>
in place of <span
class="cmtt-10">-control </span>will perform direct textual substitution of the file into the command line, prior to
any other processing.
<!--l. 565--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.15 </span> <a
id="x1-180001.15"></a>String Arguments</h3>
<!--l. 566--><p class="noindent" >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,
<span
class="cmtt-10">cpdf</span>&#x00A0;performs processing on string arguments as they are read.
<!--l. 571--><p class="indent" > 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 the command line
<!--l. 576--><p class="noindent" ><img
src="cpdfmanual28x.png" alt="" class="fbox" >
<!--l. 581--><p class="noindent" >would fail. We must escape the exclamation mark with a backslash:
<!--l. 583--><p class="noindent" ><img
src="cpdfmanual29x.png" alt="" class="fbox" >
<!--l. 587--><p class="noindent" >It follows that backslashes intended to be taken literally must themselves be escaped (i.e. written
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\\</span></span></span>).
<!--l. 591--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.16 </span> <a
id="x1-190001.16"></a>Text Encodings</h3>
<a
id="dx1-19001"></a>
<!--l. 594--><p class="noindent" >Some <span
class="cmtt-10">cpdf </span>commands write text to standard output, or read text from the command line or
configuration files. These are:
<!--l. 597--><p class="noindent" ><img
src="cpdfmanual30x.png" alt="" class="fbox" >
<!--l. 604--><p class="noindent" >There are three options to control how the text is interpreted:
<!--l. 606--><p class="noindent" ><img
src="cpdfmanual31x.png" alt="" class="fbox" >
<!--l. 612--><p class="noindent" >Add <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-utf8</span></span></span> to use Unicode UTF8, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-stripped</span></span></span> to convert to 7 bit ASCII by dropping any high
characters, or <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-raw</span></span></span> to perform no processing. The default is <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-stripped</span></span></span>.
<!--l. 617--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">1.17 </span> <a
id="x1-200001.17"></a>Font Embedding</h3>
<!--l. 618--><p class="noindent" >Use the <span
class="cmtt-10">-no-embed-font </span>to avoid embedding the Standard 14 Font metrics when adding text with
<span
class="cmtt-10">-add-text</span>.
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;2</span><br /><a
id="x1-210002"></a>Merging and Splitting</h2> <img
src="cpdfmanual32x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">2.1 </span> <a
id="x1-220002.1"></a>Merging</h3>
<a
id="dx1-22001"></a>
<!--l. 638--><p class="noindent" >The <span
class="cmtt-10">-merge </span>operation allow the merging of several files into one. Ranges can be used to select only a
subset of pages from each input file in the output. The output file consists of the concatenation of all
the input pages in the order specified on the command line. Actually, the <span
class="cmtt-10">-merge </span>can be omitted, since
this is the default operation of <span
class="cmtt-10">cpdf</span>.
<!--l. 644--><p class="noindent" ><img
src="cpdfmanual33x.png" alt="" class="fbox" >
<!--l. 657--><p class="noindent" >Merge maintains bookmarks, named destinations, and name dictionaries.
<!--l. 659--><p class="indent" > Forms and other objects which cannot be merged are retained if they are from the document which
first exhibits that feature.
<!--l. 662--><p class="indent" > The <span
class="cmtt-10">-retain-numbering </span>option keeps the PDF page numbering labels of each document intact,
rather than renumbering the output pages from 1.
<!--l. 665--><p class="indent" > The <span
class="cmtt-10">-remove-duplicate-fonts </span>ensures that fonts used in more than one of the inputs only
appear once in the output.
<!--l. 668--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">2.2 </span> <a
id="x1-230002.2"></a>Splitting</h3>
<a
id="dx1-23001"></a>
<!--l. 670--><p class="noindent" >The <span
class="cmtt-10">-split </span>operation splits a PDF file into a number of parts which are written to file, their names
being generated from a <span
class="cmti-10">format</span>. The optional <span
class="cmtt-10">-chunk </span>option allows the number of pages written to
each output file to be set.
<!--l. 675--><p class="noindent" ><img
src="cpdfmanual34x.png" alt="" class="fbox" >
<!--l. 692--><p class="noindent" >If the output format does not provide enough numbers for the files generated, the result is unspecified.
The following format operators may be used:
<div class="table">
<!--l. 695--><p class="indent" > <hr class="float"><div class="float"
>
<div class="pic-tabular">
<img
src="cpdfmanual35x.png" alt="%, %%, %%% etc. Sequence number padded to the number of percent signs
@F Original filename without extension
@N Sequence number without padding zeroes
@S Start page of this chunk
@E End page of this chunk
@B Bookmark name at this page
" ></div>
</div><hr class="endfloat" />
</div>
<h3 class="sectionHead"><span class="titlemark">2.3 </span> <a
id="x1-240002.3"></a>Splitting on Bookmarks</h3>
<a
id="dx1-24001"></a>
<!--l. 709--><p class="noindent" >The <span
class="cmtt-10">-split-bookmarks &#x003C;level&#x003E; </span>operation splits a PDF file into a number of parts, according to the
page ranges implied by the document&#8217;s bookmarks. These parts are then written to file with names
generated from the given format.
<!--l. 713--><p class="indent" > Level 0 denotes the top-level bookmarks, level 1 the next level (sub-bookmarks) and so on. So
<span
class="cmtt-10">-split-bookmarks 1 </span>creates breaks on level 0 and level 1 boundaries.
<!--l. 717--><p class="noindent" ><img
src="cpdfmanual36x.png" alt="" class="fbox" >
<!--l. 726--><p class="noindent" >Now, there may be many bookmarks on a single page (for instance, if paragraphs are bookmarked or
there are two subsections on one page). The splits calculated by <span
class="cmtt-10">-split-bookmarks </span>ensure that each
page appears in only one of the output files. It is possible to use the <span
class="cmtt-10">@ </span>operators above, including
operator <span
class="cmtt-10">@B </span>which expands to the text of the bookmark:
<!--l. 732--><p class="noindent" ><img
src="cpdfmanual37x.png" alt="" class="fbox" >
<!--l. 742--><p class="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:
<!--l. 744--><p class="noindent" ><img
src="cpdfmanual38x.png" alt="" class="fbox" >
<!--l. 750--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">2.4 </span> <a
id="x1-250002.4"></a>Encrypting with Split and Split Bookmarks</h3>
<!--l. 752--><p class="noindent" >The encryption parameters described in Chapter <a
href="#x1-330004">4<!--tex4ht:ref: encryption --></a> may be added to the command line to encrypt each
split PDF. Similarly, the <span
class="cmtt-10">-recrypt </span>switch described in <a
href="#x1-30001">1<!--tex4ht:ref: basicusage --></a> may by given to re-encrypt each file with the
existing encryption of the source PDF.
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;3</span><br /><a
id="x1-260003"></a>Pages</h2> <img
src="cpdfmanual39x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">3.1 </span> <a
id="x1-270003.1"></a>Page Sizes</h3>
<a
id="dx1-27001"></a>
<!--l. 807--><p class="noindent" >Any time when a page size is required, instead of writing, for instance <span
class="cmtt-10">"210mm 197mm" </span>one can instead
write <span
class="cmtt-10">a4portrait</span>. Here is a list of supported page sizes:
<div class="pic-tabular">
<img
src="cpdfmanual40x.png" alt="a0portrait a1portrait a2portrait
a3portrait a4portrait a5portrait
a6portrait a7portrait a8portrait
a9portrait a10portrait
a0landscape a1landscape a2landscape
a3landscape a4landscape a5landscape
a6landscape a7landscape a8landscape
a9landscape a10landscape
usletterportrait usletterlandscape
uslegalportrait uslegallandscape
" ></div>
<h3 class="sectionHead"><span class="titlemark">3.2 </span> <a
id="x1-280003.2"></a>Scale Pages</h3>
<a
id="dx1-28001"></a>
<!--l. 828--><p class="noindent" >The <span
class="cmtt-10">-scale-page </span>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.
<!--l. 831--><p class="noindent" ><img
src="cpdfmanual41x.png" alt="" class="fbox" >
<!--l. 839--><p class="noindent" >The <span
class="cmtt-10">-scale-to-fit </span>operation scales each page in the range to fit a given page size, preserving aspect
ratio and centering the result.
<!--l. 843--><p class="noindent" ><img
src="cpdfmanual42x.png" alt="" class="fbox" >
<!--l. 852--><p class="noindent" >The scale can optionally be set to a percentage of the available area, instead of filling it.
<!--l. 854--><p class="noindent" ><img
src="cpdfmanual43x.png" alt="" class="fbox" >
<!--l. 862--><p class="noindent" >The <span
class="cmtt-10">-scale-contents </span>operation scales the contents about the center of the crop box (or, if absent,
the media box), leaving the page dimensions (boxes) unchanged.
<!--l. 866--><p class="noindent" ><img
src="cpdfmanual44x.png" alt="" class="fbox" >
<!--l. 874--><p class="noindent" >To scale about a point other than the center, one can use the positioning commands described in
Section <a
href="#x1-520008.2.4">8.2.4<!--tex4ht:ref: position --></a>. For example:
<!--l. 876--><p class="noindent" ><img
src="cpdfmanual45x.png" alt="" class="fbox" >
<!--l. 886--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3.3 </span> <a
id="x1-290003.3"></a>Shift Page Contents</h3>
<a
id="dx1-29001"></a>
<!--l. 889--><p class="noindent" >The <span
class="cmtt-10">-shift </span>operation shifts the contents of each page in the range by X points horizontally and Y
points vertically.
<!--l. 892--><p class="noindent" ><img
src="cpdfmanual46x.png" alt="" class="fbox" >
<!--l. 903--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3.4 </span> <a
id="x1-300003.4"></a>Rotating Pages</h3>
<a
id="dx1-30001"></a>
<!--l. 906--><p class="noindent" >There are two ways of rotating pages: (1)&#x00A0;setting a value in the PDF file which asks the viewer (e.g.
Acrobat) to rotate the page on-the-fly when viewing it (use <span
class="cmtt-10">-rotate </span>or <span
class="cmtt-10">-rotateby</span>) and
(2)&#x00A0;actually rotating the page contents and/or the page dimensions (use <span
class="cmtt-10">-upright </span>afterwards or
<span
class="cmtt-10">-rotate-contents </span>to just rotate the page contents).
<!--l. 912--><p class="indent" > The possible values for <span
class="cmtt-10">-rotate </span>and <span
class="cmtt-10">-rotate-by </span>are 0, 90, 180 and 270, all interpreted as being
clockwise. Any value may be used for <span
class="cmtt-10">-rotate-contents</span>.
<!--l. 916--><p class="indent" > The <span
class="cmtt-10">-rotate </span>operation sets the viewing rotation of the selected pages to the absolute value
given.
<!--l. 919--><p class="noindent" ><img
src="cpdfmanual47x.png" alt="" class="fbox" > The
<span
class="cmtt-10">-rotateby </span>operation changes the viewing rotation of all the given pages by the relative value
given.
<!--l. 930--><p class="noindent" ><img
src="cpdfmanual48x.png" alt="" class="fbox" > The
<span
class="cmtt-10">-rotate-contents </span>operation rotates the contents and dimensions of the page by the given relative
value. <a
id="dx1-30002"></a>
<!--l. 942--><p class="noindent" ><img
src="cpdfmanual49x.png" alt="" class="fbox" >
<!--l. 955--><p class="noindent" >The <span
class="cmtt-10">-upright </span>operation does whatever combination of <span
class="cmtt-10">-rotate </span>and <span
class="cmtt-10">-rotate-contents </span>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.
<!--l. 959--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3.5 </span> <a
id="x1-310003.5"></a>Flipping Pages</h3>
<a
id="dx1-31001"></a>
<!--l. 961--><p class="noindent" >The <span
class="cmtt-10">-hflip </span>and <span
class="cmtt-10">-vflip </span>operations flip the contents of the chosen pages horizontally or vertically. No
account is taken of the current page rotation when considering what &#8221;horizontally&#8221; and &#8221;vertically&#8221;
mean, so you may like to use <span
class="cmtt-10">-upright </span>first.
<!--l. 965--><p class="noindent" ><img
src="cpdfmanual50x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">3.6 </span> <a
id="x1-320003.6"></a>Boxes and Cropping</h3>
<a
id="dx1-32001"></a>
<a
id="dx1-32002"></a>
<!--l. 981--><p class="noindent" >All PDF files contain a <span
class="cmti-10">media box </span>for each page, giving the dimensions of the paper. To
change these dimensions (without altering the page contents in any way), use the <span
class="cmtt-10">-mediabox</span>
option.
<!--l. 985--><p class="noindent" ><img
src="cpdfmanual51x.png" alt="" class="fbox" > The
four numbers are minimum x, minimum y, width, height. x coordinates increase to the right, y
coordinates increase upwards. PDF file can also optionally contain a <span
class="cmti-10">crop box </span>for each page, defining
to what extent the page is cropped before being displayed or printed. A crop box can be set, changed
and removed, without affecting the underlying media box. To set or change the crop box use <span
class="cmtt-10">-crop</span>.
To remove any existing crop box, use <span
class="cmtt-10">-remove-crop</span>.
<!--l. 1000--><p class="noindent" ><img
src="cpdfmanual52x.png" alt="" class="fbox" >
<!--l. 1014--><p class="noindent" >Note that the crop box is only obeyed in some viewers.
<!--l. 1016--><p class="noindent" ><img
src="cpdfmanual53x.png" alt="" class="fbox" >
This operation copies the contents of one box (Media box, Crop box, Trim box etc.) to another. If
<span
class="cmtt-10">-mediabox-if-missing </span>is added, the media box will be substituted when the &#8217;from&#8217; box is not set for
a given page. For example
<!--l. 1027--><p class="noindent" ><img
src="cpdfmanual54x.png" alt="" class="fbox" >
copies the Trim Box of each page to the Crop Box of each page. The possible boxes are <span
class="cmtt-10">/MediaBox</span>,
<span
class="cmtt-10">/CropBox</span>, <span
class="cmtt-10">/BleedBox</span>, <span
class="cmtt-10">/TrimBox</span>, <span
class="cmtt-10">/ArtBox</span>.
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;4</span><br /><a
id="x1-330004"></a>Encryption and Decryption</h2> <a
id="dx1-33001"></a> <a
id="dx1-33002"></a><img
src="cpdfmanual55x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">4.1 </span> <a
id="x1-340004.1"></a>Introduction</h3>
<!--l. 1048--><p class="noindent" >PDF files can be encrypted using various types of encryption and attaching various permissions
describing what someone can do with a particular document (for instance, printing it or extracting
content). There are two types of person:
<dl class="description"><dt class="description">
</dt><dd
class="description">The <span
class="cmbx-10">User </span>can do to the document what is allowed in the permissions.
</dd><dt class="description">
</dt><dd
class="description">The <span
class="cmbx-10">Owner </span>can do anything, including altering the permissions or removing encryption
entirely.</dd></dl>
<!--l. 1056--><p class="noindent" >There are five kinds of encryption:
<ul class="itemize1">
<li class="itemize">40-bit encryption (method <span
class="cmtt-10">40bit</span>) in Acrobat 3 (PDF 1.1) and above
</li>
<li class="itemize">128-bit encryption (method <span
class="cmtt-10">128bit</span>) in Acrobat 5 (PDF 1.4) and above
</li>
<li class="itemize">128-bit AES encryption (method <span
class="cmtt-10">AES</span>) in Acrobat 7 (PDF 1.6) and above
</li>
<li class="itemize">256-bit AES encryption (method <span
class="cmtt-10">AES256</span>) in Acrobat 9 (PDF 1.7) &#8211; <span
class="cmti-10">this is deprecated &#8211;</span>
<span
class="cmti-10">do not use for new documents</span>
</li>
<li class="itemize">256-bit AES encryption (method <span
class="cmtt-10">AES256ISO</span>) in PDF 2.0</li></ul>
<!--l. 1066--><p class="noindent" >All encryption supports these kinds of permissions:
<div class="pic-tabular">
<img
src="cpdfmanual56x.png" alt="-no-edit Cannot change the document
-no-print Cannot print the document
-no-copy Cannot select or copy text or graphics
-no-annot Cannot add or change form fields or annotations
" ></div>
<!--l. 1077--><p class="noindent" >In addition, 128-bit encryption (Acrobat 5 and above) and AES encryption supports these:
<div class="pic-tabular">
<img
src="cpdfmanual57x.png" alt="-no-forms Cannot edit form fields
-no-extract Cannot extract text or graphics
-no-assemble Cannot merge files etc.
-no-hq-print Cannot print high-quality
" ></div>
<!--l. 1088--><p class="noindent" >Add these flags to the command line to prevent each operation.
<!--l. 1092--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">4.2 </span> <a
id="x1-350004.2"></a>Encrypting a Document</h3>
<!--l. 1093--><p class="noindent" >To encrypt a document, the owner and user passwords must be given (here, <span
class="cmtt-10">fred </span>and <span
class="cmtt-10">charles</span>
respectively):
<!--l. 1095--><p class="noindent" ><img
src="cpdfmanual58x.png" alt="" class="fbox" > 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.
<!--l. 1109--><p class="noindent" ><img
src="cpdfmanual59x.png" alt="" class="fbox" > In
addition, the usual method can be used to give the existing owner password, if the document is
already encrypted.
<!--l. 1117--><p class="indent" > When using AES encryption, the option is available to refrain from encrypting the metadata. Add
<span
class="cmtt-10">-no-encrypt-metadata </span>to the command line.
<!--l. 1120--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">4.3 </span> <a
id="x1-360004.3"></a>Decrypting a Document</h3>
<!--l. 1121--><p class="noindent" >To decrypt a document, the owner password is provided.
<!--l. 1123--><p class="noindent" ><img
src="cpdfmanual60x.png" alt="" class="fbox" > The
user password cannot decrypt a file.
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;5</span><br /><a
id="x1-370005"></a>Compression</h2>
<!--l. 1131--><p class="noindent" ><img
src="cpdfmanual61x.png" alt="" class="fbox" >
<span
class="cmtt-10">cpdf</span>&#x00A0;provides basic facilities for decompressing and compressing PDF streams.
<h3 class="sectionHead"><span class="titlemark">5.1 </span> <a
id="x1-380005.1"></a>Decompressing a Document</h3>
<a
id="dx1-38001"></a>
<!--l. 1144--><p class="noindent" >To decompress the streams in a PDF file, for instance to manually inspect the PDF, use:
<!--l. 1147--><p class="noindent" ><img
src="cpdfmanual62x.png" alt="" class="fbox" > If
<span
class="cmtt-10">cpdf</span>&#x00A0;finds a compression type it can&#8217;t cope with, the stream is left compressed. When using
<span
class="cmtt-10">-decompress</span>, object streams are not compressed.
<h3 class="sectionHead"><span class="titlemark">5.2 </span> <a
id="x1-390005.2"></a>Compressing a Document</h3>
<a
id="dx1-39001"></a>
<!--l. 1154--><p class="noindent" >To compress the streams in a PDF file, use:
<!--l. 1156--><p class="noindent" ><img
src="cpdfmanual63x.png" alt="" class="fbox" >
<span
class="cmtt-10">cpdf</span>&#x00A0;compresses any streams which have no compression using the <span
class="cmbx-10">FlateDecode </span>method, with the
exception of Metadata streams, which are left uncompressed.
<!--l. 1163--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">5.3 </span> <a
id="x1-400005.3"></a>Squeezing a Document</h3>
<a
id="dx1-40001"></a>
<!--l. 1165--><p class="noindent" >To <span
class="cmti-10">squeeze </span>a PDF file, reducing its size by an average of about twenty percent (though sometimes not
at all), use:
<!--l. 1167--><p class="noindent" ><img
src="cpdfmanual64x.png" alt="" class="fbox" >
Adding <span
class="cmtt-10">-squeeze </span>to the command line when using another operation will <span
class="cmti-10">squeeze </span>the file or files upon
output.
<!--l. 1173--><p class="indent" > The <span
class="cmtt-10">-squeeze </span>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.
<div class="verbatim" id="verbatim-1">
$&#x00A0;./cpdf&#x00A0;-squeeze&#x00A0;in.pdf&#x00A0;-o&#x00A0;out.pdf
&#x00A0;<br />Beginning&#x00A0;squeeze:&#x00A0;123847&#x00A0;objects
&#x00A0;<br />Squeezing...&#x00A0;Down&#x00A0;to&#x00A0;114860&#x00A0;objects
&#x00A0;<br />Squeezing...&#x00A0;Down&#x00A0;to&#x00A0;114842&#x00A0;objects
&#x00A0;<br />Squeezing&#x00A0;page&#x00A0;data
&#x00A0;<br />Recompressing&#x00A0;document
</div>
<!--l. 1181--><p class="nopar" >
<!--l. 1183--><p class="indent" > The <span
class="cmtt-10">-squeeze-log-to &#x003C;filename&#x003E; </span>option writes the log to the given file instead of to standard
output.
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;6</span><br /><a
id="x1-410006"></a>Bookmarks</h2> <img
src="cpdfmanual65x.png" alt="" class="fbox" > <a
id="dx1-41001"></a><a
id="dx1-41002"></a> PDF Bookmarks (properly called the <span
class="cmti-10">document outline</span>) represent a tree of references to parts of the
file, typically displayed at the side of the screen. The user can click on one to move to the specified
place. <span
class="cmtt-10">cpdf</span>&#x00A0;provides facilities to list, add, and remove bookmarks. The format used by the list and
add operations is the same, so you can feed the output of one into the other, for instance to copy
bookmarks.
<h3 class="sectionHead"><span class="titlemark">6.1 </span> <a
id="x1-420006.1"></a>List Bookmarks</h3>
<a
id="dx1-42001"></a>
<!--l. 1210--><p class="noindent" >The <span
class="cmtt-10">-list-bookmarks </span>operation prints (to standard output) the bookmarks in a file. The first column
gives the level of the tree at which a particular bookmark is. Then the text of the bookmark in quotes,
then the page number which the bookmark points to, then (optionally) the word &#8221;open&#8221; if the
bookmark should have its children (at the level immediately below) visible when the file is loaded. For
example, upon executing
<!--l. 1217--><p class="noindent" ><img
src="cpdfmanual66x.png" alt="" class="fbox" >
<!--l. 1222--><p class="noindent" >the result might be:
<div class="verbatim" id="verbatim-2">
0&#x00A0;"Part&#x00A0;1"&#x00A0;1&#x00A0;open
&#x00A0;<br />1&#x00A0;"Part&#x00A0;1A"&#x00A0;2
&#x00A0;<br />1&#x00A0;"Part&#x00A0;1B"&#x00A0;3
&#x00A0;<br />0&#x00A0;"Part&#x00A0;2"&#x00A0;4
&#x00A0;<br />1&#x00A0;"Part&#x00A0;2a"&#x00A0;5
</div>
<!--l. 1229--><p class="nopar" >
<!--l. 1231--><p class="noindent" >If the page number is 0, it indicates that clicking on that entry doesn&#8217;t move to a page.
<!--l. 1233--><p class="indent" > By default, <span
class="cmtt-10">cpdf</span>&#x00A0;converts unicode to ASCII text, dropping characters outside the ASCII range. To
prevent this, and return unicode UTF8 output, add the <span
class="cmtt-10">-utf8 </span>option to the command. To prevent any
processing, use the <span
class="cmtt-10">-raw </span>option.
<!--l. 1238--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">6.2 </span> <a
id="x1-430006.2"></a>Remove Bookmarks</h3>
<a
id="dx1-43001"></a>
<!--l. 1241--><p class="noindent" >The <span
class="cmtt-10">-remove-bookmarks </span>operations removes all bookmarks from the file.
<!--l. 1243--><p class="noindent" ><img
src="cpdfmanual67x.png" alt="" class="fbox" >
<!--l. 1248--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">6.3 </span> <a
id="x1-440006.3"></a>Add Bookmarks</h3>
<a
id="dx1-44001"></a>
<!--l. 1251--><p class="noindent" >The <span
class="cmtt-10">-add-bookmarks </span>file adds bookmarks as specified by a <span
class="cmti-10">bookmarks file</span>, a text file in ASCII or
UTF8 encoding and in the same format as that produced by the <span
class="cmtt-10">-list-bookmarks </span>option. If there
are any bookmarks in the input PDF already, they are discarded. For example, if the file
<span
class="cmtt-10">bookmarks.txt </span>contains the output from <span
class="cmtt-10">-list-bookmarks </span>above, then the command
<img
src="cpdfmanual68x.png" alt="" class="fbox" >
adds the bookmarks to the input file, writing to <span
class="cmtt-10">out.pdf</span>. An error will be given if the bookmarks file
is not in the correct form (in particular, the numbers in the first column which specify
the level must form a proper tree with no entry being more than one greater than the
last).
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;7</span><br /><a
id="x1-450007"></a>Presentations</h2>
<!--l. 1267--><p class="noindent" ><img
src="cpdfmanual69x.png" alt="" class="fbox" >
<a
id="dx1-45001"></a>
<!--l. 1279--><p class="indent" > The PDF file format, starting at Version 1.1, provides for simple slide-show presentations in the
manner of Microsoft Powerpoint. These can be played in Acrobat and possibly other PDF viewers,
typically started by entering full-screen mode. The <span
class="cmtt-10">-presentation </span>operation allows such a
presentation to be built from any PDF file.
<!--l. 1285--><p class="indent" > The <span
class="cmtt-10">-trans </span>option chooses the transition style. When a page range is used, it is the transition
<span
class="cmti-10">from </span>each page named which is altered. The following transition styles are available:
<dl class="description"><dt class="description">
<span
class="cmbx-10">Split</span> </dt><dd
class="description">Two lines sweep across the screen, revealing the new page. By default the lines are
horizontal. Vertical lines are selected by using the <span
class="cmtt-10">-vertical </span>option.
</dd><dt class="description">
<span
class="cmbx-10">Blinds</span> </dt><dd
class="description">Multiple lines sweep across the screen, revealing the new page. By default the lines are
horizontal. Vertical lines are selected by using the <span
class="cmtt-10">-vertical </span>option.
</dd><dt class="description">
<span
class="cmbx-10">Box</span> </dt><dd
class="description">A rectangular box sweeps inward from the edges of the page. Use <span
class="cmtt-10">-outward </span>to make it
sweep from the center to the edges.
</dd><dt class="description">
<span
class="cmbx-10">Wipe</span> </dt><dd
class="description">A single line sweeps across the screen from one edge to the other in a direction specified
by the <span
class="cmtt-10">-direction </span>option.
</dd><dt class="description">
<span
class="cmbx-10">Dissolve</span> </dt><dd
class="description">The old page dissolves gradually to reveal the new one.
</dd><dt class="description">
<span
class="cmbx-10">Glitter</span> </dt><dd
class="description">The same as <span
class="cmbx-10">Dissolve </span>but the effect sweeps across the page in the direction specified
by the <span
class="cmtt-10">-direction </span>option.</dd></dl>
<!--l. 1305--><p class="noindent" >To remove a transition style currently applied to the selected pages, omit the <span
class="cmtt-10">-trans </span>option.
<!--l. 1308--><p class="indent" > The <span
class="cmtt-10">-effect-duration </span>option specifies the length of time in seconds for the transition itself. The
default value is one second.
<!--l. 1311--><p class="indent" > The <span
class="cmtt-10">-duration </span>option specifies the maximum time in seconds that the page is displayed before the
presentation automatically advances. The default, in the absence of the <span
class="cmtt-10">-duration </span>option, is for no
automatic advancement.
<!--l. 1316--><p class="indent" > The <span
class="cmtt-10">-direction </span>option (for <span
class="cmbx-10">Wipe </span>and <span
class="cmbx-10">Glitter </span>styles only) specifies the direction of the effect.
The following values are valid:
<ul class="itemize1">
<li class="itemize">Left to right
</li>
<li class="itemize">Bottom to top (<span
class="cmbx-10">Wipe </span>only)
</li>
<li class="itemize">Right to left (<span
class="cmbx-10">Wipe </span>only)
</li>
<li class="itemize">Top to bottom
</li>
<li class="itemize">Top-left to bottom-right (<span
class="cmbx-10">Glitter </span>only)</li></ul>
<!--l. 1326--><p class="noindent" >For example:
<!--l. 1328--><p class="noindent" ><img
src="cpdfmanual70x.png" alt="" class="fbox" >
<!--l. 1340--><p class="noindent" >To use different options on different page ranges, run <span
class="cmtt-10">cpdf</span>&#x00A0;multiple times on the file using a different
page range each time.
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;8</span><br /><a
id="x1-460008"></a>Watermarks and Stamps</h2> <a
id="dx1-46001"></a> <a
id="dx1-46002"></a>
<!--l. 1349--><p class="noindent" ><img
src="cpdfmanual71x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">8.1 </span> <a
id="x1-470008.1"></a>Add a Watermark or Logo</h3>
<!--l. 1388--><p class="noindent" >The <span
class="cmtt-10">-stamp-on </span>and <span
class="cmtt-10">-stamp-under </span>operations stamp the first page of a source PDF onto or under
each page in the given range of the input file. For example,
<!--l. 1392--><p class="noindent" ><img
src="cpdfmanual72x.png" alt="" class="fbox" >
stamps the file <span
class="cmtt-10">logo.pdf </span>onto the odd pages of <span
class="cmtt-10">in.pdf</span>, writing to <span
class="cmtt-10">out.pdf</span>. A watermark should go
underneath each page:
<!--l. 1399--><p class="noindent" ><img
src="cpdfmanual73x.png" alt="" class="fbox" >
<!--l. 1405--><p class="noindent" >The position commands in Section <a
href="#x1-520008.2.4">8.2.4<!--tex4ht:ref: position --></a> 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 <span
class="cmtt-10">-shift</span>
first.
<!--l. 1407--><p class="indent" > The <span
class="cmtt-10">-scale-stamp-to-fit </span>option can be added to scale the stamp to fit the page before
applying it. The use of positioning commands together with <span
class="cmtt-10">-scale-stamp-to-fit </span>is not
recommended.
<!--l. 1409--><p class="indent" > The <span
class="cmtt-10">-combine-pages </span>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 &#8220;under&#8221; file. For
instance:
<!--l. 1413--><p class="noindent" ><img
src="cpdfmanual74x.png" alt="" class="fbox" >
<!--l. 1418--><p class="noindent" >Page attributes (such as the display rotation) are taken from the &#8220;under&#8221; file. For best results, remove
any rotation differences in the two files using <span
class="cmtt-10">-upright </span>first.
<!--l. 1422--><p class="noindent" >The <span
class="cmtt-10">-relative-to-cropbox </span>option takes the positioning command to be relative to the crop box of
each page rather than the media box.
<!--l. 1426--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">8.2 </span> <a
id="x1-480008.2"></a>Stamp Text, Dates and Times.</h3>
<a
id="dx1-48001"></a>
<a
id="dx1-48002"></a>
<a
id="dx1-48003"></a>
<!--l. 1430--><p class="noindent" >The <span
class="cmtt-10">-add-text </span>operation allows text, dates and times to be stamped over one or more pages of the
input at a given position and using a given font, font size and color.
<!--l. 1434--><p class="noindent" ><img
src="cpdfmanual75x.png" alt="" class="fbox" >
<!--l. 1439--><p class="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 <span
class="cmtt-10">-underneath </span>option.
<!--l. 1441--><p class="indent" > Text previously added by <span
class="cmtt-10">cpdf</span>&#x00A0;may be removed by the <span
class="cmtt-10">-remove-text </span>operation. <a
id="dx1-48004"></a>
<!--l. 1444--><p class="noindent" ><img
src="cpdfmanual76x.png" alt="" class="fbox" >
<!--l. 1449--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.1 </span> <a
id="x1-490008.2.1"></a>Page Numbers</h4>
<a
id="dx1-49001"></a>
<!--l. 1451--><p class="noindent" >There are various special codes to include the page number in the text:
<div class="pic-tabular">
<img
src="cpdfmanual77x.png" alt="%Page Page number in arabic notation (1, 2, 3...)
%roman Page number in lower-case roman notation (i, ii, iii...)
%Roman Page number in upper- case roman notation (I, II, III...)
%EndPage Last page of document in arabic notation
%Label The page label of the page
%EndLabel The page label of the last page
%filename The full file name of the input document
" ></div>
<!--l. 1465--><p class="noindent" >For example, the format <span
class="cmtt-10">"Page</span><span
class="cmtt-10">&#x00A0;%Page</span><span
class="cmtt-10">&#x00A0;of</span><span
class="cmtt-10">&#x00A0;%EndPage" </span>might become &#8221;Page&#x00A0;5&#x00A0;of&#x00A0;17&#8221;.
<!--l. 1467--><p class="indent" > NB: In some circumstances (e.g in batch files) on Microsoft Windows, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">%</span></span></span> is a special
character, and must be escaped (written as <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">%%</span></span></span>). Consult your local documentation for
details.
<!--l. 1469--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.2 </span> <a
id="x1-500008.2.2"></a>Date and Time Formats</h4>
<div class="pic-tabular">
<img
src="cpdfmanual78x.png" alt="%a Abbreviated weekday name (Sun, Mon etc.)
%A Full weekday name (Sunday, Monday etc.)
%b Abbreviated month name (Jan, Feb etc.)
%B Full month name (January, February etc.)
%d Day of the month (01&#8211;31)
%e Day of the month (1&#8211;31)
%H Hour in 24-hour clock (00&#8211;23)
%I Hour in 12-hour clock (01&#8211;12)
%j Day of the year (001&#8211;366)
%m Month of the year (01&#8211;12)
%M Minute of the hour (00&#8211;59)
%p &#8221;a.m &#8221; or &#8221;p.m&#8221;
%S Second of the minute (00&#8211;61)
%T Same as %H:%M:%S
%u Weekday (1&#8211;7, 1 = Monday)
%w Weekday (0&#8211;6, 0 = Monday)
%Y Year (0000&#8211;9999)
%% The % character.
" ></div>
<!--l. 1492--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.3 </span> <a
id="x1-510008.2.3"></a>Bates Numbers</h4>
<a
id="dx1-51001"></a>
<!--l. 1494--><p class="noindent" >Unique page identifiers can be specified by putting <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">%Bates</span></span></span> in the format. The starting point can be set
with the <span
class="cmtt-10">-bates </span>option. For example:
<!--l. 1497--><p class="noindent" ><img
src="cpdfmanual79x.png" alt="" class="fbox" >
<!--l. 1502--><p class="indent" > To specify that bates numbering begins at the first page of the range, use <span
class="cmtt-10">-bates-at-range</span>
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 <span
class="cmtt-10">-bates-pad-to </span>in addition to either <span
class="cmtt-10">-bates </span>or
<span
class="cmtt-10">-bates-at-range</span>.
<!--l. 1504--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.4 </span> <a
id="x1-520008.2.4"></a>Position</h4>
<!--l. 1506--><p class="noindent" >The position of the text may be specified either in absolute terms:
<!--l. 1508--><p class="noindent" ><img
src="cpdfmanual80x.png" alt="" class="fbox" >
<!--l. 1529--><p class="noindent" >Positions relative to certain common points can be set:
<!--l. 1531--><p class="noindent" ><img
src="cpdfmanual81x.png" alt="" class="fbox" >
<!--l. 1549--><p class="noindent" >No attempt is made to take account of the page rotation when interpreting the position, so
<span
class="cmtt-10">-prerotate </span>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 <span
class="cmtt-10">-upright</span>.
<!--l. 1554--><p class="indent" > The <span
class="cmtt-10">-relative-to-cropbox </span>modifier can be added to the command line to make these
measurements relative to the crop box instead of the media box.
<!--l. 1557--><p class="indent" > The default position is equivalent to <span
class="cmtt-10">-topleft 100</span>.
<!--l. 1559--><p class="indent" > The <span
class="cmtt-10">-midline </span>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
<span
class="cmtt-10">-topline </span>option may be used to specify that the position is taken relative to the top of the
text.
<!--l. 1563--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.5 </span> <a
id="x1-530008.2.5"></a>Font and Size</h4>
<a
id="dx1-53001"></a>
<!--l. 1565--><p class="noindent" >The font may be set with the <span
class="cmtt-10">-font </span>option. The 14 Standard PDF fonts are available:
<div class="pic-tabular">
<img
src="cpdfmanual82x.png" alt="TTiimmeess--RBoomldan
Times-Italic
Times-BoldItalic
Helvetica
Helvetica-Bold
Helvetica-Oblique
Helvetica-BoldOblique
Courier
Courier-Bold
Courier-Oblique
Courier-BoldOblique
Symbol
ZapfDingbats
" ></div>
<!--l. 1587--><p class="noindent" >For example, page numbers in Times Italic can be achieved by:
<!--l. 1589--><p class="noindent" ><img
src="cpdfmanual83x.png" alt="" class="fbox" > See
Section <a
href="#x1-8300014.1">14.1<!--tex4ht:ref: copyfont --></a> for how to use other fonts.
<!--l. 1595--><p class="indent" > The font size can be altered with the <span
class="cmtt-10">-font-size </span>option, which specifies the size in
points:
<!--l. 1598--><p class="noindent" ><img
src="cpdfmanual84x.png" alt="" class="fbox" >
<!--l. 1602--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.6 </span> <a
id="x1-540008.2.6"></a>Colors</h4>
<a
id="dx1-54001"></a>
<!--l. 1604--><p class="noindent" >The <span
class="cmtt-10">-color </span>option takes an RGB color, where red, green and blue components range between 0 and 1.
The following values are predefined:
<div class="pic-tabular">
<img
src="cpdfmanual85x.png" alt="-Color--R,-G,-B---
white 1, 1, 1
black 0, 0, 0
red 1, 0, 0
green 0, 1, 0
blue 0, 0, 1
" ></div>
<!--l. 1618--><p class="noindent" ><img
src="cpdfmanual86x.png" alt="" class="fbox" >
<!--l. 1625--><p class="noindent" >Partly-transparent text may be specified using the <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-opacity</span></span></span> option. Wholly opaque is 1 and wholly
transparent is 0. For example:
<!--l. 1630--><p class="noindent" ><img
src="cpdfmanual87x.png" alt="" class="fbox" >
<!--l. 1636--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.7 </span> <a
id="x1-550008.2.7"></a>Outline Text</h4>
<a
id="dx1-55001"></a>
<!--l. 1639--><p class="noindent" >The <span
class="cmtt-10">-outline </span>option sets outline text. The line width (default 1pt) may be set with the <span
class="cmtt-10">-linewidth</span>
option. For example, to stamp documents as drafts:
<!--l. 1644--><p class="noindent" ><img
src="cpdfmanual88x.png" alt="" class="fbox" >
<!--l. 1651--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.8 </span> <a
id="x1-560008.2.8"></a>Multi-line Text</h4>
<!--l. 1653--><p class="noindent" >The code <span
class="cmsy-10">\</span><span
class="cmtt-10">n </span>can be included in the text string to move to the next line. In this case, the vertical
position refers to the baseline of the first line of text (if the position is at the top, top left or top right
of the page) or the baseline of the last line of text (if the position is at the bottom, bottom left or
bottom right).
<!--l. 1659--><p class="noindent" ><img
src="cpdfmanual89x.png" alt="" class="fbox" >
<!--l. 1667--><p class="noindent" >The <span
class="cmtt-10">-midline </span>option may be used to make these vertical positions relative to the midline of a line of
text rather than the baseline, as usual.
<!--l. 1670--><p class="indent" > The <span
class="cmtt-10">-line-spacing </span>option can be used to increase or decrease the line spacing, where a spacing of
1 is the standard.
<!--l. 1673--><p class="noindent" ><img
src="cpdfmanual90x.png" alt="" class="fbox" >
<!--l. 1680--><p class="noindent" >Justification of multiple lines is handled by the <span
class="cmtt-10">-justify-left</span>, <span
class="cmtt-10">-justify-right </span>and<br
class="newline" /><span
class="cmtt-10">-justify-center </span>options. The defaults are left justification for positions relative to the left hand side
of the page, right justification for those relative to the right, and center justification for positions
relative to the center of the page. For example:
<!--l. 1686--><p class="noindent" ><img
src="cpdfmanual91x.png" alt="" class="fbox" >
<!--l. 1693--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.2.9 </span> <a
id="x1-570008.2.9"></a>Special Characters</h4>
<!--l. 1695--><p class="noindent" >If your command line allows for the inclusion of unicode characters, the input text will be considered
as UTF8 by <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">cpdf</span></span></span>. Special characters which exist in the PDF WinAnsiEncoding Latin 1 code (such as
many accented characters) will be reproduced in the PDF. This does not mean, however, that every
special character can be reproduced. You must experiment.
<!--l. 1701--><p class="indent" > For compatibility with previous versions of cpdf, special characters may be introduced manually
with a backslash followed by the three-digit octal code of the character in the PDF WinAnsiEncoding
Latin 1 Code. The full table is included in Appendix D of the Adobe PDF Reference Manual, which is
available at <a
href="http://www.adobe.com/devnet/pdf/pdf_reference.html" class="url" ><span
class="cmtt-10">http://www.adobe.com/devnet/pdf/pdf_reference.html</span></a>.
<!--l. 1707--><p class="indent" > For example, a German sharp s (ß) may be introduced by <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\337</span></span></span>.
<!--l. 1711--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">8.3 </span> <a
id="x1-580008.3"></a>Stamping Graphics</h3>
<!--l. 1713--><p class="noindent" >A rectangle may be placed on one or more pages by using the <span
class="cmtt-10">-add-rectangle &#x003C;size&#x003E;</span>
command. Most of the options discussed above for text placement apply in the same way. For
example:
<!--l. 1715--><p class="noindent" ><img
src="cpdfmanual92x.png" alt="" class="fbox" >
<!--l. 1721--><p class="indent" > This can be used to blank out or highlight part of the document. The following positioning options
work as you would expect: <span
class="cmtt-10">-topleft</span>, <span
class="cmtt-10">-top</span>, <span
class="cmtt-10">-topright</span>, <span
class="cmtt-10">-right</span>, <span
class="cmtt-10">-bottomright</span>, <span
class="cmtt-10">-bottom</span>,
<span
class="cmtt-10">-bottomleft</span>, <span
class="cmtt-10">-left</span>, <span
class="cmtt-10">-center</span>. When using the option <span
class="cmtt-10">-pos-left "x y"</span>, the point (x, y) refers to the
bottom-left of the rectangle. When using the option <span
class="cmtt-10">-pos-right "x y"</span>, the point (x, y) refers to the
bottom-right of the rectangle. When using the option <span
class="cmtt-10">-pos-center "x y"</span>, the point (x, y) refers
to the center of the rectangle. The options <span
class="cmtt-10">-diagonal </span>and <span
class="cmtt-10">-reverse-diagonal </span>have no
meaning.
<!--l. 1725--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;9</span><br /><a
id="x1-590009"></a>Multipage Facilities</h2> <img
src="cpdfmanual93x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">9.1 </span> <a
id="x1-600009.1"></a>Two-up</h3>
<a
id="dx1-60001"></a>
<!--l. 1747--><p class="noindent" >This facility puts multiple logical pages on a single physical page. The <span
class="cmtt-10">-twoup-stack </span>operation puts
two logical pages on each physical page, rotating them 90 degrees to do so. The new mediabox is thus
larger. The <span
class="cmtt-10">-twoup </span>operation does the same, but scales the new sides down so that the media box is
unchanged.
<!--l. 1752--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">9.2 </span> <a
id="x1-610009.2"></a>Inserting Blank Pages</h3>
<a
id="dx1-61001"></a>
<!--l. 1754--><p class="noindent" >Sometimes, for instance to get a printing arrangement right, it&#8217;s useful to be able to insert blank pages
into a PDF file. <span
class="cmtt-10">cpdf</span>&#x00A0;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:
<!--l. 1759--><p class="noindent" ><img
src="cpdfmanual94x.png" alt="" class="fbox" > 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.
<!--l. 1775--><p class="indent" > The <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-pad-every</span><span
class="cmtt-10">&#x00A0;n</span></span></span> operation places a blank page after every n pages, excluding any last one. For
example&#x2026;
<!--l. 1777--><p class="noindent" ><img
src="cpdfmanual95x.png" alt="" class="fbox" > &#x2026;on
a 9 page document adds a blank page after pages 3 and 6.
<!--l. 1786--><p class="indent" > The <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-pad-multiple</span><span
class="cmtt-10">&#x00A0;n</span></span></span> operation adds blank pages so the document has a multiple of <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">n</span></span></span> pages. For
example:
<!--l. 1788--><p class="noindent" ><img
src="cpdfmanual96x.png" alt="" class="fbox" >
<!--l. 1797--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;10</span><br /><a
id="x1-6200010"></a>Annotations</h2> <img
src="cpdfmanual97x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">10.1 </span> <a
id="x1-6300010.1"></a>List Annotations</h3>
<a
id="dx1-63001"></a>
<!--l. 1812--><p class="noindent" >The <span
class="cmtt-10">-list-annotations </span>operation prints the textual content of any annotations on the selected pages
to standard output. Each annotation is preceded by the page number and followed by a
newline.
<!--l. 1815--><p class="noindent" ><img
src="cpdfmanual98x.png" alt="" class="fbox" >
<!--l. 1823--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">10.2 </span> <a
id="x1-6400010.2"></a>Copy Annotations</h3>
<a
id="dx1-64001"></a>
<!--l. 1825--><p class="noindent" >The <span
class="cmtt-10">-copy-annotations </span>operation copies the annotations in the given page range from one file (the
file specified immediately after the option) to another pre-existing PDF. The range is specified after
this pre-existing PDF. The result is then written an output file, specified in the usual way.
<img
src="cpdfmanual99x.png" alt="" class="fbox" >
<!--l. 1839--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">10.3 </span> <a
id="x1-6500010.3"></a>Remove Annotations</h3>
<a
id="dx1-65001"></a>
<!--l. 1841--><p class="noindent" >The <span
class="cmtt-10">-remove-annotations </span>operation removes all annotations from the given page range.
<!--l. 1844--><p class="noindent" ><img
src="cpdfmanual100x.png" alt="" class="fbox" >
<!--l. 1853--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;11</span><br /><a
id="x1-6600011"></a>Document Information and Metadata</h2> <a
id="dx1-66001"></a><a
id="dx1-66002"></a>
<!--l. 1857--><p class="noindent" ><img
src="cpdfmanual101x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">11.1 </span> <a
id="x1-6700011.1"></a>Listing Fonts</h3>
<a
id="dx1-67001"></a>
<!--l. 1910--><p class="noindent" >The <span
class="cmtt-10">-list-fonts </span>operation prints the fonts in the document, one-per-line to standard output. For
example:
<!--l. 1913--><p class="noindent" ><img
src="cpdfmanual102x.png" alt="" class="fbox" >
<!--l. 1940--><p class="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.
<!--l. 1945--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">11.2 </span> <a
id="x1-6800011.2"></a>Reading Document Information</h3>
<!--l. 1947--><p class="noindent" >The <span
class="cmtt-10">-info </span>option prints entries from the document information dictionary, and from any XMP
metadata to standard output.
<!--l. 1950--><p class="noindent" ><img
src="cpdfmanual103x.png" alt="" class="fbox" >
<!--l. 1974--><p class="noindent" >The details of the format for creation and modification dates can be found in Appendix&#x00A0;<a
href="#x1-97000A">A<!--tex4ht:ref: dates --></a>.
<!--l. 1977--><p class="indent" > By default, cpdf strips to ASCII, discarding character codes in excess of 127. In order to preserve
the original unicode, add the <span
class="cmtt-10">-utf8 </span>option. To disable all postprocessing of the string, add
<span
class="cmtt-10">-raw</span>.
<!--l. 1980--><p class="indent" > The <span
class="cmtt-10">-page-info </span>option prints the page label, media box and other boxes page-by-page to standard
output, for all pages in the current range.
<!--l. 1983--><p class="noindent" ><img
src="cpdfmanual104x.png" alt="" class="fbox" >
<!--l. 1998--><p class="noindent" >Note that the format for boxes is minimum x, minimum y, maximum x, maximum y.
<!--l. 2001--><p class="noindent" >The <span
class="cmtt-10">-pages </span>operation prints the number of pages in the file.
<!--l. 2003--><p class="noindent" ><img
src="cpdfmanual105x.png" alt="" class="fbox" >
<!--l. 2008--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">11.3 </span> <a
id="x1-6900011.3"></a>Setting Document Information</h3>
<!--l. 2010--><p class="noindent" >The <span
class="cmti-10">document information dictionary </span>in a PDF file specifies various pieces of information about a
PDF. These can be consulted in a PDF viewer (for instance, Acrobat).
<!--l. 2014--><p class="indent" > Here is a summary of the commands for setting entries in the document information
dictionary:
<!--l. 2017--><p class="noindent" ><img
src="cpdfmanual106x.png" alt="" class="fbox" >
<!--l. 2036--><p class="noindent" >(The details of the format for creation and modification dates can be found in Appendix&#x00A0;<a
href="#x1-97000A">A<!--tex4ht:ref: dates --></a>. Using the
date <span
class="cmtt-10">"now" </span>uses the time and date at which the command is executed. Note also that <span
class="cmtt-10">-producer </span>and
<span
class="cmtt-10">-creator </span>may be used to set the producer and/or the creator when writing any file, separate from the
operations described in this chapter.)
<!--l. 2041--><p class="indent" > For example, to set the title, the full command line would be
<!--l. 2043--><p class="noindent" ><img
src="cpdfmanual107x.png" alt="" class="fbox" >
<!--l. 2048--><p class="noindent" >The text string is considered to be in UTF8 format, unless the <span
class="cmtt-10">-raw </span>option is added&#8212;in which case, it
is unprocessed, save for the replacement of any octal escape sequence such as <span
class="cmsy-10">\</span><span
class="cmtt-10">017</span>, which is replaced
by a character of its value (here, 15).
<!--l. 2052--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">11.4 </span> <a
id="x1-7000011.4"></a>Upon Opening a Document</h3>
<!--l. 2054--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">11.4.1 </span> <a
id="x1-7100011.4.1"></a>Page Layout</h4>
<a
id="dx1-71001"></a>
<!--l. 2056--><p class="noindent" >The <span
class="cmtt-10">-set-page-layout </span>option specifies the page layout to be used when a document is opened in, for
instance, Acrobat. The possible (case-sensitive) values are:
<div class="pic-tabular">
<img
src="cpdfmanual108x.png" alt="SinglePage Display one page at a time
OneColumn Display the pages in one column
TwoColumnLeft Display the pages in two columns, odd numbered pages
on the left
TwoColumnRight Display the pages in two columns, even numbered pages
on the left
TwoPageLeft (PDF 1.5 and above) Display the pages two at a time,
odd numbered pages on the left
TwoPageRight (PDF 1.5 and above) Display the pages two at a time,
even numbered pages on the left
" ></div><br
class="newline" />
<!--l. 2071--><p class="noindent" >For instance:
<!--l. 2073--><p class="noindent" ><img
src="cpdfmanual109x.png" alt="" class="fbox" >
<!--l. 2078--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">11.4.2 </span> <a
id="x1-7200011.4.2"></a>Page Mode</h4>
<a
id="dx1-72001"></a>
<!--l. 2080--><p class="noindent" >The <span
class="cmti-10">page mode </span>in a PDF file defines how a viewer should display the document when first opened.
The possible (case-sensitive) values are:
<div class="pic-tabular">
<img
src="cpdfmanual110x.png" alt="UseNone Neither document outline nor thumbnail images visible
UseOutlines Document outline (bookmarks) visible
UseThumbs Thumbnail images visible
FullScreen Full- screenmode (nomenu bar, window controls, or any-
thing but the document visible)
UseOC (PDF 1.5 and above) Optional content group panel visi-
ble
UseAttachments (PDF 1.5 and above) Attachments panel visible
" ></div><br
class="newline" />
<!--l. 2094--><p class="noindent" >For instance:
<!--l. 2096--><p class="noindent" ><img
src="cpdfmanual111x.png" alt="" class="fbox" >
<!--l. 2102--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">11.4.3 </span> <a
id="x1-7300011.4.3"></a>Display Options</h4>
<div class="pic-tabular">
<img
src="cpdfmanual112x.png" alt="-hide-toolbar Hide the viewer&#8217;s toolbar
-hide-menubar Document outline (bookmarks) visible
-hide-window- ui Hide the viewer&#8217;s scroll bars
-fit-window Resize the document&#8217;s windows to fit size of first page
-center-window Position thedocumentwindow inthecenterofthescreen
Displaythedocumenttitleinsteadofthefile name inthe
-display-doc- title title bar
" ></div><br
class="newline" />
<!--l. 2114--><p class="noindent" >For instance:
<!--l. 2116--><p class="noindent" ><img
src="cpdfmanual113x.png" alt="" class="fbox" >
<!--l. 2121--><p class="noindent" >The page a PDF file opens at can be set using <span
class="cmtt-10">-open-at-page</span>:
<!--l. 2123--><p class="noindent" ><img
src="cpdfmanual114x.png" alt="" class="fbox" >
<!--l. 2128--><p class="noindent" >To have that page scaled to fit the window in the viewer, use <span
class="cmtt-10">-open-at-page-fit </span>instead:
<!--l. 2130--><p class="noindent" ><img
src="cpdfmanual115x.png" alt="" class="fbox" >
<!--l. 2136--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">11.5 </span> <a
id="x1-7400011.5"></a>Metadata</h3>
<a
id="dx1-74001"></a>
<!--l. 2138--><p class="noindent" >PDF files can contain a piece of arbitrary metadata, often in XMP format. This is typically stored in
an uncompressed stream, so that other applications can read it without having to decode the whole
PDF. To set the metadata:
<!--l. 2142--><p class="noindent" ><img
src="cpdfmanual116x.png" alt="" class="fbox" >
<!--l. 2147--><p class="noindent" >To remove any metadata:
<!--l. 2149--><p class="noindent" ><img
src="cpdfmanual117x.png" alt="" class="fbox" > To
print the current metadata to standard output:
<!--l. 2155--><p class="noindent" ><img
src="cpdfmanual118x.png" alt="" class="fbox" >
<!--l. 2162--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">11.6 </span> <a
id="x1-7500011.6"></a>Page Labels</h3>
<a
id="dx1-75001"></a>
<a
id="dx1-75002"></a>
<!--l. 2165--><p class="noindent" >It is possible to add <span
class="cmti-10">page labels </span>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 <span
class="cmtt-10">-add-page-labels</span>
to do this, by default with decimal arabic numbers (1,2,3&#x2026;). We can add <span
class="cmtt-10">-label-style </span>to choose what
type of labels to add from these kinds:
<div class="pic-tabular">
<img
src="cpdfmanual119x.png" alt=" DecimalArabic 1,2,3,4,5...
LowercaseRoman i,ii,iii,iv,v...
UppercaseRoman I,II,III,IV,V...
LowercaseLetters a,b,c,...,z,aa,bb...
UppercaseLetters A,B,C,...,Z,AA,BB...
NoLabelPrefixOnly No number, but a prefix will be used if defined. " ></div>
<!--l. 2178--><p class="noindent" >We can use <span
class="cmtt-10">-label-prefix </span>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&#x2026;if there are none). We will add the
following page labels:
<!--l. 2182--><p class="indent" > 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
<!--l. 2185--><p class="noindent" >Here are the commands, in order:
<!--l. 2188--><p class="noindent" ><img
src="cpdfmanual120x.png" alt="" class="fbox" >
<!--l. 2198--><p class="noindent" >By default the labels begin at page number 1 for each range. To override this, we can use
<span
class="cmtt-10">-label-startval </span>(we used 0 in the final command), where we want the numbers to begin at zero
rather than one.
<!--l. 2202--><p class="indent" > Page labels may be removed altogether by using <span
class="cmtt-10">-remove-page-labels </span>command. To print the
page labels from an existing file, use <span
class="cmtt-10">-print-page-labels</span>. For example:
<!--l. 2204--><p class="noindent" ><img
src="cpdfmanual121x.png" alt="" class="fbox" >
<!--l. 2221--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;12</span><br /><a
id="x1-7600012"></a>File Attachments</h2> <a
id="dx1-76001"></a>
<!--l. 2224--><p class="noindent" ><img
src="cpdfmanual122x.png" alt="" class="fbox" >
<!--l. 2236--><p class="indent" > PDF supports adding attachments (files of any kind, including other PDFs) to an existing file. The
<span
class="cmtt-10">cpdf</span>&#x00A0;tool supports adding and removing <span
class="cmti-10">document-level attachments </span>&#8212; that is, ones which are
associated with the document as a whole rather than with an individual page, and also <span
class="cmti-10">page-level</span>
<span
class="cmti-10">attachments</span>, associated with a particular page.
<h3 class="sectionHead"><span class="titlemark">12.1 </span> <a
id="x1-7700012.1"></a>Adding Attachments</h3>
<a
id="dx1-77001"></a>
<!--l. 2242--><p class="noindent" >To add an attachment, use the <span
class="cmtt-10">-attach-file </span>option. For instance,
<!--l. 2244--><p class="noindent" ><img
src="cpdfmanual123x.png" alt="" class="fbox" >
attaches the Excel spreadsheet <span
class="cmtt-10">sheet.xls </span>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 <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-attach-file</span></span></span>
multiple times. They will be attached in the given order.
<!--l. 2249--><p class="indent" > The <span
class="cmtt-10">-to-page </span>option can be used to specify that the files will be attached to the given
page, rather than at the document level. The <span
class="cmtt-10">-to-page </span>option may be specified at most
once.
<!--l. 2252--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">12.2 </span> <a
id="x1-7800012.2"></a>Listing Attachments</h3>
<a
id="dx1-78001"></a>
<!--l. 2254--><p class="noindent" >To list all document- and page-level attachments, use the <span
class="cmtt-10">-list-attached-files </span>operation. The page
number and filename of each attachment is given, page 0 representing a document-level
attachment.
<!--l. 2256--><p class="noindent" ><img
src="cpdfmanual124x.png" alt="" class="fbox" >
<!--l. 2265--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">12.3 </span> <a
id="x1-7900012.3"></a>Removing Attachments</h3>
<a
id="dx1-79001"></a>
<!--l. 2267--><p class="noindent" >To remove all document-level and page-level attachments from a file, use the <span
class="cmtt-10">-remove-files</span>
operation:
<!--l. 2269--><p class="noindent" ><img
src="cpdfmanual125x.png" alt="" class="fbox" >
<!--l. 2275--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;13</span><br /><a
id="x1-8000013"></a>Working with Images</h2>
<!--l. 2277--><p class="noindent" ><img
src="cpdfmanual126x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">13.1 </span> <a
id="x1-8100013.1"></a>Detecting Low-resolution Images</h3>
<!--l. 2285--><p class="noindent" >To list all images in the given range of pages which fall below a given resolution (in dots-per-inch), use
the <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-image-resolution</span></span></span> function:
<!--l. 2287--><p class="noindent" ><img
src="cpdfmanual127x.png" alt="" class="fbox" >
<!--l. 2291--><p class="noindent" ><img
src="cpdfmanual128x.png" alt="" class="fbox" >
<!--l. 2301--><p class="noindent" >The format is <span
class="cmti-10">page number, image name, x pixels, y pixels, x resolution, y resolution</span>. The resolutions
refer to the image&#8217;s effective resolution at point of use (taking account of scaling, rotation
etc).
<!--l. 2307--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;14</span><br /><a
id="x1-8200014"></a>Fonts</h2>
<!--l. 2309--><p class="noindent" ><img
src="cpdfmanual129x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">14.1 </span> <a
id="x1-8300014.1"></a>Copying Fonts</h3>
<!--l. 2324--><p class="noindent" >In order to use a font other than the standard 14 with <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-add-text</span></span></span>, it must be added to the file. The
font source PDF is given, together with the font&#8217;s resource name on a given page, and that
font is copied to all the pages in the input file&#8217;s range, and then written to the output
file.
<!--l. 2329--><p class="indent" > The font is named in the output file with its basefont name, so it can be easily used with
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-add-text</span></span></span>.
<!--l. 2332--><p class="indent" > For example, if the file <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">fromfile.pdf</span></span></span> has a font <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">/GHLIGA+c128</span></span></span> with the name <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">/F10</span></span></span> on page 1
(this information can be found with <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-list-fonts</span></span></span>), the following would copy the font to the file
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">in.pdf</span></span></span> on all pages, writing the output to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">out.pdf</span></span></span>:
<!--l. 2337--><p class="noindent" ><img
src="cpdfmanual130x.png" alt="" class="fbox" >
<!--l. 2343--><p class="noindent" >Text in this font can then be added by giving <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-font</span><span
class="cmtt-10">&#x00A0;/GHLIGA+c128</span></span></span>. Be aware that due to the vagaries
of PDF font handling concerning which characters are present in the source font, not all
characters may be available, or the encoding (mapping from input codes to glyphs) may be
non-obvious.
<!--l. 2348--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">14.2 </span> <a
id="x1-8400014.2"></a>Removing Fonts</h3>
<!--l. 2351--><p class="noindent" >To remove embedded fonts from a document, use <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-remove-fonts</span></span></span>. PDF readers will substitute local
fonts for the missing fonts. The use of this function is only recommended when file size is the sole
consideration.
<!--l. 2355--><p class="noindent" ><img
src="cpdfmanual131x.png" alt="" class="fbox" >
<!--l. 2361--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">14.3 </span> <a
id="x1-8500014.3"></a>Listing Missing Fonts</h3>
<!--l. 2362--><p class="noindent" >The <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-missing-fonts</span></span></span> operation lists any unembedded fonts in the document, one per line.
<!--l. 2364--><p class="noindent" ><img
src="cpdfmanual132x.png" alt="" class="fbox" >
<!--l. 2370--><p class="noindent" >The format is
<!--l. 2372--><p class="noindent" ><img
src="cpdfmanual133x.png" alt="" class="fbox" >
<!--l. 2382--><p class="indent" >
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;15</span><br /><a
id="x1-8600015"></a>Miscellaneous</h2>
<!--l. 2384--><p class="noindent" ><img
src="cpdfmanual134x.png" alt="" class="fbox" >
<h3 class="sectionHead"><span class="titlemark">15.1 </span> <a
id="x1-8700015.1"></a>Draft Documents</h3>
<a
id="dx1-87001"></a>
<!--l. 2425--><p class="noindent" >The <span
class="cmtt-10">-draft </span>option removes bitmap (photographic) images from a file, so that it can be printed with
less ink. Optionally, the <span
class="cmtt-10">-boxes </span>option can be added, filling the spaces left blank with a crossed box
denoting where the image was. This is not guaranteed to be fully visible in all cases (the
bitmap may be have been partially covered by vector objects or clipped in the original). For
example:
<!--l. 2432--><p class="noindent" ><img
src="cpdfmanual135x.png" alt="" class="fbox" >
<!--l. 2437--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.2 </span> <a
id="x1-8800015.2"></a>Blackening Text, Lines and Fills</h3>
<a
id="dx1-88001"></a>
<!--l. 2439--><p class="noindent" >Sometimes PDF output from an application (for instance, a web browser) has text in colors which
would not print well on a grayscale printer. The <span
class="cmtt-10">-blacktext </span>operation blackens all text on the given
pages so it will be readable when printed.
<!--l. 2444--><p class="indent" > This will not work on text which has been converted to outlines, nor on text which is part of a
form.
<!--l. 2447--><p class="noindent" ><img
src="cpdfmanual136x.png" alt="" class="fbox" >
<a
id="dx1-88002"></a>
<!--l. 2454--><p class="noindent" >The <span
class="cmtt-10">-blacklines </span>operation blackens all lines on the given pages.
<!--l. 2456--><p class="noindent" ><img
src="cpdfmanual137x.png" alt="" class="fbox" >
<a
id="dx1-88003"></a>
<!--l. 2463--><p class="noindent" >The <span
class="cmtt-10">-blackfills </span>operation blackens all fills on the given pages.
<!--l. 2465--><p class="noindent" ><img
src="cpdfmanual138x.png" alt="" class="fbox" >
<!--l. 2470--><p class="noindent" >Contrary to their names, all these operations can use another color, if specified with <span
class="cmtt-10">-color</span>.
<!--l. 2473--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.3 </span> <a
id="x1-8900015.3"></a>Hairline Removal</h3>
<a
id="dx1-89001"></a>
<!--l. 2475--><p class="noindent" >Quite often, applications will use very thin lines, or even the value of 0, which in PDF means &#8221;The
thinnest possible line on the output device&#8221;. This might be fine for on-screen work, but when printed
on a high resolution device, such as by a commercial printer, they may be too faint, or
disappear altogether. The <span
class="cmtt-10">-thinlines </span>option prevents this by changing all lines thinner than
<span
class="cmtt-10">&#x003C;minimal</span><span
class="cmtt-10">&#x00A0;thickness&#x003E; </span>to the given thickness. For example:
<!--l. 2482--><p class="noindent" ><img
src="cpdfmanual139x.png" alt="" class="fbox" >
<!--l. 2490--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.4 </span> <a
id="x1-9000015.4"></a>Garbage Collection</h3>
<a
id="dx1-90001"></a>
<!--l. 2492--><p class="noindent" >Sometimes incremental updates to a file by an application, or bad applications can leave data in a
PDF file which is no longer used. This function removes that unneeded data.
<!--l. 2496--><p class="noindent" ><img
src="cpdfmanual140x.png" alt="" class="fbox" >
<!--l. 2501--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.5 </span> <a
id="x1-9100015.5"></a>Change PDF Version Number</h3>
<a
id="dx1-91001"></a>
<!--l. 2504--><p class="noindent" >To change the pdf version number, use the <span
class="cmtt-10">-set-version </span>operation, giving the part of the version
number after the decimal point. For example:
<!--l. 2507--><p class="noindent" ><img
src="cpdfmanual141x.png" alt="" class="fbox" >
This does not alter any of the actual data in the file &#8212; just the supposed version number.
<!--l. 2517--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.6 </span> <a
id="x1-9200015.6"></a>Copy ID</h3>
<a
id="dx1-92001"></a>
<!--l. 2519--><p class="noindent" >The <span
class="cmtt-10">-copy-id-from </span>operation copies the ID from the given file to the input, writing to the
output.
<!--l. 2522--><p class="noindent" ><img
src="cpdfmanual142x.png" alt="" class="fbox" >
<!--l. 2530--><p class="noindent" >If there is no ID in the source file, the existing ID is retained. You cannot use <span
class="cmtt-10">-recrypt </span>with
<span
class="cmtt-10">-copy-id-from</span>.
<!--l. 2532--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.7 </span> <a
id="x1-9300015.7"></a>Remove ID</h3>
<a
id="dx1-93001"></a>
<!--l. 2534--><p class="noindent" >The <span
class="cmtt-10">-remove-id </span>operation removes the ID from a document.
<!--l. 2536--><p class="noindent" ><img
src="cpdfmanual143x.png" alt="" class="fbox" >
<!--l. 2544--><p class="indent" > You cannot use <span
class="cmtt-10">-recrypt </span>with <span
class="cmtt-10">-remove-id</span>.
<!--l. 2546--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.8 </span> <a
id="x1-9400015.8"></a>List Spot Colours</h3>
<!--l. 2548--><p class="noindent" >This operation lists the name of any &#8220;separation&#8221; color space in the given PDF file.
<!--l. 2550--><p class="noindent" ><img
src="cpdfmanual144x.png" alt="" class="fbox" >
<!--l. 2558--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.9 </span> <a
id="x1-9500015.9"></a>Removing Dictionary Entries</h3>
<!--l. 2560--><p class="noindent" >This is for editing data within the PDF&#8217;s internal representation. Use with caution.
<!--l. 2562--><p class="noindent" ><img
src="cpdfmanual145x.png" alt="" class="fbox" >
<!--l. 2571--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.10 </span> <a
id="x1-9600015.10"></a>Remove Clipping</h3>
<!--l. 2574--><p class="noindent" >The <span
class="cmtt-10">-remove-clipping </span>operation removes any clipping paths from the file.
<!--l. 2576--><p class="noindent" ><img
src="cpdfmanual146x.png" alt="" class="fbox" >
<!--l. 2585--><p class="indent" >
<a
id="x1-96001r86"></a>
<h2 class="appendixHead"><span class="titlemark">Appendix&#x00A0;A</span><br /><a
id="x1-97000A"></a>Dates</h2> <a
id="dx1-97001"></a> Dates in PDF are specified according to the following format:
<!--l. 2590--><p class="noindent" ><img
src="cpdfmanual147x.png" alt="" class="fbox" >
<!--l. 2608--><p class="noindent" >A contiguous prefix of the parts above can be used instead, for lower accuracy dates. For
example:
<!--l. 2611--><p class="noindent" ><img
src="cpdfmanual148x.png" alt="" class="fbox" >
</body></html>