Roll back wrong new annotation transformation code

This commit is contained in:
John Whitington 2020-07-28 16:26:26 +01:00
parent 40170283be
commit 655723c505
1 changed files with 6 additions and 6 deletions

12
cpdf.ml
View File

@ -2301,7 +2301,7 @@ let transform_rect transform rect =
(* This is used to transform the BBox inside a form xobject representing an (* This is used to transform the BBox inside a form xobject representing an
* annotation appearance.*) * annotation appearance.*)
let transform_xobject_in_place pdf transform i = (*let transform_xobject_in_place pdf transform i =
Printf.printf "transforming xobject %i as part of annotation\n" i; Printf.printf "transforming xobject %i as part of annotation\n" i;
let obj = Pdf.lookup_obj pdf i in let obj = Pdf.lookup_obj pdf i in
match Pdf.lookup_direct pdf "/BBox" obj with match Pdf.lookup_direct pdf "/BBox" obj with
@ -2309,7 +2309,7 @@ let transform_xobject_in_place pdf transform i =
Printf.printf "Found bbox %s\n" (Pdfwrite.string_of_pdf bbox); Printf.printf "Found bbox %s\n" (Pdfwrite.string_of_pdf bbox);
let obj = Pdf.add_dict_entry obj "/BBox" (transform_rect transform bbox) in let obj = Pdf.add_dict_entry obj "/BBox" (transform_rect transform bbox) in
Pdf.addobj_given_num pdf (i, obj) Pdf.addobj_given_num pdf (i, obj)
| None -> () | None -> ()*)
(* Apply transformations to any annotations in /Annots (i.e their /Rect entries) *) (* Apply transformations to any annotations in /Annots (i.e their /Rect entries) *)
let transform_annotations pdf transform rest = let transform_annotations pdf transform rest =
@ -2327,13 +2327,13 @@ let transform_annotations pdf transform rest =
Some rect -> transform_rect transform rect Some rect -> transform_rect transform rect
| None -> raise (Pdf.PDFError "transform_annotations: no rect") | None -> raise (Pdf.PDFError "transform_annotations: no rect")
in in
let ap' = (*let ap' =
match Pdf.lookup_direct pdf "/AP" annot with match Pdf.lookup_direct pdf "/AP" annot with
None -> None None -> None
| Some dict -> Some dict | Some dict -> Some dict
in in*)
let annot = Pdf.add_dict_entry annot "/Rect" rect' in let annot = Pdf.add_dict_entry annot "/Rect" rect' in
begin match ap' with (*begin match ap' with
None -> () None -> ()
| Some (Pdf.Dictionary dict) -> | Some (Pdf.Dictionary dict) ->
(* Each entry in the dictionary is either (* Each entry in the dictionary is either
@ -2370,7 +2370,7 @@ let transform_annotations pdf transform rest =
| _ -> Printf.eprintf "Malformed /AP structure c"; ()) | _ -> Printf.eprintf "Malformed /AP structure c"; ())
dict dict
| _ -> Printf.eprintf "Malformed /AP structure\n"; () | _ -> Printf.eprintf "Malformed /AP structure\n"; ()
end; end;*)
Pdf.addobj_given_num pdf (i, annot) Pdf.addobj_given_num pdf (i, annot)
| _ -> Printf.eprintf "transform_annotations: not indirect") | _ -> Printf.eprintf "transform_annotations: not indirect")
annots annots