Chapter 10

cpdf -list-annotations in.pdf [<range>]

cpdf -copy-annotations from.pdf to.pdf [<range>] -o out.pdf

cpdf -remove-annotations in.pdf [<range>] -o out.pdf

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. See Section 1.17 for more information on text encodings in the output of this operation.

cpdf -list-annotations in.pdf > annots.txt

Print annotations from in.pdf, redirecting output to annots.txt.

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.

cpdf -copy-annotations from.pdf to.pdf 1-10 -o result.pdf 

Copy annotations from the first ten pages of from.pdf onto the PDF file to.pdf, writing the result to results.pdf.

10.3 Remove Annotations

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

cpdf -remove-annotations in.pdf 1 -o out.pdf

Remove annotations from the first page of a file only.

Python Interface

# CHAPTER 10. Annotations 
# Not in the library version.