This commit is contained in:
John Whitington 2023-05-11 15:55:48 +01:00
parent b5ad08f196
commit 5f83c581f7
2 changed files with 7 additions and 11 deletions

View File

@ -1893,9 +1893,7 @@ let closepath () =
addop Cpdfdraw.ClosePath
let setthickness s =
try
addop (Cpdfdraw.SetLineThickness (float_of_string s))
with
try addop (Cpdfdraw.SetLineThickness (float_of_string s)) with
_ -> error "Thickness must be a number"
let setcap s =
@ -1919,9 +1917,7 @@ let setjoin s =
addop (Cpdfdraw.SetLineJoin num)
let setmiter s =
try
addop (Cpdfdraw.SetMiterLimit (float_of_string s))
with
try addop (Cpdfdraw.SetMiterLimit (float_of_string s)) with
_ -> error "Miter limit must be a number"
let setdash s =
@ -2089,7 +2085,6 @@ let addspecialtext s =
let addleading f =
addop (Cpdfdraw.Leading f)
let addcharspace f =
addop (Cpdfdraw.CharSpace f)

View File

@ -1,4 +1,5 @@
open Pdfutil
open Cpdferror
type colspec =
NoCol
@ -93,7 +94,7 @@ let resstack =
ref [empty_res ()]
let res () =
hd !resstack
try hd !resstack with _ -> error "graphics stack empty"
let rescopy r =
{r with
@ -106,7 +107,7 @@ let respush () =
resstack := (rescopy (res ()))::!resstack
let respop () =
let n = (hd !resstack).num in
let n = (res ()).num in
resstack := tl !resstack;
(* not necessary, since names are isolated in the xobject, but it makes
manual debugging of PDF files easier if we don't re-use numbers *)
@ -202,11 +203,11 @@ let rec ops_of_drawop pdf endpage filename bates batespad num page = function
create_form_xobject a b c d pdf endpage filename bates batespad num page n ops;
[]
| Use n ->
let pdfname = try fst (Hashtbl.find (res ()).form_xobjects n) with _ -> Cpdferror.error ("Form XObject not found: " ^ n) in
let pdfname = try fst (Hashtbl.find (res ()).form_xobjects n) with _ -> error ("Form XObject not found: " ^ n) in
(res ()).page_names <- pdfname::(res ()).page_names;
[Pdfops.Op_Do pdfname]
| Image s ->
let pdfname = try fst (Hashtbl.find (res ()).images s) with _ -> Cpdferror.error ("Image not found: " ^ s) in
let pdfname = try fst (Hashtbl.find (res ()).images s) with _ -> error ("Image not found: " ^ s) in
(res ()).page_names <- pdfname::(res ()).page_names;
[Pdfops.Op_Do pdfname]
| ImageXObject (s, obj) ->