API referenceCore SDK

pdfGetJavaScriptName

Read back a document-level named JavaScript's source — by

C
const char* __stdcall pdfGetJavaScript(PPDF IPDF, uint32_t Handle, uint32_t* Len, BOOL32* Unicode);
const char* __stdcall pdfGetJavaScriptEx(PPDF IPDF, const char* Name, uint32_t* Len, BOOL32* Unicode);
const char* __stdcall pdfGetJavaScriptName(PPDF IPDF, uint32_t Handle, uint32_t* Len, BOOL32* Unicode);
int32_t __stdcall pdfGetJavaScriptCount(PPDF IPDF);
Delphi
function pdfGetJavaScript(const IPDF: PPDF; Handle: Cardinal; var Len: Cardinal; var Unicode: LongBool): PAnsiChar; stdcall;
function pdfGetJavaScriptEx(const IPDF: PPDF; const Name: PAnsiChar; var Len: Cardinal; var Unicode: LongBool): PAnsiChar; stdcall;
function pdfGetJavaScriptName(const IPDF: PPDF; Handle: Cardinal; var Len: Cardinal; var Unicode: LongBool): PAnsiChar; stdcall;
function pdfGetJavaScriptCount(const IPDF: PPDF): Integer; stdcall;

Purpose. Read back a document-level named JavaScript's source — by handle (pdfGetJavaScript), by name (pdfGetJavaScriptEx), or read just its name given a handle (pdfGetJavaScriptName) — this is the document /Names /JavaScript tree, not a per-field/per-object action script (see pdfGetJavaScriptAction/Action2, Action Getters).

Description. pdfGetJavaScript's output Unicode is always forced to False — its underlying QueryJSActionText only exposes a narrow (ANSI/byte) form regardless of how the script was originally stored. By contrast, pdfGetJavaScriptEx and pdfGetJavaScriptName both genuinely report a real, source-derived Unicode flag (from GetJSScriptByName/GetJSNameByHandle's own U: Boolean out-param) — a real inconsistency between the by-handle and by-name/name-only retrieval paths for the same underlying data.

Parameters.

ParameterDescription
IPDFDocument handle.
Handle*(GetJavaScript/Name)* JavaScript entry handle.
Name*(Ex only)* JavaScript entry name to look up.
LenOutput: byte/char length.
UnicodeOutput: whether the returned text is wide. Always False for pdfGetJavaScript; genuinely variable for Ex/Name.

Return value. Pointer to the script/name text (transient buffer), or nil if the target doesn't resolve. pdfGetJavaScriptCount: total document-level JavaScript entry count; 0 if IPDF invalid.

See also. pdfGetJavaScriptAction (the per-object action-script counterpart).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern IntPtr pdfGetJavaScriptName(IntPtr IPDF, uint Handle, ref uint Len, [MarshalAs(UnmanagedType.Bool)] ref bool Unicode);
Area
Core SDK
Category

Getters

Exported names

pdfGetJavaScriptName

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.