diff --git a/html_manual/clean b/html_manual/clean index df07573..2b7b2c7 100755 --- a/html_manual/clean +++ b/html_manual/clean @@ -1 +1 @@ -rm -f *.4ct *.4tc *.aux *.css *.dvi *.idv *.idx *.lg *.log *.tmp *.xref *.png +rm -f *.4ct *.4tc *.aux *.css *.dvi *.idv *.idx *.lg *.log *.tmp *.xref *.png *.toc *.out diff --git a/html_manual/cpdfmanual.html b/html_manual/cpdfmanual.html index 5cc7ddf..dd05156 100644 --- a/html_manual/cpdfmanual.html +++ b/html_manual/cpdfmanual.html @@ -91,6 +91,156 @@ href="#x1-220002.1" id="QQ2-1-22">Merging href="#x1-230002.2" id="QQ2-1-23">Splitting
 2.3 Splitting on Bookmarks +
 2.4 Encrypting with Split and Split Bookmarks +
3 Pages +
 3.1 Page Sizes +
 3.2 Scale Pages +
 3.3 Shift Page Contents +
 3.4 Rotating Pages +
 3.5 Flipping Pages +
 3.6 Boxes and Cropping +
4 Encryption and Decryption +
 4.1 Introduction +
 4.2 Encrypting a Document +
 4.3 Decrypting a Document +
5 Compression +
 5.1 Decompressing a Document +
 5.2 Compressing a Document + + +
 5.3 Squeezing a Document +
6 Bookmarks +
 6.1 List Bookmarks +
 6.2 Remove Bookmarks +
 6.3 Add Bookmarks +
7 Presentations +
8 Watermarks and Stamps +
 8.1 Add a Watermark or Logo +
 8.2 Stamp Text, Dates and Times. +
  8.2.1 Page Numbers +
  8.2.2 Date and Time Formats +
  8.2.3 Bates Numbers +
  8.2.4 Position +
  8.2.5 Font and Size +
  8.2.6 Colors +
  8.2.7 Outline Text +
  8.2.8 Multi-line Text +
  8.2.9 Special Characters +
 8.3 Stamping Graphics +
9 Multipage Facilities +
 9.1 Two-up +
 9.2 Inserting Blank Pages +
10 Annotations +
 10.1 List Annotations +
 10.2 Copy Annotations +
 10.3 Remove Annotations +
11 Document Information and Metadata +
 11.1 Listing Fonts +
 11.2 Reading Document Information +
 11.3 Setting Document Information +
 11.4 Upon Opening a Document +
  11.4.1 Page Layout +
  11.4.2 Page Mode +
  11.4.3 Display Options +
 11.5 Metadata +
 11.6 Page Labels +
12 File Attachments +
 12.1 Adding Attachments +
 12.2 Listing Attachments +
 12.3 Removing Attachments +
13 Working with Images +
 13.1 Detecting Low-resolution Images +
14 Fonts +
 14.1 Copying Fonts +
 14.2 Removing Fonts +
 14.3 Listing Missing Fonts + + +
15 Miscellaneous +
 15.1 Draft Documents +
 15.2 Blackening Text, Lines and Fills +
 15.3 Hairline Removal +
 15.4 Garbage Collection +
 15.5 Change PDF Version Number +
 15.6 Copy ID +
 15.7 Remove ID +
 15.8 List Spot Colours +
 15.9 Removing Dictionary Entries +
 15.10 Remove Clipping +
A Dates @@ -275,8 +425,8 @@ class="cmtt-10">-recrypt option:

The password required (owner or user) depends upon the operation being performed. Separate -facilities are provided to decrypt and encrypt files (See Section ??). +facilities are provided to decrypt and encrypt files (See Section 4).

1.4 Standard Input and Standard Output

@@ -451,8 +601,8 @@ PDF 1.6 Acrobat 7.0 PDF 1.7 Acrobat 8.0, 9.0, 10.0 " >

If you wish to manually alter the PDF version of a file, use the -set-version option described in -Section ??. +Section 15.5.

@@ -718,6 +868,1387 @@ following characters are removed, in addition to any character with ASCII code l 32:

+

+

2.4 Encrypting with Split and Split Bookmarks

+

The encryption parameters described in Chapter 4 may be added to the command line to encrypt each +split PDF. Similarly, the -recrypt switch described in 1 may by given to re-encrypt each file with the +existing encryption of the source PDF. + + +

Chapter 3
Pages

+

3.1 Page Sizes

+ +

Any time when a page size is required, instead of writing, for instance "210mm 197mm" one can instead +write a4portrait. Here is a list of supported page sizes: +

+ 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
+
+

3.2 Scale Pages

+ +

The -scale-page operation scales each page in the range by the X and Y factors given. +This scales both the page contents, and the page size itself. It also scales any Crop Box + + +and other boxes (Art Box, Trim Box etc). As with several of these commands, remember +to take into account any page rotation when considering what the X and Y axes relate +to. +

+

The -scale-to-fit operation scales each page in the range to fit a given page size, preserving aspect +ratio and centering the result. +

+

The scale can optionally be set to a percentage of the available area, instead of filling it. +

+

The -scale-contents operation scales the contents about the center of the crop box (or, if absent, +the media box), leaving the page dimensions (boxes) unchanged. +

+

To scale about a point other than the center, one can use the positioning commands described in +Section 8.2.4. For example: +

+

+

3.3 Shift Page Contents

+ +

The -shift operation shifts the contents of each page in the range by X points horizontally and Y +points vertically. +

+

+

3.4 Rotating Pages

+ +

There are two ways of rotating pages: (1) 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 -rotate or -rotateby) and +(2) actually rotating the page contents and/or the page dimensions (use -upright afterwards or + + +-rotate-contents to just rotate the page contents). +

The possible values for -rotate and -rotate-by are 0, 90, 180 and 270, all interpreted as being +clockwise. Any value may be used for -rotate-contents. +

The -rotate operation sets the viewing rotation of the selected pages to the absolute value +given. +

The +-rotateby operation changes the viewing rotation of all the given pages by the relative value +given. +

The +-rotate-contents operation rotates the contents and dimensions of the page by the given relative +value. +

+

The -upright operation does whatever combination of -rotate and -rotate-contents is +required to change the rotation of the document to zero without altering its appearance. +In addition, it makes sure the media box has its origin at (0,0), changing other boxes to +compensate. +

+

3.5 Flipping Pages

+ +

The -hflip and -vflip operations flip the contents of the chosen pages horizontally or vertically. No +account is taken of the current page rotation when considering what ”horizontally” and ”vertically” +mean, so you may like to use -upright first. +

+

3.6 Boxes and Cropping

+ + +

All PDF files contain a media box for each page, giving the dimensions of the paper. To +change these dimensions (without altering the page contents in any way), use the -mediabox +option. + + +

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 crop box 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 -crop. +To remove any existing crop box, use -remove-crop. +

+

Note that the crop box is only obeyed in some viewers. +

+This operation copies the contents of one box (Media box, Crop box, Trim box etc.) to another. If +-mediabox-if-missing is added, the media box will be substituted when the ’from’ box is not set for +a given page. For example +

+copies the Trim Box of each page to the Crop Box of each page. The possible boxes are /MediaBox, +/CropBox, /BleedBox, /TrimBox, /ArtBox. + + +

Chapter 4
Encryption and Decryption

+

4.1 Introduction

+

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: +

+
The User can do to the document what is allowed in the permissions. +
+
The Owner can do anything, including altering the permissions or removing encryption + entirely.
+

There are five kinds of encryption: +

+

All encryption supports these kinds of permissions: +

+ -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
+
+

In addition, 128-bit encryption (Acrobat 5 and above) and AES encryption supports these: +

+ -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
+
+ + +

Add these flags to the command line to prevent each operation. +

+

4.2 Encrypting a Document

+

To encrypt a document, the owner and user passwords must be given (here, fred and charles +respectively): +

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. +

In +addition, the usual method can be used to give the existing owner password, if the document is +already encrypted. +

When using AES encryption, the option is available to refrain from encrypting the metadata. Add +-no-encrypt-metadata to the command line. +

+

4.3 Decrypting a Document

+

To decrypt a document, the owner password is provided. +

The +user password cannot decrypt a file. + + +

Chapter 5
Compression

+

+cpdf provides basic facilities for decompressing and compressing PDF streams. +

5.1 Decompressing a Document

+ +

To decompress the streams in a PDF file, for instance to manually inspect the PDF, use: +

If +cpdf finds a compression type it can’t cope with, the stream is left compressed. When using +-decompress, object streams are not compressed. +

5.2 Compressing a Document

+ +

