THotPDF.GetLoadedJavaScriptSource Method
Reads the source code of the document-level JavaScript script with the specified name in the loaded PDF document
Declaration
function GetLoadedJavaScriptSource(const AName: AnsiString): AnsiString;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
AName | The name of the script entry in the JavaScript name tree, used to locate the target script |
Return value
Returns the JavaScript source code string corresponding to the specified name; returns an empty string if the name does not exist
Usage notes
- PDF 中的文档级 JavaScript 存储在名称树(Names > JavaScript)中,需要使用正确的脚本名称才能定位
- Some PDF generation tools use FlateDecode compression to store JavaScript streams; this method returns the uncompressed original script text
- For security reasons, do not directly execute JavaScript code extracted from third-party PDFs without the user's knowledge