more matterhorn fixes

This commit is contained in:
John Whitington 2024-07-02 15:08:14 +01:00
parent c8447f0ba1
commit f6f01b3001
1 changed files with 8 additions and 2 deletions

View File

@ -299,7 +299,8 @@ let matterhorn_09_005 st st2 pdf =
(* for each /LI, 1 or n /Lbl or /LBody or both *) (* for each /LI, 1 or n /Lbl or /LBody or both *)
| E ("/LI", []) -> merror_str "Empty /LI" | E ("/LI", []) -> merror_str "Empty /LI"
| E ("/LI", cs) -> iter check_li_child cs | E ("/LI", cs) -> iter check_li_child cs
| E (_, _) -> merror_str "Unknown child of /LI" | E ("/L", cs) -> check_l (E ("/L", cs))
| E (n, _) -> merror_str ("Unknown child of /LI: " ^ n)
(* need to check all children of /LBody too, to see if any is /L *) (* need to check all children of /LBody too, to see if any is /L *)
and check_li_child = function and check_li_child = function
| E (("/LBody"| "/Lbl"), cs) -> iter check_l cs | E (("/LBody"| "/Lbl"), cs) -> iter check_l cs
@ -640,10 +641,15 @@ let matterhorn_28_002 _ _ pdf =
(* An annotation, other than of subtype Widget, does not have a Contents entry (* An annotation, other than of subtype Widget, does not have a Contents entry
and does not have an alternative description (in the form of an Alt entry in and does not have an alternative description (in the form of an Alt entry in
the enclosing structure element). *) the enclosing structure element). *)
(* NB for future: "The requirements of this clause shall not apply to
annotations whose hidden flag is set or whose rectangle is outside the
CropBox or whose Subtype is Popup." *)
let matterhorn_28_004 _ _ pdf = let matterhorn_28_004 _ _ pdf =
let parent_tree = read_parent_tree pdf in let parent_tree = read_parent_tree pdf in
Pdf.objiter Pdf.objiter
(fun n obj -> match Pdf.lookup_direct pdf "/Subtype" obj with (fun n obj ->
(*flprint (Pdfwrite.string_of_pdf obj ^ "\n");*)
match Pdf.lookup_direct pdf "/Subtype" obj with
| Some (Pdf.Name | Some (Pdf.Name
("/Stamp" | "/Line" | "Square" | "/Circle" | "/Polygon" | "/PolyLine" | ("/Stamp" | "/Line" | "Square" | "/Circle" | "/Polygon" | "/PolyLine" |
"/Highlight" | "/Underline" | "/Squiggly" | "/StrikeOut" | "/Caret" | "/Highlight" | "/Underline" | "/Squiggly" | "/StrikeOut" | "/Caret" |