To compress the streams in a PDF file, use: cpdf compresses any streams which have no compression using the FlateDecode method, with the +exception of Metadata streams, which are left uncompressed. +

+

5.3 Squeezing a Document

+ +

To squeeze a PDF file, reducing its size by an average of about twenty percent (though sometimes not +at all), use: +

+Adding -squeeze to the command line when using another operation will squeeze the file or files upon +output. +

The -squeeze operation writes some information about the squeezing process to standard output. +The squeezing process involves several processes which losslessly attempt to reduce the file size. It is +slow, so should not be used without thought. + + +

+$ ./cpdf -squeeze in.pdf -o out.pdf + 
Beginning squeeze: 123847 objects + 
Squeezing... Down to 114860 objects + 
Squeezing... Down to 114842 objects + 
Squeezing page data + 
Recompressing document +
+

+

The -squeeze-log-to <filename> option writes the log to the given file instead of to standard +output. + + +

Chapter 6
Bookmarks

PDF Bookmarks (properly called the document outline) 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. cpdf 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. +

6.1 List Bookmarks

+ +

The -list-bookmarks 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 ”open” if the bookmark should have its children (at the +level immediately below) visible when the file is loaded. For example, upon executing + +

the result might be: + + +

+0 "Part 1" 1 open + 
1 "Part 1A" 2 + 
1 "Part 1B" 3 + 
0 "Part 2" 4 + 
1 "Part 2a" 5 +
+

+

If the page number is 0, it indicates that clicking on that entry doesn’t move to a page. +

By default, cpdf converts unicode to ASCII text, dropping characters outside the ASCII range. To +prevent this, and return unicode UTF8 output, add the -utf8 option to the command. To prevent any +processing, use the -raw option. +

+

6.2 Remove Bookmarks

+ +

The -remove-bookmarks operations removes all bookmarks from the file. + +

+

6.3 Add Bookmarks

+ +

The -add-bookmarks file adds bookmarks as specified by a bookmarks file, a text file in ASCII or +UTF8 encoding and in the same format as that produced by the -list-bookmarks option. If there +are any bookmarks in the input PDF already, they are discarded. For example, if the file +bookmarks.txt contains the output from -list-bookmarks above, then the command + +adds the bookmarks to the input file, writing to out.pdf. 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). + + +

Chapter 7
Presentations

+

+ +

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 -presentation operation allows such a +presentation to be built from any PDF file. +

The -trans option chooses the transition style. When a page range is used, it is the transition +from each page named which is altered. The following transition styles are available: +

+Split
Two lines sweep across the screen, revealing the new page. By default the lines are + horizontal. Vertical lines are selected by using the -vertical option. +
+Blinds
Multiple lines sweep across the screen, revealing the new page. By default the lines are + horizontal. Vertical lines are selected by using the -vertical option. +
+Box
A rectangular box sweeps inward from the edges of the page. Use -outward to make it + sweep from the center to the edges. +
+Wipe
A single line sweeps across the screen from one edge to the other in a direction specified + by the -direction option. +
+Dissolve
The old page dissolves gradually to reveal the new one. +
+Glitter
The same as Dissolve but the effect sweeps across the page in the direction specified + by the -direction option.
+

To remove a transition style currently applied to the selected pages, omit the -trans option. +

The -effect-duration option specifies the length of time in seconds for the transition itself. The +default value is one second. +

The -duration option specifies the maximum time in seconds that the page is displayed before the +presentation automatically advances. The default, in the absence of the -duration option, is for no +automatic advancement. +

The -direction option (for Wipe and Glitter styles only) specifies the direction of the effect. +The following values are valid: +

+

For example: +

+

To use different options on different page ranges, run cpdf multiple times on the file using a different +page range each time. + + +

Chapter 8
Watermarks and Stamps

+

+

8.1 Add a Watermark or Logo

+

The -stamp-on and -stamp-under operations stamp the first page of a source PDF onto or under +each page in the given range of the input file. For example, +

+stamps the file logo.pdf onto the odd pages of in.pdf, writing to out.pdf. A watermark should go +underneath each page: +

+

The position commands in Section 8.2.4 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 -shift +first. +

The -scale-stamp-to-fit option can be added to scale the stamp to fit the page before +applying it. The use of positioning commands together with -scale-stamp-to-fit is not +recommended. +

The -combine-pages operation takes two PDF files and stamps each page of one over each page +of the other. The length of the output is the same as the length of the “under” file. For + + +instance: +

+

Page attributes (such as the display rotation) are taken from the “under” file. For best results, remove +any rotation differences in the two files using -upright first. +

The -relative-to-cropbox option takes the positioning command to be relative to the crop box of +each page rather than the media box. +

+

8.2 Stamp Text, Dates and Times.

+ + + +

The -add-text 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. +

+

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 -underneath option. +

Text previously added by cpdf may be removed by the -remove-text operation. +

+

+

8.2.1 Page Numbers

+ +

There are various special codes to include the page number in the text: +

+ %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
+
+

For example, the format "Page %Page of %EndPage" might become ”Page 5 of 17”. +

NB: In some circumstances (e.g in batch files) on Microsoft Windows, % is a special +character, and must be escaped (written as %%). Consult your local documentation for +details. + + +

+

8.2.2 Date and Time Formats

+
+ %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–31)
+%e  Day of the month (1–31)
+%H  Hour in 24-hour clock (00–23)
+%I  Hour in 12-hour clock (01–12)
+%j  Day of the year (001–366)
+%m  Month of the year (01–12)
+%M  Minute of the hour (00–59)
+%p  ”a.m ” or ”p.m”
+%S  Second of the minute (00–61)
+%T  Same as %H:%M:%S
+%u  Weekday (1–7, 1 = Monday)
+%w  Weekday (0–6, 0 = Monday)
+%Y  Year (0000–9999)
+%%  The % character.
+
+

+

8.2.3 Bates Numbers

+ +

Unique page identifiers can be specified by putting %Bates in the format. +The starting point can be set with the -bates option. For example: + +

To specify that bates numbering begins at the first page of the range, use -bates-at-range +instead. This option must be specified after the range is specified. To pad the bates number up +to a given number of leading zeros, use -bates-pad-to in addition to either -bates or +-bates-at-range. +

+

8.2.4 Position

+

The position of the text may be specified either in absolute terms: + + +

+

Positions relative to certain common points can be set: +

+

No attempt is made to take account of the page rotation when interpreting the position, so +-prerotate must be added to the command line if the file contains pages with a non-zero viewing +rotation. This is equivalent to pre-processing the document with -upright. +

The -relative-to-cropbox modifier can be added to the command line to make these +measurements relative to the crop box instead of the media box. +

The default position is equivalent to -topleft 100. +

The -midline option may be added to specify that the positioning commands above are to +be considered relative to the midline of the text, rather than its baseline. Similarly, the +-topline option may be used to specify that the position is taken relative to the top of the +text. +

+

8.2.5 Font and Size

+ +

The font may be set with the -font option. The 14 Standard PDF fonts are available: +

+ TTiimmeess--RBoomldan
+Times-Italic
+Times-BoldItalic
+Helvetica
+Helvetica-Bold
+Helvetica-Oblique
+Helvetica-BoldOblique
+Courier
+Courier-Bold
+Courier-Oblique
+Courier-BoldOblique
+Symbol
+ZapfDingbats
+
+

For example, page numbers in Times Italic can be achieved by: +

See +Section 14.1 for how to use other fonts. +

The font size can be altered with the -font-size option, which specifies the size in +points: +

+

+

8.2.6 Colors

+ +

The -color option takes an RGB color, where red, green and blue components range between 0 and 1. +The following values are predefined: +

+ -Color--R,-G,-B---
+ white   1, 1, 1
+ black   0, 0, 0
+ red     1, 0, 0
+ green   0, 1, 0
+ blue    0, 0, 1
+
+

+

Partly-transparent text may be specified using the -opacity option. Wholly opaque is 1 and wholly +transparent is 0. For example: +

+ + +

+

8.2.7 Outline Text

+ +

The -outline option sets outline text. The line width (default 1pt) may be set with the -linewidth +option. For example, to stamp documents as drafts: +

+

+

8.2.8 Multi-line Text

+

The code \n 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). +

+

The -midline option may be used to make these vertical positions relative to the midline of a line of +text rather than the baseline, as usual. +

The -line-spacing option can be used to increase or decrease the line spacing, where a spacing of +1 is the standard. +

+

Justification of multiple lines is handled by the -justify-left, -justify-right and
-justify-center 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: +

+

+

8.2.9 Special Characters

+

If your command line allows for the inclusion of unicode characters, the input text will be considered +as UTF8 by cpdf. 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. +

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 http://www.adobe.com/devnet/pdf/pdf_reference.html. +

