diff --git a/Changes b/Changes index 1fe9242..0b4de2b 100644 --- a/Changes +++ b/Changes @@ -13,6 +13,7 @@ o Add @b@ for trimming bookmark text to given length o Allow bold, italic, colours for JSON bookmarks o Show OpenAction in -info o Show more form information in -info +o Show XFA in -info Fixes: diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 703e504..d8d5f0f 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 84b7db3..2574850 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -3257,6 +3257,7 @@ CenterWindow: DisplayDocTitle: True NonFullScreenPageMode: AcroForm: False +XFA: False Marked: False UserProperties: False Suspects: False @@ -3312,6 +3313,7 @@ The \texttt{-info-json} operation prints the information in JSON format instead. "DisplayDocTitle": true, "NonFullPageScreenMode": null, "AcroForm": false, + "XFA": false, "Marked": false, "UserProperties": false, "Suspects": false, diff --git a/cpdfmetadata.ml b/cpdfmetadata.ml index 1711fc6..0099fd7 100644 --- a/cpdfmetadata.ml +++ b/cpdfmetadata.ml @@ -239,6 +239,9 @@ let get_open_action_string pdf = | `Null -> "" | j -> Pdfwrite.string_of_pdf (Cpdfjson.object_of_json j) +let is_xfa pdf = + Pdf.lookup_chain pdf pdf.Pdf.trailerdict ["/Root"; "/AcroForm"; "/XFA"] <> None + let output_info ?(json=ref [("none", `Null)]) encoding pdf = let notjson = !json = [("none", `Null)] in let getstring = getstring encoding pdf in @@ -292,6 +295,8 @@ let output_info ?(json=ref [("none", `Null)]) encoding pdf = json =| ("NonFullPageScreenMode", match (get_viewer_pref_item "/NonFullPageScreenMode" pdf) with "" -> `Null | x -> `String x); if notjson then Printf.printf "AcroForm: %s\n" (match get_catalog_item "/AcroForm" pdf with "" -> "False" | x -> x); json =| ("AcroForm", match (get_catalog_item "/AcroForm" pdf) with "" -> `Bool false | x -> `Bool true); + if notjson then Printf.printf "XFA: %s\n" (if is_xfa pdf then "True" else "False"); + json =| ("XFA", `Bool (is_xfa pdf)); if notjson then Printf.printf "Marked: %s\n" (match get_markinfo_item "/Marked" pdf with true -> "True" | _ -> "False"); json =| ("Marked", `Bool (get_markinfo_item "/Marked" pdf)); if notjson then Printf.printf "UserProperties: %s\n" (match get_markinfo_item "/UserProperties" pdf with true -> "True" | _ -> "False");