Contains the properties of a single PDF JavaScript action.
[SerializableAttribute()]
public struct PDFJavaScript
public class PDFJavaScript
[SerializableAttribute()]
public value class PDFJavaScript : public System.ValueType
class PDFJavaScript:
The PDFJavaScript structure contains the properties of a single PDF JavaScript action. The JavaScript actions are stored as an array and are not part of any page. They are typically processed when the file is opened and before any image is shown.
Each JavaScript action has a name and the javascript code. The array is sorted in ascending order based on the name. The actions get executed in the order in which they are read. So to ensure the actions get executed in correct order, make sure the names reflect the desired order. The name comparison is not case sensitive. If one name is the beginning of another name, the shorter name will be written first.
So, if one action is called "name"
and the other "name1"
, "name"
will be considered to be "smaller" than "name1"
.
The array of JavaScript actions will be sorted in ascending order based on the name, so they might not be written in the order in which you put them in the array.
The JavaScript action has the following properties to represent its appearance:
Name: The name of the JavaScript action. The name determines the order and can also be used from inside the PDF file to identify an action.
Code: The actual JavaScript code, which will be interpreted by the JavaScript engine in the viewer.
Both of these properties are strings.
using Leadtools.WinForms;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.Pdf;
using Leadtools.Svg;
public void TestExtractJavaScript_string_string()
{
string fileName = Path.Combine(LEAD_VARS.ImagesDir, "leadtools.pdf");
IList<PDFJavaScript> list = PDFFile.ExtractJavaScript(fileName, null);
if (list == null || list.Count == 0)
Console.WriteLine("The source files does not have any javaScript");
else
{
Console.WriteLine($"The source files has {list.Count} javascript actions");
for (int i = 0; i < list.Count; i++)
{
Console.WriteLine($" [{i}] Name = {list[i].Name}");
Console.WriteLine($" [{i}] Code = {list[i].Code}\n");
}
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document