This commit is contained in:
John Whitington 2019-07-28 12:35:51 +01:00
parent 84b98e083d
commit 1cd898ce74
3 changed files with 45 additions and 22 deletions

View File

@ -2118,12 +2118,12 @@ and specs =
("-set-untrapped", ("-set-untrapped",
Arg.Unit (setop SetUntrapped), Arg.Unit (setop SetUntrapped),
" Mark as not trapped"); " Mark as not trapped");
("-also-set-xml", ("-also-set-xmp",
Arg.Unit setalsosetxml, Arg.Unit setalsosetxml,
" Also set XML metadata"); " Also set XMP metadata");
("-just-set-xml", ("-just-set-xmp",
Arg.Unit setjustsetxml, Arg.Unit setjustsetxml,
" Just set XML metadata, not old-fashioned metadata"); " Just set XMP metadata, not old-fashioned metadata");
("-create-metadata", ("-create-metadata",
Arg.Unit (setop CreateMetadata), Arg.Unit (setop CreateMetadata),
" Create XML metadata from scratch."); " Create XML metadata from scratch.");

Binary file not shown.

View File

@ -1785,7 +1785,8 @@ given page range.
\small\noindent\verb!cpdf -pages in.pdf! \small\noindent\verb!cpdf -pages in.pdf!
\vspace{1.5mm} \vspace{1.5mm}
\small\noindent\verb!cpdf -set-title <title of document> [-raw] in.pdf -o out.pdf!\\ \small\noindent\verb!cpdf -set-title <title of document>!\\
\small\noindent\verb! [-also-set-xmp] [-just-set-xmp] [-raw] in.pdf -o out.pdf!\\
(Also \texttt{-set-author} etc. See Section \ref{setdocinfo}.) (Also \texttt{-set-author} etc. See Section \ref{setdocinfo}.)
\vspace{1.5mm} \vspace{1.5mm}
@ -1809,7 +1810,9 @@ given page range.
\vspace{1.5mm} \vspace{1.5mm}
\small\noindent\verb!cpdf -set-metadata <metadata-file> in.pdf -o out.pdf! \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 -remove-metadata in.pdf -o out.pdf!\\
\small\noindent\verb!cpdf -print-metadata in.pdf -o out.pdf! \small\noindent\verb!cpdf -print-metadata in.pdf!\\
\small\noindent\verb!cpdf -create-metadata in.pdf -o out.pdf!\\
\small\noindent\verb!cpdf -set-metadata-date <date> in.pdf -o out.pdf!
\vspace{1.5mm} \vspace{1.5mm}
\small\noindent\verb!cpdf -add-page-labels in.pdf -o out.pdf!\\ \small\noindent\verb!cpdf -add-page-labels in.pdf -o out.pdf!\\
@ -1949,6 +1952,36 @@ at which the command is executed. Note also that \texttt{-producer} and \texttt{
\noindent The text string is considered to be in UTF8 format, unless the \texttt{-raw} \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). 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).
To set also any field in the XMP metadata, add \texttt{-also-set-xmp}. The field must exist already. To set only the field (not the document information dictionary), add \texttt{-just-set-xmp} instead.
\section{XMP 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 To remove any metadata:
\begin{framed}
\small\verb!cpdf -remove-metadata in.pdf -o out.pdf!
\end{framed}
\noindent To print the current metadata to standard output:
\begin{framed}
\small\verb!cpdf -print-metadata in.pdf!
\end{framed}
\noindent To create XMP metadata from scratch, using any information in the Document Information Dictionary (old-style metadata):
\begin{framed}
\small\verb!cpdf -create-metadata in.pdf -o out.pdf!
\end{framed}
\noindent To set the XMP metadata date field, use:
\begin{framed}
\small\verb!cpdf -set-metadata-date <date> in.pdf -o out.pdf!
\end{framed}
The date format is defined in Appendix \ref{xmpdate}. Using the date \texttt{"now"} uses the time and date
at which the command is executed.
\section{Upon Opening a Document} \section{Upon Opening a Document}
\subsection{Page Layout} \subsection{Page Layout}
@ -2024,22 +2057,6 @@ document when first opened. The possible (case-sensitive) values are:
\small\verb!cpdf -open-at-page-fit 15 in.pdf -o out.pdf! \small\verb!cpdf -open-at-page-fit 15 in.pdf -o out.pdf!
\end{framed} \end{framed}
\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 To remove any metadata:
\begin{framed}
\small\verb!cpdf -remove-metadata in.pdf -o out.pdf!
\end{framed}
\noindent To print the current metadata to standard output:
\begin{framed}
\small\verb!cpdf -print-metadata in.pdf!
\end{framed}
\section{Page Labels} \section{Page Labels}
\index{page labels}\index{page!labels} \index{page labels}\index{page!labels}
@ -2454,6 +2471,8 @@ The \texttt{-remove-clipping} operation removes any clipping paths on given page
\chapter{Dates}\pagestyle{empty} \chapter{Dates}\pagestyle{empty}
\label{dates} \label{dates}
\index{dates!defined} \index{dates!defined}
\section{PDF Date Format}
Dates in PDF are specified according to the following format: Dates in PDF are specified according to the following format:
\begin{framed} \begin{framed}
@ -2485,6 +2504,10 @@ accuracy dates. For example:
\noindent\verb!D:201401031854-08'00'! (3rd March 2014, 6:54PM, US Pacific Standard Time) \noindent\verb!D:201401031854-08'00'! (3rd March 2014, 6:54PM, US Pacific Standard Time)
\end{framed} \end{framed}
\section{XMP Metadata Date Format}
\label{xmpdate}
\backmatter \backmatter
\pagestyle{fancy} \pagestyle{fancy}