Add XFA detection
This commit is contained in:
parent
28fe2a7f6f
commit
f0b5edd086
1
Changes
1
Changes
|
@ -13,6 +13,7 @@ o Add @b<n>@ 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:
|
||||
|
||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue