easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

GetDocumentJavaScriptsCount Method

Gets the number of document-level JavaScripts in the PDF.

Function GetDocumentJavaScriptsCount(InputFileName As String) As Long

int GetDocumentJavaScriptsCount(string InputFileName)

int GetDocumentJavaScriptsCount(String InputFileName)


Return Values

The number of document-level JavaScripts in the PDF. 0 means no scripts, 1 means a single script, and so on.


Each script is auto-executed upon document open. All JavaScript function definitions are global, and available to be called from other scripts in the PDF. Multiple scripts behave as if they were merged into a single big script.

To enumerate all scripts in a document, use functions GetDocumentJavaScriptsCount, GetDocumentJavaScriptName, GetDocumentJavaScriptContent.

Note: This function only counts the global document-level scripts, and ignores local JavaScript actions in annotations, hyperlinks, form fields, etc.

Example Usage

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
scriptsCount = oProcessor.GetDocumentJavaScriptsCount("C:\test\input.pdf")
MsgBox "The document has " & scriptsCount & " global script(s)."