property JavaScriptActionCount: Integer; // read only
document level에 선언된 JavaScript action의 수를 반환합니다 —
일반적으로 catalog의 /Names /JavaScript name tree 아래의 entry입니다
(PDF 1.7 spec section 12.6.4.16) plus document-level OpenAction,
DA, WC, WS, DS, WP,
DP entry 중 action dictionary가 JS stream을 담고 있는 경우를
포함합니다. Field-level 및 annotation-level script는 포함하지 않습니다. 그것들은
annotations 또는 AcroForm field dictionary에 있습니다
문서가 로드되지 않거나 Active가 False이거나 PDF에
document-level script가 전혀 없으면 값은 0입니다. 단일 entry를
가져오려면 JavaScriptAction[Index]를 사용해 TPdfJavaScriptAction
record(Name + Script source)를 가져오거나, 한 번에 전체 array가 필요하면
JavaScriptActions를 사용하세요
이 property를 읽는 비용은 낮습니다 — PDFium은 script를 실행하지 않고 name tree만 순회합니다. PDFiumPas는 JavaScript를 평가하지 않습니다; 반환되는 string은 순수한 inspection data이며, 포렌식 분석, 배포 전 script 제거, 또는 사용자에게 “Document contains JavaScript” 경고를 띄우는 데 유용합니다
JavaScriptActions 대신 indexed accessor를 느긋하게 iterate하세요Name entry는 유효합니다 — PDF는 이름 없는 action dictionary를
허용합니다(예: OpenAction). Name이 유일하다고도 가정하지 마세요
// Warn the user if the PDF carries embedded JavaScript.
if Pdf1.JavaScriptActionCount > 0 then
if MessageDlg('This document contains JavaScript. Open anyway?',
mtWarning, [mbYes, mbNo], 0) = mrNo then
Pdf1.Active := False;