diff --git a/cpdfcommand.ml b/cpdfcommand.ml index e2524eb..c4257b9 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -449,7 +449,6 @@ type args = mutable createpdf_pagesize : Pdfpaper.t; mutable removeonly : string option; mutable jsonparsecontentstreams : bool; - mutable jsonprecombinecontentstreams : bool; mutable jsonnostreamdata : bool; mutable jsondecompressstreams : bool; mutable ocgrenamefrom : string; @@ -555,7 +554,6 @@ let args = createpdf_pagesize = Pdfpaper.a4; removeonly = None; jsonparsecontentstreams = false; - jsonprecombinecontentstreams = false; jsonnostreamdata = false; jsondecompressstreams = false; ocgrenamefrom = ""; @@ -646,7 +644,6 @@ let reset_arguments () = args.createpdf_pagesize <- Pdfpaper.a4; args.removeonly <- None; args.jsonparsecontentstreams <- false; - args.jsonprecombinecontentstreams <- false; args.jsonnostreamdata <- false; args.jsondecompressstreams <- false; args.ocgrenamefrom <- ""; @@ -1502,9 +1499,6 @@ let setgsquiet () = let setjsonparsecontentstreams () = args.jsonparsecontentstreams <- true -let setjsonprecombinecontentstreams () = - args.jsonprecombinecontentstreams <- true - let setjsonnostreamdata () = args.jsonnostreamdata <- true @@ -2199,9 +2193,6 @@ and specs = ("-output-json-parse-content-streams", Arg.Unit setjsonparsecontentstreams, " Parse content streams"); - ("-output-json-precombine-content-streams", - Arg.Unit setjsonprecombinecontentstreams, - " Precombine content streams"); ("-output-json-no-stream-data", Arg.Unit setjsonnostreamdata, " Skip stream data for brevity"); @@ -3417,7 +3408,6 @@ let write_json output pdf = ~parse_content:args.jsonparsecontentstreams ~no_stream_data:args.jsonnostreamdata ~decompress_streams:args.jsondecompressstreams - ~precombine_page_content:args.jsonprecombinecontentstreams pdf | File filename -> let f = open_out filename in @@ -3426,7 +3416,6 @@ let write_json output pdf = ~parse_content:args.jsonparsecontentstreams ~no_stream_data:args.jsonnostreamdata ~decompress_streams:args.jsondecompressstreams - ~precombine_page_content:args.jsonprecombinecontentstreams pdf; close_out f diff --git a/cpdfjson.ml b/cpdfjson.ml index ffc7641..fb8eba0 100644 --- a/cpdfjson.ml +++ b/cpdfjson.ml @@ -287,10 +287,10 @@ let json_of_op pdf no_stream_data = function | O.Op_M m -> `List [mkfloat m; `String "M"] | O.Op_ri s -> `List [`String s; `String "ri"] | O.Op_i i -> `List [mkint i; `String "i"] - | O.Op_c (a, b, c, d, e, k) -> + | O.Op_c (a, b, c, d, e, f) -> `List [mkfloat a; mkfloat b; mkfloat c; - mkfloat d; mkfloat e; mkfloat k; `String "c"] + mkfloat d; mkfloat e; mkfloat f; `String "c"] | O.Op_v (a, b, c, d) -> `List [mkfloat a; mkfloat b; mkfloat c; @@ -318,10 +318,10 @@ let json_of_op pdf no_stream_data = function | O.Op_' s -> `List [`String s; `String "'"] | O.Op_'' (k, k', s) -> `List [mkfloat k; mkfloat k'; `String s; `String "''"] | O.Op_d0 (k, k') -> `List [mkfloat k; mkfloat k'; `String "d0"] - | O.Op_d1 (a, b, c, d, e, k) -> + | O.Op_d1 (a, b, c, d, e, f) -> `List [mkfloat a; mkfloat b; mkfloat c; - mkfloat d; mkfloat e; mkfloat k; `String "d1"] + mkfloat d; mkfloat e; mkfloat f; `String "d1"] | O.Op_cs s -> `List [`String s; `String "cs"] | O.Op_SC fs -> `List (map (fun x -> mkfloat x) fs @ [`String "SC"]) | O.Op_sc fs -> `List (map (fun x -> mkfloat x) fs @ [`String "sc"]) @@ -354,7 +354,7 @@ let parse_content_stream pdf resources bs = if not split on op boundaries, each one would fail to parse on its own. The caller should really only do this on otherwise-failing files, since it could blow up any shared content streams. *) -let do_precombine_page_content pdf = +let precombine_page_content pdf = let pages' = map (fun page -> @@ -371,10 +371,10 @@ let do_precombine_page_content pdf = Pdfpage.change_pages true pdf pages' let json_of_pdf - ~parse_content ~no_stream_data ~decompress_streams ~precombine_page_content + ~parse_content ~no_stream_data ~decompress_streams pdf = - let pdf = if parse_content && precombine_page_content then do_precombine_page_content pdf else pdf in + let pdf = if parse_content then precombine_page_content pdf else pdf in if decompress_streams then Pdf.objiter (fun _ obj -> Pdfcodec.decode_pdfstream_until_unknown pdf obj) pdf; Pdf.remove_unreferenced pdf; @@ -432,8 +432,8 @@ let json_of_pdf (fun (objnum, jsonobj) -> `List [`Int objnum; jsonobj]) pairs_parsed) -let to_output o ~parse_content ~no_stream_data ~decompress_streams ~precombine_page_content pdf = - let json = json_of_pdf ~parse_content ~no_stream_data ~decompress_streams ~precombine_page_content pdf in +let to_output o ~parse_content ~no_stream_data ~decompress_streams pdf = + let json = json_of_pdf ~parse_content ~no_stream_data ~decompress_streams pdf in match o.Pdfio.out_caml_channel with | Some ch -> J.pretty_to_channel ch json | None -> o.Pdfio.output_string (J.pretty_to_string json) diff --git a/cpdfjson.mli b/cpdfjson.mli index 1e7b837..6abe8cb 100644 --- a/cpdfjson.mli +++ b/cpdfjson.mli @@ -1,2 +1,2 @@ -val to_output : Pdfio.output -> parse_content:bool -> no_stream_data:bool -> decompress_streams:bool -> precombine_page_content:bool -> Pdf.t -> unit +val to_output : Pdfio.output -> parse_content:bool -> no_stream_data:bool -> decompress_streams:bool -> Pdf.t -> unit val of_input : Pdfio.input -> Pdf.t