For example, a German sharp s (ß) may be introduced by \337. + + +

+

8.3 Stamping Graphics

+

A rectangle may be placed on one or more pages by using the -add-rectangle <size> +command. Most of the options discussed above for text placement apply in the same way. For +example: +

+

This can be used to blank out or highlight part of the document. The following positioning options +work as you would expect: -topleft, -top, -topright, -right, -bottomright, -bottom, +-bottomleft, -left, -center. When using the option -pos-left "x y", the point (x, y) refers to the +bottom-left of the rectangle. When using the option -pos-right "x y", the point (x, y) refers to the +bottom-right of the rectangle. When using the option -pos-center "x y", the point (x, y) refers +to the center of the rectangle. The options -diagonal and -reverse-diagonal have no +meaning. + + +

+ + +

Chapter 9
Multipage Facilities

+

9.1 Two-up

+ +

This facility puts multiple logical pages on a single physical page. The -twoup-stack operation puts +two logical pages on each physical page, rotating them 90 degrees to do so. The new mediabox is thus +larger. The -twoup operation does the same, but scales the new sides down so that the media box is +unchanged. +

+

9.2 Inserting Blank Pages

+ +

Sometimes, for instance to get a printing arrangement right, it’s useful to be able to insert blank pages +into a PDF file. cpdf can add blank pages before a given page or pages, or after. The pages in +question are specified by a range in the usual way: +

The +dimensions of the padded page are derived from the boxes (media box, crop box etc.) of the page after +or before which the padding is to be applied. +

The -pad-every n operation places a blank page after every n pages, excluding any last one. For +example… +

…on +a 9 page document adds a blank page after pages 3 and 6. +

The -pad-multiple n operation adds blank pages so the document has a multiple of n pages. For +example: +

+ + +

+ + +

Chapter 10
Annotations

+

10.1 List Annotations

+ +

The -list-annotations 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. +

+

+

10.2 Copy Annotations

+ +

The -copy-annotations 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. + +

+

10.3 Remove Annotations

+ +

The -remove-annotations operation removes all annotations from the given page range. +

+ + +

+ + +

Chapter 11
Document Information and Metadata

+

+

11.1 Listing Fonts

+ +

The -list-fonts operation prints the fonts in the document, one-per-line to standard output. For +example: + + +

+

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. +

+

11.2 Reading Document Information

+

The -info option prints entries from the document information dictionary, and from any XMP +metadata to standard output. + + +

+

The details of the format for creation and modification dates can be found in Appendix A. +

By default, cpdf strips to ASCII, discarding character codes in excess of 127. In order to preserve +the original unicode, add the -utf8 option. To disable all postprocessing of the string, add +-raw. +

The -page-info option prints the page label, media box and other boxes page-by-page to standard +output, for all pages in the current range. +

+

Note that the format for boxes is minimum x, minimum y, maximum x, maximum y. +

The -pages operation prints the number of pages in the file. +

+

+

11.3 Setting Document Information

+ + +

The document information dictionary in a PDF file specifies various pieces of information about a +PDF. These can be consulted in a PDF viewer (for instance, Acrobat). +

Here is a summary of the commands for setting entries in the document information +dictionary: +

+

(The details of the format for creation and modification dates can be found in Appendix A. Using the +date "now" uses the time and date at which the command is executed. Note also that -producer and +-creator may be used to set the producer and/or the creator when writing any file, separate from the +operations described in this chapter.) +

For example, to set the title, the full command line would be +

+

The text string is considered to be in UTF8 format, unless the -raw option is added—in which case, it +is unprocessed, save for the replacement of any octal escape sequence such as \017, which is replaced +by a character of its value (here, 15). +

+

11.4 Upon Opening a Document

+

+

11.4.1 Page Layout

+ +

The -set-page-layout option specifies the page layout to be used when a document is opened in, for +instance, Acrobat. The possible (case-sensitive) values are: +

+ 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
+

+

For instance: +

+

+

11.4.2 Page Mode

+ +

The page mode in a PDF file defines how a viewer should display the document when first opened. +The possible (case-sensitive) values are: +

+ 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
+

+

For instance: +

+

+

11.4.3 Display Options

+
+ -hide-toolbar      Hide the viewer’s toolbar
+-hide-menubar      Document outline (bookmarks) visible
+-hide-window- ui     Hide the viewer’s scroll bars
+
+-fit-window        Resize the document’s windows to fit size of first page
+-center-window      Position thedocumentwindow inthecenterofthescreen
+                  Displaythedocumenttitleinsteadofthefile name inthe
+-display-doc- title  title bar
+

+

For instance: +

+

The page a PDF file opens at can be set using -open-at-page: +

+

To have that page scaled to fit the window in the viewer, use -open-at-page-fit instead: +

+

+

11.5 Metadata

+ +

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: +

+

To remove any metadata: +

To +print the current metadata to standard output: +

+

+

11.6 Page Labels

+ + +

It is possible to add page labels to a document. These are not the printed on the page, but may be +displayed alongside thumbnails or in print dialogue boxes by PDF readers. We use -add-page-labels +to do this, by default with decimal arabic numbers (1,2,3…). We can add -label-style to choose what +type of labels to add from these kinds: + + +

+    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.
+

We can use -label-prefix to add a textual prefix to each label. Consider a file with twenty pages +and no current page labels (a PDF reader will assume 1,2,3…if there are none). We will add the +following page labels: +

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 +

Here are the commands, in order: +

+

By default the labels begin at page number 1 for each range. To override this, we can use +-label-startval (we used 0 in the final command), where we want the numbers to begin at zero +rather than one. +

Page labels may be removed altogether by using -remove-page-labels command. To print the +page labels from an existing file, use -print-page-labels. For example: +

+ + +

+ + +

Chapter 12
File Attachments

+

+

PDF supports adding attachments (files of any kind, including other PDFs) to an existing file. The +cpdf tool supports adding and removing document-level attachments — that is, ones which are +associated with the document as a whole rather than with an individual page, and also page-level +attachments, associated with a particular page. +

12.1 Adding Attachments

+ +

To add an attachment, use the -attach-file option. For instance, +

+attaches the Excel spreadsheet sheet.xls to the input file. If the file already has attachments, the +new file is added to their number. You can specify multiple files to be attached by using -attach-file +multiple times. They will be attached in the given order. +

The -to-page option can be used to specify that the files will be attached to the given +page, rather than at the document level. The -to-page option may be specified at most +once. +

+

12.2 Listing Attachments

+ +

To list all document- and page-level attachments, use the -list-attached-files operation. The page +number and filename of each attachment is given, page 0 representing a document-level +attachment. +

+

+

12.3 Removing Attachments

+ +

To remove all document-level and page-level attachments from a file, use the -remove-files +operation: +

+ + +

+ + +

Chapter 13
Working with Images

+

+

13.1 Detecting Low-resolution Images

+

To list all images in the given range of pages which fall below a given resolution (in dots-per-inch), use +the -image-resolution function: +

+

+

The format is page number, image name, x pixels, y pixels, x resolution, y resolution. The resolutions +refer to the image’s effective resolution at point of use (taking account of scaling, rotation +etc). + + +

+ + +

Chapter 14
Fonts

+

+

14.1 Copying Fonts

+

In order to use a font other than the standard 14 with -add-text, it must be added to the file. The +font source PDF is given, together with the font’s resource name on a given page, and that +font is copied to all the pages in the input file’s range, and then written to the output +file. +

The font is named in the output file with its basefont name, so it can be easily used with +-add-text. +

For example, if the file fromfile.pdf has a font /GHLIGA+c128 with the name /F10 on page 1 +(this information can be found with -list-fonts), the following would copy the font to the file +in.pdf on all pages, writing the output to out.pdf: +

+

Text in this font can then be added by giving -font /GHLIGA+c128. 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. +

+

14.2 Removing Fonts

+

To remove embedded fonts from a document, use -remove-fonts. 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. +

+

+

14.3 Listing Missing Fonts

+

The -missing-fonts operation lists any unembedded fonts in the document, one per line. +

+

The format is +

+ + +

+ + +

Chapter 15
Miscellaneous

+

+

15.1 Draft Documents

+ +

The -draft option removes bitmap (photographic) images from a file, so that it can be printed with +less ink. Optionally, the -boxes 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: +

+

+

15.2 Blackening Text, Lines and Fills

+ +

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 -blacktext operation blackens all text on the given +pages so it will be readable when printed. +

This will not work on text which has been converted to outlines, nor on text which is part of a +form. +

+ +

The -blacklines operation blackens all lines on the given pages. +

+ +

The -blackfills operation blackens all fills on the given pages. + + +

+

Contrary to their names, all these operations can use another color, if specified with -color. +

