Strip out unused options
This commit is contained in:
parent
03fbc8b88d
commit
445c96408b
|
@ -3,7 +3,7 @@ let demo = false
|
||||||
let noncomp = false
|
let noncomp = false
|
||||||
let major_version = 2
|
let major_version = 2
|
||||||
let minor_version = 4
|
let minor_version = 4
|
||||||
let version_date = "(devel, 9th October 2020)"
|
let version_date = "(devel, 11th November 2020)"
|
||||||
|
|
||||||
open Pdfutil
|
open Pdfutil
|
||||||
open Pdfio
|
open Pdfio
|
||||||
|
@ -420,8 +420,6 @@ type args =
|
||||||
mutable mediabox_if_missing : bool;
|
mutable mediabox_if_missing : bool;
|
||||||
mutable topage : string option;
|
mutable topage : string option;
|
||||||
mutable scale_stamp_to_fit : bool;
|
mutable scale_stamp_to_fit : bool;
|
||||||
mutable keep_this_id : string option;
|
|
||||||
mutable makenewid : bool;
|
|
||||||
mutable labelstyle : Pdfpagelabels.labelstyle;
|
mutable labelstyle : Pdfpagelabels.labelstyle;
|
||||||
mutable labelprefix : string option;
|
mutable labelprefix : string option;
|
||||||
mutable labelstartval : int;
|
mutable labelstartval : int;
|
||||||
|
@ -522,8 +520,6 @@ let args =
|
||||||
mediabox_if_missing = false;
|
mediabox_if_missing = false;
|
||||||
topage = None;
|
topage = None;
|
||||||
scale_stamp_to_fit = false;
|
scale_stamp_to_fit = false;
|
||||||
keep_this_id = None;
|
|
||||||
makenewid = false;
|
|
||||||
labelstyle = Pdfpagelabels.DecimalArabic;
|
labelstyle = Pdfpagelabels.DecimalArabic;
|
||||||
labelprefix = None;
|
labelprefix = None;
|
||||||
labelstartval = 1;
|
labelstartval = 1;
|
||||||
|
@ -623,8 +619,6 @@ let reset_arguments () =
|
||||||
args.mediabox_if_missing <- false;
|
args.mediabox_if_missing <- false;
|
||||||
args.topage <- None;
|
args.topage <- None;
|
||||||
args.scale_stamp_to_fit <- false;
|
args.scale_stamp_to_fit <- false;
|
||||||
args.keep_this_id <- None;
|
|
||||||
args.makenewid <- false;
|
|
||||||
args.labelstyle <- Pdfpagelabels.DecimalArabic;
|
args.labelstyle <- Pdfpagelabels.DecimalArabic;
|
||||||
args.labelprefix <- None;
|
args.labelprefix <- None;
|
||||||
args.labelstartval <- 1;
|
args.labelstartval <- 1;
|
||||||
|
@ -1354,14 +1348,6 @@ let settopage s =
|
||||||
let setscalestamptofit () =
|
let setscalestamptofit () =
|
||||||
args.scale_stamp_to_fit <- true
|
args.scale_stamp_to_fit <- true
|
||||||
|
|
||||||
let setkeepthisid () =
|
|
||||||
match args.inputs with
|
|
||||||
| (InFile s, _, _, _, _, _)::_ -> args.keep_this_id <- Some s
|
|
||||||
| _ -> ()
|
|
||||||
|
|
||||||
let setmakenewid () =
|
|
||||||
args.makenewid <- true
|
|
||||||
|
|
||||||
let setjustifyleft () =
|
let setjustifyleft () =
|
||||||
args.justification <- Cpdf.LeftJustify
|
args.justification <- Cpdf.LeftJustify
|
||||||
|
|
||||||
|
@ -2514,7 +2500,6 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf =
|
||||||
if args.debugcrypt then Printf.printf "write_pdf\n";
|
if args.debugcrypt then Printf.printf "write_pdf\n";
|
||||||
if args.create_objstm && not args.keepversion
|
if args.create_objstm && not args.keepversion
|
||||||
then pdf.Pdf.minor <- max pdf.Pdf.minor 5;
|
then pdf.Pdf.minor <- max pdf.Pdf.minor 5;
|
||||||
let mk_id = args.makenewid || mk_id in
|
|
||||||
match args.out with
|
match args.out with
|
||||||
| NoOutputSpecified ->
|
| NoOutputSpecified ->
|
||||||
output_pdfs =| pdf
|
output_pdfs =| pdf
|
||||||
|
@ -3616,20 +3601,6 @@ let go () =
|
||||||
begin match args.out, args.inputs with
|
begin match args.out, args.inputs with
|
||||||
| _, (_::_ as inputs) ->
|
| _, (_::_ as inputs) ->
|
||||||
let op = match inputs with [_] -> None | _ -> Some Merge in
|
let op = match inputs with [_] -> None | _ -> Some Merge in
|
||||||
let write_pdf x pdf =
|
|
||||||
match args.keep_this_id with
|
|
||||||
| None -> write_pdf x pdf
|
|
||||||
| Some s ->
|
|
||||||
(* get the ID from the file with name 's', and copy to pdf *)
|
|
||||||
let namewiths =
|
|
||||||
keep (function (InFile s', _, _, _, _, _) when s' = s -> true | _ -> false) inputs
|
|
||||||
in
|
|
||||||
match namewiths with
|
|
||||||
| (namewiths, _, _, _, _, _) as input::t ->
|
|
||||||
let spdf = get_pdf_from_input_kind input op namewiths in
|
|
||||||
write_pdf x (Cpdf.copy_id true spdf pdf)
|
|
||||||
| _ -> write_pdf x pdf
|
|
||||||
in
|
|
||||||
let names, ranges, rotations, _, _, _ = split6 inputs in
|
let names, ranges, rotations, _, _, _ = split6 inputs in
|
||||||
let pdfs = map2 (fun i -> get_pdf_from_input_kind i op) inputs names in
|
let pdfs = map2 (fun i -> get_pdf_from_input_kind i op) inputs names in
|
||||||
(* If at least one file had object streams and args.preserve_objstm is true, set -objstm-create *)
|
(* If at least one file had object streams and args.preserve_objstm is true, set -objstm-create *)
|
||||||
|
@ -3877,7 +3848,7 @@ let go () =
|
||||||
try Pdfcodec.decode_pdfstream_until_unknown pdf stream with
|
try Pdfcodec.decode_pdfstream_until_unknown pdf stream with
|
||||||
e -> Printf.eprintf "Decode failure: %s. Carrying on...\n" (Printexc.to_string e); ())
|
e -> Printf.eprintf "Decode failure: %s. Carrying on...\n" (Printexc.to_string e); ())
|
||||||
pdf;
|
pdf;
|
||||||
write_pdf ~is_decompress:true args.makenewid pdf
|
write_pdf ~is_decompress:true false pdf
|
||||||
| Some Compress ->
|
| Some Compress ->
|
||||||
let pdf = get_single_pdf (Some Compress) false in
|
let pdf = get_single_pdf (Some Compress) false in
|
||||||
if args.remove_duplicate_streams then
|
if args.remove_duplicate_streams then
|
||||||
|
@ -4376,7 +4347,7 @@ let go () =
|
||||||
let newversion = if args.create_objstm then 5 else newversion in
|
let newversion = if args.create_objstm then 5 else newversion in
|
||||||
pdf.Pdf.minor <- max pdf.Pdf.minor newversion
|
pdf.Pdf.minor <- max pdf.Pdf.minor newversion
|
||||||
end;
|
end;
|
||||||
write_pdf ~encryption:(Some encryption) args.makenewid pdf
|
write_pdf ~encryption:(Some encryption) false pdf
|
||||||
| Some Decrypt ->
|
| Some Decrypt ->
|
||||||
args.recrypt <- false;
|
args.recrypt <- false;
|
||||||
write_pdf false (get_single_pdf args.op false)
|
write_pdf false (get_single_pdf args.op false)
|
||||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -3,7 +3,7 @@
|
||||||
\usepackage{microtype}
|
\usepackage{microtype}
|
||||||
\usepackage{graphics}
|
\usepackage{graphics}
|
||||||
\usepackage{upquote}
|
\usepackage{upquote}
|
||||||
\usepackage[plainpages=false,pdfpagelabels,pdfborder=0 0 0]{hyperref}
|
\usepackage[plainpages=false,pdfpagelabels,pdfborder=0 0 0,draft=false,hidelinks]{hyperref}
|
||||||
\usepackage{framed}
|
\usepackage{framed}
|
||||||
\newcommand{\smallgap}{\bigskip}
|
\newcommand{\smallgap}{\bigskip}
|
||||||
\newcommand{\cpdf}{\texttt{cpdf}}
|
\newcommand{\cpdf}{\texttt{cpdf}}
|
||||||
|
|
Loading…
Reference in New Issue