mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Adds, documents -remove-obj
This commit is contained in:
@ -4871,7 +4871,8 @@ let go () =
|
|||||||
write_pdf false pdf
|
write_pdf false pdf
|
||||||
| Some (RemoveObj s) ->
|
| Some (RemoveObj s) ->
|
||||||
let pdf = get_single_pdf args.op true in
|
let pdf = get_single_pdf args.op true in
|
||||||
Cpdftweak.remove_obj pdf s
|
Cpdftweak.remove_obj pdf s;
|
||||||
|
write_pdf false pdf
|
||||||
| Some (Verify standard) ->
|
| Some (Verify standard) ->
|
||||||
begin match standard with
|
begin match standard with
|
||||||
| "PDF/UA-1(matterhorn)" ->
|
| "PDF/UA-1(matterhorn)" ->
|
||||||
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
@ -2611,6 +2611,8 @@ font size and color.
|
|||||||
\noindent\small\verb!cpdf -remove-text in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -remove-text in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
|
\noindent NB: Cpdf can only use characters available in the font specified. If necessary, supply your own font with \texttt{-load-ttf} (see below). Times Roman as used in the preceding example refers to the Standard PDF font Times Roman, not the Times Roman which is likely to be supplied with your computer system -- which may have more characters available.
|
||||||
|
|
||||||
\subsection{Page Numbers and other Special Codes}
|
\subsection{Page Numbers and other Special Codes}
|
||||||
\index{page!numbers}
|
\index{page!numbers}
|
||||||
There are various special codes to include the page number in the text:
|
There are various special codes to include the page number in the text:
|
||||||
@ -2761,7 +2763,7 @@ specifies the size in points:
|
|||||||
\noindent\small\verb!cpdf -add-text "-%Page-" -font-size 36 in.pdf -o out.pdf!
|
\noindent\small\verb!cpdf -add-text "-%Page-" -font-size 36 in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\noindent Adding \texttt{-embed-std14 <directory>}, given a directory holding the URW Base35 free fonts, will embed subsetted font files in the PDF for any of the Standard fonts used. These free fonts may be downloaded from \url{https://github.com/ArtifexSoftware/urw-base35-fonts}. This is important, for example, for PDF/A documents, which must have their fonts embedded.
|
\noindent Adding \texttt{-embed-std14 <directory>}, given a directory holding the URW Base35 free fonts, will embed subsetted font files in the PDF for any of the Standard fonts used. These free fonts may be downloaded from \url{https://github.com/ArtifexSoftware/urw-base35-fonts}. This is important, for example, for PDF/A or PDF/UA documents, which must have their fonts embedded.
|
||||||
|
|
||||||
The standard fonts cover only the Latin characters, and are limiting. Other TrueType fonts may be introduced with the \texttt{-load-ttf} option, giving a name for, and the file name of the font. For example:
|
The standard fonts cover only the Latin characters, and are limiting. Other TrueType fonts may be introduced with the \texttt{-load-ttf} option, giving a name for, and the file name of the font. For example:
|
||||||
|
|
||||||
@ -6289,12 +6291,8 @@ The following table lists each mechanically-verifiable test from the Matterhorn
|
|||||||
\noindent\verb!cpdf -remove-all-text in.pdf [<range>] -o out.pdf!
|
\noindent\verb!cpdf -remove-all-text in.pdf [<range>] -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\noindent\verb!cpdf -blacktext in.pdf [<range>] -o out.pdf!
|
\noindent\verb!cpdf -blacktext in.pdf [<range>] -o out.pdf!\\
|
||||||
|
\noindent\verb!cpdf -blacklines in.pdf [<range>] -o out.pdf!\\
|
||||||
\vspace{1.5mm}
|
|
||||||
\noindent\verb!cpdf -blacklines in.pdf [<range>] -o out.pdf!
|
|
||||||
|
|
||||||
\vspace{1.5mm}
|
|
||||||
\noindent\verb!cpdf -blackfills in.pdf [<range>] -o out.pdf!
|
\noindent\verb!cpdf -blackfills in.pdf [<range>] -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
@ -6333,7 +6331,8 @@ The following table lists each mechanically-verifiable test from the Matterhorn
|
|||||||
\noindent\verb!cpdf -obj[-json] <object specification> in.pdf!
|
\noindent\verb!cpdf -obj[-json] <object specification> in.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\noindent\verb!cpdf -replace-obj <object specification>=<object> in.pdf!
|
\noindent\verb!cpdf -replace-obj <object specification>=<object> in.pdf -o out.pdf!\\
|
||||||
|
\noindent\verb!cpdf -remove-obj <object number> in.pdf -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\noindent\verb!cpdf -extract-stream[-decompress] <object specification>!\\
|
\noindent\verb!cpdf -extract-stream[-decompress] <object specification>!\\
|
||||||
@ -6638,7 +6637,17 @@ We may also edit dictionary entries with \texttt{-replace-obj} by giving an obje
|
|||||||
|
|
||||||
\noindent Any part of the object specification not already present will be fabricated using direct nested dictionaries. For example, if \texttt{/MarkInfo} does not exist in the root dictionary, this command adds \texttt{/MarkInfo <</Marked true>>} to the root dictionary.
|
\noindent Any part of the object specification not already present will be fabricated using direct nested dictionaries. For example, if \texttt{/MarkInfo} does not exist in the root dictionary, this command adds \texttt{/MarkInfo <</Marked true>>} to the root dictionary.
|
||||||
|
|
||||||
Stream contents may be replaced with \texttt{-replace-stream}:
|
An object may be remove with \texttt{-remove-obj}:
|
||||||
|
|
||||||
|
\begin{framed}
|
||||||
|
\small\noindent\verb!cpdf -remove-obj 6 in.pdf -o out.pdf!
|
||||||
|
|
||||||
|
\vspace{2.5mm}
|
||||||
|
\noindent Remove object 6 from \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
||||||
|
\end{framed}
|
||||||
|
|
||||||
|
|
||||||
|
\noindent Stream contents may be replaced with \texttt{-replace-stream}:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\noindent\verb!cpdf -replace-stream 4 -replace-stream-with in.dat in.pdf -o out.pdf!
|
\small\noindent\verb!cpdf -replace-stream 4 -replace-stream-with in.dat in.pdf -o out.pdf!
|
||||||
|
@ -313,7 +313,8 @@ let replace_obj pdf objspec obj =
|
|||||||
try Pdf.replace_chain pdf (split_chain objspec) obj with
|
try Pdf.replace_chain pdf (split_chain objspec) obj with
|
||||||
_ -> raise (Pdf.PDFError "Chain not found")
|
_ -> raise (Pdf.PDFError "Chain not found")
|
||||||
|
|
||||||
let remove_obj pdf objspec = ()
|
let remove_obj pdf objspec =
|
||||||
|
Pdf.removeobj pdf (int_of_string objspec)
|
||||||
|
|
||||||
(* Replace a stream from a file e.g 4=data.dat replaces contents of object 4.
|
(* Replace a stream from a file e.g 4=data.dat replaces contents of object 4.
|
||||||
The stream dictionary is altered only to correct the length. *)
|
The stream dictionary is altered only to correct the length. *)
|
||||||
|
Reference in New Issue
Block a user