PDFium Component Docs

JavaScriptActionCount 속성

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
컴포넌트: TPdf  ·  유닛: PDFium
Number of document-level JavaScript actions stored in the PDF.

구문

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에 있습니다

문서가 로드되지 않거나 ActiveFalse이거나 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” 경고를 띄우는 데 유용합니다

비고

예제

// 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;

참고 항목

JavaScriptAction, JavaScriptActions, Permissions