diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 1658643..982e298 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -530,6 +530,7 @@ type args = mutable length_threshold : int; mutable percentage_threshold : int; mutable dpi_threshold : int; + mutable dpi_target : int; mutable resample_factor : int; mutable resample_interpolate : bool} @@ -662,6 +663,7 @@ let args = length_threshold = 100; percentage_threshold = 99; dpi_threshold = 0; + dpi_target = 0; resample_factor = 101; resample_interpolate = false} @@ -780,6 +782,7 @@ let reset_arguments () = args.length_threshold <- 100; args.percentage_threshold <- 99; args.dpi_threshold <- 0; + args.dpi_target <- 0; args.resample_factor <- 101; args.resample_interpolate <- false; clear Cpdfdrawcontrol.fontpack_initialised @@ -1968,6 +1971,9 @@ let setpercentagethreshold i = let setdpithreshold i = args.dpi_threshold <- i +let setdpitarget i = + args.dpi_target <- i + let setlosslessresample i = args.resample_factor <- i @@ -2787,6 +2793,9 @@ and specs = ("-resample-interpolate", Arg.Unit setresampleinterpolate, " Interpolate when resampling"); + ("-dpi-target", + Arg.Int setdpitarget, + " Resample to this dpi when using -lossless-resample"); ("-squeeze", Arg.Unit setsqueeze, " Squeeze"); @@ -4527,7 +4536,7 @@ let go () = Cpdfimage.process ~q:args.jpegquality ~qlossless:args.jpegqualitylossless ~onebppmethod:args.onebppmethod ~length_threshold:args.length_threshold ~percentage_threshold:args.percentage_threshold ~pixel_threshold:args.pixel_threshold - ~dpi_threshold:args.dpi_threshold ~factor:args.resample_factor ~interpolate:args.resample_interpolate + ~dpi_threshold:args.dpi_threshold ~dpi_target:args.dpi_target ~factor:args.resample_factor ~interpolate:args.resample_interpolate ~path_to_jbig2enc:args.path_to_jbig2enc ~path_to_convert:args.path_to_convert range pdf; write_pdf false pdf diff --git a/cpdfimage.ml b/cpdfimage.ml index e918136..70a0f57 100644 --- a/cpdfimage.ml +++ b/cpdfimage.ml @@ -716,7 +716,7 @@ let recompress_1bpp_jbig2_lossless ~pixel_threshold ~length_threshold ~path_to_j - JBIG2 with refinement coding for multipage lossless? *) let process ?q ?qlossless ?onebppmethod ~length_threshold ~percentage_threshold ~pixel_threshold ~dpi_threshold - ~factor ~interpolate ~path_to_jbig2enc ~path_to_convert range pdf + ~dpi_target ~factor ~interpolate ~path_to_jbig2enc ~path_to_convert range pdf = let inrange = match images pdf range with diff --git a/cpdfimage.mli b/cpdfimage.mli index cc8563b..e0316bc 100644 --- a/cpdfimage.mli +++ b/cpdfimage.mli @@ -18,7 +18,7 @@ val images : Pdf.t -> int list -> Cpdfyojson.Safe.t val process : ?q:int -> ?qlossless:int -> ?onebppmethod:string -> length_threshold:int -> percentage_threshold:int -> pixel_threshold:int -> - dpi_threshold:int -> factor:int -> interpolate:bool -> + dpi_threshold:int -> dpi_target:int -> factor:int -> interpolate:bool -> path_to_jbig2enc:string -> path_to_convert:string -> int list -> Pdf.t -> unit (**/**)