more
This commit is contained in:
parent
a395681efb
commit
2caa9de061
3
cpdf.ml
3
cpdf.ml
|
@ -2619,7 +2619,6 @@ let scale_pdf ?(fast=false) sxsylist pdf range =
|
||||||
process_pages scale_page pdf range
|
process_pages scale_page pdf range
|
||||||
|
|
||||||
(* Scale to fit page of size x * y *)
|
(* Scale to fit page of size x * y *)
|
||||||
(* FIXME: Can we do this in terms of scale_contents - and then just fix up the boxes? For 1.8 *)
|
|
||||||
let scale_to_fit_pdf ?(fast=false) input_scale xylist op pdf range =
|
let scale_to_fit_pdf ?(fast=false) input_scale xylist op pdf range =
|
||||||
let scale_page_to_fit pnum page =
|
let scale_page_to_fit pnum page =
|
||||||
let x, y = List.nth xylist (pnum - 1) in
|
let x, y = List.nth xylist (pnum - 1) in
|
||||||
|
@ -2642,7 +2641,7 @@ let scale_to_fit_pdf ?(fast=false) input_scale xylist op pdf range =
|
||||||
in
|
in
|
||||||
let page =
|
let page =
|
||||||
change_boxes
|
change_boxes
|
||||||
(function (minx, miny, maxx, maxy) -> 0., 0., x, y (* FIXME: scale boxes properly *))
|
(function (minx, miny, maxx, maxy) -> 0., 0., x, y)
|
||||||
pdf page
|
pdf page
|
||||||
in
|
in
|
||||||
Pdfpage.prepend_operators pdf [Pdfops.Op_cm matrix] ~fast
|
Pdfpage.prepend_operators pdf [Pdfops.Op_cm matrix] ~fast
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
(* FIXME DOC Added -relative-to-cropbox for stamps *)
|
|
||||||
(* cpdf command line tools *)
|
(* cpdf command line tools *)
|
||||||
let demo = false
|
let demo = false
|
||||||
let noncomp = false
|
let noncomp = false
|
||||||
|
@ -166,7 +165,6 @@ type op =
|
||||||
| RemoveDictEntry of string
|
| RemoveDictEntry of string
|
||||||
| ListSpotColours
|
| ListSpotColours
|
||||||
| RemoveClipping
|
| RemoveClipping
|
||||||
| ChangeFontSize of float
|
|
||||||
|
|
||||||
let string_of_op = function
|
let string_of_op = function
|
||||||
| CopyFont _ -> "CopyFont"
|
| CopyFont _ -> "CopyFont"
|
||||||
|
@ -271,7 +269,6 @@ let string_of_op = function
|
||||||
| RemoveDictEntry _ -> "RemoveDictEntry"
|
| RemoveDictEntry _ -> "RemoveDictEntry"
|
||||||
| ListSpotColours -> "ListSpotColours"
|
| ListSpotColours -> "ListSpotColours"
|
||||||
| RemoveClipping -> "RemoveClipping"
|
| RemoveClipping -> "RemoveClipping"
|
||||||
| ChangeFontSize _ -> "ChangeFontSize"
|
|
||||||
|
|
||||||
(* Inputs: filename, pagespec. *)
|
(* Inputs: filename, pagespec. *)
|
||||||
type input_kind =
|
type input_kind =
|
||||||
|
@ -382,8 +379,6 @@ type args =
|
||||||
mutable creator : string option;
|
mutable creator : string option;
|
||||||
mutable producer : string option;
|
mutable producer : string option;
|
||||||
mutable embedfonts : bool;
|
mutable embedfonts : bool;
|
||||||
mutable change_font_size_shift : string;
|
|
||||||
mutable change_font_size_color : float * float * float;
|
|
||||||
mutable extract_text_font_size : float option}
|
mutable extract_text_font_size : float option}
|
||||||
|
|
||||||
let args =
|
let args =
|
||||||
|
@ -468,8 +463,6 @@ let args =
|
||||||
producer = None;
|
producer = None;
|
||||||
creator = None;
|
creator = None;
|
||||||
embedfonts = true;
|
embedfonts = true;
|
||||||
change_font_size_shift = "0 0";
|
|
||||||
change_font_size_color = (0., 0., 0.);
|
|
||||||
extract_text_font_size = None}
|
extract_text_font_size = None}
|
||||||
|
|
||||||
let reset_arguments () =
|
let reset_arguments () =
|
||||||
|
@ -548,7 +541,10 @@ let reset_arguments () =
|
||||||
args.squeeze <- false;
|
args.squeeze <- false;
|
||||||
args.producer <- None;
|
args.producer <- None;
|
||||||
args.creator <- None;
|
args.creator <- None;
|
||||||
args.embedfonts <- true
|
args.embedfonts <- true;
|
||||||
|
args.creator <- None;
|
||||||
|
args.producer <- None;
|
||||||
|
args.extract_text_font_size <- None
|
||||||
(* Do not reset original_filename or cpdflin or was_encrypted or
|
(* Do not reset original_filename or cpdflin or was_encrypted or
|
||||||
* was_decrypted_with_owner or recrypt, since we want these to work across ANDs. *)
|
* was_decrypted_with_owner or recrypt, since we want these to work across ANDs. *)
|
||||||
|
|
||||||
|
@ -618,7 +614,7 @@ let banned banlist = function
|
||||||
AddText _|ScaleContents _|AttachFile _|CopyAnnotations _|SetMetadata _|
|
AddText _|ScaleContents _|AttachFile _|CopyAnnotations _|SetMetadata _|
|
||||||
ThinLines _|SetAuthor _|SetTitle _|SetSubject _|SetKeywords _|SetCreate _|
|
ThinLines _|SetAuthor _|SetTitle _|SetSubject _|SetKeywords _|SetCreate _|
|
||||||
SetModify _|SetCreator _|SetProducer _|SetVersion _|RemoveDictEntry _ |
|
SetModify _|SetCreator _|SetProducer _|SetVersion _|RemoveDictEntry _ |
|
||||||
RemoveClipping | ChangeFontSize _ ->
|
RemoveClipping ->
|
||||||
mem Pdfcrypt.NoEdit banlist
|
mem Pdfcrypt.NoEdit banlist
|
||||||
|
|
||||||
let operation_allowed pdf banlist op =
|
let operation_allowed pdf banlist op =
|
||||||
|
@ -1531,15 +1527,6 @@ let setstayonerror () =
|
||||||
let setnoembedfont () =
|
let setnoembedfont () =
|
||||||
args.embedfonts <- false
|
args.embedfonts <- false
|
||||||
|
|
||||||
let setchangefontsizeto i =
|
|
||||||
args.op <- Some (ChangeFontSize i)
|
|
||||||
|
|
||||||
let setchangefontsizeshift s =
|
|
||||||
args.change_font_size_shift <- s
|
|
||||||
|
|
||||||
let setchangefontsizecolor s =
|
|
||||||
args.change_font_size_color <- parse_color s
|
|
||||||
|
|
||||||
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
(* Parse a control file, make an argv, and then make Arg parse it. *)
|
||||||
let rec make_control_argv_and_parse filename =
|
let rec make_control_argv_and_parse filename =
|
||||||
control_args := !control_args @ parse_control_file filename
|
control_args := !control_args @ parse_control_file filename
|
||||||
|
@ -3949,11 +3936,6 @@ let go () =
|
||||||
let pdf = get_single_pdf args.op false in
|
let pdf = get_single_pdf args.op false in
|
||||||
let range = parse_pagespec pdf (get_pagespec ()) in
|
let range = parse_pagespec pdf (get_pagespec ()) in
|
||||||
write_pdf false (remove_clipping pdf range)
|
write_pdf false (remove_clipping pdf range)
|
||||||
| Some (ChangeFontSize target_size) ->
|
|
||||||
let pdf = get_single_pdf args.op false in
|
|
||||||
let range = parse_pagespec pdf (get_pagespec ()) in
|
|
||||||
let dx, dy = parse_coordinate pdf args.change_font_size_shift in
|
|
||||||
write_pdf false (change_font_size pdf range args.change_font_size_color dx dy args.fontsize target_size)
|
|
||||||
|
|
||||||
let parse_argv () =
|
let parse_argv () =
|
||||||
if args.debug then
|
if args.debug then
|
||||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -1202,12 +1202,12 @@ the file using a different page range each time.
|
||||||
\index{stamps}
|
\index{stamps}
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\noindent\small\verb!cpdf -stamp-on source.pdf!\\
|
\noindent\small\verb!cpdf -stamp-on source.pdf!\\
|
||||||
\noindent\small\verb! ([-scale-stamp-to-fit] | [<positioning command>]) !\\
|
\noindent\small\verb! [-scale-stamp-to-fit] [<positioning command>] [-relative-to-cropbox] !\\
|
||||||
\noindent\small\verb! in.pdf [<range>] -o out.pdf!
|
\noindent\small\verb! in.pdf [<range>] -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\noindent\small\verb!cpdf -stamp-under source.pdf!\\
|
\noindent\small\verb!cpdf -stamp-under source.pdf!\\
|
||||||
\noindent\small\verb! ([-scale-stamp-to-fit] | [<positioning command>]) !\\
|
\noindent\small\verb! [-scale-stamp-to-fit] [<positioning command>] [-relative-to-cropbox]!\\
|
||||||
\noindent\small\verb! in.pdf [<range>] -o out.pdf!
|
\noindent\small\verb! in.pdf [<range>] -o out.pdf!
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
|
@ -1264,6 +1264,8 @@ as the length of the ``under'' file. For instance:
|
||||||
file. For best results, remove any rotation differences in the two files using
|
file. For best results, remove any rotation differences in the two files using
|
||||||
\texttt{-upright} first.
|
\texttt{-upright} first.
|
||||||
|
|
||||||
|
\noindent The \texttt{-relative-to-cropbox} option takes the positioning command to be relative to the cro box of each page rather than the media box.
|
||||||
|
|
||||||
\section{Stamp Text, Dates and Times.}
|
\section{Stamp Text, Dates and Times.}
|
||||||
\index{date}
|
\index{date}
|
||||||
\index{time}
|
\index{time}
|
||||||
|
|
Loading…
Reference in New Issue