From 73701b5d7dbe64a821627909315f57e0706d95a6 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 10 May 2023 17:03:53 +0100 Subject: [PATCH] more --- cpdfcommand.ml | 1 + cpdfdraw.ml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 0d0878c..6188f2e 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -4568,6 +4568,7 @@ let go_withargv argv = (*Printf.printf "AND:%b, %s\n" islast (Array.fold_left (fun x y -> x ^ " " ^ y) "" s); flprint "\n";*) reset_arguments (); + drawops := [("_MAIN", [])]; process_env_vars (); parse_argv () s (align_specs specs) anon_fun usage_msg; parse_argv () (Array.of_list ("cpdf"::!control_args)) (align_specs specs) anon_fun usage_msg; diff --git a/cpdfdraw.ml b/cpdfdraw.ml index 03c01d4..2b09fd9 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -58,7 +58,7 @@ type res = mutable current_font : Pdftext.font; mutable num : int} -let empty_res = +let empty_res () = {images = null_hash (); extgstates = null_hash (); fonts = null_hash (); @@ -69,7 +69,7 @@ let empty_res = num = 0} let resstack = - ref [empty_res] + ref [empty_res ()] let res () = hd !resstack @@ -302,6 +302,7 @@ let draw_single ~filename ~bates ~batespad fast range pdf drawops = Pdfpage.change_pages true pdf pages let draw ~filename ~bates ~batespad fast range pdf drawops = + resstack := [empty_res ()]; (res ()).time <- Cpdfstrftime.current_time (); let pdf = ref pdf in let range = ref range in