mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-05-04 19:58:48 +02:00
Begin implementation of javascript functions
This commit is contained in:
parent
022bc0b7ad
commit
b9c14fcebb
1
Changes
1
Changes
@ -3,6 +3,7 @@
|
|||||||
New features:
|
New features:
|
||||||
|
|
||||||
o CCITT and CCITTG4 encoders in -process-images
|
o CCITT and CCITTG4 encoders in -process-images
|
||||||
|
o Detect and remove JavaScript
|
||||||
|
|
||||||
Extended features:
|
Extended features:
|
||||||
|
|
||||||
|
@ -3830,16 +3830,16 @@ let write_images device res quality boxname annots antialias downsample spec pdf
|
|||||||
Sys.remove tmppdf
|
Sys.remove tmppdf
|
||||||
|
|
||||||
let remove_javascript pdf =
|
let remove_javascript pdf =
|
||||||
(* Find /S /JavaScript and empty the /JS string *)
|
(* Find /S /JavaScript and empty the /JS string. Also, Empty out any /URI (javascript). *)
|
||||||
|
Pdf.objselfmap (fun o -> o) pdf
|
||||||
(* Process the /Root -> /Names -> /JavaScript *)
|
(* Process the /Root -> /Names -> /JavaScript *)
|
||||||
(* Empty out and /URL (javascript:...*)
|
(*Pdf.remove_chain pdf ["/Root"; "/Names"; "/JavaScript"];*)
|
||||||
()
|
|
||||||
|
|
||||||
let contains_javascript pdf =
|
let contains_javascript pdf =
|
||||||
(* Any dictionary with /S /JavaScript; or
|
let found = ref false in
|
||||||
Any /Root -> /Names -> /JavaScript; or
|
(* Any dictionary with /S /JavaScript or any /URI (javascript:...) *)
|
||||||
Any /URL (javascript:...) *)
|
(* Any /Root -> /Names -> /JavaScript *)
|
||||||
()
|
print_string (Printf.sprintf "%b" !found)
|
||||||
|
|
||||||
(* Main function *)
|
(* Main function *)
|
||||||
let go () =
|
let go () =
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
%Document negative widths in -thinlines
|
%Document negative widths in -thinlines
|
||||||
%Document CCITT and CCITTG4 in -process-images
|
%Document CCITT and CCITTG4 in -process-images
|
||||||
%Document -decompress-just-content
|
%Document -decompress-just-content
|
||||||
|
%Document -contains-javascript and -remove-javascript
|
||||||
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
|
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
|
||||||
\documentclass{book}
|
\documentclass{book}
|
||||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user