+

15.3 Hairline Removal

+ +

Quite often, applications will use very thin lines, or even the value of 0, which in PDF means ”The +thinnest possible line on the output device”. 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 -thinlines option prevents this by changing all lines thinner than +<minimal thickness> to the given thickness. For example: +

+

+

15.4 Garbage Collection

+ +

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. +

+

+

15.5 Change PDF Version Number

+ +

To change the pdf version number, use the -set-version operation, giving the part of the version +number after the decimal point. For example: +

+This does not alter any of the actual data in the file — just the supposed version number. +

+

15.6 Copy ID

+ +

The -copy-id-from operation copies the ID from the given file to the input, writing to the +output. + + +

+

If there is no ID in the source file, the existing ID is retained. You cannot use -recrypt with +-copy-id-from. +

+

15.7 Remove ID

+ +

The -remove-id operation removes the ID from a document. +

+

You cannot use -recrypt with -remove-id. +

+

15.8 List Spot Colours

+

This operation lists the name of any “separation” color space in the given PDF file. +

+

+

15.9 Removing Dictionary Entries

+

This is for editing data within the PDF’s internal representation. Use with caution. +

+

+

15.10 Remove Clipping

+

The -remove-clipping operation removes any clipping paths from the file. +

+ + +

+ + + +

Appendix A
Dates

Dates in PDF are specified according to the following format: +

+

A contiguous prefix of the parts above can be used instead, for lower accuracy dates. For +example: +

+ + + + diff --git a/html_manual/cpdfmanual.pdf b/html_manual/cpdfmanual.pdf index da4fc64..8472139 100644 Binary files a/html_manual/cpdfmanual.pdf and b/html_manual/cpdfmanual.pdf differ diff --git a/html_manual/cpdfmanual.tex b/html_manual/cpdfmanual.tex index bf0c66e..ea8570d 100644 --- a/html_manual/cpdfmanual.tex +++ b/html_manual/cpdfmanual.tex @@ -1717,93 +1717,105 @@ A rectangle may be placed on one or more pages by using the \texttt{-add-rectang This can be used to blank out or highlight part of the document. The following positioning options work as you would expect: \texttt{-topleft}, \texttt{-top}, \texttt{-topright}, \texttt{-right}, \texttt{-bottomright}, \texttt{-bottom}, \texttt{-bottomleft}, \texttt{-left}, \texttt{-center}. When using the option \texttt{-pos-left "x y"}, the point (x, y) refers to the bottom-left of the rectangle. When using the option \texttt{-pos-right "x y"}, the point (x, y) refers to the bottom-right of the rectangle. When using the option \texttt{-pos-center "x y"}, the point (x, y) refers to the center of the rectangle. The options \texttt{-diagonal} and \texttt{-reverse-diagonal} have no meaning.\pagestyle{empty}\thispagestyle{fancy} -\end{document} \chapter{Multipage Facilities}\pagestyle{fancy} - \begin{framed} - \small\noindent\verb!cpdf -twoup-stack in.pdf -o out.pdf! +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -twoup-stack in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -twoup in.pdf -o out.pdf! + \small\noindent\texttt{cpdf -twoup in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -pad-before in.pdf [] -o out.pdf! + \small\noindent\texttt{cpdf -pad-before in.pdf [\textlangle range\textrangle ] -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -pad-after in.pdf [] -o out.pdf! + \small\noindent\texttt{cpdf -pad-after in.pdf [\textlangle range\textrangle ] -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -pad-every [] in.pdf -o out.pdf! + \small\noindent\texttt{cpdf -pad-every [\textlangle integer\textrangle ] in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -pad-multiple [] in.pdf -o out.pdf! - \end{framed} + \small\noindent\texttt{cpdf -pad-multiple [\textlangle integer\textrangle ] in.pdf -o out.pdf} +}} \section{Two-up} \index{two-up} This facility puts multiple logical pages on a single physical page. The \texttt{-twoup-stack} operation puts two logical pages on each physical page, rotating them 90 degrees to do so. The new mediabox is thus larger. The \texttt{-twoup} operation does the same, but scales the new sides down so that the media box is unchanged. + \section{Inserting Blank Pages} \index{blank pages!inserting} Sometimes, for instance to get a printing arrangement right, it's useful to be able to insert blank pages into a PDF file. \cpdf\ can add blank pages before a given page or pages, or after. The pages in question are specified by a range in the usual way: - \begin{framed} - \small\verb!cpdf -pad-before in.pdf 1 -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -pad-before in.pdf 1 -o out.pdf} \vspace{2.5mm} \noindent Add a blank page before page 1 (i.e. at the beginning of the document.) \vspace{2.5mm} - \verb!cpdf -pad-after in.pdf 2,16,38,84,121,147 -o out.pdf! + \texttt{cpdf -pad-after in.pdf 2,16,38,84,121,147 -o out.pdf} \vspace{2.5mm} \noindent Add a blank page after pages 2, 16, 38, 84, 121 and 147 (for instance, to add a clean page between chapters of a document.) - \end{framed} +}} \noindent The dimensions of the padded page are derived from the boxes (media box, crop box etc.) of the page after or before which the padding is to be applied. The \verb!-pad-every n! operation places a blank page after every n pages, excluding any last one. For example\ldots - \begin{framed} - \small\verb!cpdf -pad-every 3 in.pdf -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -pad-every 3 in.pdf -o out.pdf} \vspace{2.5mm} \noindent Add a blank page after every three pages - \end{framed} +}} \noindent\ldots on a 9 page document adds a blank page after pages 3 and 6. The \verb!-pad-multiple n! operation adds blank pages so the document has a multiple of \verb!n! pages. For example: - \begin{framed} - \small\verb!cpdf -pad-multiple 8 in.pdf -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -pad-multiple 8 in.pdf -o out.pdf} \vspace{2.5mm} \noindent Add blank pages to \texttt{in.pdf} so it has a multiple of 8 pages. - \end{framed} +}} + \chapter{Annotations} - \begin{framed} - \small\noindent\verb!cpdf -list-annotations in.pdf []! +\noindent\fbox{\parbox{\textwidth}{ + + + \small\noindent\texttt{cpdf -list-annotations in.pdf [\textlangle range\textrangle ]} \vspace{1.5mm} - \small\noindent\verb!cpdf -copy-annotations from.pdf to.pdf [] -o out.pdf! + \small\noindent\texttt{cpdf -copy-annotations from.pdf to.pdf [\textlangle range\textrangle ] -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -remove-annotations in.pdf [] -o out.pdf! - \end{framed} + \small\noindent\texttt{cpdf -remove-annotations in.pdf [\textlangle range\textrangle ] -o out.pdf} +}} \section{List Annotations} \index{annotations!listing} The \texttt{-list-annotations} 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. - \begin{framed} - \small\verb!cpdf -list-annotations in.pdf > annots.txt! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -list-annotations in.pdf \textrangle annots.txt} \vspace{2.5mm} \noindent Print annotations from \texttt{in.pdf}, redirecting output to \texttt{annots.txt}. - \end{framed} +}} \section{Copy Annotations} \index{annotations!copying} @@ -1811,135 +1823,151 @@ annotations on the selected pages to standard output. Each annotation is precede 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. - \begin{framed} - \small\verb!cpdf -copy-annotations from.pdf to.pdf 1-10 -o result.pdf ! +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -copy-annotations from.pdf to.pdf 1-10 -o result.pdf} \vspace{2.5mm} \noindent Copy annotations from the first ten pages of \texttt{from.pdf} onto the PDF file \texttt{to.pdf}, writing the result to \texttt{results.pdf}. - \end{framed} +}} \section{Remove Annotations} \index{annotations!removing} The \texttt{-remove-annotations} operation removes all annotations from the given page range. - \begin{framed} - \small\verb!cpdf -remove-annotations in.pdf 1 -o out.pdf! +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -remove-annotations in.pdf 1 -o out.pdf} \vspace{2.5mm} \noindent Remove annotations from the first page of a file only. - \end{framed} +}} + + \chapter{Document Information and Metadata} \index{document information} \index{metadata} - \begin{framed} - \small\noindent\verb!cpdf -list-fonts in.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -list-fonts in.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -info [-raw | -utf8] in.pdf! + \small\noindent\texttt{cpdf -info [-raw | -utf8] in.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -page-info in.pdf! + \small\noindent\texttt{cpdf -page-info in.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -pages in.pdf! + \small\noindent\texttt{cpdf -pages in.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -set-title in.pdf -o out.pdf!\\ + \small\noindent\texttt{cpdf -set-title \textlangle title of document\textrangle in.pdf -o out.pdf}\\ (Also \texttt{-set-author} etc. See Section \ref{setdocinfo}.) \vspace{1.5mm} - \small\noindent\verb!cpdf -set-page-layout <layout> in.pdf -o out.pdf! + \small\noindent\texttt{cpdf -set-page-layout \textlangle layout\textrangle in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -set-page-mode <mode> in.pdf -o out.pdf! + \small\noindent\texttt{cpdf -set-page-mode \textlangle mode\textrangle in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -hide-toolbar <true | false> in.pdf -o out.pdf!\\ - \noindent\verb! -hide-menubar!\\ - \noindent\verb! -hide-window-ui!\\ - \noindent\verb! -fit-window!\\ - \noindent\verb! -center-window!\\ - \noindent\verb! -display-doc-title! + \small\noindent\texttt{cpdf -hide-toolbar \textlangle true | false\textrangle in.pdf -o out.pdf}\\ + \noindent\texttt{ -hide-menubar}\\ + \noindent\texttt{ -hide-window-ui}\\ + \noindent\texttt{ -fit-window}\\ + \noindent\texttt{ -center-window}\\ + \noindent\texttt{ -display-doc-title} \vspace{1.5mm} - \small\noindent\verb!cpdf -open-at-page <page number> in.pdf -o out.pdf!\\ - \noindent\verb!cpdf -open-at-page-fit <page number> in.pdf -o out.pdf! + \small\noindent\texttt{cpdf -open-at-page \textlangle page number\textrangle in.pdf -o out.pdf}\\ + \noindent\texttt{cpdf -open-at-page-fit \textlangle page number\textrangle in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -set-metadata <metadata-file> in.pdf -o out.pdf! - \small\noindent\verb!cpdf -remove-metadata in.pdf -o out.pdf!\\ - \small\noindent\verb!cpdf -print-metadata in.pdf -o out.pdf! + \small\noindent\texttt{cpdf -set-metadata \textlangle metadata-file\textrangle in.pdf -o out.pdf}\\ + \small\noindent\texttt{cpdf -remove-metadata in.pdf -o out.pdf}\\ + \small\noindent\texttt{cpdf -print-metadata in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -add-page-labels in.pdf -o out.pdf!\\ - \noindent\verb! [-label-style <style>] [-label-prefix <string>]!\\ - \noindent\verb! [-label-startval <integer>]!\\ + \small\noindent\texttt{cpdf -add-page-labels in.pdf -o out.pdf}\\ + \noindent\texttt{ [-label-style \textlangle style\textrangle ] [-label-prefix \textlangle string\textrangle ]}\\ + \noindent\texttt{ [-label-startval \textlangle integer\textrangle ]}\\ \vspace{1.5mm} - \small\noindent\verb!cpdf -remove-page-labels in.pdf -o out.pdf!\\ - \small\noindent\verb!cpdf -print-page-labels in.pdf! - \end{framed} + \small\noindent\texttt{cpdf -remove-page-labels in.pdf -o out.pdf}\\ + \small\noindent\texttt{cpdf -print-page-labels in.pdf} +}} + + \section{Listing Fonts} \index{fonts!listing} The \texttt{-list-fonts} operation prints the fonts in the document, one-per-line to standard output. For example: -\begin{framed}\small\begin{verbatim}1 /F245 /Type0 /Cleargothic-Bold /Identity-H -1 /F247 /Type0 /ClearGothicSerialLight /Identity-H -1 /F248 /Type1 /Times-Roman /WinAnsiEncoding -1 /F250 /Type0 /Cleargothic-RegularItalic /Identity-H -2 /F13 /Type0 /Cleargothic-Bold /Identity-H -2 /F16 /Type0 /Arial-ItalicMT /Identity-H -2 /F21 /Type0 /ArialMT /Identity-H -2 /F58 /Type1 /Times-Roman /WinAnsiEncoding -2 /F59 /Type0 /ClearGothicSerialLight /Identity-H -2 /F61 /Type0 /Cleargothic-BoldItalic /Identity-H -2 /F68 /Type0 /Cleargothic-RegularItalic /Identity-H -3 /F47 /Type0 /Cleargothic-Bold /Identity-H -3 /F49 /Type0 /ClearGothicSerialLight /Identity-H -3 /F50 /Type1 /Times-Roman /WinAnsiEncoding -3 /F52 /Type0 /Cleargothic-BoldItalic /Identity-H -3 /F54 /Type0 /TimesNewRomanPS-BoldItalicMT /Identity-H -3 /F57 /Type0 /Cleargothic-RegularItalic /Identity-H -4 /F449 /Type0 /Cleargothic-Bold /Identity-H -4 /F451 /Type0 /ClearGothicSerialLight /Identity-H -4 /F452 /Type1 /Times-Roman /WinAnsiEncoding -\end{verbatim} -\end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + +\small\texttt{1 /F245 /Type0 /Cleargothic-Bold /Identity-H}\\ +\texttt{1 /F247 /Type0 /ClearGothicSerialLight /Identity-H}\\ +\texttt{1 /F248 /Type1 /Times-Roman /WinAnsiEncoding}\\ +\texttt{1 /F250 /Type0 /Cleargothic-RegularItalic /Identity-H}\\ +\texttt{2 /F13 /Type0 /Cleargothic-Bold /Identity-H}\\ +\texttt{2 /F16 /Type0 /Arial-ItalicMT /Identity-H}\\ +\texttt{2 /F21 /Type0 /ArialMT /Identity-H}\\ +\texttt{2 /F58 /Type1 /Times-Roman /WinAnsiEncoding}\\ +\texttt{2 /F59 /Type0 /ClearGothicSerialLight /Identity-H}\\ +\texttt{2 /F61 /Type0 /Cleargothic-BoldItalic /Identity-H}\\ +\texttt{2 /F68 /Type0 /Cleargothic-RegularItalic /Identity-H}\\ +\texttt{3 /F47 /Type0 /Cleargothic-Bold /Identity-H}\\ +\texttt{3 /F49 /Type0 /ClearGothicSerialLight /Identity-H}\\ +\texttt{3 /F50 /Type1 /Times-Roman /WinAnsiEncoding}\\ +\texttt{3 /F52 /Type0 /Cleargothic-BoldItalic /Identity-H}\\ +\texttt{3 /F54 /Type0 /TimesNewRomanPS-BoldItalicMT /Identity-H}\\ +\texttt{3 /F57 /Type0 /Cleargothic-RegularItalic /Identity-H}\\ +\texttt{4 /F449 /Type0 /Cleargothic-Bold /Identity-H}\\ +\texttt{4 /F451 /Type0 /ClearGothicSerialLight /Identity-H}\\ +\texttt{4 /F452 /Type1 /Times-Roman /WinAnsiEncoding} + +}} + + \noindent The first column gives the page number, the second the internal unique font name, the third the type of font (Type1, TrueType etc), the fourth the PDF font name, the fifth the PDF font encoding. + \section{Reading Document Information} \label{info} The \texttt{-info} option prints entries from the document information dictionary, and from any XMP metadata to standard output. -\begin{framed} -{\small\begin{verbatim} -$cpdf -info pdf_reference.pdf -Encryption: 40bit -Linearized: true -Permissions: No edit -Version: 1.6 -Pages: 1310 -Title: PDF Reference, version 1.7 -Author: Adobe Systems Incorporated -Subject: Adobe Portable Document Format (PDF) -Keywords: -Creator: FrameMaker 7.2 -Producer: Acrobat Distiller 7.0.5 (Windows) -Created: D:20061017081020Z -Modified: D:20061118211043-02'30' -XMP pdf:Producer: Adobe PDF library 7.77 -XMP xmp:CreateDate: 2006-12-21T18:19:09+01:00 -XMP xmp:CreatorTool: Adobe Illustrator CS2 -XMP xmp:MetadataDate: 2006-12-21T18:19:09Z -XMP xmp:ModifyDate: 2006-12-21T18:19:09Z -XMP dc:title: AI6\end{verbatim}}\end{framed} +\noindent\fbox{\parbox{\textwidth}{ +{\small +\texttt{\$cpdf -info pdf\_reference.pdf}\\ +\texttt{Encryption:\ 40bit}\\ +\texttt{Linearized:\ true}\\ +\texttt{Permissions:\ No edit}\\ +\texttt{Version:\ 1.6}\\ +\texttt{Pages:\ 1310}\\ +\texttt{Title:\ PDF Reference, version 1.7}\\ +\texttt{Author:\ Adobe Systems Incorporated}\\ +\texttt{Subject:\ Adobe Portable Document Format (PDF)}\\ +\texttt{Keywords:} \\ +\texttt{Creator:\ FrameMaker 7.2}\\ +\texttt{Producer:\ Acrobat Distiller 7.0.5 (Windows)}\\ +\texttt{Created:\ D:20061017081020Z}\\ +\texttt{Modified:\ D:20061118211043-02'30'}\\ +\texttt{XMP pdf:Producer:\ Adobe PDF library 7.77}\\ +\texttt{XMP xmp:CreateDate:\ 2006-12-21T18:19:09+01:00}\\ +\texttt{XMP xmp:CreatorTool:\ Adobe Illustrator CS2}\\ +\texttt{XMP xmp:MetadataDate:\ 2006-12-21T18:19:09Z}\\ +\texttt{XMP xmp:ModifyDate:\ 2006-12-21T18:19:09Z}\\ +\texttt{XMP dc:title:\ AI6}}}} + + \noindent The details of the format for creation and modification dates can be found in Appendix~\ref{dates}. @@ -1949,30 +1977,30 @@ By default, cpdf strips to ASCII, discarding character codes in excess of 127. I The \texttt{-page-info} option prints the page label, media box and other boxes page-by-page to standard output, for all pages in the current range. -\begin{framed} -{\small\begin{verbatim} -$cpdf -page-info 14psfonts.pdf -Page 1: -Label: i -MediaBox: 0.000000 0.000000 600.000000 450.000000 -CropBox: 200.000000 200.000000 500.000000 500.000000 -BleedBox: -TrimBox: -ArtBox: -Rotation: 0 -\end{verbatim}} -\end{framed} +\noindent\fbox{\parbox{\textwidth}{ + +{\small +\texttt{\$cpdf -page-info 14psfonts.pdf}\\ +\texttt{Page 1:}\\ +\texttt{Label:\ i}\\ +\texttt{MediaBox:\ 0.000000 0.000000 600.000000 450.000000}\\ +\texttt{CropBox:\ 200.000000 200.000000 500.000000 500.000000}\\ +\texttt{BleedBox:}\\ +\texttt{TrimBox:}\\ +\texttt{ArtBox:}\\ +\texttt{Rotation:\ 0} +} +}} \noindent Note that the format for boxes is minimum x, minimum y, maximum x, maximum y. \smallgap \noindent The \texttt{-pages} operation prints the number of pages in the file. -\begin{framed} -{\small\begin{verbatim} -cpdf -pages Archos.pdf -8 -\end{verbatim}} -\end{framed} + +\noindent\fbox{\parbox{\textwidth} +{\small\texttt{cpdf -pages Archos.pdf}\\ +\texttt{8}}} + \section{Setting Document Information} \label{setdocinfo} @@ -1983,7 +2011,9 @@ instance, Acrobat). Here is a summary of the commands for setting entries in the document information dictionary: -{\small\begin{framed} +\noindent\fbox{\parbox{\textwidth}{ + +{\small \noindent\begin{tabular}{ll} \textbf{Information} & \textbf{Example command-line fragment} \\ Title & \texttt{cpdf -set-title "Discourses"} \\ @@ -1997,7 +2027,8 @@ information dictionary: Mark as Trapped & \texttt{cpdf -set-trapped} \\ Mark as Untrapped & \texttt{cpdf -set-untrapped} \\ \end{tabular} -\end{framed}} +}}} + \noindent (The details of the format for creation and modification dates can be found in Appendix~\ref{dates}. Using the date \texttt{"now"} uses the time and date @@ -2005,12 +2036,16 @@ at which the command is executed. Note also that \texttt{-producer} and \texttt{ \vspace{2mm} For example, to set the title, the full command line would be - \begin{framed} - \small\verb!cpdf -set-title "A Night in London" in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -set-title "A Night in London" in.pdf -o out.pdf} + }} + \noindent The text string is considered to be in UTF8 format, unless the \texttt{-raw} option is added---in which case, it is unprocessed, save for the replacement of any octal escape sequence such as \texttt{\textbackslash 017}, which is replaced by a character of its value (here, 15). + \section{Upon Opening a Document} \subsection{Page Layout} @@ -2029,11 +2064,14 @@ when a document is opened in, for instance, Acrobat. The possible \texttt{TwoPageRight} & \vspace{2mm} \parbox{8cm}{(PDF 1.5 and above) Display the pages two at a time, even numbered pages on the left} \end{tabular}}\\ + \noindent For instance: - \begin{framed} - \small\verb!cpdf -set-page-layout TwoColumnRight in.pdf -o out.pdf! - \end{framed} - + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -set-page-layout TwoColumnRight in.pdf -o out.pdf} +}} + \subsection{Page Mode} \index{page!mode} The \textit{page mode} in a PDF file defines how a viewer should display the @@ -2049,11 +2087,15 @@ document when first opened. The possible (case-sensitive) values are: \texttt{UseAttachments} & \vspace{2mm} \parbox{8cm}{(PDF 1.5 and above) Attachments panel visible} \end{tabular}}\\ + \noindent For instance: - \begin{framed} - \small\verb!cpdf -set-page-mode FullScreen in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -set-page-mode FullScreen in.pdf -o out.pdf} +}} + \subsection{Display Options} \vspace{2mm} {\small\begin{tabular}{ll} @@ -2065,37 +2107,54 @@ document when first opened. The possible (case-sensitive) values are: \texttt{-display-doc-title} & \vspace{2mm} \parbox{8cm}{Display the document title instead of the file name in the title bar} \end{tabular}}\\ + \noindent For instance: - \begin{framed} - \small\verb!cpdf -hide-toolbar true in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -hide-toolbar true in.pdf -o out.pdf} +}} \noindent The page a PDF file opens at can be set using \texttt{-open-at-page}: - \begin{framed} - \small\verb!cpdf -open-at-page 15 in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -open-at-page 15 in.pdf -o out.pdf} +}} \noindent To have that page scaled to fit the window in the viewer, use \texttt{-open-at-page-fit} instead: - \begin{framed} - \small\verb!cpdf -open-at-page-fit 15 in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -open-at-page-fit 15 in.pdf -o out.pdf} +}} + \section{Metadata} \index{metadata} 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: - \begin{framed} - \small\verb!cpdf -set-metadata data.xml in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -set-metadata data.xml in.pdf -o out.pdf} +}} + \noindent To remove any metadata: - \begin{framed} - \small\verb!cpdf -remove-metadata in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -remove-metadata in.pdf -o out.pdf} +}} \noindent To print the current metadata to standard output: - \begin{framed} - \small\verb!cpdf -print-metadata in.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -print-metadata in.pdf} +}} + + \section{Page Labels} \index{page labels}\index{page!labels} @@ -2122,42 +2181,55 @@ i, ii, iii, iv, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, A-0, A-1, A-2, A-3, A-4, A-5 \noindent Here are the commands, in order: -{\small\begin{framed} - \noindent\verb!cpdf -add-page-labels in.pdf 1-4 -label-style LowercaseRoman!\\ - \noindent\verb! -o out.pdf!\\ - - \noindent\verb!cpdf -add-page-labels out.pdf 5-14 -o out.pdf!\\ - \noindent\verb!cpdf -add-page-labels out.pdf 15-20 -label-prefix "A-"!\\ - \noindent\verb! -label-startval 0 -o out.pdf! -\end{framed}} +\noindent\fbox{\parbox{\textwidth}{ + \noindent\texttt{cpdf -add-page-labels in.pdf 1-4 -label-style LowercaseRoman}\\ + \noindent\texttt{ -o out.pdf}\\ + + \noindent\texttt{cpdf -add-page-labels out.pdf 5-14 -o out.pdf}\\ + + \noindent\texttt{cpdf -add-page-labels out.pdf 15-20 -label-prefix "A-"}\\ + \noindent\texttt{ -label-startval 0 -o out.pdf} +}} \noindent By default the labels begin at page number 1 for each range. To override this, we can use \texttt{-label-startval} (we used $0$ in the final command), where we want the numbers to begin at zero rather than one. + + Page labels may be removed altogether by using \texttt{-remove-page-labels} command. To print the page labels from an existing file, use \texttt{-print-page-labels}. For example: -\begin{framed}\small\begin{verbatim}$ cpdf -print-page-labels cpdfmanual.pdf -labelstyle: LowercaseRoman -labelprefix: None -startpage: 1 -startvalue: 1 -labelstyle: DecimalArabic -labelprefix: None -startpage: 9 -startvalue: 1 -\end{verbatim} -\end{framed}\pagestyle{empty}\thispagestyle{fancy} + +\noindent\fbox{\parbox{\textwidth}{ +\texttt{\$ cpdf -print-page-labels cpdfmanual.pdf}\\ +\texttt{labelstyle:\ LowercaseRoman}\\ +\texttt{labelprefix:\ None}\\ +\texttt{startpage:\ 1}\\ +\texttt{startvalue:\ 1}\\ +\texttt{labelstyle:\ DecimalArabic}\\ +\texttt{labelprefix:\ None}\\ +\texttt{startpage:\ 9}\\ +\texttt{startvalue:\ 1} +}} + + +\pagestyle{empty}\thispagestyle{fancy} + + \chapter{File Attachments}\pagestyle{fancy} \index{attachments} -\begin{framed} - \small\noindent\verb!cpdf -attach-file <filename> [-to-page <page number>] in.pdf -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -attach-file <filename> [-to-page <page number>] in.pdf -o out.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -list-attached-files in.pdf! + \small\noindent\texttt{cpdf -list-attached-files in.pdf} \vspace{1.5mm} - \small\noindent\verb!cpdf -remove-files in.pdf -o out.pdf! -\end{framed} + \small\noindent\texttt{cpdf -remove-files in.pdf -o out.pdf} +}} + + PDF supports adding attachments (files of any kind, including other PDFs) to an existing file. The \cpdf\ tool supports adding and removing \textit{document-level attachments} --- that is, ones which are associated with the document as a @@ -2165,79 +2237,84 @@ whole rather than with an individual page, and also \textit{page-level attachmen \section{Adding Attachments} \index{attachments!adding} To add an attachment, use the \texttt{-attach-file} option. For instance, - \begin{framed} - \small\verb!cpdf -attach-file sheet.xls in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + \small\texttt{cpdf -attach-file sheet.xls in.pdf -o out.pdf} +}} \noindent attaches the Excel spreadsheet \texttt{sheet.xls} to the input file. If the file already has attachments, the new file is added to their number. You can specify multiple files to be attached by using \verb!-attach-file! multiple times. They will be attached in the given order. The \texttt{-to-page} option can be used to specify that the files will be attached to the given page, rather than at the document level. The \texttt{-to-page} option may be specified at most once. + \section{Listing Attachments} \index{attachments!listing} To list all document- and page-level attachments, use the \texttt{-list-attached-files} operation. The page number and filename of each attachment is given, page 0 representing a document-level attachment. -\begin{framed} -{\small\begin{verbatim} -$cpdf -list-attached-files 14psfonts.pdf -0 utility.ml -0 utility.mli -4 notes.xls -\end{verbatim}} -\end{framed} + +\noindent\fbox{\parbox{\textwidth}{ +\texttt{\$cpdf -list-attached-files 14psfonts.pdf}\\ +\texttt{0 utility.ml}\\ +\texttt{0 utility.mli}\\ +\texttt{4 notes.xls} +}} + + \section{Removing Attachments} \index{attachments!removing} To remove all document-level and page-level attachments from a file, use the \texttt{-remove-files} operation: - \begin{framed} - \small\verb!cpdf -remove-files in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -remove-files in.pdf -o out.pdf} +}} + \chapter{Working with Images} -\begin{framed} -\noindent\small\verb!cpdf -image-resolution <minimum resolution> in.pdf [<range>]! -%\vspace{1.5mm} -%\noindent\small\verb!cpdf -extract-images in.pdf [<range>] -o <string>! -\end{framed} +\noindent\fbox{\parbox{\textwidth}{ + +\noindent\small\texttt{cpdf -image-resolution <minimum resolution> in.pdf [<range>]} + +}} + + \section{Detecting Low-resolution Images} - To list all images in the given range of pages which fall below a given resolution (in dots-per-inch), use the \verb!-image-resolution! function: - \begin{framed} - \noindent\small\verb@cpdf -image-resolution 300 in.pdf [<range>]@ - \end{framed} + To list all images in the given range of pages which fall below a given resolution (in dots-per-inch), use the \verb!-image-resolution! function: + +\noindent\fbox{\parbox{\textwidth}{ + \noindent\small\texttt{cpdf -image-resolution 300 in.pdf [<range>]} +}} + +\noindent\fbox{\parbox{\textwidth}{ +\texttt{2, /Im5, 531, 684, 149.935297, 150.138267}\\ +\texttt{2, /Im6, 184, 164, 149.999988, 150.458710}\\ +\texttt{2, /Im7, 171, 156, 149.999996, 150.579145}\\ +\texttt{2, /Im9, 65, 91, 149.999986, 151.071856}\\ +\texttt{2, /Im10, 94, 60, 149.999990, 152.284285}\\ +\texttt{2, /Im15, 184, 139, 149.960011, 150.672060}\\ +\texttt{4, /Im29, 53, 48, 149.970749, 151.616446}\\ +}} - \begin{framed} -{\small\begin{verbatim}2, /Im5, 531, 684, 149.935297, 150.138267 -2, /Im6, 184, 164, 149.999988, 150.458710 -2, /Im7, 171, 156, 149.999996, 150.579145 -2, /Im9, 65, 91, 149.999986, 151.071856 -2, /Im10, 94, 60, 149.999990, 152.284285 -2, /Im15, 184, 139, 149.960011, 150.672060 -4, /Im29, 53, 48, 149.970749, 151.616446\end{verbatim}} - \end{framed} \noindent The format is \textit{page number, image name, x pixels, y pixels, x resolution, y resolution}. The resolutions refer to the image's effective resolution at point of use (taking account of scaling, rotation etc). -% \section{Extracting Images} -% \begin{framed} -% \noindent\verb!cpdf -extract-images in.pdf [<range>] -o <string>! -% \end{framed} -%The Tools can extract images from PDF files to JPEG, JPEG2000, JBIG2 and PNM (Portable Any Map) files. Images which are already in JPEG/JPEG2000/JBIG2 format in the PDF are written in those formats, unaltered. All other images are decoded and written as PNM files (unless the decoding method is unknown). If the command line tool \textsf{pnm2png} is present, PNG files are output instead. -%For example, -% \begin{framed} -% \small\verb!cpdf -extract-images in.pdf 2-6 -o img%%%! -% \end{framed} -%might generate \texttt{img001.jpg}, \texttt{img002.png}, \texttt{img003.jpg} etc. from the images on pages two to six. The number of percentage characters in the output format indicate the width of the numbering system for the output file names. + + \pagestyle{empty} \chapter{Fonts}\pagestyle{fancy} - {\small \begin{framed} - \noindent\verb!cpdf -copy-font fromfile.pdf -copy-font-page <int>!\\ - \noindent\verb! -copy-font-name <name> in.pdf [<range>] -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \noindent\texttt{cpdf -copy-font fromfile.pdf -copy-font-page <int>}\\ + \noindent\texttt{ -copy-font-name <name> in.pdf [<range>] -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -remove-fonts in.pdf -o out.pdf! + \noindent\texttt{cpdf -remove-fonts in.pdf -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -missing-fonts in.pdf! - \end{framed}} + \noindent\texttt{cpdf -missing-fonts in.pdf} +}} + \section{Copying Fonts} \label{copyfont} @@ -2253,10 +2330,12 @@ For example, if the file \verb!fromfile.pdf! has a font \verb!/GHLIGA+c128! with the name \verb!/F10! on page 1 (this information can be found with \verb!-list-fonts!), the following would copy the font to the file \verb!in.pdf! on all pages, writing the output to \verb!out.pdf!: - \begin{framed} - \small\noindent\verb!cpdf -copy-font fromfile.pdf -copy-font-name /F10!\\ - \small\noindent\verb! -copy-font-page 1 in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -copy-font fromfile.pdf -copy-font-name /F10}\\ + \small\noindent\texttt{ -copy-font-page 1 in.pdf -o out.pdf} +}} \noindent Text in this font can then be added by giving \verb!-font /GHLIGA+c128!. Be aware that due to the vagaries of PDF font handling concerning which characters @@ -2270,63 +2349,74 @@ To remove embedded fonts from a document, use \verb!-remove-fonts!. PDF readers substitute local fonts for the missing fonts. The use of this function is only recommended when file size is the sole consideration. - \begin{framed} - \small\noindent\verb!cpdf -remove-fonts in.pdf -o out.pdf! +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -remove-fonts in.pdf -o out.pdf} \vspace{2.5mm} - \end{framed} +}} \section{Listing Missing Fonts} The \verb!-missing-fonts! operation lists any unembedded fonts in the document, one per line. - \begin{framed} - \small\noindent\verb!cpdf -missing-fonts in.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -missing-fonts in.pdf} \vspace{2.5mm} - \end{framed} +}} \noindent The format is - \begin{framed} - \small\noindent\verb!Page number, Name, Subtype, Basefont, Encoding! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{Page number, Name, Subtype, Basefont, Encoding} \vspace{2.5mm} - \end{framed} +}} \label{listmisingfonts} + + \chapter{Miscellaneous} - {\small\begin{framed} - \noindent\verb!cpdf -draft [-boxes] in.pdf [<range>] -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \noindent\texttt{cpdf -draft [-boxes] in.pdf [<range>] -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -blacktext in.pdf [<range>] -o out.pdf! + \noindent\texttt{cpdf -blacktext in.pdf [<range>] -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -blacklines in.pdf [<range>] -o out.pdf! + \noindent\texttt{cpdf -blacklines in.pdf [<range>] -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -blackfills in.pdf [<range>] -o out.pdf! + \noindent\texttt{cpdf -blackfills in.pdf [<range>] -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -thinlines <minimum thickness> in.pdf [<range>] -o out.pdf! + \noindent\texttt{cpdf -thinlines <minimum thickness> in.pdf [<range>] -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -clean in.pdf -o out.pdf! + \noindent\texttt{cpdf -clean in.pdf -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -set-version <version number> in.pdf -o out.pdf! + \noindent\texttt{cpdf -set-version <version number> in.pdf -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -copy-id-from source.pdf in.pdf -o out.pdf! + \noindent\texttt{cpdf -copy-id-from source.pdf in.pdf -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -remove-id in.pdf -o out.pdf! + \noindent\texttt{cpdf -remove-id in.pdf -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -list-spot-colors in.pdf! + \noindent\texttt{cpdf -list-spot-colors in.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -remove-dict-entry in.pdf -o out.pdf! + \noindent\texttt{cpdf -remove-dict-entry in.pdf -o out.pdf} \vspace{1.5mm} - \noindent\verb!cpdf -remove-clipping in.pdf -o out.pdf! - \end{framed}} + \noindent\texttt{cpdf -remove-clipping in.pdf -o out.pdf} +}} + + \section{Draft Documents} \index{draft} The \texttt{-draft} option removes bitmap (photographic) images from a @@ -2335,9 +2425,11 @@ file, so that it can be printed with less ink. Optionally, the 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: - \begin{framed} - \small\verb!cpdf -draft -boxes in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -draft -boxes in.pdf -o out.pdf} +}} \section{Blackening Text, Lines and Fills} \index{blacken text} @@ -2348,28 +2440,33 @@ when printed. This will not work on text which has been converted to outlines, nor on text which is part of a form. - \begin{framed} - \small\verb!cpdf -blacktext in.pdf -o out.pdf! - \end{framed} + +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -blacktext in.pdf -o out.pdf} +}} \index{blacken lines} \noindent The \texttt{-blacklines} operation blackens all lines on the given pages. - \begin{framed} - \small\verb!cpdf -blacklines in.pdf -o out.pdf! - \end{framed} +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -blacklines in.pdf -o out.pdf} +}} \index{blacken fills} \noindent The \texttt{-blackfills} operation blackens all fills on the given pages. - \begin{framed} - \small\verb!cpdf -blackfills in.pdf -o out.pdf! - \end{framed} +\noindent\fbox{\parbox{\textwidth}{ + + \small\texttt{cpdf -blackfills in.pdf -o out.pdf} +}} \noindent Contrary to their names, all these operations can use another color, if specified with \texttt{-color}. + \section{Hairline Removal} \index{hairline removal} Quite often, applications will use very thin lines, or even the value of 0, @@ -2378,12 +2475,14 @@ 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 \texttt{-thinlines} option prevents this by changing all lines thinner than \texttt{<minimal~thickness>} to the given thickness. For example: - \begin{framed} - \small\noindent\verb!cpdf -thinlines 0.2mm in.pdf [<range>] -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -thinlines 0.2mm in.pdf [<range>] -o out.pdf} \vspace{2.5mm} \noindent Thicken all lines less than 0.2mm to that value. - \end{framed} +}} \section{Garbage Collection} \index{garbage collection} @@ -2391,21 +2490,24 @@ thinner than \texttt{<minimal~thickness>} to the given thickness. For example: applications can leave data in a PDF file which is no longer used. This function removes that unneeded data. - \begin{framed} - \small\noindent\verb!cpdf -clean in.pdf -o out.pdf! - \end{framed} +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -clean in.pdf -o out.pdf} +}} \section{Change PDF Version Number} \index{version number} \label{setversion} To change the pdf version number, use the \texttt{-set-version} operation, giving the part of the version number after the decimal point. For example: - \begin{framed} - \small\noindent\verb!cpdf -set-version 4 in.pdf -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -set-version 4 in.pdf -o out.pdf} \vspace{2.5mm} \noindent Change file to PDF 1.4. - \end{framed} +}} \noindent This does not alter any of the actual data in the file --- just the supposed version number. @@ -2413,23 +2515,28 @@ just the supposed version number. \index{copy ID} The \texttt{-copy-id-from} operation copies the ID from the given file to the input, writing to the output. - \begin{framed} - \small\noindent\verb!cpdf -copy-id-from source.pdf in.pdf -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -copy-id-from source.pdf in.pdf -o out.pdf} \vspace{2.5mm} \noindent Copy the id from \texttt{source.pdf} to the contents of \texttt{in.pdf}, writing to \texttt{out.pdf}. - \end{framed} +}} + \noindent If there is no ID in the source file, the existing ID is retained. You cannot use \texttt{-recrypt} with \texttt{-copy-id-from}. \section{Remove ID} \index{remove ID} The \texttt{-remove-id} operation removes the ID from a document. - \begin{framed} - \small\noindent\verb!cpdf -remove-id in.pdf -o out.pdf! + +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -remove-id in.pdf -o out.pdf} \vspace{2.5mm} \noindent Remove the ID from \texttt{in.pdf}, writing to \texttt{out.pdf}. - \end{framed} +}} You cannot use \texttt{-recrypt} with \texttt{-remove-id}. @@ -2437,23 +2544,25 @@ You cannot use \texttt{-recrypt} with \texttt{-remove-id}. This operation lists the name of any ``separation'' color space in the given PDF file. - \begin{framed} - \small\noindent\verb!cpdf -list-spot-colors in.pdf! +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -list-spot-colors in.pdf} \vspace{2.5mm} \noindent List the spot colors, one per line in \texttt{in.pdf}, writing to \texttt{stdout}. - \end{framed} +}} \section{Removing Dictionary Entries} This is for editing data within the PDF's internal representation. Use with caution. - \begin{framed} - \small\noindent\verb!cpdf -remove-dict-entry /One in.pdf -o out.pdf! +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -remove-dict-entry /One in.pdf -o out.pdf} \vspace{2.5mm} \noindent Remove the entry for \texttt{/One} in every dictionary \texttt{in.pdf}, writing to \texttt{out.pdf}. - \end{framed} +}} \section{Remove Clipping} @@ -2461,13 +2570,13 @@ This is for editing data within the PDF's internal representation. Use with caut The \texttt{-remove-clipping} operation removes any clipping paths from the file. - \begin{framed} - \small\noindent\verb!cpdf -remove-clipping in.pdf -o out.pdf! +\noindent\fbox{\parbox{\textwidth}{ + + \small\noindent\texttt{cpdf -remove-clipping in.pdf -o out.pdf} \vspace{2.5mm} \noindent Remove every clipping path in \texttt{in.pdf}, writing to \texttt{out.pdf}. - \end{framed} - +}} \appendix \chapter{Dates}\pagestyle{empty} @@ -2475,7 +2584,8 @@ The \texttt{-remove-clipping} operation removes any clipping paths from the file \index{dates!defined} Dates in PDF are specified according to the following format: -\begin{framed} +\noindent\fbox{\parbox{\textwidth}{ + \texttt{D:YYYYMMDDHHmmSSOHH'mm'}\\\\where: \begin{itemize} @@ -2489,24 +2599,25 @@ Dates in PDF are specified according to the following format: \item \texttt{HH} is the absolute value of the offset from UT in hours (00-23); \item \texttt{mm} is the absolute value of the offset from UT in minutes (00-59). \end{itemize} -\end{framed} +}} + \noindent A contiguous prefix of the parts above can be used instead, for lower accuracy dates. For example: -\begin{framed} - \small\noindent\verb!D:2014! (2014) +\noindent\fbox{\parbox{\textwidth}{ + \small\noindent\texttt{D:2014} (2014) \vspace{1.5mm} - \noindent\verb!D:20140103! (3rd March 2014) + \noindent\texttt{D:20140103} (3rd March 2014) \vspace{1.5mm} - \noindent\verb!D:201401031854-08'00'! (3rd March 2014, 6:54PM, US Pacific Standard Time) + \noindent\texttt{D:201401031854-08'00'} (3rd March 2014, 6:54PM, US Pacific Standard Time) -\end{framed} +}} \backmatter \pagestyle{fancy} \printindex -\end{document} +\end{document}