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

GetDocumentJavaScriptContent Method

Gets the content of a specific document-level JavaScript in the PDF. It can be used to enumerate all scripts.

Function GetDocumentJavaScriptContent(InputFileName As String, IndexOrName As Variant) As String

string GetDocumentJavaScriptContent(string InputFileName, NameOrIndex IndexOrName)

String GetDocumentJavaScriptContent(String InputFileName, NameOrIndex IndexOrName) throws PDFProcessorException

Where NameOrIndex is a utility class:

public class NameOrIndex
   public NameOrIndex(String name);
   public NameOrIndex(int index);


Return Values

The content of the script.


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 that the name of a script does not affect its functionality in any way. It is only used for organizational and documentation purposes. You can consider the name of the script as a comment. However, each script must have a unique name that may not be empty.

Note: This function only enumerates 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")
For index = 0 To scriptsCount - 1
   MsgBox oProcessor.GetDocumentJavaScriptContent("C:\test\input.pdf", index)