Javascript API: Class List

Javascript API
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
C Annot3D | A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest
C Annotation | This object represents an Foxit PDF Editor annotation. Annotations can be created using the Foxit PDF Editor annotation tool or by using the Doc object method addAnnot. Before an annotation can be accessed, it must be bound to a JavaScript variable through a Doc object method such as getAnnot: var a = this.getAnnot(0, "f70f59c4-2dc8-4512-b15c-abdc90376c36"); The script can then manipulate the annotation named"f70f59c4-2dc8-4512-b15c-abdc90376c36" on page 1 (0-based page numbering system) by means of the variable a. For example, the following code first stores the type of annotation in the variable thetype, then changes the author to “John Q. Public”. var thetype = a.type; // read property a.author = "John Q. Public"; // write property Another way of accessing the Annotation object is through the Doc object getAnnots method
C app | This object is used to set and get the properties and to set the JavaScript action of a link
C app_media | This object defines properties and functions useful in multimedia JavaScript code
C attachment | The annotAttachment object represents the file stored as the attachment for a FileAttachment type annotation. annotAttachment is similar to the Data object and represents the file content and metadata of the attachment
C Bookmark | A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest
C Certificate | The Certificate object provides read-only access to the properties of an X.509 public key certificate
C color | The color object is a convenience static object that defines the basic colors. Use this object to set a property or call a method that requires a color array
C console | The console object is a static object that enables access to the Foxit PDF Editor JavaScript Console for executing JavaScript and displaying debug messages
C Data | The Data object is the representation of an embedded file or data stream that is stored in the document. See the PDF Reference for details
C Doc | This object provides the interface between a PDF Doc open in the viewer and the JavaScript interpreter. It provides methods and properties for accessing the PDF Doc
C doc_media | The media property of each document specifies an object that contains multimedia properties and methods that apply to the document
C event | All JavaScript scripts are executed as the result of a particular event. For each of these events, JavaScript creates an event object. During the occurrence of each event, you can access this object to get and possibly manipulate information about the current state of the event
C Field | This object represents an form field (that is, a field created using the form tool or the Doc addField method). In the same manner that a form author can modify an existing field’s properties, such as the border color or font, the JavaScript user can use the Field object to perform the same modifications
C FullScreen | The interface to fullscreen (presentation mode) preferences and properties. To acquire a fullScreen object, use app.fs
C global | This is a static JavaScript object that allows you to share data between documents and to have data be persistent across sessions. Such data is called persistent global data. Global data-sharing and notification across documents is done through a subscription mechanism, which allows you to monitor global data variables and report their value changes across documents
C HostContainer | This object manages communication between a PDF document and a corresponding host container that the document is contained within, such as an HTML page. The host container for a document is specified by the Doc hostContainer property.\0 The Embedded PDF object provides the corresponding API for the object model of the container application
C Icon This generic JavaScript object is an opaque representation of a Form XObject appearance stored in the Doc icons property. It is used with Field objects of type button. The icon object contains the following property:

C identity | This is a static object that identifies the current user of the application
C Index | An object that represents a Catalog-generated index. It is non-creatable and returned by various methods of the search object and catalog object. You use this object to perform various indexing operations using Catalog. You can find the status of the index with a search
C Link | This object is used to set and get the properties and to set the JavaScript action of a link
C MediaPlayer | A MediaPlayer object represents an instance of a multimedia player such as QuickTime, Windows Media Player, or others. Its settings and events properties let you manipulate the player from JavaScript code and handle events that the player triggers. MediaPlayer is not part of a PDF file; it is a transient object created in memory when needed
C OCG | An OCG object represents an optional content group in a PDF file. Content in the file can belong to one or more optional content groups. Content belonging to one or more OCGs is referred to as optional content and its visibility is determined by the states (ON or OFF) of the OCGs to which it belongs. In the simplest case, optional content belongs to a single OCG, with the content being visible when the OCG is on and hidden when the OCG is off. More advanced visibility behavior can be achieved by using multiple OCGs and different visibility mappings. Use the Doc getOCGs method to get an array of OCG objects for a PDF document. The Doc methods addWatermarkFromFile and addWatermarkFromText add watermarks in an OCG. See the PDF Reference for additional details on optional content groups
C PrintParams | This is a generic object that controls printing parameters that affect any document printed using JavaScript. Changing this object does not change the user preferences or make any permanent changes to the document
C RDN This generic object represents a Relative Distinguished Name. It is used by securityHandler. newUser and the certificate.issuerDN and subjectCN properties. It has the following properties.

C ReadStream | A ReadStream object is an object literal that represents a stream of data. It contains a method to allow reading the data stream
C Rendition | A Rendition contains information needed to play a media clip, including embedded media data (or a URL) and playback settings. It corresponds to a Rendition in the Foxit PDF Editor authoring user interface
C ScreenAnnot | A ScreenAnnot object represents a screen annotation, which is a rectangular area within a PDF document viewed on the display screen. A ScreenAnnot may have Renditions and RenditionActions associated with it for multimedia playback
C search | The search object is a static object that accesses the functionality provided by the Foxit PDF Editor Search plug-in. This plug-in must be installed to interface with the search object (see available). See also the Index object, which is returned by some of the methods of the search object. The results for query calls are displayed in the Find dialog box of Foxit PDF Editor
C security | The security object is a static JavaScript object that exposes security-related PDF functions such as encryption and digital signatures. Security functions are performed using a SecurityHandler object, which is obtained from the security object using the getHandler method
C SecurityHandler | SecurityHandler objects are used to access security handler capabilities such as signatures, encryption, and directories. Different security handlers have different properties and methods. This section documents the full set of properties and methods that security objects may have. Individual SecurityHandler objects may or may not implement these properties and methods
C SignatureInfo | A generic JavaScript object that contains the properties of a digital signature. Some properties are supported by all handlers, and additional properties can be supported
C Span | A generic object that represents a length of text and its associated properties in a rich text form field or annotation. A rich text value consists of an array of span objects representing the text and formatting
C Template | Template objects are named pages within the document. These pages may be hidden or visible and can be copied or spawned. They are typically used to dynamically create content (for example, to add pages to an invoice on overflow)
C util | A static JavaScript object that defines a number of utility methods and convenience functions for string and date formatting and parsing
Generated by doxygen 1.8.15


Javascript API: Annot3D Class Reference

Public Member Functions | List of all members
Annot3D Class Reference

A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest.

Public Member Functions

FX_BOOL | activated (OBJ_PROP_PARAMS)
An array of Bookmark objects that are the children of this bookmark in the bookmark tree. If there are no children of this bookmark, this property has a value of null. See also the parent and bookmarkRoot properties. More...
FX_BOOL | innerRect (OBJ_PROP_PARAMS)
The Doc that the bookmark resides in. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The text string for the bookmark that the user sees in the navigational panel. More...
FX_BOOL | page (OBJ_PROP_PARAMS)
The parent bookmark of the bookmark or null if the bookmark is the root bookmark. See also the children and bookmarkRoot properties. More...

Member Function Documentation

◆ activated()

FX_BOOL Annot3D::activated ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ innerRect()

FX_BOOL Annot3D::innerRect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ name()

FX_BOOL Annot3D::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ page()

FX_BOOL Annot3D::page ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader


Javascript API: Annotation Class Reference

Public Member Functions | List of all members
Annotation Class Reference

This object represents an Foxit PDF Editor annotation. Annotations can be created using the Foxit PDF Editor annotation tool or by using the Doc object method addAnnot. Before an annotation can be accessed, it must be bound to a JavaScript variable through a Doc object method such as getAnnot: var a = this.getAnnot(0, "f70f59c4-2dc8-4512-b15c-abdc90376c36"); The script can then manipulate the annotation named"f70f59c4-2dc8-4512-b15c-abdc90376c36" on page 1 (0-based page numbering system) by means of the variable a. For example, the following code first stores the type of annotation in the variable thetype, then changes the author to “John Q. Public”. var thetype = a.type; // read property a.author = "John Q. Public"; // write property Another way of accessing the Annotation object is through the Doc object getAnnots method.

Public Member Functions

FX_BOOL | alignment (OBJ_PROP_PARAMS)
Controls the alignment of the text for a FreeText annotation. More...
FX_BOOL | AP (OBJ_PROP_PARAMS)
The named appearance of the stamp to be used in displaying a stamp annotation. The names of the standard stamp annotations are given below: Approved Void Verified Revised Reviewed Received Final Expired Emergency Draft Confidential Completed. More...
FX_BOOL | arrowBegin (OBJ_PROP_PARAMS)
Determines the line cap style that specifies the shape to be used at the beginning of a line annotation. Permissible values are:
None (default)
OpenArrow
ClosedArrow
ROpenArrow
RClosedArrow
Butt
Diamond
Circle
Square
Slash
. More...
FX_BOOL | arrowEnd (OBJ_PROP_PARAMS)
Determines the line cap style that specifies the shape to be used at the end of a line annotation. The following list shows the allowed values:
None (default)
OpenArrow
ClosedArrow
ROpenArrow
RClosedArrow
Butt
Diamond
Circle
Square
Slash
. More...
FX_BOOL | attachIcon (OBJ_PROP_PARAMS)
The name of an icon to be used in displaying the annotation. Recognized values are listed below: Paperclip
PushPin (default)
Graph
Tag
. More...
FX_BOOL | author (OBJ_PROP_PARAMS)
Gets or sets the author of the annotation. More...
FX_BOOL | borderEffectIntensity (OBJ_PROP_PARAMS)
The intensity of the border effect, if any. This represents how cloudy a cloudy rectangle, polygon, or oval is. More...
FX_BOOL | borderEffectStyle (OBJ_PROP_PARAMS)
If non-empty, the name of a border effect style. Currently, the only supported border effects are the empty string (nothing) or “C” for cloudy. More...
FX_BOOL | callout (OBJ_PROP_PARAMS)
An array of four or six numbers specifying a callout line attached to the free text annotation. See the PDF Reference for additional details. More...
FX_BOOL | caretSymbol (OBJ_PROP_PARAMS)
The symbol associated with a Caret annotation, which is a visual symbol that indicates the presence of text edits. Valid values are “” (nothing), “P” (paragraph symbol) or “S” (space symbol). More...
FX_BOOL | contents (OBJ_PROP_PARAMS)
Accesses the contents of any annotation that has a pop-up window. For sound and file attachment annotations, specifies the text to be displayed as a description. More...
FX_BOOL | creationDate (OBJ_PROP_PARAMS)
The date and time when the annotation was created. More...
FX_BOOL | dash (OBJ_PROP_PARAMS)
A dash array defining a pattern of dashes and gaps to be used in drawing a dashed border. For example, a value of [3, 2] specifies a border drawn with 3-point dashes alternating with 2-point gaps. To set the dash array, the style property must be set to D. More...
FX_BOOL | delay (OBJ_PROP_PARAMS)
If true, property changes to the annotation are queued and then executed when delay is set back to false. (Similar to the Field object delay property.) More...
FX_BOOL | doc (OBJ_PROP_PARAMS)
The Doc object of the document in which the annotation resides. More...
FX_BOOL | doCaption (OBJ_PROP_PARAMS)
If true, draws the rich contents in the line appearance itself. More...
FX_BOOL | fillColor (OBJ_PROP_PARAMS)
Sets the background color for circle, square, line, polygon, polyline, and free text annotations. Values are defined by using transparent, gray, RGB or CMYK color. See Color arrays for information on defining color arrays and how values are used with this property. More...
FX_BOOL | gestures (OBJ_PROP_PARAMS)
An array of arrays, each representing a stroked path. Each array is a series of alternating x and y coordinates in default user space, specifying points along the path. When drawn, the points are connected by straight lines or curves in an implementation-dependent way. See the PDF Reference for more details. More...
FX_BOOL | hidden (OBJ_PROP_PARAMS)
If true, the annotation is not shown and there is no user interaction, display, or printing of the annotation. More...
FX_BOOL | inReplyTo (OBJ_PROP_PARAMS)
If non-empty, specifies the name value of the annotation that this annotation is in reply to. More...
FX_BOOL | intent (OBJ_PROP_PARAMS)
This property allows a markup annotation type to behave differently, depending on the intended use of the annotation. For example, the Callout Tool is a free text annotation with intent set to FreeTextCallout. Though this property is defined for all annotations, currently, only free text, polygon,and line annotations have non-empty values for intent. More...
FX_BOOL | leaderExtend (OBJ_PROP_PARAMS)
Specifies the length of leader line extensions that extend from both endpoints of the line, perpendicular to the line. These lines extend from the line proper 180 degrees from the leader lines. The value should always be greater than or equal to zero. The default is zero (no leader line extension). More...
FX_BOOL | leaderLength (OBJ_PROP_PARAMS)
Specifies the length of leader lines that extend from both endpoints of the line, perpendicular to the line. The value may be negative to specify an alternate orientation of the leader lines. The default is 0 (no leader line). More...
FX_BOOL | lineEnding (OBJ_PROP_PARAMS)
This property determines how the end of a callout line is stroked. It is relevant only for a free text annotation when the value of intent is FreeTextCallout. Recognized values are listed below:
None (default)
OpenArrow
ClosedArrow
ROpenArrow
RClosedArrow
Butt
Diamond
Circle
Square
Slash
. More...
FX_BOOL | lock (OBJ_PROP_PARAMS)
If true, the annotation is locked, which is equivalent to readOnly except that the annotation is accessible through the properties dialog box in the UI. More...
FX_BOOL | modDate (OBJ_PROP_PARAMS)
The last modification date for the annotation. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The name of an annotation. This value can be used by the Doc object getAnnot method to find and access the properties and methods of the annotation. More...
FX_BOOL | noteIcon (OBJ_PROP_PARAMS)
The name of an icon to be used in displaying the annotation. Recognized values are given below: Check Circle Comment Cross Help Insert Key NewParagraph Note(default) Paragraph
RightArrow
RightPointer
Star
UpArrow
UpLeftArrow
. More...
FX_BOOL | noView (OBJ_PROP_PARAMS)
If true, the annotation is hidden, but if the annotation has an appearance, that appearance should be used for printing only. More...
FX_BOOL | opacity (OBJ_PROP_PARAMS)
The constant opacity value to be used in painting the annotation. This value applies to all visible elements of the annotation in its closed state (including its background and border), but not to the pop-up window that appears when the annotation is opened. Permissible values are 0.0 - 1.0. A value of 0.5 makes the annotation semitransparent. More...
FX_BOOL | page (OBJ_PROP_PARAMS)
The page on which the annotation resides. More...
FX_BOOL | point (OBJ_PROP_PARAMS)
An array of two numbers, [xul, yul] that specifies the upper left-hand corner in default user space of the icon for a text, sound or file attachment annotation. More...
FX_BOOL | points (OBJ_PROP_PARAMS)
An array of two points, [[x1, y1], [x2, y2]], specifying the starting and ending coordinates of the line in default user space. More...
FX_BOOL | popupOpen (OBJ_PROP_PARAMS)
If true, the pop-up text note appears open when the page is displayed. More...
FX_BOOL | popupRect (OBJ_PROP_PARAMS)
An array of four numbers [xll, yll, xur, yur] specifying the lower-left x, lower-left y, upper-right x, and upper-right y coordinates—in default user space—of the rectangle of the pop-up annotation associated with a parent annotation. It defines the location of the pop-up annotation on the page. More...
FX_BOOL | print (OBJ_PROP_PARAMS)
Indicates whether the annotation should be printed (true) or not (false). More...
FX_BOOL | quads (OBJ_PROP_PARAMS)
An array of 8 x n numbers specifying the coordinates of n quadrilaterals in default user space. Each quadrilateral encompasses a word or group of contiguous words in the text underlying the annotation. See the PDF Reference for more details. The quads for a word can be obtained through calls to the Doc object getPageNthWordQuads method. More...
FX_BOOL | readOnly (OBJ_PROP_PARAMS)
If true, the annotation should display but not interact with the user. More...
FX_BOOL | rect (OBJ_PROP_PARAMS)
The rect array consists of four numbers [xll, yll, xur, yur] specifying the lower-left x, lower-left y, upper-right x, and upper-right y coordinates—in default user space—of the rectangle defining the location of the annotation on the page. See also the popupRect property. More...
FX_BOOL | refType (OBJ_PROP_PARAMS)
The reference type of the annotation. The property distinguishes whether inReplyTo indicates a plain threaded discussion relationship or a group relationship. Recognized values are “R” and “Group”. See the PDF Reference for additional details. More...
FX_BOOL | soundIcon (OBJ_PROP_PARAMS)
The name of an icon to be used in displaying the sound annotation. A value of “Speaker” is recognized. More...
FX_BOOL | strokeColor (OBJ_PROP_PARAMS)
Sets the appearance color of the annotation. Values are defined by using transparent, gray, RGB or CMYK color. In the case of a free text annotation, strokeColor sets the border and text colors. See Color arrays for information on defining color arrays and how values are used with this property. More...
FX_BOOL | style (OBJ_PROP_PARAMS)
This property gets and sets the border style. Recognized values are S (solid) and D (dashed). The style property is defined for all annotation types but is only relevant for line, free text, circle, square, polyline, polygon and ink annotations. More...
FX_BOOL | subject (OBJ_PROP_PARAMS)
Text representing a short description of the subject being addressed by the annotation. The text appears in the title bar of the pop-up window, if there is one, or the properties dialog box. More...
FX_BOOL | textFont (OBJ_PROP_PARAMS)
Determines the font that is used when laying out text in a free text annotation. Valid fonts are defined as properties of the font object (see the Field object textFont property). An arbitrary font can be used when laying out a free text annotation by setting the value of textFont equal to a string that represents the PostScript name of the font. More...
FX_BOOL | textSize (OBJ_PROP_PARAMS)
The text size (in points) for a free text annotation. Valid text sizes include zero and the range from 4 to 144, inclusive. Zero indicates the largest point size that allows all the text to fit in the annotation’s rectangle. More...
FX_BOOL | toggleNoView (OBJ_PROP_PARAMS)
If true, the noView flag is toggled when the mouse hovers over the annotation or the annotation is selected. If an annotation has both the noView and toggleNoView flags set, the annotation is usually invisible. However, when the mouse is over it or it is selected, it becomes visible. More...
FX_BOOL | type (OBJ_PROP_PARAMS)
The type of annotation. The type of an annotation can only be set within the object-literal argument of the Doc object addAnnot method. The valid values are:
Text
FreeText
Line
Square
Circle
Polygon
PolyLine
Highlight
Underline
Squiggly
StrikeOut
Stamp
Caret
Ink
FileAttachment
Sound
. More...
FX_BOOL | vertices (OBJ_PROP_PARAMS)
An array of coordinate arrays representing the alternating horizontal and vertical coordinates, respectively, of each vertex, in default user space of a polygon or polyline annotation. See the PDF Reference for details. More...
FX_BOOL | width (OBJ_PROP_PARAMS)
The border width in points. If this value is 0, no border is drawn. The default value is 1. More...
FX_BOOL | destroy (OBJ_METHOD_PARAMS)
Destroys the annotation, removing it from the page. The object becomes invalid. More...

Member Function Documentation

◆ alignment()

FX_BOOL Annotation::alignment ( OBJ_PROP_PARAMS )
Alignment | Value
Left aligned | 0
Centered | 1
Right aligned | 2
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FreeText, Redact
Example
var gAnnot= this.getAnnot(0,"f70f59c4-2dc8-4512-b15c-abdc90376c36");// annot must be exist.
app.alert(gAnnot.alignment);
gAnnot.alignment = 2;
app.alert(gAnnot.alignment);

◆ AP()

FX_BOOL Annotation::AP ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Stamp
Example
Programmatically add a stamp annotation.
var annot = this.addAnnot({
page: 0,
type: "Stamp",
author: "abc",
name: "myStamp",
rect: [400, 400, 550, 500],
contents: "Try it again, this time with order and
method!", AP: "Approved" });
Note:The name of a particular stamp can be found by opening the PDF file in the Stamps folder that contains the stamp in question. For a list of stamp names currently in use in the document, see the Doc object icons property.

◆ arrowBegin()

FX_BOOL Annotation::arrowBegin ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Line, PolyLine
Example
var gAnnot= this.getAnnot(0,"3df1483e-6b0a-4651-85bc-174a2caf3927");
gAnnot.arrowBegin="OpenArrow";

◆ arrowEnd()

FX_BOOL Annotation::arrowEnd ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Line, PolyLine
Example
var gAnnot= this.getAnnot(0,"3df1483e-6b0a-4651-85bc-174a2caf3927");
gAnnot.arrowEnd="OpenArrow";

◆ attachIcon()

FX_BOOL Annotation::attachIcon ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FileAttachment
Example
var gannot1= this.getAnnot(0,"4326c763-2518-48ba-9cbf-067f20313e06");
gannot1.attachIcon="Paperclip";

◆ author()

FX_BOOL Annotation::author ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
var annots = this.getAnnots(0, ANSB_Type, true);
var newAuthor = "new author";
for (var i = 0; i < annots.length; i++)
{
annots[i].author= newAuthor ;
console.println(util.printf(annots[i].name+" author is ："+annots[i].author));
}

◆ borderEffectIntensity()

FX_BOOL Annotation::borderEffectIntensity ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
{
annots[i].borderEffectIntensity =2;
console.println(annots[i].borderEffectIntensity);
}

◆ borderEffectStyle()

FX_BOOL Annotation::borderEffectStyle ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
{
annots[i].borderEffectStyle ="C";
console.println(annots[i].borderEffectStyle);
}

◆ callout()

FX_BOOL Annotation::callout ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FreeText
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
{
console.println(annots[i].callout)
}

◆ caretSymbol()

FX_BOOL Annotation::caretSymbol ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Caret
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
{
console.println(annots[i].caretSymbol)
}

◆ contents()

FX_BOOL Annotation::contents ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
Create a text annotation, with author and contents specified.
var annot = this.addAnnot({
page: 0,
type: "Text",
point: [400,500],
author: "abc",
contents: "Call Smith to get help on this paragraph.",
noteIcon: "Help"
});
See also the Doc object addAnnot method.

◆ creationDate()

FX_BOOL Annotation::creationDate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
{
console.println(annots[i].creationDate)
}

◆ dash()

FX_BOOL Annotation::dash ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FreeText, Line, PolyLine, Polygon, Circle, Square, Ink
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].dash));

◆ delay()

FX_BOOL Annotation::delay ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
Assuming annot is an Annotation object, the code below changes the border to dashed.
annot.delay=true;
annot.style = "D";
annot.dash = [4,3];
annot.delay = false;

◆ doc()

FX_BOOL Annotation::doc ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Doc object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
Construct an annotation, and illustrate the use of the doc property.
var inch = 72;
var annot = this.addAnnot({
page: 0,
type: "Square",
rect: [1*inch, 3*inch, 2*inch, 3.5*inch]
});
console.println(annot.doc.URL);

◆ doCaption()

FX_BOOL Annotation::doCaption ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Line
Example
function Annotation_doCaption()
{
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].doCaption));
}
Annotation_doCaption();

◆ fillColor()

FX_BOOL Annotation::fillColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Color
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Circle, Square, Line, Polygon, PolyLine, FreeText
Example
Create a Circle annotation and set the background color.
var annot = this.addAnnot(
{
type: "Circle",
page: 0,
rect: [200,200,400,300],
author: "abc",
name: "myCircle",
popupOpen: true,
popupRect: [200,100,400,200],
contents: "Hi World!",
strokeColor: color.red,
fillColor: ["RGB",1,1,.855]
});

◆ gestures()

FX_BOOL Annotation::gestures ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Ink
Example
function Annotation_gestures()
{
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].gestures));
}
Annotation_gestures();

◆ hidden()

FX_BOOL Annotation::hidden ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
function Annotation_hidden()
{
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].hidden));
}
Annotation_hidden();

◆ inReplyTo()

FX_BOOL Annotation::inReplyTo ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
function Annotation_hidden()
{
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].inReplyTo));
}
Annotation_hidden();

◆ intent()

FX_BOOL Annotation::intent ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All The table below lists the tools available through the UI for creating annotations with special appearances. | UI | Annotation type |Intent | -—: | :-—: |:-— |Callout Tool | FreeText | FreeTextCallout |Cloud Tool | Polygon | PolygonCloud |Arrow Tool | Line | LineArrow |Dimensioning Tool | Line | LineDimension
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].intent));

◆ leaderExtend()

FX_BOOL Annotation::leaderExtend ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Line
Example
function Annotation_leaderExtend()
{
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);;
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].leaderExtend));
}
Annotation_leaderExtend();

◆ leaderLength()

FX_BOOL Annotation::leaderLength ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Line
Example
function Annotation_leaderLength()
{
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);;
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].leaderLength));
}
Annotation_leaderLength();

◆ lineEnding()

FX_BOOL Annotation::lineEnding ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FreeText
Example
function Annotation_lineEnding()
{
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].lineEnding));
}
Annotation_lineEnding();

◆ lock()

FX_BOOL Annotation::lock ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
var annots = this.getAnnots(0, ANSB_Type, true);
for (var i = 0; i < annots.length; i++)
{
console.println(util.printf(annots[i].lock));
annots[i].lock = true;
console.println(util.printf(annots[i].lock));
}

◆ modDate()

FX_BOOL Annotation::modDate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
Print the modification date to the console.
console.println(util.printd("mmmm dd, yyyy", annot.modDate));

◆ name()

FX_BOOL Annotation::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].name));

◆ noteIcon()

FX_BOOL Annotation::noteIcon ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Text
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].noteIcon));

◆ noView()

FX_BOOL Annotation::noView ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
{
console.println(util.printf(annots[i].noView));
annots[i].noView = true;
console.println(util.printf(annots[i].noView));
}

◆ opacity()

FX_BOOL Annotation::opacity ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].opacity));

◆ page()

FX_BOOL Annotation::page ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
The following code moves the Annotation object annot from its current page to page 3 (0-based
page numbering system). annot.page = 2;

◆ point()

FX_BOOL Annotation::point ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Text, Sound, FileAttachment
Example
Place a help note icon at specified coordinates. The icon is located at the upper right corner of the popup note.
var annot = this.addAnnot({ page: 0, type: "Text", point: [400,500],
contents: "Call Smith to get help on this paragraph.",
popupRect: [400,400,550,500],
popupOpen: true,
noteIcon: "Help"
});
See also the noteIcon property and the Doc object addAnnot method.

◆ points()

FX_BOOL Annotation::points ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Line
Example
Draw a line between two specified points.
var annot = this.addAnnot({
type: "Line",
page: 0,
author: "abc",
doCaption: true,
contents: "Look at this again!",
points: [[10,40],[200,200]],
});
See the arrowBegin and arrowEnd properties, the setProps method, and the Doc object addAnnot method.

◆ popupOpen()

FX_BOOL Annotation::popupOpen ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All except FreeText, Sound, FileAttachment
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].popupOpen));

◆ popupRect()

FX_BOOL Annotation::popupRect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All except FreeText, Sound, FileAttachment
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].popupRect));

◆ print()

FX_BOOL Annotation::print ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].print));

◆ quads()

FX_BOOL Annotation::quads ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Highlight, StrikeOut, Underline, Squiggly,Redact
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].quads));

◆ readOnly()

FX_BOOL Annotation::readOnly ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].readOnly));

◆ rect()

FX_BOOL Annotation::rect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].rect));

◆ refType()

FX_BOOL Annotation::refType ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].refType));

◆ soundIcon()

FX_BOOL Annotation::soundIcon ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Sound
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].soundIcon));

◆ strokeColor()

FX_BOOL Annotation::strokeColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Color
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
Make a text note red.
var annot = this.addAnnot({type: "Text"});
annot.strokeColor = color.red;

◆ style()

FX_BOOL Annotation::style ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].style));

◆ subject()

FX_BOOL Annotation::subject ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].subject));

◆ textFont()

FX_BOOL Annotation::textFont ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FreeText
Example
Create a FreeText annotation using the Helvetica font.
var annot = this.addAnnot({
page: 0,
type: "FreeText",
textFont: font.Helv, // or, textFont: "Viva-Regular",
textSize: 10,
rect: [200, 300, 200+150, 300+3*12], // height for three lines
width: 1,
alignment: 1 });

◆ textSize()

FX_BOOL Annotation::textSize ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
FreeText
Example
See the textFont property.

◆ toggleNoView()

FX_BOOL Annotation::toggleNoView ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
function Annotation_toggleNoView()
{
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
var msg = "%s toggleNoView is %s";
for (var i = 0; i < annots.length; i++)
console.println(util.printf(msg,annots[i].type, annots[i].toggleNoView));
}
Annotation_toggleNoView();

◆ type()

FX_BOOL Annotation::type ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
All
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].type));

◆ vertices()

FX_BOOL Annotation::vertices ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array of arrays
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Polygon, PolyLine
Example
function Annotation_vertices()
{
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
for (var i = 0; i < annots.length; i++)
console.println(util.printf(annots[i].vertices));
}
Annotation_vertices();

◆ width()

FX_BOOL Annotation::width ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Annotations
Square, Circle, Line, Ink, FreeText
Example
this.syncAnnotScan();
var annots = this.getAnnots(0, ANSB_Type, true);
console.println("Number of Annotations: " + annots.length);
var msg="%s width is %s";
for (var i = 0; i < annots.length; i++)
console.println(util.printf(msg,annots[i].name,annots[i].width));

◆ destroy()

FX_BOOL Annotation::destroy ( OBJ_METHOD_PARAMS )
Example
Remove all "FreeText" annotations on page 0.
var annots = this.getAnnots({ nPage:0 });
for (var i = 0; i < annots.length; i++)
if (annots[i].type == "FreeText") annots[i].destroy();


Javascript API: app Class Reference

Public Member Functions | List of all members
app Class Reference

This object is used to set and get the properties and to set the JavaScript action of a link.

Public Member Functions

FX_BOOL | activeDocs (OBJ_PROP_PARAMS)
An array containing the Doc object for each active document. If no documents are active, activeDocs returns nothing; that is, it has the same behavior as d = new Array(0) in core JavaScript. The array returned by app.activeDocs includes any documents opened by app.openDoc with the bHidden parameter set to true, subject to the security restrictions described above. More...
FX_BOOL | calculate (OBJ_PROP_PARAMS)
If true (the default value), calculations can be performed. If false, calculations are not permitted. The use of this property is discouraged; the Doc object property calculate is preferred. More...
FX_BOOL | formsVersion (OBJ_PROP_PARAMS)
The version number of the viewer forms software. Check this property to determine whether objects, properties, or methods in newer versions of the software are available if you want to maintain backward compatibility in your scripts. More...
FX_BOOL | fs (OBJ_PROP_PARAMS)
A FullScreen object, which can be used to access the fullscreen properties. More...
FX_BOOL | fullscreen (OBJ_PROP_PARAMS)
The use of this property is discouraged; it has been superseded by the FullScreen object property isFullScreen. The fs method returns a FullScreen object that can be used to access the fullscreen properties. Controls whether the viewer is in full screen mode or regular viewing mode. Note:A PDF document being viewed from within a web browser cannot be put into full screen mode. Full screen mode can be initiated from within the browser, but applies only to a document open in the Foxit PDF Editor viewer application, if any, not to the browser itself. More...
FX_BOOL | language (OBJ_PROP_PARAMS)
The language of the running Foxit PDF Editor viewer. It can be one of the following strings. More...
FX_BOOL | printerNames (OBJ_PROP_PARAMS)
A list of available printers. Each of these values is suitable to use in the printerName property of the PrintParams object. If no printers are installed on the system, an empty array is returned. More...
FX_BOOL | media (OBJ_PROP_PARAMS)
Defines an extensive number of properties and methods useful for setting up and controlling a multimedia player. See the app.media object for a listing of the properties and methods of this object, as well as numerous examples of use. More...
FX_BOOL | platform (OBJ_PROP_PARAMS)
The platform that the script is currently executing on. There are three valid values: WIN MAC UNIX. More...
FX_BOOL | runtimeHighlight (OBJ_PROP_PARAMS)
If true, the background color and hover color for form fields are shown. More...
FX_BOOL | runtimeHighlightColor (OBJ_PROP_PARAMS)
Sets the color for runtime highlighting of form fields. The value of this property is a color array. (See Color arrays for details.) More...
FX_BOOL | viewerType (OBJ_PROP_PARAMS)
A string that indicates which viewer application is running. It can be one of these values. More...
FX_BOOL | viewerVariation (OBJ_PROP_PARAMS)
Indicates the packaging of the running viewer application. It can be one of these values: Reader Fill-In Business Tools Full. More...
FX_BOOL | viewerVersion (OBJ_PROP_PARAMS)
Indicates the version number of the current viewer application. More...
FX_BOOL | constants (OBJ_PROP_PARAMS)
A wrapper object for holding various constant values. Currently, this property returns an object with a single property, align. app.constants.align is an object that has the possible properties left, center, right, top, and bottom, indicating the type of alignment. These values can be used to specify alignment, such as when adding a watermark. More...
FX_BOOL | thermometer (OBJ_PROP_PARAMS)
A Thermometer object, which is a combined status window/progress bar that indicates to the user that a lengthy operation is in progress. More...
FX_BOOL | alert (OBJ_METHOD_PARAMS)
Displays an alert dialog box. More...
FX_BOOL | beep (OBJ_METHOD_PARAMS)
Causes the system to play a sound. Note:On Mac OS and UNIX systems the beep type is ignored. More...
FX_BOOL | browseForDoc (OBJ_METHOD_PARAMS)
Presents a file system browser and returns an object containing information concerning the user’s response. Note:This method can only be executed during a batch or console event. See the event object for a discussion of JavaScript events. See Privileged versus non-privileged context for details. More...
FX_BOOL | clearInterval (OBJ_METHOD_PARAMS)
Cancels a previously registered interval initially set by the setInterval method. See also setTimeOut and clearTimeOut. More...
FX_BOOL | clearTimeOut (OBJ_METHOD_PARAMS)
Cancels a previously registered time-out interval. Such an interval is initially set by setTimeOut. See also setInterval and clearInterval. More...
FX_BOOL | execDialog (OBJ_METHOD_PARAMS)
Presents a modal dialog box to the user. Modal dialog boxes must be closed by the user before the host application can be directly used again. The monitor parameter specifies a dialog descriptor, which is a generic object literal that consists of a set of handler functions for various events and a set of properties that describe the contents of the dialog box. Dialog box items are identified by an ItemID, which is a unique 4-character string. An ItemID is necessary only if the element must be referred to elsewhere in the dialog box description (for example, to set or get a value for the element, to add a handler for the element, or to set a tab order including the element). Note:To distinguish Foxit PDF Editor dialog boxes from those created by JavaScript, dialog boxes that are added at the document level have a title of “JavaScript Dialog” and display the text “Warning: JavaScript Dialog” at the bottom. More...
FX_BOOL | execMenuItem (OBJ_METHOD_PARAMS)
Executes the specified menu item. More...
FX_BOOL | launchURL (OBJ_METHOD_PARAMS)
Launches a URL in a browser window. More...
FX_BOOL | mailMsg (OBJ_METHOD_PARAMS)
Sends out an e-mail message with or without user interaction. See also the Doc object mailDoc and mailForm methods, the FDF object mail method and the Report object mail method. Note:On Windows: The client machine must have its default mail program configured to be MAPI enabled to use this method. More...
FX_BOOL | newFDF (OBJ_METHOD_PARAMS)
Creates a new FDF object that contains no data. Note:This method is available only during batch, console and application initialization. Not available in Foxit PDF Reader. See Privileged versus non-privileged context. More...
FX_BOOL | newDoc (OBJ_METHOD_PARAMS)
Creates a new document and returns its Doc object. The optional parameters specify the media box dimensions of the document in points. Note:This method can only be executed during a batch or console event. See Privileged versus non-privileged context. See the event object for a discussion of JavaScript events. More...
FX_BOOL | openDoc (OBJ_METHOD_PARAMS)
Opens a specified PDF document and returns its Doc object. This object can be used by the script to call methods, or to get or set properties in the newly opened document. More...
FX_BOOL | popUpMenuEx (OBJ_METHOD_PARAMS)
Creates a pop-up menu at the current mouse position. Each of the parameters is a MenuItem object that describes a menu item to be included in the pop-up menu. This method is preferred over the use of popUpMenu. More...
FX_BOOL | popUpMenu (OBJ_METHOD_PARAMS)
Note:popUpMenuEx is preferred over this method. Creates a pop-up menu at the current mouse position, containing the specified items. More...
FX_BOOL | response (OBJ_METHOD_PARAMS)
Displays a dialog box containing a question and an entry field for the user to reply to the question. More...
FX_BOOL | setInterval (OBJ_METHOD_PARAMS)
Specifies a JavaScript script and a time period. The script is executed every time the period elapses. The return value of this method must be held in a JavaScript variable. Otherwise, the interval object is subject to garbage-collection, which would cause the clock to stop. To terminate the periodic execution, pass the returned interval object to clearInterval. More...
FX_BOOL | setTimeOut (OBJ_METHOD_PARAMS)
Specifies a JavaScript script and a time period. The script is executed one time only, after the period elapses. The return value of this method must be held in a JavaScript variable. Otherwise, the timeout object is subject to garbage-collection, which would cause the clock to stop. To cancel the timeout event, pass the returned timeout object to clearTimeOut. More...
FX_BOOL | addMenuItem (OBJ_METHOD_PARAMS)
Adds a menu item to a menu. Note:Starting Foxit PDF Editor X, the number of top-level menu items has been reduced. The menu items available from Foxit PDF Editor X onwards are: File, Edit, View, Window, and Help. If any of your previous scripts referred to a top-level menu item that no longer exists, the reference will not work. Note:This method can only be executed during application initialization or console events. See the event object for a discussion of JavaScript events. See also the addSubMenu, execMenuItem, hideMenuItem, and listMenuItems methods. More...
FX_BOOL | listMenuItems (OBJ_METHOD_PARAMS)
returns an array of TreeItem objects, which describes a menu hierarchy. this method returned a list of menu item names to the console. See also addMenuItem, addSubMenu, execMenuItem, and hideMenuItem. More...

Member Function Documentation

◆ activeDocs()

FX_BOOL app::activeDocs ( OBJ_PROP_PARAMS )
Type
Array
Access
R
Availability:
Foxit PDF Editor/Reader
Example
var d = app.activeDocs;
var name =" ";
for(var i = 0 ; i < d.length ; i++)
{
name = d[i].info.Title+name;
}
console.println(name);

◆ calculate()

FX_BOOL app::calculate ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Reader

◆ formsVersion()

FX_BOOL app::formsVersion ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R
Availability:
Foxit PDF Editor/Reader
Example
Toggle fullscreen mode.
if (typeof app.formsVersion != "undefined" && app.formsVersion >= 5.0) {
app.fs.defaultTransition = "";
app.fs.isFullScreen = !app.fs.isFullScreen;
}
else app.fullscreen = !app.fullscreen;

◆ fs()

FX_BOOL app::fs ( OBJ_PROP_PARAMS )
Type
Object
Access
R
Availability:
Foxit PDF Editor/Reader
Example
// This code puts the viewer into fullscreen (presentation) mode.
app.fs.isFullScreen = true;
See also fullScreenObject.isFullScreen.

◆ fullscreen()

FX_BOOL app::fullscreen ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Reader

◆ language()

FX_BOOL app::language ( OBJ_PROP_PARAMS )
String | Language
CHS | Chinese Simplified
CHT | Chinese Traditional
DAN | Danish
DEU | German
ENU | English
ESP | Spanish
FRA | French
ITA | Italian
KOR | Korean
JPN | Japanese
NLD | Dutch
NOR | Norwegian
PTB | Brazilian Portuguese
SUO | Finnish
SVE | Swedish
Type
String
Access
R
Availability:
Foxit PDF Editor/Reader
Example
app.alert(app.language)

◆ printerNames()

FX_BOOL app::printerNames ( OBJ_PROP_PARAMS )
Type
Array of Strings
Access
R
Availability:
Foxit PDF Editor/Reader
Example
Print out a listing of available printers:
var l = app.printerNames.length
for ( var i = 0; i < l; i++)
console.println("(" + (i+1) + ") " + app.printerNames[i]);

◆ media()

FX_BOOL app::media ( OBJ_PROP_PARAMS )
Type
Object
Access
R
Availability:
Foxit PDF Editor/Reader

◆ platform()

FX_BOOL app::platform ( OBJ_PROP_PARAMS )
Type
String
Access
R
Availability:
Foxit PDF Editor/Reader
Example
app.alert(app.platform)

◆ runtimeHighlight()

FX_BOOL app::runtimeHighlight ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Reader
Example
If run-time highlighting is off (false), do nothing, otherwise change the preferences.
if (!app.runtimeHighlight)
{
app.runtimeHighlight = true;
app.runtimeHighlightColor = color.red;
}

◆ runtimeHighlightColor()

FX_BOOL app::runtimeHighlightColor ( OBJ_PROP_PARAMS )
Type
Color array
Access
R/W
Availability:
Foxit PDF Editor/Reader
Example
See the runtimeHighlight property.

◆ viewerType()

FX_BOOL app::viewerType ( OBJ_PROP_PARAMS )
Type
String
Access
R
Availability:
Foxit PDF Editor/Reader
Example
app.alert(app.viewerType)

◆ viewerVariation()

FX_BOOL app::viewerVariation ( OBJ_PROP_PARAMS )
Type
String
Access
R
Availability:
Foxit PDF Editor/Reader
Example
app.alert(app.viewerVariation)

◆ viewerVersion()

FX_BOOL app::viewerVersion ( OBJ_PROP_PARAMS )
Type
Number
Access
R
Availability:
Foxit PDF Editor/Reader
Example
app.alert(app.viewerVersion)

◆ constants()

FX_BOOL app::constants ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
Availability:
Foxit PDF Editor/Reader
Example
See the Doc object methods addWatermarkFromFile and addWatermarkFromText for examples.

◆ thermometer()

FX_BOOL app::thermometer ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
Availability:
Foxit PDF Editor/Reader
Example
See the Thermometer object.

◆ alert()

FX_BOOL app::alert ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cMsg A string containing the message to be displayed.
nIcon (optional) An icon type. Possible values are these:
0 — Error (default)
1 — Warning
2 — Question
3 — Status
Note:In Mac OS, there is no distinction between warnings and questions.
nType (optional) A button group type. Possible values are these:
0 — OK (default)
1 — OK, Cancel
2 — Yes, No
3 — Yes, No, Cancel
cTitle (optional) The dialog box title. If not specified, the title “Foxit Alert” is used.
Returns
nButton, the type of the button that was pressed by the user:
1 — OK
2 — Cancel
3 — No
4 — Yes
Example
Close the document with the user’s permission:
// A MouseUp action
var nButton = app.alert({
cMsg: "Do you want to close this document?",
cTitle: "A message from abc",
nIcon: 2, nType: 2
});
if ( nButton == 4 ) this.closeDoc();

◆ beep()

FX_BOOL app::beep ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
nType (optional) The sound type. Values are associated with sounds as follows:
0 — Error
1 — Warning
2 — Question
3 — Status
4 — Default (default value)

◆ browseForDoc()

FX_BOOL app::browseForDoc ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
bSave (optional) A Boolean value that, if true, specifies that the file system browser should be presented as it would be for a save operation. The default is false.
cFilenameInit (optional) A string that specifies the default file name for the file system browser to be populated with.
cFSInit (optional) A string that specifies the file system that the file system browser operates on initially. Two values are supported: “” (the empty string) representing the default file system and “CHTTP”. The default is the default file system. This parameter is only relevant if the web server supports WebDAV.
Returns
On success, returns an object that has three properties.
Property Description
cFS A string containing the resulting file system name for the chosen file.
cPath A string containing the resulting path for the chosen file.
cURL A string containing the resulting URL for the chosen file
If the user cancels, the return value is undefined. On error, throws an exception.
Example
//bSave: true,cFSInit: ""
var oRetn = app.browseForDoc({
bSave: true,
cFilenameInit: "appbrowseForDoctest1.pdf",
cFSInit: "",
});
if ( typeof oRetn != "undefined" )
{
for ( var o in oRetn )
console.println( "oRetn." + o + "=" + oRetn[o]);
}
else
console.println("User cancelled!");

◆ clearInterval()

FX_BOOL app::clearInterval ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
oInterval The registered interval to cancel.
Example
See setTimeOut.

◆ clearTimeOut()

FX_BOOL app::clearTimeOut ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
oTime The previously registered time-out interval to cancel.
Example
See setTimeOut.

◆ execDialog()

FX_BOOL app::execDialog ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
monitor An object literal. It consists of several handlers (see Dialog box handlers) and a description property that describes the dialog box elements (see description property).
inheritDialog (optional) A Dialog object that should be reused when displaying this dialog box.It is useful when displaying a series of dialog boxes (such as a wizard) to prevent one from disappearing before the new one is displayed. The default is not to reuse a dialog box.
parentDoc (optional) A Doc object to use as the parent for this dialog box.
Returns
A string, which is the ItemID of the element that caused the dialog box to be dismissed. The return value is “ok” or “cancel” if the dismissing element is the ok or cancel button.
Dialog box handlers
The dialog box handlers are called when specific dialog box events occur. Each handler is optional and is passed a Dialog object that can be used to query or set values in the dialog box. The supported handlers are listed in the table that follows.
Dialog box handler | Description
initialize | Called when the dialog box is being initialized.
validate | Called when a field is modified to determine if the value is acceptable (by returning true) or unacceptable (by returning false).
commit | Called when the OK button of the dialog box is clicked.
destroy | Called when the dialog box is being destroyed.
ItemID | Called when the dialog box element ItemID is modified. For a text box, it is when the text box loses focus. For other controls, it is when the selection changes. If ItemID is not a JavaScript identifier, the name must be enclosed in double quotes when the method is defined, as in the following example. "bt:1": function () { .... } If ItemID is a JavaScript identifier, the double quotes are optional. For example, the following are both correct. "butn": function () { .... } butn: function () { .... }
description property
The description property is an object literal that contains properties describing the dialog. Its elements property specifies the elements of the dialog box, and each of the elements in turn can have an elements property describing subelements. The dialog properties at the root level of the description property are listed in the table that follows.
Property Type Description
name String The title bar of the dialog box, which should be localized.
first_tab String An ItemID for the dialog box item that should be first in the tab order. This dialog box item will also be active when the dialog box is created. This property is required for setting up a tabbing order. See the next_tab property defined below.
width Numeric The width of the dialog box in pixels. If no width is specified, the combined width of the contents is used.
height Numeric The height of the dialog box in pixels. If no height is specified, the combined height of the contents is used.
char_width Numeric The width of the dialog box in characters. If no width is specified, the combined width of the contents is used.
char_height Numeric The height of the dialog box in characters. If no height is specified, the combined height of the contents is used.
align_children String The alignment for all descendants. Must be one of the following values:
“align_left”: Left aligned
“align_center”: Center aligned
“align_right”: Right aligned
“align_top”: Top aligned
“align_fill”: Align to fill the parent’s width; may widen objects.
“align_distribute”: Distribute the contents over the parent’s width.
“align_row”: Distribute the contents over the parent’s width with a consistent baseline.
elements Array An array of object literals that describe the dialog box elements contained within this dialog (see elements property).
elements property
A dialog box elements property specifies an object literal with the following set of properties.
Property Type Description
name String The displayed name of the dialog box element, which should be localized.
Note:This property is ignored for the “edit_text” type.
item_id String An ItemID for this dialog box, which is a unique 4-character string.
type String The type of this dialog box element. It must be one of the following strings:
“button” - A push button.
“check_box” - A check box.
“radio” - A radio button.
“list_box” - A list box.
“hier_list_box” - A hierarchical list box.
“static_text” - A static text box.
“edit_text” - An editable text box.
“popup” - A pop-up control.
“ok” - An OK button.
“ok_cancel” - An OK and Cancel Button.
“ok_cancel_other” - An OK, Cancel, and Other button.
“view” - A container for a set controls.
“cluster” - A frame for a set of controls.
“gap” - A place holder.
next_tab String An ItemID for the next dialog box item in the tab order.
Note:Tabbing does not stop at any dialog box item that is not the target of the next_tab (or first_tab) property. Tabbing should form a circular linked list.
width Numeric Specifies the width of the element in pixels. If no width is specified, the combined width of the contents is used.
height Numeric Specifies the height of the element in pixels. If no height is specified, the combined height of the contents is used.
char_width Numeric Specifies the width of the element in characters. If no width is specified, the combined width of the contents is used.
char_height Numeric Specifies the height of the element in characters. If no height is specified, the combined height of the contents is used.
font String The font to use for this element. Must be one of the following strings:
“default” - Default font
“dialog” - Dialog box font
“palette” - Palette (small) Font
bold Boolean Specify if the font is bold.
italic Boolean Specify if the font is italic.
alignment String Sets the alignment for this element. Must be one of the following values:
“align_left”: Left aligned
“align_center”: Center aligned
“align_right”: Right aligned
“align_top”: Top aligned
“align_fill”: Align to fill the parent’s width; may widen objects.
“align_distribute”: Distribute the contents over the parent’s width.
“align_row”: Distribute the contents over the parent’s width with a consistent baseline.
align_children String Sets the alignment for all descendants. Possible values are the same as for alignment.
elements Array An array of object literals that describe the subelements of this dialog box element. Its properties are the same as those described in this table.
Additional attributes of some dialog box elements
Some of the element types have additional attributes, as listed below.
Element type Property Type Description
static_text multiline Boolean If true, this static text element is multiline.
Note:For Mac OS, the height property must be at least 49 to display the up/down buttons, which allow users to read the whole box content.
edit_text multiline Boolean If true, this edit text element is multiline.
readonly Boolean If true, this text element is read only.
Note:This property is ignored when password is set to true.
password Boolean If true, this text element is a password field.
PopupEdit Boolean If true, it is a pop-up edit text element.
SpinEdit Boolean If true, it is a spin edit text element.
radio group_id String The group name to which this radio button belongs.
ok, ok_cancel,
ok_cancel_other 		ok_name String The name for the OK button.
cancel_name String The name for the cancel button.
other_name String The name for the other button.
Example 1
The following dialog box descriptor can be a document-level or folder-level JavaScript. The
dialog box created contains text fields for your first and last name. When the OK button is
clicked, the names entered are reported to the console. var dialog1 = {
initialize: function (dialog) {
// Create a static text containing the current date.
var todayDate = dialog.store()["date"];
todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
dialog.load({ "date": todayDate });
},
commit:function (dialog) { // called when OK pressed
var results = dialog.store();
// Now do something with the data collected, for example,
console.println("Your name is " + results["fnam"]
+ " " + results["lnam"] );
},
description:
{
name: "Personal Data", // Dialog box title
align_children: "align_left",
width: 350,
height: 200,
elements:
[
{
type: "cluster",
name: "Your Name",
align_children: "align_left",
elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "First Name: "
},
{
item_id: "fnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Last Name: "
},
{
item_id: "lnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "static_text",
name: "Date: ",
char_width: 25,
item_id: "date"
},
]
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
}
]
}
};
Now, the following line can be executed from actions such as the mouse-up action of a button
or a menu action. app.execDialog(dialog1);
Example 2
The following example uses a check box and a radio button field. This code might be a
document-level JavaScript. var dialog2 =
{
initialize: function(dialog) {
// Set a default value for radio button field
dialog.load({"rd01": true });
this.hasPet = false;
// Disable radio button field
dialog.enable({
"rd01" : this.hasPet,
"rd02" : this.hasPet,
"rd03" : this.hasPet
});
},
commit: function(dialog) {
// When the user presses "Ok", this handler will execute first
console.println("commit");
var results = dialog.store();
// Do something with the data, for example,
var hasPet = (this.hasPet) ? "have" : "don't have";
console.println("You " + hasPet + " a pet.");
if (this.hasPet)
console.println("You have " + this.getNumPets(results)
+ " pet(s).");
},
getNumPets: function (results) {
for ( var i=1; i<=3; i++) {
if ( results["rd0"+i] ) {
switch (i) {
case 1:
var nPets = "one";
break;
case 2:
var nPets = "two";
break;
case 3:
var nPets = "three or more";
}
}
};
return nPets;
},
ok: function(dialog) {
// The handler for the Ok button will be handed after commit
console.println("Ok!");
},
ckbx: function (dialog) {
// Process the checkbox, if the user has a pet, turn on radios
this.hasPet = !this.hasPet;
dialog.enable({
"rd01" : this.hasPet,
"rd02" : this.hasPet,
"rd03" : this.hasPet
});
},
cancel: function(dialog) { // Handle the cancel button
console.println("Cancel!");
},
other: function(dialog){ // Handle the other button
app.alert("Thanks for pressing me!");
dialog.end("other"); // End the dialog box, return "other"!
},
// The dialog box description
description:
{
name: "More Personal Information",
elements:
[
{
type: "view",
align_children: "align_left",
elements:
[
{
type: "static_text",
name: "Personal Information",
bold: true,
font: "dialog",
char_width: 30,
height: 20
},
{
type: "check_box",
item_id: "ckbx",
name: "Pet Owner"
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Number of pets: "
},
{
type: "radio",
item_id: "rd01",
group_id: "rado",
name: "One"
},
{
type: "radio",
item_id: "rd02",
group_id: "rado",
name: "Two",
},
{
type: "radio",
item_id: "rd03",
group_id: "rado",
name: "Three or more",
}
]
}
]
},
{
type: "gap", //Add a small vertical gap between
height: 10 //..radio fields and buttons
},
{
type: "ok_cancel_other",
ok_name: "Ok",
cancel_name: "Cancel",
other_name: "Press Me"
}
]
}
};
The following line can be executed in situations such as the mouse-up action of a button or
a menu action. var retn = app.execDialog(dialog2); The value of retn is “ok” if the Ok button was
clicked, “cancel” if the Cancel button was clicked, and “other” if the button labeled “Press Me”
was clicked.
Example 3
This example uses a list box.
var dialog3 = {
// This dialog box is called when the dialog box is created
initialize: function(dialog) {
this.loadDefaults(dialog);
},
// This dialog box is called when the OK button is clicked.
commit: function(dialog) {
// See the Dialog object for a description of how dialog.load
// and dialog.store work.
var elements = dialog.store()["subl"];
// do something with the data.
},
// Callback for when the button "butn" is clicked.
butn: function(dialog) {
var elements = dialog.store()["subl"]
for(var i in elements) {
if ( elements[i] > 0 ) {
app.alert("You chose \"" + i
+ "\", which has a value of " + elements[i] );
}
}
},
loadDefaults: function (dialog) {
dialog.load({
subl:
{
"Bussiness": +1,
"Standard": -2,
"Reader": -3
}
})
},
// The dialog box description
description:
{
name: "Products", // Title of the dialog box
elements: // Child element array
[
{
type: "view",
align_children: "align_left",
elements: // Child element array
[
{
type: "cluster",
name: "Select",
elements: // Child Element Array
[
{
type: "static_text",
name: "Select Foxit PDF Editor you use",
font: "default"
},
{
type: "list_box",
item_id: "subl",
width: 200,
height: 60
},
{
type: "button",
item_id: "butn",
name: "Press Me"
}
]
},
{
type: "ok_cancel"
}
]
}
]
}
}
Then execute
app.execDialog(dialog3);
In the example above, if the line type: "list_box" is replaced by type: "popup" and the
height specification is removed, the example will run with a pop-up control rather than a list
box.
Example 4
This example shows a hierarchical list box. After the dialog box is opened, a hierarchical
list is presented. After a selection is made and the user clicks the Select button, the document
jumps to the destination chosen by the user. The Doc object is passed to the dialog box by making
it a property of the dialog box. var dialog4 = { initialize: function(dialog) { dialog.load({
subl:
{
"Chapter 1":
{
"Section 1":
{
"SubSection 1": -1,
"SubSection 2": -2,
},
"Section 2":
{
"SubSection 1": -3,
"SubSection 2": -4,
}
},
"Chapter 3": -5,
"Chapter 4": -6
}
})
},
subl: function(dialog) {
console.println("Selection Box Hit");
},
getHierChoice: function (e)
{
if (typeof e == "object") {
for ( var i in e ) {
if ( typeof e[i] == "object" ) {
var retn = this.getHierChoice(e[i]);
if ( retn ) {
retn.label = i + ", " + retn.label;
return retn;
}
// if e[i] > 0, we’ve found the selected item
} else if ( e[i] > 0 ) return { label:i, value: e[i] };
}
} else {
if ( e[i] > 0 ) return e[i];
}
},
butn: function (dialog)
{
var element = dialog.store()["subl"]
var retn = this.getHierChoice(element);
if ( retn ) {
// Write to the console the full name of the item selected
console.println("The selection you've chosen is \""
+ retn.label + "\", its value is " + retn.value );
dialog.end("ok");
// this.doc is the doc object of this document
this.doc.gotoNamedDest("dest"+retn.value);
}
else app.alert("Please make a selection, or cancel");
},
cncl: function (dialog) { dialog.end("cancel") },
// Dialog box description
description:
{
name: "My Novel",
elements:
[
{
type: "view",
align_children: "align_left",
elements:
[
{
type: "cluster",
name: "Book Headings",
elements:
[
{
type: "static_text",
name: "Make a selection",
},
{
type: "hier_list_box",
item_id: "subl",
char_width: 20,
height: 200
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "button",
item_id: "cncl",
name: "Cancel"
},
{
item_id: "butn",
type: "button",
name: "Select"
}
]
}
]
}
]
}
};
This function attaches the Doc object to the dialog box, then passes the dialog box to the
app.execDialog method. The dialog4 object and this function can be at the document level.
function dotheDialog(dialog,doc)
{
dialog.doc = doc;
var retn = app.execDialog( dialog )
}
Finally, the following script can be executed from a mouse-up action, for example.
dotheDialog( dialog4, this );

◆ execMenuItem()

FX_BOOL app::execMenuItem ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cMenuItem The menu item to execute.
A list of menu item names can be obtained with
listMenuItems.
Example 1
This example executes the File > Open menu item. It displays a dialog box asking for the
file to be opened. app.execMenuItem("Open");
Example 2
This example illustrates how a form object does not survive the execution of
app.execMenuItem("SaveAs"), as noted above. var f = this.getField("myField");
// Assume preferences set to save linearized
app.execMenuItem("SaveAs");
// Exception thrown, field not updated
f.value = 3;
Example 3
After executing app.execMenuItem("SaveAs"), Field objects must be acquired again.
var f = this.getField("myField");
// Assume preferences set to save linearized
app.execMenuItem("SaveAs");
// Get the field again after the linear save
var f = getField("myField");
// Field updated to a value of 3
f.value = 3;

◆ launchURL()

FX_BOOL app::launchURL ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cURL A string that specifies the URL to launch.
Returns
The value undefined is returned on success. An exception is thrown on failure.
Example 1
app.launchURL("https://globe-map.foxitservice.com/");

◆ mailMsg()

FX_BOOL app::mailMsg ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
bUI Indicates whether user interaction is required. If true, the remaining parameters are used to seed the compose-new-message window that is displayed to the user. If false, the cTo parameter is required and others are optional.
Note: When this method is executed in a non-privileged context, the bUI parameter is not honored and defaults to true. See Privileged versus non-privileged context.
cTo A semicolon-separated list of addressees.
cCc (optional) A semicolon-separated list of CC addressees.
cBcc (optional) A semicolon-separated list of BCC addressees.
cSubject (optional) Subject line text. The length limit is 64 KB.
cMsg (optional) Mail message text. The length limit is 64 KB.
Example
Open the compose new message window.
app.mailMsg(true);
Send the message to fun1@example.com and fun2@example.com.
app.mailMsg(false, "fun1@example.com; fun2@example.com", "", "",
"This is the subject", "This is the body of the mail.");
It is possible to compose a message containing form data.
var cMyMsg = "Below are the current budget figures:\n\n";
cMyMsg += "Date Compiled: " + this.getField("date").value + "\n";
cMyMsg += "Current Estimate: " + this.getField("budget").value + "\n";
app.mailMsg({
bUI: true,
cTo: "myBoss@example.com",
cSubject: "The latest budget figures",
cMsg: cMyMsg
} );

◆ newFDF()

FX_BOOL app::newFDF ( OBJ_METHOD_PARAMS )
Returns
A new FDF object.
Example
Create an FDF with an embedded PDF file.
var fdf = app.newFDF();
This example continues following the description of app.openFDF.

◆ newDoc()

FX_BOOL app::newDoc ( OBJ_METHOD_PARAMS )
Returns
The object of the newly created document.
Example
Create a blank document and acquire the Doc object, then insert a watermark.
var myNewDoc = app.newDoc();
myNewDoc.addWatermarkFromText("Confidential",0,font.Helv,24,color.red);
This example uses the Doc object addWatermarkFromText method.

◆ openDoc()

FX_BOOL app::openDoc ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cPath A device-independent path to the document to be opened. If oDoc is specified, the path can be relative to it. The target document must be accessible in the default file system.
Note:When cFS is set to “CHTTP”, the cPath string should be escaped, perhaps using the core JavaScript global function encodeURI. See Example 5 below.
Returns
A Doc object or null:
Example
This example opens another document, inserts a prompting message into a text field, sets the
focus in the field, and then closes the current document. var otherDoc =
app.openDoc("/c/temp/myDoc.pdf"); otherDoc.getField("name").value="Enter your name here: "
otherDoc.getField("name").setFocus();
this.closeDoc();

◆ popUpMenuEx()

FX_BOOL app::popUpMenuEx ( OBJ_METHOD_PARAMS )
Parameters
One or more MenuItem objects (see below).
Returns
The cReturn value of the menu item that was selected, or its cName if cReturn was not specified for that item. The method returns null if no selection was made.
MenuItem Object
This generic JavaScript object represents a menu item. It has the following properties.
Property Description
cName The menu item name, which is the string to appear on the menu item. The value of "-" is reserved to draw a separator line in the menu.
bMarked (optional) A Boolean value specifying whether the item is to be marked with a check. The default is false (not marked).
bEnabled (optional) A Boolean value specifying whether the item is to appear enabled or grayed out. The default is true (enabled).
cReturn (optional) A string to be returned when the menu item is selected. The default is the value of cName.
oSubMenu (optional) A MenuItem object representing a submenu item or an array of submenu items, each represented by a MenuItem object.
Example 1
Show all the features of the popUpMenuEx method.
var cChoice = app.popUpMenuEx
(
{cName: "Item 1", bMarked:true, bEnabled:false},
{cName: "-"},
{cName: "Item 2", oSubMenu:
[ {cName: "Item 2, Submenu 1"},
{
cName: "Item 2, Submenu 2",
oSubMenu: {cName:"Item 2, Submenu 2, Subsubmenu 1", cReturn: "0"}
}
]
},
{cName: "Item 3"},
{cName: "Item 4", bMarked:true, cReturn: "1"}
)
app.alert("You chose the \"" + cChoice + "\" menu item");

◆ popUpMenu()

FX_BOOL app::popUpMenu ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cItem (optional) If the argument is a string, it is listed in the menu as a menu item. The menu item name "-" is reserved to draw a separator line in the menu.
Array (optional) If the argument is an array, it appears as a submenu where the first element in the array is the parent menu item. This array can contain further submenus.
Returns
The name of the menu item that was selected, or null if no item was selected.
Example
Create a pop-up menu consisting of chapter of a document.
var cChoice = app.popUpMenu("Introduction", "-", "Chapter 1",
[ "Chapter 2", "Chapter 2 Start", "Chapter 2 Middle",
["Chapter 2 End", "The End"]]);
app.alert("You chose the \"" + cChoice + "\" menu item");

◆ response()

FX_BOOL app::response ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cQuestion The question to be posed to the user.
cTitle (optional) The title of the dialog box.
cDefault (optional) A default value for the answer to the question. If not specified, no default value is presented.
cLabel (optional) A short string to appear in front of and on the same line as the edit text field.
Returns
A string containing the user’s response. If the user clicks the Cancel button, the response is the null object.
Example
Asks for a response from the user and report back the response.
var cResponse = app.response({
cQuestion: "How are you today?",
cTitle: "Your Health Status",
cDefault: "Fine",
cLabel: "Response:"
});
if (cResponse == null)
app.alert("Thanks for trying anyway.");
else
app.alert("You responded, \""+cResponse+"\", to the health "
+ "question.",3);

◆ setInterval()

FX_BOOL app::setInterval ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cExpr The JavaScript script to be executed.
nMilliseconds The time period in milliseconds.
Returns
An interval object
Example
Create a simple color animation on a field called “Color” that changes every second.
function DoIt() {
var f = this.getField("Color");
var nColor = (timeout.count++ % 10 / 10);
// Various shades of red.
var aColor = new Array("RGB", nColor, 0, 0);
f.fillColor = aColor;
}
// save return value as a variable
timeout = app.setInterval("DoIt()", 1000);
// Add a property to our timeout object so that DoIt() can keep
// a count going.
timeout.count = 0;
See setTimeOut for an additional example.

◆ setTimeOut()

FX_BOOL app::setTimeOut ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cExpr The JavaScript script to be executed.
nMilliseconds The time period in milliseconds.
Returns
A timeout object
Example
Create a simple running marquee. Assume there is a text field named “marquee”. The default
value of this field is “Foxit PDF Editor version 8.0 will soon be here!”.
// Document-level JavaScript function
function runMarquee() {
var f = this.getField("marquee");
var cStr = f.value;
// get field value
var aStr = cStr.split(""); // Convert to an array
aStr.push(aStr.shift()); // Move first char to last
cStr = aStr.join(""); // Back to string again
f.value = cStr; // Put new value in field
}
// Insert a mouse-up action into a "Go" button
run = app.setInterval("runMarquee()", 100);
// stop after a minute
stoprun=app.setTimeOut("app.clearInterval(run)",6000);
// Insert a mouse-up action into a "Stop" button
try {
app.clearInterval(run);
app.clearTimeOut(stoprun);
} catch (e){}
The Stop button code is protected with a try/catch construct. If the user clicks the Stop
button without having first clicked Go, run and stoprun will be undefined and the Stop code will
throw an exception. When the exception is thrown, the catch code is executed. In this example,
the code does nothing if the user clicks Stop first.

◆ addMenuItem()

FX_BOOL app::addMenuItem ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cName The language-independent name of the menu item. This name can be used by other methods (for example, hideMenuItem) to access the menu item.
cUser (optional) The user string (language-dependent name) to display as the menu item name. If cUser is not specified, cName is used.
cParent The name of the parent menu item. Its submenu will have the new menu item added to it. If cParent has no submenu, an exception is thrown.
Menu item names can be obtained with the listMenuItems method.
nPos (optional) The position within the submenu to locate the new menu item. The default behavior is to append to the end of the submenu. Specifying nPos as 0 adds the menu to the top of the submenu. the value of nPos can also be the language-independent name of a menu item.
If the value nPos is a string, this string is interpreted as a named item in the menu (a language-independent name of a menu item). The named item determines the position at which the new menu item is to be inserted. See bPrepend for additional details.
The nPos parameter is ignored in certain menus that are alphabetized. The alphabetized menus are
The first section of View > Navigation Panels.
The first section of View > Toolbars.
Note:When nPos is a number, nPos is not obeyed in the Tools menu. A menu item introduced into the Tools menu comes in at the top of the menu. nPos is obeyed when it is a string referencing another user-defined menu item.
cExec An expression string to evaluate when the menu item is selected by the user.
Note: execution of JavaScript through a menu event is no longer privileged. See Privileged versus non-privileged context for details.
cEnable (optional) An expression string that is evaluated to determine whether to enable the menu item. The default is that the menu item is always enabled. This expression should set event.rc to false to disable the menu item.
cMarked (optional) An expression string that determines whether the menu item has a check mark next to it. The expression should set event.rc to false to uncheck the menu item and true to check it. The default is that the menu item is not marked.
bPrepend Determines the position of the new menu item relative to the position specified by nPos. The default value is false. If bPrepend is true, the rules for insertion are as follows:
If nPos is a string, the new item is placed before the named item.
If nPos is a number, the new item is placed before the numbered item.
If the named item cannot be found or nPos is not between zero and the number of items in the list, inclusive, the new item is inserted as the first item in the menu (rather than at the end of the menu).
bPrepend is useful when the named item is the first item in a group.
Example 1
At the top of the File menu, add a menu item that opens an alert dialog box displaying the
active document title. This menu is only enabled if a document is opened. app.addMenuItem({
cName: "Hello", cParent: "File", cExec: "app.alert(" addMenuItem ");", cEnable: "event.rc =
(event.target != null);", nPos: 0
});
Example 2
Place two menu items in the File menu, one before the Close item and the other after the
Close item.
// Insert after the "Close" item (the default behavior)
app.addMenuItem( { cName: "myItem1", cUser: "My Item 1", cParent:
"File", cExec: "_myProc1()", nPos: "Close"});
// Insert before the "Close" item, set bPrepend to true.
app.addMenuItem( { cName: "myItem2", cUser: "My Item 2", cParent:
"File", cExec: "_myProc2()", nPos: "Close", bPrepend: true });

◆ listMenuItems()

FX_BOOL app::listMenuItems ( OBJ_METHOD_PARAMS )
Returns
Array of TreeItem objects.
TreeItem Object
A generic JavaScript object that represents a menu or toolbar item hierarchy. An array of these objects is returned by app.listMenuItems and app.listToolbarButtons. It contains the following properties. | cName | The name of a menu item or toolbar button.
| oChildren | (optional) An array of treeItem objects containing the submenus or flyout buttons.
Example 1
List all menu item names to the console.
var menuItems = app.listMenuItems()
for( var i in menuItems)
console.println(menuItems[i] + "\n")
Example 2
List all menu items to the console using a fancy format.
function FancyMenuList(m, nLevel)
{
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
console.println(s + "+-" + m.cName);
if ( m.oChildren != null )
for ( var i = 0; i < m.oChildren.length; i++ )
FancyMenuList(m.oChildren[i], nLevel + 1);
}
var m = app.listMenuItems();
for ( var i=0; i < m.length; i++ ) FancyMenuList(m[i], 0);


Javascript API: app_media Class Reference

Public Member Functions | List of all members
app_media Class Reference

This object defines properties and functions useful in multimedia JavaScript code. More...

Public Member Functions

FX_BOOL | align (OBJ_PROP_PARAMS)
Enumerates the values that may be found in the MediaSettings.floating.align property. The alignment is relative to the window specified by the MediaSettings.floating.over property. (See the values for app.media.over.) Valid values are listed in the table below. More...
FX_BOOL | closeReason (OBJ_PROP_PARAMS)
Enumerates the values that may be found in the event.reason property for a Close event. These values are: app.media.closeReason.general app.media.closeReason.error app.media.closeReason.done app.media.closeReason.stop app.media.closeReason.play app.media.closeReason.uiGeneral app.media.closeReason.uiScreen app.media.closeReason.uiEdit app.media.closeReason.docClose app.media.closeReason.docSave app.media.closeReason.docChange See the afterClose and onClose methods of the EventListener object. More...
FX_BOOL | windowType (OBJ_PROP_PARAMS)
Enumerates the values allowed in a MediaSettings.windowType property. These values are given in the table below. More...
FX_BOOL | canResize (OBJ_PROP_PARAMS)
Enumerates the values that may be found in the MediaSettings.floating.canResize property, which specifies whether a floating window may be resized by the user. These values are listed in the table below. More...
FX_BOOL | ifOffScreen (OBJ_PROP_PARAMS)
Enumerates the values allowed in a MediaSettings.floating.ifOffScreen property, which specifies what action should be taken if the floating window is positioned totally or partially offscreen. These values and their descriptions are given in the table below. More...
FX_BOOL | over (OBJ_PROP_PARAMS)
Enumerates the values allowed in a MediaSettings.floating.over property, the value of which is used to align a floating window. See app.media.align. More...
FX_BOOL | getPlayers (OBJ_METHOD_PARAMS)
Returns a PlayerInfoList object, which is an array of PlayerInfo objects representing the available media players. The PlayerInfoList may be filtered using its select method, and it may be used in the settings.players property when creating a media player with createPlayer. See PlayerInfoList object and PlayerInfo object for more details. More...
FX_BOOL | getURLData (OBJ_METHOD_PARAMS)
Returns a MediaData object (see MediaSettings.data) that represents data to be retrieved for a URL and optional MIME type. This MediaData object can be used to create a player that accesses data from that URL. More...
FX_BOOL | openPlayer (OBJ_METHOD_PARAMS)
Calls app.media.createPlayer to create a MediaPlayer object and then calls MediaPlayer.open to open the player. This method triggers several events, which may include Ready (see onReady and afterReady), Play (see onPlay and afterPlay), and Focus (see onFocus and afterFocus). See the EventListener object for a general description of these events. The method alerts the user and returns null on failure. It does not throw exceptions. More...
FX_BOOL | createPlayer (OBJ_METHOD_PARAMS)
Creates a MediaPlayer object without opening the player. Note:To open the player, call MediaPlayer.open. You can combine these two steps into one by calling app.media.openPlayer instead of createPlayer. If createPlayer is called inside a rendition action (for example, in custom JavaScript entered from the Actions tab in the Multimedia Properties panel), default values are taken from the action’s event object. The args parameter is not required in this case unless you want to override the rendition action’s values. createPlayer calls argsDWIM to process the event object and args (see PlayerArgs object object) parameter. Unless noStockEvents of the PlayerArgs object is set to true, the MediaPlayer object is equipped with stock EventListeners that provide the standard behavior required to interact properly with Foxit PDF Editor. Additional EventListeners can be provided in the PlayerArgs object or may be added afterward with MediaPlayer.events.add. If args.annot.player is an open MediaPlayer, createPlayer closes that player, which triggers events. More...

Detailed Description

Several app.media properties are enumeration objects that list the values allowed in various properties. Future versions of Foxit PDF Editor may add more such values, and JavaScript code should be prepared to encounter values other than the ones listed here. Similarly, JavaScript code may be run on an older version of Foxit PDF Editor than it was designed for, in which case it must fall back to using the values available in that version.

Member Function Documentation

◆ align()

FX_BOOL app_media::align ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object (enumeration)
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ closeReason()

FX_BOOL app_media::closeReason ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object (enumeration)
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ windowType()

FX_BOOL app_media::windowType ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Parameters
Value | Description
docked | Docked to a PDF page
floating | Floating (pop-up) window
fullScreen | Full screen mode
Type
Object (enumeration)
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ canResize()

FX_BOOL app_media::canResize ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object (enumeration)
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ ifOffScreen()

FX_BOOL app_media::ifOffScreen ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object (enumeration)
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ over()

FX_BOOL app_media::over ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object (enumeration)
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ getPlayers()

FX_BOOL app_media::getPlayers ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cMimeType (optional) An optional MIME type such as “audio/wav”. If cMimeType is omitted, the list includes all available players. If cMimeType is specified, the list includes only players that can handle that MIME type.
Returns
PlayerInfoList object
Example 1
List MP3 players to the debug console.
var mp = app.media.getPlayers("audio/mp3")
for ( var i = 0; i < mp.length; i++) {
console.println("\nmp[" + i + "] Properties");
for ( var p in mp[i] ) console.println(p + ": " + mp[i][p]);
}

◆ getURLData()

FX_BOOL app_media::getURLData ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cURL The URL from which media data is to be retrieved.
cMimeType (optional) The MIME type of the data.
Returns
MediaData object
Example
Retrieve a media clip from the Internet and plays it in a floating window.
var myURLClip = "http://www.example.com/myClip.mpg";
var args = {
URL: myURLClip,
mimeType: "video/x-mpg",
doc: this,
settings: {
players: app.media.getPlayers("video/x-mpg"),
windowType: app.media.windowType.floating,
data: app.media.getURLData(myURLClip,"video/x-mpg"),
floating: { height: 400, width: 600 }
}
}
app.media.openPlayer(args);

◆ openPlayer()

FX_BOOL app_media::openPlayer ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
args (optional) A PlayerArgs object.
Returns
A MediaPlayer object, or null on failure
Example 1
The following script is executed from a mouse-up action of a form button. It plays a docked media clip in a screen annotation.
app.media.openPlayer({
rendition: this.media.getRendition( "myClip" ),
annot: this.media.getAnnot( {nPage:0,cAnnotTitle:"myScreen"} ),
settings: { windowType: app.media.windowType.docked }
});

◆ createPlayer()

FX_BOOL app_media::createPlayer ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
args A PlayerArgs object, whose required and optional properties are described below.
If createPlayer is executed within a Rendition action with an associated rendition, this parameter is optional and its properties are populated by the defaults and by options selected in the UI. Otherwise, this parameter is required.
PlayerArgs object
Property Type
Description
doc Object
The Doc object of the document. Required if both annot and rendition are omitted, for example, for URL playback.
annot Object
A ScreenAnnot object. Required for docked playback unless it is found in the event object or MediaSettings.page is provided. The new player is associated with the annotation. If a player was already associated with the annotation, it is stopped and closed.
rendition Object
(optional) A Rendition object (either a MediaRendition or a RenditionList). Required unless rendition is found in the event object or URL is present.
URL String
Either URL or rendition is required, with URL taking precedence.
mimeType String
(optional) Ignored unless URL is present. If URL is present, either mimeType or settings.players, as returned by app.media.getPlayers, is required.
settings Object
(optional) A MediaSettings object. Overrides the rendition settings.
events Object
(optional) An EventListener object. Optional if stock events are used, added after stock events.
noStockEvents Boolean
(optional) If true, do not use stock events. The default is false.
fromUser Boolean
(optional) It should be true if a direct user action will trigger this code, or false, otherwise. The default depends on the event object.
showAltText Boolean
(optional) If true, show alternate text (see Rendition.altText) if the media cannot be played. The default is true.
showEmptyAltText Boolean
(optional) If true and alternate text (see Rendition.altText) is empty, show the alternate text as an empty box; if false, respond with an alert.
The default value is true if fromUser is false, and false if fromUser is true.
Returns
MediaPlayer object
Example 1
The following code is the definition of openPlayer, which uses createPlayer in its definition.
app.media.openPlayer = function( args )
{
var player = null;
try
{
args = app.media.argsDWIM( args );
player = app.media.createPlayer( args );
if( player )
{
var result = player.open();
if( result.code != app.media.openCode.success )
{
player = null;
app.media.alert
( "Open", args, { code: result.code } );
}
else if( player.visible )
player.setFocus(); // triggers Focus event
}
}
catch( e )
{
player = null;
app.media.alert( 'Exception', args, { error: e } );
}
return player;
}
Example 2
See the examples at the end of the description of openPlayer for examples of PlayerArgs usage.


Javascript API: attachment Class Reference

Public Member Functions | List of all members
attachment Class Reference

The annotAttachment object represents the file stored as the attachment for a FileAttachment type annotation. annotAttachment is similar to the Data object and represents the file content and metadata of the attachment.

Public Member Functions

FX_BOOL | name (OBJ_PROP_PARAMS)
The name of the attached file. More...
FX_BOOL | creationDate (OBJ_PROP_PARAMS)
The date of creation of the attached file. More...
FX_BOOL | modDate (OBJ_PROP_PARAMS)
The date of modification of the attached file. More...
FX_BOOL | MIMEType (OBJ_PROP_PARAMS)
The MIME type of the attached file. More...
FX_BOOL | path (OBJ_PROP_PARAMS)
The pathname of the attached file. More...
FX_BOOL | size (OBJ_PROP_PARAMS)
The size, in bytes, of the uncompressed attachment. More...
FX_BOOL | contentStream (OBJ_PROP_PARAMS)
A ReadStream property representing the file attachment stream. This property enables access to the contents of the file attachment associated with an annotAttachment object. A NotAllowedError is thrown and the method fails if it attempts to access the content of an embedded file attachment for which any of the following conditions is true (all file name extension matching is case-insensitive): Note:If you use the Data.MIMEType property to check whether a Data object represents a .SWF file, note that the MIME type for .SWF files is application/x-shockwave-flash. More...

Member Function Documentation

◆ name()

FX_BOOL attachment::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ creationDate()

FX_BOOL attachment::creationDate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ modDate()

FX_BOOL attachment::modDate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ MIMEType()

FX_BOOL attachment::MIMEType ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ path()

FX_BOOL attachment::path ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ size()

FX_BOOL attachment::size ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var annot = this.addAnnot({
page: 0
type: "FileAttachment",
point: [400,500],
author: "A. C. Robat",
contents: "Call Smith to get help on this paragraph.",
cAttachmentPath: "/d/a.pdf" ,
});
var attachObj = annot.attachment;
console.println("Name: " + attachObj.name);
console.println("Type: " + attachObj.MIMEType);
console.println("Size: "+ attachObj.size);
console.println("==============Content=================");
var stm = attachObj.contentStream;
console.println(util.stringFromStream(stm));

◆ contentStream()

FX_BOOL attachment::contentStream ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader


Javascript API: Bookmark Class Reference

Public Member Functions | List of all members
Bookmark Class Reference

A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest.

Public Member Functions

FX_BOOL | children (OBJ_PROP_PARAMS)
An array of Bookmark objects that are the children of this bookmark in the bookmark tree. If there are no children of this bookmark, this property has a value of null. See also the parent and bookmarkRoot properties. More...
FX_BOOL | doc (OBJ_PROP_PARAMS)
The Doc that the bookmark resides in. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The text string for the bookmark that the user sees in the navigational panel. More...
FX_BOOL | parent (OBJ_PROP_PARAMS)
The parent bookmark of the bookmark or null if the bookmark is the root bookmark. See also the children and bookmarkRoot properties. More...
FX_BOOL | open (OBJ_PROP_PARAMS)
Determines whether the bookmark shows its children in the navigation panel (open) or whether the children subtree is collapsed (closed). More...
FX_BOOL | createChild (OBJ_METHOD_PARAMS)
Creates a new child bookmark at the specified location. See also the children property and the insertChild and remove methods. More...
FX_BOOL | insertChild (OBJ_METHOD_PARAMS)
Inserts the specified bookmark as a child of this bookmark. If the bookmark already exists in the bookmark tree, it is unlinked before inserting it back into the tree. In addition, the insertion is checked for circularities and disallowed if one exists. This prevents users from inserting a bookmark as a child or grandchild of itself. See also the children property and the createChild and remove methods. More...
FX_BOOL | remove (OBJ_METHOD_PARAMS)
Removes the bookmark and all its children from the bookmark tree. See also the children property and the createChild and insertChild methods. More...
FX_BOOL | setAction (OBJ_METHOD_PARAMS)
Sets a JavaScript action for a bookmark. See also the Doc addRequirement and setPageAction methods and the Field object setAction method. Note:This method overwrites any action already defined for this bookmark. More...

Member Function Documentation

◆ children()

FX_BOOL Bookmark::children ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array | null
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Dump all bookmarks in the document.
function DumpBookmark(bkm, nLevel)
{
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
console.println(s + "+-" + bkm.name);
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
DumpBookmark(bkm.children[i], nLevel + 1);
}
console.clear(); console.show();
console.println("Dumping all bookmarks in the document.");
DumpBookmark(this.bookmarkRoot, 0);

◆ doc()

FX_BOOL Bookmark::doc ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var bkm = this.bookmarkRoot.children[0];
var bkmDoc = bkm.doc;
console.println(bkmDoc.path);

◆ name()

FX_BOOL Bookmark::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var bkm = this.bookmarkRoot.children[0];
console.println( "Top-level bookmark name: " + bkm.name );
The example that follows the children property also uses the name property.

◆ parent()

FX_BOOL Bookmark::parent ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object | null
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var bkm = this.bookmarkRoot.children[0].children[0];
var bkmparent = bkm.parent;
console.println(bkmparent.name);

◆ open()

FX_BOOL Bookmark::open ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W (Reader: R only)
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var bkm = this.bookmarkRoot.children[0];
bkm.open = true;

◆ createChild()

FX_BOOL Bookmark::createChild ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cName The name of the bookmark that the user sees in the navigation panel.
cExpr (optional) An expression to be evaluated whenever the user clicks the bookmark. It is equivalent to creating a bookmark with a JavaScript action, as described in the PDF Reference. The default is no expression.
nIndex (optional) The 0-based index into the children array of the bookmark at which to create the new child. The default is 0.
Example
Create a bookmark at the top of the bookmark panel that takes you to the next page in the
document. this.bookmarkRoot.createChild("Next Page", "this.pageNum++");

◆ insertChild()

FX_BOOL Bookmark::insertChild ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
oBookmark A bookmark object to add as the child of this bookmark.
nIndex (optional) The 0-based index into the children array of the bookmark at which to insert the new child. The default is 0.
Example
Take the first child bookmark and move it to the end of the bookmarks.
var bm = bookmarkRoot.children[0];
bookmarkRoot.insertChild(bm, bookmarkRoot.children.length);

◆ remove()

FX_BOOL Bookmark::remove ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Example
Remove all bookmarks from the document.
bookmarkRoot.remove();

◆ setAction()

FX_BOOL Bookmark::setAction ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cScript Defines the JavaScript expression that is to be executed whenever the user clicks the bookmark.
Example
Attach an action to the topmost bookmark.
var bm = bookmarkRoot.children[0]
bm.setAction("app.beep(0);");


Javascript API: Certificate Class Reference

Public Member Functions | List of all members
Certificate Class Reference

The Certificate object provides read-only access to the properties of an X.509 public key certificate.

Public Member Functions

FX_BOOL | binary (OBJ_PROP_PARAMS)
The raw bytes of the certificate, as a hex encoded string. More...
FX_BOOL | issuerDN (OBJ_PROP_PARAMS)
The distinguished name of the issuer of the certificate, returned as an RDN object. More...
FX_BOOL | keyUsage (OBJ_PROP_PARAMS)
An array of strings indicating the value of the certificate key usage extension. Possible values are kDigitalSignature kDataEncipherment kCRLSign kNonRepudiation kKeyAgreement kEncipherOnly kKeyEncipherment kKeyCertSign kDecipherOnly. More...
FX_BOOL | MD5Hash (OBJ_PROP_PARAMS)
The MD5 digest of the certificate, represented as a hex-encoded string. This provides a unique fingerprint for this certificate. More...
FX_BOOL | privateKeyValidityEnd (OBJ_PROP_PARAMS)
The date before which it’s legal to use the private key associated with this certificate. If the PKUP extension is not present or this property isn’t present in the extension, this represents the validity end date of the certificate itself. Before a digital ID can be used for signing, Foxit PDF Editor ensures that the signing time is prior to the privateKeyValidityEnd date. More...
FX_BOOL | privateKeyValidityStart (OBJ_PROP_PARAMS)
The date after which it’s legal to use the private key associated with this certificate. If the Private Key Usage Period (PKUP) certificate extension is not present, this represents the validity start date of the certificate itself. Before a digital ID can be used for signing, Foxit PDF Editor ensures that the signing time is more recent than the privateKeyValidityStart date. More...
FX_BOOL | SHA1Hash (OBJ_PROP_PARAMS)
The SHA1 digest of the certificate, represented as a hex-encoded string. This provides a unique fingerprint for this certificate. More...
FX_BOOL | serialNumber (OBJ_PROP_PARAMS)
A unique identifier for this certificate, used in conjunction with issuerDN. More...
FX_BOOL | subjectCN (OBJ_PROP_PARAMS)
The common name of the signer. More...
FX_BOOL | subjectDN (OBJ_PROP_PARAMS)
The distinguished name of the signer, returned as an RDN object. More...
FX_BOOL | validityEnd (OBJ_PROP_PARAMS)
The validity end date of the certificate. Before a digital ID can be used for signing, Foxit PDF Editor ensures that the signing time is prior to the validityEnd date. More...
FX_BOOL | validityStart (OBJ_PROP_PARAMS)
The validity start date of the certificate. Before a digital ID can be used for signing Foxit PDF Editor, ensures that the signing time is more recent than the validityStart date. More...

Member Function Documentation

◆ binary()

FX_BOOL Certificate::binary ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ issuerDN()

FX_BOOL Certificate::issuerDN ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
RDN object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ keyUsage()

FX_BOOL Certificate::keyUsage ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array of Strings
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ MD5Hash()

FX_BOOL Certificate::MD5Hash ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ privateKeyValidityEnd()

FX_BOOL Certificate::privateKeyValidityEnd ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ privateKeyValidityStart()

FX_BOOL Certificate::privateKeyValidityStart ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ SHA1Hash()

FX_BOOL Certificate::SHA1Hash ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ serialNumber()

FX_BOOL Certificate::serialNumber ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ subjectCN()

FX_BOOL Certificate::subjectCN ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ subjectDN()

FX_BOOL Certificate::subjectDN ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
RDN object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ validityEnd()

FX_BOOL Certificate::validityEnd ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ validityStart()

FX_BOOL Certificate::validityStart ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader


Javascript API: color Class Reference

Public Member Functions | List of all members
color Class Reference

The color object is a convenience static object that defines the basic colors. Use this object to set a property or call a method that requires a color array. More...

Public Member Functions

FX_BOOL | convert (OBJ_METHOD_PARAMS)
Converts the color space and color values specified by the color object to the specified color space: More...
FX_BOOL | equal (OBJ_METHOD_PARAMS)
Compares two Color Arrays to see if they are the same. The routine performs conversions, if necessary, to determine if the two colors are indeed equal (for example, ["RGB",1,1,0] is equal to ["CMYK",0,0,1,0]). More...

Detailed Description

*

color properties
Color object | Keyword | Equivalent JavaScript
Transparent | color.transparent | ["T"]
Black | color.black | ["G", 0]
White | color.white | ["G", 1]
Red | color.red | ["RGB", 1,0,0]
Green | color.green | ["RGB", 0,1,0]
Blue | color.blue | ["RGB", 0,0,1]
Cyan | color.cyan | ["CMYK", 1,0,0,0]
Magenta | color.magenta | ["CMYK", 0,1 0,0]
Yellow | color.yellow | ["CMYK", 0,0,1,0]
Dark Gray | color.dkGray | ["G", 0.25]
Gray | color.gray | ["G", 0.5]
Light Gray | color.ltGray | ["G", 0.75]
Example
This example sets the text color of the field to red if the value of the field is negative, or to black if the field value is nonnegative.
var f = event.target; // field that the event occurs at
f.target.textColor = event.value < 0 ? color.red : color.black;

Member Function Documentation

◆ convert()

FX_BOOL color::convert ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
colorArray Array of color values. See Color arrays.
cColorspace The color space to which to convert.
Returns
A color array.
Example
The return value of the code line below is the array ["CMYK", 0, 1, 1, 0].
color.convert(["RGB",1,0,0], "CMYK");

◆ equal()

FX_BOOL color::equal ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
colorArray1 The first color array for comparison.
colorArray2 The second color array for comparison.
Returns
true if the arrays represent the same color, false otherwise.
Example
var f = this.getField("foo");
if (color.equal(f.textColor, f.fillColor))
app.alert("Foreground and background color are the same!");


Javascript API: console Class Reference

Public Member Functions | List of all members
console Class Reference

The console object is a static object that enables access to the Foxit PDF Editor JavaScript Console for executing JavaScript and displaying debug messages.

Public Member Functions

FX_BOOL | clear (OBJ_METHOD_PARAMS)
Clears the console windows buffer of any output.
FX_BOOL | hide (OBJ_METHOD_PARAMS)
Closes the console window.
FX_BOOL | println (OBJ_METHOD_PARAMS)
Prints a string value to the console window with an accompanying carriage return. More...
FX_BOOL | show (OBJ_METHOD_PARAMS)
Shows the console window. More...

Member Function Documentation

◆ println()

FX_BOOL console::println ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cMessage A string message to print.
Example 1
This example prints the value of a field to the console window. The script could be executed
during a mouse-up event.
var f = this.getField("myText");
console.clear();
console.show();
console.println("Field value = " + f.value);
Example 2
The console can be used as a debugging tool. For example, you can write values of variables
to the console. The following script is at the document level:
var debugIsOn = true;
function myFunction ( n, m ){
if (debugIsOn){
console.println("Entering function: myFunction");
console.println(" Parameter 1: n =" + n);
console.println(" Parameter 2: m = " + m);
} ....
....
if (debugIsOn) console.println(" Return value: rtn = " + rtn);
return rtn;
}
See the dbg object.

◆ show()

FX_BOOL console::show ( OBJ_METHOD_PARAMS )
Example
Clear and show the console window:
console.clear();
console.show();


Javascript API: Data Class Reference

Public Member Functions | List of all members
Data Class Reference

The Data object is the representation of an embedded file or data stream that is stored in the document. See the PDF Reference for details. More...

Public Member Functions

FX_BOOL | creationDate (OBJ_PROP_PARAMS)
The creation date of the file that was embedded. More...
FX_BOOL | description (OBJ_PROP_PARAMS)
The description associated with this data object. More...
FX_BOOL | MIMEType (OBJ_PROP_PARAMS)
The MIME type associated with this data object. More...
FX_BOOL | modDate (OBJ_PROP_PARAMS)
The modification date of the file that was embedded. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The name associated with this data object. More...
FX_BOOL | path (OBJ_PROP_PARAMS)
The file name and extension of the file that was embedded. More...
FX_BOOL | size (OBJ_PROP_PARAMS)
The size, in bytes, of the uncompressed data object. More...

Detailed Description

Using Data objects is a good way to associate and embed source files, metadata, and other associated data with a document. Data objects can be inserted from the external file system, queried, and extracted.

Member Function Documentation

◆ creationDate()

FX_BOOL Data::creationDate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ description()

FX_BOOL Data::description ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ MIMEType()

FX_BOOL Data::MIMEType ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ modDate()

FX_BOOL Data::modDate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Date
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ name()

FX_BOOL Data::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Display the names of file attachments to this document.
console.println("Dumping all data objects in the document.");
var d = this.dataObjects;
for (var i = 0; i < d.length; i++)
console.println("DataObject[" + i + "]=" + d[i].name);

◆ path()

FX_BOOL Data::path ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ size()

FX_BOOL Data::size ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader


Javascript API: Doc Class Reference

Public Member Functions | Static Public Member Functions | List of all members
Doc Class Reference

This object provides the interface between a PDF Doc open in the viewer and the JavaScript interpreter. It provides methods and properties for accessing the PDF Doc.

Public Member Functions

FX_BOOL | author (OBJ_PROP_PARAMS)
The author of the Doc. More...
FX_BOOL | baseURL (OBJ_PROP_PARAMS)
The base URL for the Doc is used to resolve relative web links within the Doc. See also URL. More...
FX_BOOL | bookmarkRoot (OBJ_PROP_PARAMS)
The root bookmark for the bookmark tree. This bookmark is not displayed to the user but is a programmatic construct used to access the tree and the child bookmarks. More...
FX_BOOL | calculate (OBJ_PROP_PARAMS)
If true(the default value), calculations can be performed for this Doc.If false, calculations cannot be performed for this Doc.This property supersedes theapp.calculateproperty, whose use is now discouraged. More...
FX_BOOL | creationDate (OBJ_PROP_PARAMS)
The Doc’s creation date. More...
FX_BOOL | creator (OBJ_PROP_PARAMS)
The creator of the Doc (for example, “Foxit FrameMaker” or “Foxit PageMaker”). More...
FX_BOOL | delay (OBJ_PROP_PARAMS)
This property can delay the redrawing of any appearance changes to every field in the Doc. It is generally used to buffer a series of changes to fields before requesting that the fields regenerate their appearance. If true, all changes are queued until delay is reset to false, at which time all the fields on the Page are redrawn. See also the Field object delay property. More...
FX_BOOL | dirty (OBJ_PROP_PARAMS)
Specifies whether the Doc needs to be saved as the result of a changes to the Doc.It is useful to reset the dirty flag when performing changes that do not warrant saving, such as updating a status field. More...
FX_BOOL | documentFileName (OBJ_PROP_PARAMS)
The base file name, with extension, of the Doc referenced by the Doc. The device-independent path is not returned. See also thepathandURLproperties. The file size of the Doc can be obtained from the file size property. More...
FX_BOOL | external (OBJ_PROP_PARAMS)
Specifies whether the current Doc is being viewed in the Foxit PDF Editor application or in an external window (such as a web browser). More...
FX_BOOL | filesize (OBJ_PROP_PARAMS)
The file size of the Doc in bytes. More...
FX_BOOL | icons (OBJ_PROP_PARAMS)
An array of named Icon objects that are present in the Doc-level named icons tree. If there are no named icons in the Doc, the property has a value of null. See also addIcon, getIcon, importIcon, removeIcon, the Field object properties buttonGetIcon, buttonImportIcon, buttonSetIcon, and the Icon object. More...
FX_BOOL | info (OBJ_PROP_PARAMS)
Specifies an object with properties from the Doc information dictionary in the PDF file. (See the PDF Reference). Standard entries are: Title Author Authors Subject Keywords Creator Producer CreationDate ModDate Trapped For Foxit Foxit PDF Editor, properties of this object are write able and setting a property dirties the Doc. Additional Doc information fields can be added by setting non-standard properties. In Foxit PDF Reader, writing to any property in this object throws an exception. More...
FX_BOOL | keywords (OBJ_PROP_PARAMS)
The keywords that describe the Doc(for example, “forms”, “taxes”, “government”). More...
FX_BOOL | layout (OBJ_PROP_PARAMS)
Changes the Page layout of the current Doc. Valid values are: SinglePage OneColumn TwoColumnLeft TwoColumnRight TwoPageLeft TwoPageRight. More...
FX_BOOL | media (OBJ_PROP_PARAMS)
An object that contains multimedia properties and methods for the Doc.The properties and methods are described under the Doc.media object. More...
FX_BOOL | modDate (OBJ_PROP_PARAMS)
The date the Doc was last modified. More...
FX_BOOL | mouseX (OBJ_PROP_PARAMS)
Gets the x coordinate of the mouse coordinates in default user space in relation to the current Page. More...
FX_BOOL | mouseY (OBJ_PROP_PARAMS)
Gets the y coordinate of the mouse coordinates in default user space in relation to the current Page. More...
FX_BOOL | numFields (OBJ_PROP_PARAMS)
The total number of fields in the Doc. See also getNthFieldName. More...
FX_BOOL | numPages (OBJ_PROP_PARAMS)
The number of pages in the Doc. More...
FX_BOOL | pageNum (OBJ_PROP_PARAMS)
Gets or sets the current Page of the Doc. When setting pageNum to a specific Page, remember that the values are 0-based. More...
FX_BOOL | pageWindowRect (OBJ_PROP_PARAMS)
An array of screen coordinates (a rectangle) for the Foxit PDF Editor Page view window. The Page view window is the area inside the inner Doc window in which the PDF content is displayed. More...
FX_BOOL | path (OBJ_PROP_PARAMS)
The device-independent path of the Doc, for example: /c/Program Files (x86)/Foxit Software/Foxit PDF Editor/. More...
FX_BOOL | producer (OBJ_PROP_PARAMS)
The producer of the Doc . More...
FX_BOOL | securityHandler (OBJ_PROP_PARAMS)
The name of the security handler used to encrypt the Doc. Returns null if there is no security handler (for example, the Doc is not encrypted). More...
FX_BOOL | subject (OBJ_PROP_PARAMS)
The Doc’s subject. This property is read-only in Foxit PDF Reader. More...
FX_BOOL | title (OBJ_PROP_PARAMS)
The title of the Doc. More...
FX_BOOL | zoom (OBJ_PROP_PARAMS)
The current Page zoom level. Allowed values are between 8.33% and 6400%, specified as a percentage number. For example, a zoom value of 100 specifies 100%. More...
FX_BOOL | zoomType (OBJ_PROP_PARAMS)
The current zoom type of the Doc. The table below lists the valid zoom types. The convenience zoomtype object defines all the valid zoom types and is used to access all zoom types. More...
FX_BOOL | dynamicXFAForm (OBJ_PROP_PARAMS)
Returns true if the Doc is a dynamic XFA form and false otherwise. A dynamic XFA form is one in which some of the fields can grow or shrink in size to accommodate the values they contain. More...
FX_BOOL | URL (OBJ_PROP_PARAMS)
The Doc’s URL. If the Doc is local, it returns a URL with a file:/// scheme for Windows and UNIX and file://localhost/ for Mac OS. This may be different from the baseURL. More...
FX_BOOL | dataObjects (OBJ_PROP_PARAMS)
An array containing all the named Data objects in the Doc. Related properties and methods are openDataObject, getDataObject, createDataObject, importDataObject, removeDataObject, getDataObjectContents, and setDataObjectContents. More...
FX_BOOL | hostContainer (OBJ_PROP_PARAMS)
An instance of the HostContainer object if the PDF Doc is embedded in another container such as a web browser, otherwise undefined. More...
FX_BOOL | xfa (OBJ_PROP_PARAMS)
The property is defined only if the Doc is an XML form, that is, if the Doc was created in LiveCycle Designer. When defined, xfa is a static XFA Object, which is the root node of the underlying xfa model, and gives access to the xfa scripting object model (SOM). Refer to the Doc XML Form Object Model Reference for details on the xfa SOM. The Doc Converting Foxit PDF Editor JavaScript for Use in LiveCycle Designer Forms has a comparison between the Foxit PDF Editor and LiveCycle Designer scripting object models. More...
FX_BOOL | templates (OBJ_PROP_PARAMS)
An array of all of the Template objects in the Doc. See also createTemplate, getTemplate, and removeTemplate. More...
FX_BOOL | page (OBJ_PROP_PARAMS)
Gets or sets the current page of the document. When setting pageNum to a specific page, remember that the values are 0-based. More...
FX_BOOL | addAnnot (OBJ_METHOD_PARAMS)
FX_BOOL | addField (OBJ_METHOD_PARAMS)
Creates a new form field and returns it as a Field object. More...
FX_BOOL | addLink (OBJ_METHOD_PARAMS)
Adds a new link to the specified Page with the specified coordinates, if the user has permission to add links to the Doc. More...
FX_BOOL | addIcon (OBJ_METHOD_PARAMS)
Adds a new named Icon object to the Doc-level icon tree, storing it under the specified name. More...
FX_BOOL | calculateNow (OBJ_METHOD_PARAMS)
Forces computation of all calculation fields in the current Doc. When a form contains many calculations, there can be a significant delay after the user inputs data into a field, even if it is not a calculation field. One strategy is to turn off calculations at some point and turn them back on later (see example). More...
FX_BOOL | closeDoc (OBJ_METHOD_PARAMS)
Closes the Doc. It is important to use this method carefully, because it is an abrupt change in the Doc state that can affect any JavaScript executing after the close. Triggering this method from a Page event or Doc event could cause the application to behave strangely. More...
FX_BOOL | createTemplate (OBJ_METHOD_PARAMS)
Creates a visible template from the specified Page. More...
FX_BOOL | deletePages (OBJ_METHOD_PARAMS)
Deletes pages from the Doc. If neither Page of the range is specified, the first Page (Page 0) is deleted. More...
FX_BOOL | exportAsText (OBJ_METHOD_PARAMS)
Exports form fields as a tab-delimited text file to a local hard disk. The text file that is created follows the conventions specified by Microsoft Excel. In particular, exportAsText correctly handles quotes and multiline text fields. More...
FX_BOOL | exportAsFDF (OBJ_METHOD_PARAMS)
Exports form fields as an FDF file to the local hard drive. More...
FX_BOOL | exportAsXFDF (OBJ_METHOD_PARAMS)
Exports form fields as an XFDF file to the local hard drive. More...
FX_BOOL | exportAsXFDFStr (OBJ_METHOD_PARAMS)
Exports form fields as an XFDF file to the local hard drive. More...
FX_BOOL | extractPages (OBJ_METHOD_PARAMS)
Creates a new Doc consisting of pages extracted from the current Doc. If a Page range is not specified, the method extracts all pages in the Doc. More...
FX_BOOL | exportDataObject (OBJ_METHOD_PARAMS)
Extracts the specified data object to an external file. More...
FX_BOOL | getAnnot (OBJ_METHOD_PARAMS)
Returns an Annotation object contained on a specific Doc Page. More...
FX_BOOL | getAnnots (OBJ_METHOD_PARAMS)
Gets an array of Annotation objects satisfying specified criteria. More...
FX_BOOL | getField (OBJ_METHOD_PARAMS)
Maps a Field object in the PDF Doc to a JavaScript variable. More...
FX_BOOL | getIcon (OBJ_METHOD_PARAMS)
Obtains a specific icon object. See also the icons property, the addIcon, importIcon, and removeIcon methods, and the Field object methods buttonGetIcon, buttonImportIcon, and buttonSetIcon. More...
FX_BOOL | getLinks (OBJ_METHOD_PARAMS)
Gets an array of Link objects that are enclosed within specified coordinates on a Page. More...
FX_BOOL | getNthFieldName (OBJ_METHOD_PARAMS)
Gets the name of the nth field in the Doc. More...
FX_BOOL | getOCGs (OBJ_METHOD_PARAMS)
Gets an array of OCG objects found on a specified Page. More...
FX_BOOL | getPageBox (OBJ_METHOD_PARAMS)
Gets a rectangle in rotated user space that encompasses the named box for the Page. More...
FX_BOOL | getPageNthWord (OBJ_METHOD_PARAMS)
Gets the nth word on the Page. More...
FX_BOOL | getPageNthWordQuads (OBJ_METHOD_PARAMS)
Gets the quads list for the nth word on the page. The quads property of the Annotation object can be used for constructing text markup, underline, strikeout, highlight and squiggly annotations. See also getPageNthWord, getPageNumWords, and selectPageNthWord. Note:This method throws an exception if the document security is set to prevent content extraction. More...
FX_BOOL | getPageNumWords (OBJ_METHOD_PARAMS)
Gets the number of words on the Page. More...
FX_BOOL | getPageRotation (OBJ_METHOD_PARAMS)
Gets the rotation of the specified Page. More...
FX_BOOL | getPrintParams (OBJ_METHOD_PARAMS)
Gets a PrintParams object that reflects the default print settings. More...
FX_BOOL | getURL (OBJ_METHOD_PARAMS)
Gets the specified URL over the Internet using a GET. More...
FX_BOOL | getDataObject (OBJ_METHOD_PARAMS)
Obtains a specific Data object. More...
FX_BOOL | getTemplate (OBJ_METHOD_PARAMS)
Gets the named template from the Doc. More...
FX_BOOL | gotoNamedDest (OBJ_METHOD_PARAMS)
Goes to a named destination within the PDF Doc. For details on named destinations and how to create them, see the PDF Reference. More...
FX_BOOL | importAnFDF (OBJ_METHOD_PARAMS)
Imports the specified FDF file. More...
FX_BOOL | importAnXFDF (OBJ_METHOD_PARAMS)
Imports the specified XFDF file containing XML form data. More...
FX_BOOL | importDataObject (OBJ_METHOD_PARAMS)
Imports an external file into the Doc and associates the specified name with the data object. Data objects can later be extracted or manipulated. More...
FX_BOOL | importTextData (OBJ_METHOD_PARAMS)
Imports a row of data from a text file. Each row must be tab delimited. The entries in the first row of the text file are the column names of the tab delimited data. These names are also field names for text fields present in the PDF file. The data row numbers are 0-based; that is, the first row of data is row zero (this does not include the column name row). When a row of data is imported, each column datum becomes the field value of the field that corresponds to the column to which the data belongs. See also the export version of this method, exportAsText. More...
FX_BOOL | insertPages (OBJ_METHOD_PARAMS)
Inserts pages from the source Doc into the current Doc. If a Page range is not specified, the method gets all pages in the source Doc. See also deletePages and replacePages. More...
FX_BOOL | mailForm (OBJ_METHOD_PARAMS)
Exports the form data and mails the resulting FDF file as an attachment to all recipients, with or without user interaction. The method does not support signed signature fields. See also mailDoc, app.mailGetAddrs, app.mailMsg, the FDF object mail method and the Report object mail method. More...
FX_BOOL | print (OBJ_METHOD_PARAMS)
Prints all or a specific number of pages of the Doc. More...
FX_BOOL | removeField (OBJ_METHOD_PARAMS)
Removes the specified field from the Doc. If the field appears on more than one Page, all representations are removed. More...
FX_BOOL | removeDataObject (OBJ_METHOD_PARAMS)
Deletes the data object corresponding to the specified name from the Doc. Related objects, properties, and methods are dataObjects, getDataObject, openDataObject, createDataObject, removeDataObject, importDataObject, getDataObjectContents, and setDataObjectContents, and the Data object. More...
FX_BOOL | removeTemplate (OBJ_METHOD_PARAMS)
Removes the named template from the Doc. See also templates, createTemplate, getTemplate, and the Template object. More...
FX_BOOL | replacePages (OBJ_METHOD_PARAMS)
Replaces pages in the current Doc with pages from the source Doc. More...
FX_BOOL | resetForm (OBJ_METHOD_PARAMS)
Resets the field values within a Doc. Resetting a field causes it to take on its default value (which, in the case of text fields, is usually blank). More...
FX_BOOL | submitForm (OBJ_METHOD_PARAMS)
Submits the form to a specified URL. More...
FX_BOOL | mailDoc (OBJ_METHOD_PARAMS)
Saves the current PDF Doc and mails it as an attachment to all recipients, with or without user interaction. See also mailForm, app.mailGetAddrs, app.mailMsg, the FDF object mail method and the Report object mail method. More...
FX_BOOL | removeIcon (OBJ_METHOD_PARAMS)
Removes the specified named icon from the document. See also icons, addIcon, getIcon, and importIcon, the Field object methods buttonGetIcon, buttonImportIcon, and buttonSetIcon, and the Icon object. More...
FX_BOOL | spawnPageFromTemplate (OBJ_METHOD_PARAMS)
Note:This method has been superseded by templates, createTemplate, and the Template object spawn method. Spawns a page in the document using the given template, as returned by getNthTemplate. The template feature does not work in Foxit PDF Reader. More...
FX_BOOL | scroll (OBJ_METHOD_PARAMS)
Scrolls the specified point on the current Page into the middle of the current view. These coordinates must be defined in rotated user space. See the PDF Reference for details. More...
FX_BOOL | syncAnnotScan (OBJ_METHOD_PARAMS)
Guarantees that all annotations will be scanned by the time this method returns. To show or process annotations for the entire Doc, all annotations must have been detected. Normally, a background task runs that examines every Page and looks for annotations during idle time, as this scan is a time-consuming task. Much of the annotation behavior works gracefully even when the full list of annotations is not yet acquired by background scanning. In general, you should call this method if you want the entire list of annotations. See also getAnnots. More...
FX_BOOL | setPageTabOrder (OBJ_METHOD_PARAMS)
Sets the tab order of the form fields on a Page. The tab order can be set by row, by column, or by structure. More...
FX_BOOL | addWatermarkFromText (OBJ_METHOD_PARAMS)
Adds the given text as a watermark to the specified pages in the Doc and places the watermark in an optional content group (OCG). See the OCG object. More...
FX_BOOL | addWatermarkFromFile (OBJ_METHOD_PARAMS)
Adds a Page as a watermark to the specified pages in the Doc and places the watermark in an optional content group (OCG). See also the OCG object. More...
FX_BOOL | flattenPages (OBJ_METHOD_PARAMS)
Converts all annotations in a Page range to Page contents. If a Page range is not specified, all annotations in the Doc are converted. Note: Great care must be used when using this method. All annotations—including form fields, comments, and links— on the specified range of pages are flattened. They may have appearances, but they will no longer be annotations. More...
FX_BOOL | setPageTransitions (OBJ_METHOD_PARAMS)
Sets the Page transition for a specific range of pages. See also getPageTransition. More...
FX_BOOL | getPageTransition (OBJ_METHOD_PARAMS)
Sets the Page transition for a specific range of pages. More...
FX_BOOL | movePage (OBJ_METHOD_PARAMS)
Moves a Page within the Doc. More...
FX_BOOL | newPage (OBJ_METHOD_PARAMS)
Adds a new Page to the active Doc.
Note: This method can only be executed during batch and console events. More...
FX_BOOL | setPageRotations (OBJ_METHOD_PARAMS)
Rotates the specified pages in the current Doc. More...
FX_BOOL | setPageBoxes (OBJ_METHOD_PARAMS)
Sets a rectangle that encompasses the named box for the specified pages. More...
FX_BOOL | addWeblinks (OBJ_METHOD_PARAMS)
Scans the specified pages looking for instances of text with an http: scheme and converts them into links with URL actions. More...
FX_BOOL | removeWeblinks (OBJ_METHOD_PARAMS)
Scans the specified pages looking for links with actions to go to a particular URL on the web and deletes them. See also addWeblinks. More...
FX_BOOL | removeLinks (OBJ_METHOD_PARAMS)
If the user has permission to remove links from the Doc, removes all the links on the specified Page within the specified coordinates. More...
FX_BOOL | getOCGOrder (OBJ_METHOD_PARAMS)
Returns this Doc’s OCGOrder array. This array represents how layers are displayed in the UI. More...
FX_BOOL | setOCGOrder (OBJ_METHOD_PARAMS)
Sets this Doc’s OCGOrder array. This array represents how layers are displayed in the UI. The simplest order array is a flat array of OCG objects. In this case, the listed OCGs are displayed in the UI as a flat list in the same order. If a subarray is present in the order array and the first element of the array is a string, the string will be listed with the rest of the array nested underneath it. If the first element of the array is not a string, the entire array will appear nested underneath the OCG preceding the subarray. More...

Static Public Member Functions

static FX_BOOL AnnotCanBeFetched (IFXJS_AnnotProvider *pAnnot)

Member Function Documentation

◆ author()

FX_BOOL Doc::author ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.author);
example 2:
this.author = "new author";

◆ baseURL()

FX_BOOL Doc::baseURL ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println("Base URL was " + this.baseURL);
example 2:
this.baseURL = "http://www.foxitsoftware.com";

◆ bookmarkRoot()

FX_BOOL Doc::bookmarkRoot ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Object
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
function DumpBookmark(bkm, nLevel)
{
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
console.println(s + "+-" + bkm.name);
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
DumpBookmark(bkm.children[i], nLevel + 1);
}
console.clear(); console.show();
console.println("Dumping all bookmarks in the Doc.");
DumpBookmark(this.bookmarkRoot, 0);

◆ calculate()

FX_BOOL Doc::calculate ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Object
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.calculate);
example 2:
this.calculate = false;

◆ creationDate()

FX_BOOL Doc::creationDate ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Date
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
console.println(this.creationDate);

◆ creator()

FX_BOOL Doc::creator ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.creator);
example 2:
this.creator = "new creator";

◆ delay()

FX_BOOL Doc::delay ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Boolean
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.delay);
example 2:
this.delay = true;

◆ dirty()

FX_BOOL Doc::dirty ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Boolean
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Reset a form and setsdirtytofalse.After the reset, the user can close the Doc without having
to dismiss a Save dialog box. var f = this.getField("MsgField"); f.value = "You have made too
many mistakes, I’m resetting the form. "
+ "Start over, this time follow the directions!";
this.resetForm();
this.dirty = false;
example 2:
//Fill a text field to instruct the user to complete the form.The script is constructed so that
populating the field does not change the save state of the Doc. var f =
this.getField("MsgField"); var b = this.dirty; f.value = "Please fill in the fields below.";
this.dirty = b;

◆ documentFileName()

FX_BOOL Doc::documentFileName ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Get the Doc file name.
console.println('"The file name of this Doc is '
+ this.documentFileName +'."');

◆ external()

FX_BOOL Doc::external ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Boolean
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Detect whether this Doc is in a browser or not.
if ( this.external )
{
// Viewing from a browser
}
else
{
// Viewing in the Foxit PDF Editor application.
}

◆ filesize()

FX_BOOL Doc::filesize ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Integer
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
console.println("File size is " + this.filesize);

◆ icons()

FX_BOOL Doc::icons ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Object|null
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Report the number of named icons in the current Doc.
if (this.icons == null)
console.println("No named icons in this doc");
else
{
var objKeys = Object.keys(this.icons);
console.println("There are " + objKeys.length + " named icons in this doc");
}
example 2:
//List all named icons the current Doc.
for (var i = 0; i < this.icons.length; i++) {
console.println("icon[" + i + "]=" + this.icons[i].name);
}

◆ info()

FX_BOOL Doc::info ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Object
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Get the title of the current Doc.
var docTitle = this.Info.Title;
example 2:
this.Info.Title = "JavaScript, The Definitive Guide";
this.Info.ISBN = "1-56592-234-4";
this.Info.PublishDate = new Date();
for (var i in this.Info)
console.println(i + ": "+ this.Info[i]);

◆ keywords()

FX_BOOL Doc::keywords ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W(Reader: R only)
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.keywords);
example 2:
this.keywords = "new keywords";

◆ layout()

FX_BOOL Doc::layout ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Put the Doc into a continuous facing layout where the first Page of the Doc appears in the
left column: this.layout = "TwoColumnLeft";

◆ media()

FX_BOOL Doc::media ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Doc.media object
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
var mediaObj = this.media;
var annot = mediaObj.getAnnot
({ nPage: 0,cAnnotTitle: "myScreen" });
console.println(annot.rect)

◆ modDate()

FX_BOOL Doc::modDate ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Date
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
console.println(this.modDate)

◆ mouseX()

FX_BOOL Doc::mouseX ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Number
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Get the coordinates of the mouse as the user moves it around the viewer.
function getMouseCoor() {
console.println( "("+this.mouseX+","+ this.mouseY+")" );
}
getMouseCoor();

◆ mouseY()

FX_BOOL Doc::mouseY ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Number
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ numFields()

FX_BOOL Doc::numFields ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Integer
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println("There are " + this.numFields + " in this Doc");

◆ numPages()

FX_BOOL Doc::numPages ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Integer
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println("There are " + this.numPages + " in this Doc");
example 2:
//Delete the last Page from the Doc. The (0-based) Page number of the last Page in the Doc is
//this.numPages - 1.
this.deletePages({ nStart: this.numPages - 1 });

◆ pageNum()

FX_BOOL Doc::pageNum ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Integer
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Go to the first Page of the Doc.
this.pageNum = 0;
//Advance the Doc to the next Page.
this.pageNum++;

◆ pageWindowRect()

FX_BOOL Doc::pageWindowRect ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Array of Numbers
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
console.println(this.pageWindowRect)

◆ path()

FX_BOOL Doc::path ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
console.println(this.path)

◆ producer()

FX_BOOL Doc::producer ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.producer)
example 2:
this.producer = "new producer"

◆ securityHandler()

FX_BOOL Doc::securityHandler ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
console.println(this.securityHandler != null ?
"This Doc is encrypted with " + this.securityHandler
+ " security." : "This Doc is unencrypted.");
This script could print the following if the document was encrypted with the standard security handler.
This document is encrypted with Standard security

◆ subject()

FX_BOOL Doc::subject ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.subject)
example 2:
this.subject = "new subject"

◆ title()

FX_BOOL Doc::title ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R/W (Reader: R only)
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
console.println(this.title)
example 2:
this.title = "new title"

◆ zoom()

FX_BOOL Doc::zoom ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Number
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Zoom to twice the current zoom level.
this.zoom *= 2;
//Set the zoom to 200%.
this.zoom = 200;

◆ zoomType()

FX_BOOL Doc::zoomType ( OBJ_PROP_PARAMS )
Zoom type | Keyword
NoVary | zoomtype.none
FitPage | zoomtype.fitP
FitWidth | zoomtype.fitW
FitHeight | zoomtype.fitH
FitVisibleWidth | zoomtype.fitV
Preferred | zoomtype.pref
Precondition
Doc must be opened.
Type:
String
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//Set the zoom type of the Doc to fit the width.
this.zoomType = zoomtype.fitW;

◆ dynamicXFAForm()

FX_BOOL Doc::dynamicXFAForm ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Boolean
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
if ( this.dynamicXFAForm )
console.println(" This is a dynamic XML form.");

◆ URL()

FX_BOOL Doc::URL ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
String
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ dataObjects()

FX_BOOL Doc::dataObjects ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Array
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//List all embedded files in the Doc.
var d = this.dataObjects;
for (var i = 0; i < d.length; i++)
console.println("Data Object[" + i + "]=" + d[i].name);

◆ hostContainer()

FX_BOOL Doc::hostContainer ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Object
Access:
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ xfa()

FX_BOOL Doc::xfa ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
XFAObject
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Suppose this Doc is an XML form, and that there is a text field named EmployeeName.This
example uses the xfa
//object to access and change the value of this field.
var eN = this.xfa.form.form1.EmployeeName;
console.println("\nEmployeeName: " + eN.rawValue);
//Now change the value of the EmployeeName.
eN.rawValue = "Foxit PDF Editor"
console.println("\nEmployeeName: " + eN.rawValue);
example 2:
//Call a function, defined in a folder level script file, that uses the xfa property, by passing
the Doc object. function isXFA(doc) { var wasWasNot = (typeof doc.xfa == "undefined") ? "not" :
""; console.println("This Doc was "+wasWasNot+"created by Designer.");
}
//From within the Doc, or from the console, the function is called is by isXFA(this).

◆ templates()

FX_BOOL Doc::templates ( OBJ_PROP_PARAMS )
Precondition
Doc must be opened.
Type:
Array
Access:
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
example:
//List all templates in the Doc.
var t = this.templates
for ( var i=0; i < t.length; i++)
{
var state = (t[i].hidden) ? "visible" : "hidden"
console.println("Template: \"" + t[i].name
+ "\", current state: " + state);
}

◆ page()

FX_BOOL Doc::page ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Go to the first page of the document.
this.pageNum = 0;
Advance the document to the next page.
this.pageNum++;

◆ addAnnot()

FX_BOOL Doc::addAnnot ( OBJ_METHOD_PARAMS )

Creates an Annotation object having the specified properties. Properties not specified are given their default values for the specified type of annotation.

Parameters
parameter | instruction
object | A generic object that specifies the properties of the Annotation object, such as

type, rect, and Page, to be created

Returns
The new Annotation object.
Precondition
Doc must be opened.
example 1:
var annot = this.addAnnot
({
Page: 0,
type: "Text",
author: "Foxit PDF Editor",
point: [300,400],
strokeColor: color.yellow,
contents: "Need a little help with this paragraph.",
noteIcon: "Help"
});
example 2:
var annot = this.addAnnot
({
Page: 0,
type: "Square",
rect: [0, 0, 100, 100],
name: "OnMarketShare",
author: "Foxit PDF Editor",
contents: "This section needs revision."
});

◆ addField()

FX_BOOL Doc::addField ( OBJ_METHOD_PARAMS )
Precondition
Doc must be opened.
Parameters
parameter | instruction
cName | The name of the new field to create. This name can use the dot separator syntax to denote a hierarchy (for example, name.last creates a parent node, name, and a child node, last).
cFieldType | The type of form field to create. Valid types are: text button combobox listbox checkbox radiobutton signature
nPageNum | The 0-based index of the Page to which to add the field.
oCoords | An array of four numbers in rotated user space that specifies the size and placement of the form field. These four numbers are the coordinates of the bounding rectangle, in the following order: upper-left x, upper-left y, lower-right x and lower-right y. See also the Field object rect property.
Returns
The newly created Field object.
example:
var inch = 72;
for (var p = 0; p < this.numPages; p++) {
// Position a rectangle (.5 inch, .5 inch)
var aRect = this.getPageBox( {nPage: p} );
aRect[0] += .5*inch; // from upper left hand corner of Page.
aRect[2] = aRect[0]+.5*inch; // Make it .5 inch wide
aRect[1] -= .5*inch;
aRect[3] = aRect[1] - 24; // and 24 points high
var f = this.addField("NextPage", "button", p, aRect )
f.setAction("MouseUp", "this.pageNum++");
f.borderStyle = border.s;
f.highlight = "push";
f.textColor = color.blue;
f.fillColor = color.ltGray;
}

◆ addLink()

FX_BOOL Doc::addLink ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | The Page on which to add the new link.
oCoords | An array of four numbers in rotated user space specifying the size and placement of the link. The numbers are the coordinates of the bounding rectangle in the following order: upper-left x, upper-left y, lower-right x and lower-right y.
Returns
The newly created Link object.
Precondition
Doc must be opened.
example 1:
var linkWidth = 36, linkHeight = 18;
for ( var i=0; i < this.numPages; i++)
{
var cropBox = this.getPageBox("Crop", i);
var linkRect1 = [0,linkHeight,linkWidth,0];
var offsetLink = cropBox[2] - cropBox[0] - linkWidth;
var linkRect2 = [offsetLink,linkHeight,linkWidth + offsetLink,0]
var lhLink = this.addLink(i, linkRect1);
var rhLink = this.addLink(i, linkRect2);
var nextPage = (i + 1) % this.numPages;
var prevPage = (i - 1) % this.numPages;
var prevPage = (prevPage>=0) ? prevPage : -prevPage;
lhLink.setAction( "this.pageNum = " + prevPage);
lhLink.borderColor = color.red;
lhLink.borderWidth = 1;
rhLink.setAction( "this.pageNum = " + nextPage);
rhLink.borderColor = color.red;
rhLink.borderWidth = 1;
}

◆ addIcon()

FX_BOOL Doc::addIcon ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the new object
icon | The Icon object to add.
Precondition
Doc must be opened. Only apply to push button
example:
var f = this.getField("myButton");
this.addIcon("myButtonIcon", f.buttonGetIcon());

◆ calculateNow()

FX_BOOL Doc::calculateNow ( OBJ_METHOD_PARAMS )
Precondition
Doc must be opened.
example 1:
this.calculateNow();

◆ closeDoc()

FX_BOOL Doc::closeDoc ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
bNoSave (optional) A Boolean value indicating whether to close the Doc without saving:
  • If false (the default), the user is prompted to save the Doc if it has been modified.
  • If true, the Doc is closed without prompting the user and without saving,
    even if the Doc has been modified. Be careful in using this feature because it can cause data loss without user approval.
Precondition
Doc must be opened.
example:
var d = app.activeDocs;
for( var i in d ) d[i].closeDoc();

◆ createTemplate()

FX_BOOL Doc::createTemplate ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name to be associated with this Page.
nPage | (optional) The 0-based index of the Page to operate on. The default is 0, the first Page in the Doc.
Precondition
Doc must be opened.
example 1:
numNewTemplates = this.numPages - 2;
for ( var i = 0; i < numNewTemplates; i++)
{
var t = this.createTemplate({cName:"myTemplate"+i, nPage:2 });
t.hidden = true;
}

◆ deletePages()

FX_BOOL Doc::deletePages ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nStart | (optional) The 0-based index of the first Page in the range of pages to be deleted. The default is 0, the first Page in the Doc.
nEnd | (optional) The last Page in the range of pages to be deleted. If nEnd is not specified, only the Page specified by nStart is deleted.
Precondition
Doc must be opened.
example 1:
this.deletePages({nStart: 1, nEnd: 3});

◆ exportAsText()

FX_BOOL Doc::exportAsText ( OBJ_METHOD_PARAMS )

This method writes two lines to the text file, the first line is a tab-delimited list of the names of the fields specified by aFields, the second line is a tab-delimited list of the values of the fields.

Parameters
parameter | instruction
bNoPassword | (optional) If true (the default), do not include text fields that have the password flag set in the exported text file.
aFields (optional) The array of field names to submit or a string containing a single field
name:
  • If specified, only these fields are exported, except those excluded by bNoPassword.
  • If aFields is an empty array, no fields are exported.
  • If this parameter is omitted or is null, all fields in the form are exported, except those excluded by bNoPassword.
cPath (optional) A string specifying the device-independent path for the file.
The path may be relative to the location of the current Doc.
If the parameter is omitted, a dialog box is shown to let the user select the file.
Precondition
Doc must be opened.
example:
this.exportAsText();

◆ exportAsFDF()

FX_BOOL Doc::exportAsFDF ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
bAllFields | (optional) If true, all fields are exported, including those that have no value.
bNoPassword | (optional) If true (the default), do not include text fields that have the password flag set in the exported FDF file.
aFields (optional) The array of field names to submit or a string containing a single field
name:
  • If specified, only these fields are exported, except those excluded by bNoPassword.
  • If aFields is an empty array, no fields are exported. The FDF file might still
    contain data, depending on the bAnnotations parameter.
  • If this parameter is omitted or is null, all fields in the form are exported,
    except those excluded by bNoPassword.
    Specify non-terminal field names to export an entire subtree of fields (see the
    example below).
bFlags (optional) If true, field flags are included in the exported FDF file. The default is
false.
cPath (optional) A string specifying the device-independent path for the file. The path may
be relative to the location of the current Doc. If the parameter is omitted, a
dialog box is shown to let the user select the file.
bAnnotations (optional) If true, annotations are included in the exported FDF file.
The default is false.
Precondition
Doc must be opened.
example 1:
this.exportAsFDF(true, true, null, true);
example 2:
this.exportAsFDF(false, true, "name");

◆ exportAsXFDF()

FX_BOOL Doc::exportAsXFDF ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
bAllFields (optional) If true, all fields are exported, including those that have no value. If
false (the default), excludes those fields that currently have no value.
bNoPassword (optional) If true (the default), do not include text fields that have the password
flag set in the exported XFDF.
aFields (optional) The array of field names to submit or a string containing a single field
name:
  • If specified, only these fields are exported, except those excluded by
    bNoPassword.
  • If aFields is an empty array, no fields are exported. The XFDF file might still
    contain data, depending on the bAnnotations parameter.
  • If this parameter is omitted or is null, all fields in the form are exported, except
    those excluded by bNoPassword.
cPath (optional) A string specifying the device-independent path for the file. The path may
be relative to the location of the current Doc. If the parameter is omitted, a
dialog box is shown to let the user select the file.
bAnnotations (optional) If true, annotations are included in the exported XFDF file.
The default is false.
Precondition
Doc must be opened.
example:
this.exportAsXFDF();

◆ exportAsXFDFStr()

FX_BOOL Doc::exportAsXFDFStr ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
bAllFields (optional) If true, all fields are exported, including those that have no value. If
false (the default), excludes those fields that currently have no value.
bNoPassword (optional) If true (the default), do not include text fields that have the password
flag set in the exported XFDF.
aFields (optional) The array of field names to submit or a string containing a single field
name:
  • If specified, only these fields are exported, except those excluded by
    bNoPassword.
  • If aFields is an empty array, no fields are exported. The XFDF file might still
    contain data, depending on the bAnnotations parameter.
  • If this parameter is omitted or is null, all fields in the form are exported, except
    those excluded by bNoPassword.
bAnnotations | (optional) Must be false, which is the default. Annotations are not supported.
cHRef | (optional) When supplied, its value is inserted as the source or target file of the returned XFDF expression (i.e., the value of the href attribute of the f element child of the xfdf element).
Precondition
Doc must be opened.
example:
var c =
this.exportAsXFDFStr({bAllFields:"",bNoPassword:true,aFields:null,bAnnotations:false,cHRef:
"6936983800013"}); console.println(c);

◆ extractPages()

FX_BOOL Doc::extractPages ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nStart | (optional) A 0-based index that defines the start of the range of pages to extract from the source Doc. If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd | (optional) A 0-based index that defines the end of the range of pages to extract from the source Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
cPath | (optional) The device-independent path to save the new Doc. The path name may be relative to the location of the current Doc.
Returns
If cPath is not specified, returns the Doc for the new Doc; otherwise, returns the null object.
Precondition
Doc must be opened.
example:
//Extract each page of the document.
for (i = this.numPages - 1; i >= 0; i--)
this.extractPages( i );

◆ exportDataObject()

FX_BOOL Doc::exportDataObject ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the data object to extract.
cDIPath (optional) A device-independent path to which to extract the data object. This path
may be absolute or relative to the current Doc. If not specified, the user is
prompted to specify a save location.
bAllowAuth (optional) If true, a dialog box is used to obtain user authorization.
Authorization may be required if the data object was encrypted using the
encryptForRecipients method. Authorization dialog boxes are allowed if
bAllowAuth is true. The default value is false.
nLaunch (optional) nLaunch controls whether the file is launched, or opened,
after it is saved. Launching may involve opening an external application if the file is
not a PDF file. The values of nLaunch are:
  • If the value is 0, the file will not be launched after it is saved.
  • If the value is 1, the file will be saved and then launched. Launching will prompt
    the user with a security alert warning if the file is not a PDF file. The user will be
    prompted for a save path.
  • If the value is 2, the file will be saved and then launched. Launching will prompt
    the user with a security alert warning if the file is not a PDF file. A temporary path
    is used, and the user will not be prompted for a save path. The temporary file
    that is created will be deleted by Foxit PDF Editor upon application shutdown.
    The default value is 0.
Precondition
Doc must be opened.
example 1:
this.exportDataObject("MyData");
example 2:
this.exportDataObject({ cName: "MyPDF.pdf", nLaunch: 2 });

◆ getAnnot()

FX_BOOL Doc::getAnnot ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | The Page that contains the Annotation object.
cName | The name of the Annotation object.
Returns
The Annotation object, or null if there is no such annotation.
Precondition
Doc must be opened.
example:
var ann = this.getAnnot(0, "fa8bac3d-0881-42fa-b119-f25bf5b92e99");
if (ann == null)
console.println("Not Found!")
else
console.println("Found it! type: " + ann.type);

◆ getAnnots()

FX_BOOL Doc::getAnnots ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) A 0-based Page number. If specified, gets only annotations on the given Page. If not specified, gets annotations that meet the search criteria from all pages.
nSortBy | (optional) A sort method applied to the array. Values are: ANSB_None — (default) Do not sort; equivalent to not specifiying this parameter. ANSB_Page — Use the Page number as the primary sort criteria. ANSB_Author — Use the author as the primary sort criteria. ANSB_ModDate — Use the modification date as the primary sort criteria. ANSB_Type — Use the annotation type as the primary sort criteria.
bReverse | (optional) If true, causes the array to be reverse sorted with respect to nSortBy.
Returns
An array of Annotation objects, or null if none are found.
Precondition
Doc must be opened.
example:
this.syncAnnotScan();
var annots = this.getAnnots({
nPage:0,
nSortBy: ANSB_Author,
bReverse: true
});
console.show();
console.println("Number of Annotations: " + annots.length);
var msg = "%s in a %s annot said: \"%s\"";
for (var i = 0; i < annots.length; i++)
console.println(util.printf(msg, annots[i].author, annots[i].type,annots[i].contents));

◆ getField()

FX_BOOL Doc::getField ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the field of interest.
Returns
A Field object representing a form field in the PDF Doc.
Precondition
Doc must be opened.
example 1:
var f = this.getField("myText");
var aRect = f.rect;
f.multiline = true;
var height = aRect[1]-aRect[3];
aRect[3] -= 2* height;
f.rect = aRect;
example 2:
var f = this.getField("myRadio.0");
f.setAction("MouseUp",
"app.alert('Thanks for selecting the first choice.');");
example 3:
f = this.getField("myField");
for ( var i in f ) {
try {
if ( typeof f[i] != "function" )
console.println( i + ":" + f[i] )
}
catch(e) {}
}

◆ getIcon()

FX_BOOL Doc::getIcon ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cName The name of the icon object to obtain.
Returns
An Icon object associated with the specified name in the document or null if no icon of that name exists.
Example
The following is a custom keystroke script from a combo box. The face names of the items in the combo box are the names of some of the icons that populate the document. As the user chooses different items from the combo box, the corresponding icon appears as the button face of the field “myPictures”.
if (!event.willCommit) {
var b = this.getField("myPictures");
var i = this.getIcon(event.change);
b.buttonSetIcon(i);
}
See the Field object buttonSetIcon method or a more elaborate variation on this example.

◆ getLinks()

FX_BOOL Doc::getLinks ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | The Page that contains the Link objects. The first Page is 0.
oCoords | An array of four numbers in rotated user space, the coordinates of a rectangle listed in the following order: upper-left x, upper-left y, lower-right x and lower-right y.
Returns
An array of Link objects.
Precondition
Doc must be opened.
example 1:
var numLinks=0;
for ( var p = 0; p < this.numPages; p++)
{
var b = this.getPageBox("Crop", p);
var l = this.getLinks(p, b);
console.println("Number of Links on Page " + p +" is " + l.length);
numLinks += l.length;
}
console.println("Number of Links in Doc is " + numLinks);

◆ getNthFieldName()

FX_BOOL Doc::getNthFieldName ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nIndex | The index of the field whose name should be obtained.
Returns
The name of the field in the Doc.
Precondition
Doc must be opened.
example 1:
for (var i = 0; i < this.numFields; i++)
console.println("Field[" + i + "] = " + this.getNthFieldName(i));

◆ getOCGs()

FX_BOOL Doc::getOCGs ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based Page number. If not specified, all the OCGs found in the Doc are returned. If no argument is passed, returns all OCGs listed in alphabetical order, by name. If nPage is passed, this method returns the OCGs for that Page, in the order they were created.
Returns
An array of OCG objects or null if no OCGs are present.
Precondition
Doc must be opened.
example 1:
var ocgArray = this.getOCGs({nPage:0});
for (var i=0; i < ocgArray.length; i++)
console.println("Ocg " + i + " is " + ocgArray[i].state);

◆ getPageBox()

FX_BOOL Doc::getPageBox ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cBox | (optional) The type of box. Values are: BBox For definitions of these boxes see the PDF Reference.
Returns
A rectangle in rotated user space that encompasses the named box for the Page.
Precondition
Doc must be opened.
example 1:
var aRect = this.getPageBox("Media");
var width = aRect[2] - aRect[0];
var height = aRect[1] - aRect[3];
console.println("Current Page has a width of " + width + " and a height of " + height);

◆ getPageNthWord()

FX_BOOL Doc::getPageNthWord ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based index of the Page. The default is 0, the first Page in the Doc.
nWord | (optional) The 0-based index of the word. The default is 0, the first word on the Page.
Returns
The nth word on the Page.
Precondition
Doc must be opened.
example 1:
var ckWord = this.getPageNthWord(0, 0);
console.println("Page 1 nth word is " + ckWord);

◆ getPageNthWordQuads()

FX_BOOL Doc::getPageNthWordQuads ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nPage (optional) The 0-based index of the page. The default is 0, the first page in the document.
nWord (optional) The 0-based index of the word. The default is 0, the first word on the page.
Returns
The quads list for the nth word on the page.
Example
Underline the fifth word on the second page of a document.
var annot = this.addAnnot({
page: 1,
type: "Underline",
quads: this.getPageNthWordQuads(1, 4),
author: "A. C. Robat",
contents: "Fifth word on second page"
});
See spell.checkWord for an additional example.

◆ getPageNumWords()

FX_BOOL Doc::getPageNumWords ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based index of the Page. The default is 0, the first Page in the Doc.
Returns
The number of words on the Page.
Precondition
Doc must be opened.
example 1:
var numWord = this.getPageNumWords(0);
console.println("The number of words on the Page 1 is " + numWord);

◆ getPageRotation()

FX_BOOL Doc::getPageRotation ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based index of the Page. The default is 0, the first Page in the Doc.
Returns
The rotation value of 0, 90, 180, or 270.
Precondition
Doc must be opened.
example 1:
var ratate = this.getPageRotation(0);
console.println("The rotation value the Page 1 is " + ratate);

◆ getPrintParams()

FX_BOOL Doc::getPrintParams ( OBJ_METHOD_PARAMS )
Returns
A PrintParams object.
Precondition
Doc must be opened.
example 1:
var pp = this.getPrintParams();
console.println( pp.binaryOK + " " + pp.bitmapDPI + " " + pp.booklet);

◆ getURL()

FX_BOOL Doc::getURL ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cURL | A fully qualified URL or a relative URL. There can be a query string at the end of the URL.
Precondition
Doc must be opened.
example 1:
this.getURL("https://www.foxitsoftware.cn/");

◆ getDataObject()

FX_BOOL Doc::getDataObject ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the data object to obtain.
Returns
The Data object corresponding to the specified name.
Precondition
Doc must be opened.
example 1:
var MyData = this.getDataObject("MyData");
console.show(); console.clear();
for (var i in MyData) console.println("MyData." + i + "=" + MyData[i]);

◆ getTemplate()

FX_BOOL Doc::getTemplate ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the template to retrieve.
Returns
The Template object or null if the named template does not exist in the Doc.
Precondition
Doc must be opened.
example 1:
var t = this.getTemplate("myTemplate");
if ( t != null ) console.println( "myTemplate exists and is "
+ eval( '( t.hidden) ? "hidden" : "visible"' ) + ".");
else console.println( "myTemplate is not present!");

◆ gotoNamedDest()

FX_BOOL Doc::gotoNamedDest ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the destination within a Doc.
Precondition
Doc must be opened.
example 1:
// Open a new Doc
var myNovelDoc = app.openDoc("..//test.pdf");
// Go to a destination in this new doc
myNovelDoc.gotoNamedDest("chapter5");
// Close the old Doc
this.closeDoc();

◆ importAnFDF()

FX_BOOL Doc::importAnFDF ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cPath | (optional) The device-independent path to the FDF file. It should look like the value of the F entry in an FDF file exported with the submitForm method or with the Form > Form Data > Export. The path may be relative to the location of the current Doc. If this parameter is omitted, a dialog box is shown to let the user select the file.
Precondition
Doc must be opened.
example 1:
this.importAnFDF("E:\\Untitled.fdf");

◆ importAnXFDF()

FX_BOOL Doc::importAnXFDF ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cPath | (optional) The device-independent path to the XFDF file. The path may be relative to the location of the current Doc. If the parameter is omitted, a dialog box is shown to let the user select the file.
Precondition
Doc must be opened.
example 1:
this.importAnXFDF("E:\\Untitled.xfdf");

◆ importDataObject()

FX_BOOL Doc::importDataObject ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name to associate with the data object.
Returns
true on success. An exception is thrown on failure.
Precondition
Doc must be opened.
example 1:
this.importDataObject("MyData");
var dataobj = this.getDataObject("MyData");
console.println(dataobj.name);

◆ importTextData()

FX_BOOL Doc::importTextData ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cPath | (optional) A relative device-independent path to the text file. If not specified, the user is prompted to locate the text data file.
nRow | (optional) The 0-based index of the row of the data to import, not counting the header row. If not specified, the user is prompted to select the row to import.
Returns
An integer return code.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
//In this example, there are text fields named “First”, “Middle”, and “Last”, and a data file
whose first row consists of the three
//strings, “First”, “Middle”, and “Last”, separated by tabs, along with four additional rows of
tab-separated name data.
//First Middle Last
//A. C. Red
//T. A. black
//A. T. white
//B. A. yellow
// Import the first row of data from "myData.txt".
this.importTextData("/c/data/myData.txt", 0)

◆ insertPages()

FX_BOOL Doc::insertPages ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based index of the Page after which to insert the source Doc pages. Use -1 to insert pages before the first Page of the Doc.
cPath | The device-independent path to the PDF file that will provide the inserted pages. The path may be relative to the location of the current Doc.
nStart | (optional) A 0-based index that defines the start of an inclusive range of pages in the source Doc to insert. If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd | (optional) A 0-based index that defines the end of an inclusive range of pages in the source Doc to insert. If only nEnd is specified, the range of pages is 0 to nEnd.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
//Insert a cover Page to the current Doc.
this.insertPages ({
nPage: -1,
cPath: "/c/temp/myPage.pdf",
nStart: 0
});

◆ mailForm()

FX_BOOL Doc::mailForm ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
bUI | If true, the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all other are optional.
cTo | (required if bUI is true) A semicolon-delimited list of recipients for the message.
cCc | (optional) A semicolon-delimited list of CC recipients for the message.
cBcc | (optional) A semicolon-delimited list of BCC recipients for the message.
cSubject | (optional) The subject of the message.
cMsg | (optional) The content of the message.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Open the compose message window.
this.mailForm(true);
//Send the mail with the attached FDF file to fun1@example.com and fun2@example.com.
this.mailForm(false, "test@example.com; test@example.com", "", "",
"This is the subject", "This is the body of the mail.");

◆ print()

FX_BOOL Doc::print ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
bUI | (optional) If true (the default), will cause a UI to be presented to the user to obtain printing information and confirm the action.
nStart | (optional) A 0-based index that defines the start of an inclusive range of pages. If nStart and nEnd are not specified, all pages in the Doc are printed. If only nStart is specified, the range of pages is the single Page specified by nStart. If nStart and nEnd parameters are used, bUI must be false.
nEnd | (optional) A 0-based index that defines the end of an inclusive Page range. If nStart and nEnd are not specified, all pages in the Doc are printed. If only nEnd is specified, the range of a pages is 0 to nEnd. If nStart and nEnd parameters are used, bUI must be false.
bSilent | (optional) If true, suppresses the cancel dialog box while the Doc is printing. The default is false.
bPrintAsImage | (optional) If true, print pages as an image. The default is false.
bReverse | (optional) If true, print from nEnd to nStart. The default is false.
bAnnotations | (optional) If true (the default), annotations are printed.
printParams | (optional) The PrintParams object containing the settings to use for printing. If this parameter is passed, any other parameters are ignored.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Print the current Page.
this.print(false, this.pageNum, this.pageNum);
// Print a file silently
this.print({bUI: false, bSilent: true});
example 2:
//Print current Doc to a known printer.
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
pp.printerName = "Foxit Foxit PDF Editor Printer";
this.print(pp);

◆ removeField()

FX_BOOL Doc::removeField ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The field name to remove.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example 1:
this.removeField(("myField");

◆ removeDataObject()

FX_BOOL Doc::removeDataObject ( OBJ_METHOD_PARAMS )
Parameters | instruction
cName | The name of the data object to remove.

The name of a data object is a property of the Data object. A name is given to the object when it is embedded, either automatically by the Foxit UI or programmatically by the JavaScript methods createDataObject or importDataObject.

Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
this.removeDataObject("MyData");

◆ removeTemplate()

FX_BOOL Doc::removeTemplate ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | The name of the template to remove. The template name is a property of the Template object. A name is given to a template when it is created, either by the Foxit UI or by the JavaScript method getTemplate.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor

◆ replacePages()

FX_BOOL Doc::replacePages ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based index of the Page at which to start replacement. The default is 0.
cPath | The device-independent path to the PDF file that will provide the replacement pages. The path may be relative to the location of the current Doc.
nStart | (optional) A 0-based index that defines the start of an inclusive range of pages in the source Doc to be used for replacement. If nStart and nEnd are not specified, gets all pages in the source Doc. If only nStart is specified, the range of pages is the single Page specified by nStart.
nStart | (optional) A 0-based index that defines the end of an inclusive range of pages in the source Doc to be used for replacement. If nStart and nEnd are not specified, gets all pages in the source Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example 1:
this.replacePages(0,"D:\\test.pdf",0,0)

◆ resetForm()

FX_BOOL Doc::resetForm ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
aFields | (optional) An array specifying the fields to reset. If not present or null, all fields in the form are reset. You can include non-terminal fields in the array.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Select fields to be reset and reset them.
var fields = new Array();
fields[0] = "Form1.Name";
fields[1] = "Form2.CID";
this.resetForm(fields);
//The same fields can be reset using only one line of code:
this.resetForm(["Form1.Name","Form2.CID"]);
example 2:
//This example shows how to reset a whole subtree. For example, if you pass “name” as part of
the fields array, all name
//fields, such as name.first and name.last, are reset.
this.resetForm(["name"]);

◆ submitForm()

FX_BOOL Doc::submitForm ( OBJ_METHOD_PARAMS )

The https protocol is supported for secure connections.

Parameters
parameter | instruction
cURL The URL to submit to. This string must end in #FDF if the result from the
submission is FDF or XFDF (that is, the value of cSubmitAs is “FDF” or
“XFDF”) and the Doc is being viewed inside a browser window.
bFDF (optional) If true (the default) form data is submitted as FDF. If false, it is
submitted as URL-encoded HTML.
bEmpty | (optional) If true, submit all fields, including those that have no value. If\nfalse (the default), exclude fields that currently have no value.
aFields (optional) An array of field names to submit or a string containing a single
field name:
  • If supplied, only the fields indicated are submitted, except those
    excluded by bEmpty.
  • If omitted or null, all fields are submitted, except those excluded by
    bEmpty.
  • If an empty array, no fields are submitted. A submitted FDF file might
    still contain data if bAnnotations is true.
    You can specify non-terminal field names to export an entire subtree of\nfields.
cCharset (optional) The encoding for the values submitted. String values
are utf-8, utf-16, Shift-JIS, BigFive, GBK, and UHC.
For XML-based formats,utf-8 is used. For other formats, Foxit tries to find the best host
encoding for the values being submitted.
XFDF submission ignores this value and always uses utf-8.
cSubmitAs (optional) This parameter indicates the format for submission.
Values are
FDF — (default): Submit as FDF
XFDF — Submit as XFDF
HTML — Submit as HTML
XML — submit as XML.form data is submitted in XML
format unless the parameter oXML contains a valid
XMLData object, in which case that is what gets submitted instead.
PDF — Submit the complete PDF Doc; all other parameters
except cURL are ignored.

This parameter supersedes the individual format parameters. However, they
are considered in the following priority order, from high to low:
cSubmitAs, bPDF, bXML, bFDF.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Submit the form to the server.
this.submitForm("http://www.example.com/cgi-bin/myscript.cgi#FDF");
example 2:
//Submit selected form fields to a server-side script as FDF.
ar aSubmitFields = new Array( "name", "id", "score" );
this.submitForm({
cURL: "http://www.example.com/cgi-bin/myscript.cgi#FDF",
aFields: aSubmitFields,
cSubmitAs: "FDF" // the default, not needed here
});
example 3:
//Submit form as XFDF to a server-side script.
this.submitForm({
cURL: "http://www.example.com/cgi-bin/myscript.cgi#FDF",
cSubmitAs: "XFDF"
});

◆ mailDoc()

FX_BOOL Doc::mailDoc ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
bUI | (optional) If true (the default), the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.
cTo | (optional) The semicolon-delimited list of recipients for the message..
cCc | (optional) The semicolon-delimited list of CC recipients for the message.
cBcc | (optional) The semicolon-delimited list of BCC recipients for the message.
cSubject | (optional) The subject of the message.
cMsg | (optional) The content of the message.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Open the compose message window.
this.mailDoc(true);
//Send email with the attached PDF file to apstory@example.com and dpsmith@example.com.
this.mailDoc({
bUI: false,
cTo: "apstory@example.com",
cCC: "dpsmith@example.com",
cSubject: "The Latest News",
cMsg: "attached is my latest news story in PDF."
});

◆ removeIcon()

FX_BOOL Doc::removeIcon ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cName The name of the icon to remove.
The name of the icon is a property of the Icon object. A name is given to the object either by importIcon, when the icon file is imported into the document, or by addIcon, which names an icon that is not in the document-level named icons tree.
Example
Remove all named icons from the document.
for ( var i = 0; i < this.icons.length; i++)
this.removeIcon(this.icons[i].name);

◆ spawnPageFromTemplate()

FX_BOOL Doc::spawnPageFromTemplate ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cTemplate The template name.
nPage (optional) The 0-based page number before which or into which the template is spawned, depending on the value of bOverlay. If nPage is omitted, a new page is created at the end of the document.
bRename (optional) Specifies whether fields should be renamed. The default is true.
bOverlay If false, the template is inserted before the page specified by nPage. If true (the default) it is overlaid on top of that page.
oXObject The value of this parameter is the return value of an earlier call to spawnPageFromTemplate.
Returns
this method returned nothing. Now, this method returns an object representing the page contents of the page spawned. This return object can then be used as the value of the optional parameter oXObject for subsequent calls to spawnPageFromTemplate. Note:Repeatedly spawning the same page can cause a large increase in file size. To avoid this problem, spawnPageFromTemplate now returns an object that represents the page contents of the spawned page. This return value can be used as the value of the oXObject parameter in subsequent calls to the spawnPageFromTemplate method to spawn the same page.
Example 1
Spawn each template page in the current document.
var n = this.numTemplates;
var cTempl;
for (i = 0; i < n; i++) {
cTempl = this.getNthTemplate(i);
this.spawnPageFromTemplate(cTempl);
}
Example 2
The following example spawns the same template 31 times using the oXObject parameter and return value. Using this technique avoids overly inflating the file size.
var t = this.getNthTemplate(0)
var XO = this.spawnPageFromTemplate(t, this.numPages, false, false);
for (var i=0; i < 30; i++)
this.spawnPageFromTemplate(t,this.numPages, false, false, XO);

◆ scroll()

FX_BOOL Doc::scroll ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nX | The x coordinate for the point to scroll.
nY | The y coordinate for the point to scroll.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
this.scroll(100,100);

◆ syncAnnotScan()

FX_BOOL Doc::syncAnnotScan ( OBJ_METHOD_PARAMS )
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Wait for all annotations to be scanned, then get the array of annotations in the Doc and sort
by author.
//The second line of code is not executed until syncAnnotScan returns, which does not occur
until the annotation scan
//of the Doc is completed.
this.syncAnnotScan();
annots = this.getAnnots({nSortBy:ANSB_Author});

◆ setPageTabOrder()

FX_BOOL Doc::setPageTabOrder ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | The 0-based index of the Page number on which the tabbing order is to be set.
cOrder | The order to be used. Values are: rows columns structure
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor/Foxit PDF Reader
example 1:
//Set the Page tab order for all pages to rows.
for (var i = 0; i < this.numPages; i++)
this.setPageTabOrder(i, "rows");

◆ addWatermarkFromText()

FX_BOOL Doc::addWatermarkFromText ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cText | The text to use as the watermark. Multiline text is allowed. A newline can be specified with the characters “\r”.
nTextAlign | (optional) The text alignment to use for cText within the watermark. See app.constants.align for possible values. This parameter has no effect if cText is only one line.
cFont | (optional) The font to be used for this watermark. Valid fonts are defined as properties of the font object, as listed in the textFont property of the Field object.An arbitrary font can be used by passing a string that represents the PostScript name of the font. The default is font.Helv.
nFontSize | (optional) The point size of the font to use for the watermark. The default is 24.
aColor | (optional) The color to use for the watermark. See Color arrays. The default is color.black.
nStart | (optional) The 0-based index of the first Page in the range of pages to which the watermark should be added. If nStart and nEnd are not specified, the range of pages is for all pages in the Doc. If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd | (optional) The last Page in the range of pages to which the watermark should be added. If nStart and nEnd are not specified, the range of pages is for all pages in the Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
bOnTop | (optional) A Boolean value specifying the z-ordering of the watermark. A value of true will result in the watermark being added above all other Page content. A value of false will result in the watermark being added below all other Page content. This parameter is ignored if bFixedPrint is true. The default is true.
bOnScreen | (optional) A Boolean value to indicate whether the watermark should be displayed when viewing the Doc on screen.
bOnPrint | (optional) A Boolean value to indicate whether the watermark should be displayed when printing the Doc.
nHorizAlign | (optional) A number indicating how the watermark should be aligned horizontally. See app.constants.align for possible values. The default is app.constants.align.center.
nVertAlign | (optional) A number indicating how the watermark should be aligned vertically. See app.constants.align for possible values. The default is app.constants.align.center.
nHorizValue | (optional) A number used to shift the horizontal position of the watermark on the Page. If bPercentage is true, this number represents a percentage of the horizontal Page size. If bPercentage is false, this number represents the number of points to be offset. The default is 0.
nVertValue | (optional) A number used to shift the vertical position of the watermark on the page. If bPercentage is true, this number represents a percentage of the vertical Page size. If bPercentage is false, this number represents the number of points to be offset. The default is 0.
bPercentage | (optional) A Boolean value used to indicate whether nHorizValue and nVertValue represent a percentage of the Page size or an explicit number of points. The default is false.
nScale | (optional) The scale to be used for the watermark, where 1.0 is 100%. A value of -1 specifies that the watermark should fit to the Page while maintaining its proportions. The default is 1.0.
bFixedPrint | (optional) A Boolean value that indicates that the watermark should be added as a FixedPrint Watermark annotation. This prints the watermark at a fixed size and position regardless of the size of the Page being printed to. If true, bOnTop is ignored. The default is false.
nRotation | (optional) The number of degrees to rotate the watermark counterclockwise. The default is 0.
nOpacity | (optional) The opacity to be used for the watermark, where 0 is transparent and 1.0 is opaque. The default is 1.0
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example 1:
Adds “Confidential” as a watermark to the center of all pages of the current Doc.
this.addWatermarkFromText("Confidential", 0, font.Helv, 23, color.red);
example 2:
//Adds a multiline watermark to each Page of the current Doc 1 inch down and 1 inch over from
the upper-right
//corner.
this.addWatermarkFromText({
cText: "Confidential Doc\rA. C. Robat",
nTextAlign: app.constants.align.right,
nHorizAlign: app.constants.align.right,
nVertAlign: app.constants.align.top});

◆ addWatermarkFromFile()

FX_BOOL Doc::addWatermarkFromFile ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cDIPath | The device-independent path of the source file to use for the watermark. File Type : pdf/bmp.dib/jpg/jpeg/jpe/gif/png/tif/tiff
nSourcePage | (optional) The 0-based index of the Page in the source file to be used as thewatermark. The default is 0
nStart | (optional) The 0-based index of the first Page in the range of pages to which the watermark should be added. If nStart and nEnd are not specified, the range of pages is for all pages in the Doc. If only nStart is specified, the range of pages is the single Page specified by nStart. If only nEnd isspecified, the range of pages is 0 to nEnd.
nEnd | (optional) The last Page in the range of pages to which the watermark should be added. See nStart for details
bOnTop | (optional) A Boolean value specifying the z-ordering of the watermark. If true (the default), the watermark is added above all other Page content. If false, the watermark is added below all other Page content. This parameter is ignored if bFixedPrint is true.
bOnScreen | (optional) A Boolean value to indicate whether the watermark should be displayed when viewing the Doc on screen. The default is true.
bOnPrint | (optional) A Boolean value to indicate whether the watermark should be displayed when printing the Doc. The default is true
nHorizAlign | (optional) A number indicating how the watermark should be aligned horizontally. See app.constants.align for possible values. The default is app.constants.align.center.
nVertAlign | (optional) A number indicating how the watermark should be aligned vertically. See app.constants.align for possible values. The default is app.constants.align.center.
nHorizValue | (optional) A number used to shift the horizontal position of the watermark on the Page. If bPercentage is true, this number represents a percentage of the horizontal Page size. If bPercentage is false, this number represents the number of points to be offset. The default is 0.
nVertValue | (optional) A number used to shift the vertical position of the watermark on the Page. If bPercentage is true, this number represents a percentage of the vertical Page size. If bPercentage is false, this number represents the number of points to be offset. The default is 0.
bPercentage | (optional) A Boolean value that indicates whether nHorizValue and nVertValue represent a percentage of the Page size or an explicit number of points. The default is false.
nScale | (optional) The scale to be used for the watermark, where 1.0 is 100%. A value of -1 specifies that the watermark should fit to the Page while maintaining its proportions. The default is 1.0.
bFixedPrint | (optional) A Boolean value that indicates that this watermark should be added as a FixedPrint Watermark annotation. This allows watermarks to be printed at a fixed size/position regardless of the size of the Page being printed to. If true, bOnTop is ignored. The default is false.
nRotation | (optional) The number of degrees to rotate the watermark counterclockwise. The default is 0.
nOpacity | (optional) The opacity to be used for the watermark, where 0 is transparent and 1.0 is opaque. The default is 1.0
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example 1:
//Adds the first Page of watermark.pdf as a watermark to the center of all pages of the current
Doc. this.addWatermarkFromFile("/C/temp/watermark.pdf");
example 2:
//Adds the second Page of watermark.pdf as a watermark to the first 10 pages of the current Doc.
The watermark
//is rotated counterclockwise 45 degrees and positioned 1 inch down and 2 inches over from the
upper-left corner of the
//Page.
this.addWatermarkFromFile({
cDIPath: "/C/temp/watermark.pdf",
nSourcePage: 4, nEnd: 9,
nHorizAlign: 0,
nVertAlign: 0,
nHorizValue: 144,
nRotation: 45
});

◆ flattenPages()

FX_BOOL Doc::flattenPages ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nStart | (optional) A 0-based index that defines the start of an inclusive range of pages in the current Doc. If only nStart is specified, the Page range is the single Page specified by nStart.
nEnd | (optional) (optional) A 0-based index that defines the end of an inclusive range of pages in the current Doc.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example 1:
//Flatten all pages in the Doc.
this.flattenPages();

◆ setPageTransitions()

FX_BOOL Doc::setPageTransitions ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
nStart (optional) A 0-based index that defines the start of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc.
If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd (optional) A 0-based index that defines the end of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc.
If only nEnd is specified, the range of pages is 0 to nEnd.
aTrans (optional) The page transition array consists of three values:
[nDuration, cTransition, nTransDuration].
● nDuration is the maximum amount of time the page is displayed before the viewer automatically turns to the next page. Set to -1 to turn off automatic page turning.
● cTransition is the name of the transition to apply to the page. See fullScreen.transitions for a list of valid transitions.
● nTransDuration is the duration (in seconds) of the transition effect.If aTrans is not present, any page transitions for the pages are removed.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
// Put the Doc into full screen mode and apply some transitions:
this.setPageTransitions({ aTrans: [-1, "Random", 1] } );
app.fs.isFullScreen=true;

◆ getPageTransition()

FX_BOOL Doc::getPageTransition ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) A 0-based index that defines the start of an inclusive range of pages in the Doc to be operated on.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor Returns:
An array of three values: [ nDuration, cTransition, nTransDuration ].
● nDuration is the maximum amount of time the Page is displayed before the viewer automatically turns to the next
Page. A duration of -1 indicates that there is no automatic Page turning.
● cTransition is the name of the transition to apply to the Page. See the property app.fs.transitions for a list
of valid transitions.
● cTransDuration is the duration (in seconds) of the transition effect.

◆ movePage()

FX_BOOL Doc::movePage ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | (optional) The 0-based index of the Page to move. The default is 0.
nAfter (optional) The 0-based index of the Page after which to move the specified Page.
Use -1 to move the Page before the first Page of the Doc. The default is the last Page in the Doc.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
//Reverse the pages in the Doc.
for (i = this.numPages - 1; i >= 0; i--) this.movePage(i);

◆ newPage()

FX_BOOL Doc::newPage ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage (optional) The Page after which to add the new Page in a 1-based Page numbering system.
The default is the last Page of the Doc. Use 0 to add a Page before the first Page. An invalid Page range is truncated to the valid range of pages.
nWidth | (optional) The width of the Page in points. The default value is 612.
nHeight | (optional) The height of the Page in points. The default value is 792.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
//Add a new Page to match the Page size of the doc.
var Rect = this.getPageBox("Crop");
this.newPage(0, Rect[2], Rect[1]);

◆ setPageRotations()

FX_BOOL Doc::setPageRotations ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nStart (optional) A 0-based index that defines the start of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on allpages in the Doc. If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd (optional) A 0-based index that defines the end of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
nRotate | (optional) The amount of rotation that should be applied to the target pages. Can be 0, 90, 180, or 270. The default is 0.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
//Rotate pages 0 through 10 of the current Doc.
this.setPageRotations(0, 10, 90);

◆ setPageBoxes()

FX_BOOL Doc::setPageBoxes ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cBox (optional) The box type value, one of:
Art
Bleed
Crop
Media
Trim
Note that the BBox box type is read-only and only supported in getPageBox. For definitions of these boxes, see the PDF Reference.
nStart (optional) A 0-based index that defines the start of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc.
If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd (optional) A 0-based index that defines the end of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified,operates on all pages in the Doc.
rBox | (optional) An array of four numbers in rotated user space to which to set the specified box. If not provided, the specified box is removed.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
this.setPageBoxes("Crop",2,2,[0,300,300,0]);
var aRect3 = this.getPageBox("Crop",2);
console.println(aRect3);

◆ addWeblinks()

FX_BOOL Doc::addWeblinks ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nStart | (optional) A 0-based index that defines the start of an inclusive range of pages. If nStart and nEnd are not specified, the range of pages is for all pages in the Doc. If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd (optional) A 0-based index that defines the end of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor Returns:
The number of web links added to the Doc.
example:
this.setPageBoxes("Crop",2,2,[0,300,300,0]);
var aRect3 = this.getPageBox("Crop",2);
console.println(aRect3);

◆ removeWeblinks()

FX_BOOL Doc::removeWeblinks ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nStart | (optional) A 0-based index that defines the start of an inclusive range of pages. If nStart and nEnd are not specified, the range of pages is for all pages in the Doc. If only nStart is specified, the range of pages is the single Page specified by nStart.
nEnd (optional) A 0-based index that defines the end of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor Returns:
The number of web links removed from the Doc.
example:
//Remove all web links from the Doc and report results to the console window.
var numWeblinks = this.removeWeblinks();
console.println("There were " + numWeblinks + " web links removed from the Doc.");

◆ removeLinks()

FX_BOOL Doc::removeLinks ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
nPage | The 0-based index of the Page from which to remove links.
oCoords (optional) A 0-based index that defines the end of an inclusive range of pages in the Doc to be operated on.
If nStart and nEnd are not specified, operates on all pages in the Doc. If only nEnd is specified, the range of pages is 0 to nEnd.
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor Returns:
The number of web links removed from the Doc.
example:
// Remove all links from the document
for ( var a = 0; a < this.numPages; a++ )
{
var b = this.getPageBox("Crop", a);
this.removeLinks(a,b);
}

◆ getOCGOrder()

FX_BOOL Doc::getOCGOrder ( OBJ_METHOD_PARAMS )
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor Returns:
An array containing OCG objects, strings, and similar subarrays, or null if no OCGs are present.
See setOCGOrder for a description of the order array.
example:
var ocgOrder = this.getOCGOrder();
console.println("Currrent OCG order --" + ocgOrder);

◆ setOCGOrder()

FX_BOOL Doc::setOCGOrder ( OBJ_METHOD_PARAMS )
Precondition
Doc must be opened.
Availability:
Foxit PDF Editor
example:
var ocgOrder = this.getOCGOrder();
var newOrder = new Array();
for (var j=0; j < ocgOrder.length; j++)
newOrder[j] = ocgOrder[ocgOrder.length-j-1];
this.setOCGOrder(newOrder);

◆ AnnotCanBeFetched()

static FX_BOOL Doc::AnnotCanBeFetched ( IFXJS_AnnotProvider * pAnnot )
static

Check if the annot can be fetched by getAnnot or getAnnots.


Javascript API: doc_media Class Reference

Public Member Functions | List of all members
doc_media Class Reference

The media property of each document specifies an object that contains multimedia properties and methods that apply to the document.

Public Member Functions

FX_BOOL | getAnnot (OBJ_METHOD_PARAMS)
Looks for and returns a ScreenAnnot object in the document by page number and either name or title, or returns null if there is no matching screen annotation. If both name and title are specified, both must match. More...
FX_BOOL | getOpenPlayers (OBJ_METHOD_PARAMS)
Returns an array of MediaPlayer objects, one for each currently open media player. The players in the array are listed in the order in which they were opened. Using this array, some or all of the open players can be manipulated. For example, you can stop or close all players that the document has opened, without having to keep a list of them yourself. Each time getOpenPlayers is called, it returns a new copy of the array, listing the players open at that time. New players that are subsequently opened do not show up in an array already returned. If a player in the array is closed, the player object remains in the array and player.isOpen becomes false. The doc.media.getOpenPlayers method can be called again to get a new, up-to-date player array. Do not write code that iterates directly over doc.media.getOpenPlayers: for( var i in doc.media.getOpenPlayers() ) // Wrong! Instead, get a copy of the player array and iterate over that: var players = doc.media.getOpenPlayers(); for( var i in players ) { .... } This insures that the loop works correctly even if players are opened or closed during the loop. More...
FX_BOOL | getRendition (OBJ_METHOD_PARAMS)
Looks up a Rendition in the document by name and returns it, or returns null if there is no Rendition with that name. More...

Member Function Documentation

◆ getAnnot()

FX_BOOL doc_media::getAnnot ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
args | An object containing the properties to be passed to this method. The properties are described below.
This table describes the properties of args.
parameter | instruction
nPage | The page number (base 0) on which the annotation resides.
cAnnotName | (optional) The name of the screen annotation. Note:cAnnotName is never used in PDF files generated by Acrobat.
cAnnotTitle | (optional) The title of the screen annotation.
Note:
The parameters for this method must be passed as an object literal and not as an ordered listing of parameters.
Returns
ScreenAnnot object
Example
The Acrobat user interface allows you to specify the title for a screen annotation but not its name, so a typical use of getAnnot would be:
var annot= myDoc.media.getAnnot
({ nPage: 0,cAnnotTitle: "My Annot Title" });
See the example following getRendition for an additional example.

◆ getOpenPlayers()

FX_BOOL doc_media::getOpenPlayers ( OBJ_METHOD_PARAMS )
Returns
Array of MediaPlayer objects.
Example
The following two functions take a Doc as a parameter and operate on the running players associated with that Doc.
// Stop all running players.
function stopAllPlayers( doc ) {
var players = doc.media.getOpenPlayers();
for( var i in players ) players[i].stop();
}
// Close all running players. Closing a player does not remove it from
// the array.
function closeAllPlayers( doc ) {
var players = doc.media.getOpenPlayers();
for( var i in players )
players[i].close( app.media.closeReason.general );
}

◆ getRendition()

FX_BOOL doc_media::getRendition ( OBJ_METHOD_PARAMS )
Parameters
parameter | instruction
cName | cName, a string, is the name of the Rendition.
Returns
Rendition object
Example
The following script is executed from a mouse-up action of a form button. It plays a docked media clip in a screen annotation.
app.media.openPlayer({
rendition: this.media.getRendition( "myClip" ),
annot: this.media.getAnnot( {nPage:0,cAnnotTitle:"myScreen"} ),
settings: { windowType: app.media.windowType.docked }
});


Javascript API: event Class Reference

Public Member Functions | List of all members
event Class Reference

All JavaScript scripts are executed as the result of a particular event. For each of these events, JavaScript creates an event object. During the occurrence of each event, you can access this object to get and possibly manipulate information about the current state of the event. More...

Public Member Functions

FX_BOOL | change (OBJ_PROP_PARAMS)
A string specifying the change in value that the user has just typed. A JavaScript may replace part or all of this string with different characters. The change may take the form of an individual keystroke or a string of characters (for example, if a paste into the field is performed). More...
FX_BOOL | changeEx (OBJ_PROP_PARAMS)
Contains the export value of the change and is available only during a Field/Keystroke event for list boxes and combo boxes. For the list box, the keystroke script, if any, is entered under the Selection Change tab in the properties dialog box. For the combo box, changeEx is only available if the pop-up list is used—that is, a selection (with the mouse or the keyboard) is being made from the list. If the combo is editable and the user types in an entry, the Field/Keystroke event behaves as for a text field (that is, there are no changeEx or keyDown event properties). event.changeEx is defined for text fields. When event.fieldFull is true, changeEx is set to the entire text string the user attempted to enter and event.change is the text string cropped to what fits within the field. Use event.richChangeEx (and event.richChange) to handle rich text fields. More...
FX_BOOL | commitKey (OBJ_PROP_PARAMS)
Determines how a form field will lose focus. Values are:
0 — Value was not committed (for example, escape key was pressed).
1 — Value was committed because of a click outside the field using the mouse.
2 — Value was committed because of pressing the Enter key.
3 — Value was committed by tabbing to a new field. More...
FX_BOOL | fieldFull (OBJ_PROP_PARAMS)
Set to true when the user attempts to enter text that does not fit in the field due to either a space limitation (the Field object property doNotScroll is set to true) or the maximum character limit (the Field object property charLimit is set to a positive value). When fieldFull is true, event.changeEx is set to the entire text string the user attempted to enter and event.change is the text string cropped to what fits within the field. Only available in keystroke events for text fields. More...
FX_BOOL | keyDown (OBJ_PROP_PARAMS)
Available only during a keystroke event for list box and combo box. For a list box or the pop-up part of a combo box, the value is true if the arrow keys were used to make a selection, false otherwise. For the combo box, keyDown is only available if the pop-up part of it is used, that is, a selection (with the mouse or the keyboard) is being made from the pop-up. If the combo is editable and the user types in an entry, the Field/Keystroke event behaves as for a text field (that is, there are no changeEx or keyDown event properties). More...
FX_BOOL | modifier (OBJ_PROP_PARAMS)
Specifies whether the modifier key is down during a particular event. The modifier key on the Microsoft Windows platform is Control and on the Mac OS platform is Option or Command. This property is not supported on UNIX. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The name of the current event as a text string. The type and name together uniquely identify the event. Valid names are:
Keystroke Mouse Exit
Validate WillPrint
Focus DidPrint
Blur WillSave
Format DidSave
Calculate Init
Mouse Up Exec
Mouse Down Open
Mouse Enter Close. More...
FX_BOOL | rc (OBJ_PROP_PARAMS)
Used for validation. Indicates whether a particular event in the event chain should succeed. Set to false to prevent a change from occurring or a value from committing. The default is true. More...
FX_BOOL | richChange (OBJ_PROP_PARAMS)
Specifies the change in value that the user has just typed. The richChange property is only defined for rich text fields and mirrors the behavior of the event.change property. The value of richChange is an array of Span objects that specify both the text entered into the field and the formatting. Keystrokes are represented as single member arrays, while rich text pasted into a field is represented as an array of arbitrary length. When event.fieldFull is true, richChangeEx is set to the entire rich formatted text string the user attempted to enter and event.richChange is the rich formatted text string cropped to what fits within the field. Use event.changeEx (and event.change) to handle (plain) text fields. Related objects and properties are event.richValue, the Span object, the Field object defaultStyle, richText, and richValue properties, and the Annotation object richContents property. More...
FX_BOOL | richChangeEx (OBJ_PROP_PARAMS)
This property is only defined for rich text fields. It mirrors the behavior of the event.changeEx property for text fields. Its value is an array of Span objects that specify both the text entered into the field and the formatting. Keystrokes are represented as single member arrays, while rich text pasted into a field is represented as an array of arbitrary length. If event.fieldFull is true, richChangeEx is set to the entire rich formatted text string the user attempted to enter and event.richChange is the rich formatted text string cropped to what fits within the field. Use event.changeEx (and event.change) to handle (plain) text fields. Related objects and properties include event.richChange, event.richValue, the Span object, the Field object defaultStyle, richText, and richValue properties, and the Annotation object richContents property. More...
FX_BOOL | richValue (OBJ_PROP_PARAMS)
This property mirrors the richValue property of the Field object and the event.value property for each event. Related objects and properties include the Span object, the Field object properties defaultStyle, richText, richValue, event.richChange, event.richChangeEx, and the Annotation object richContents property. More...
FX_BOOL | selEnd (OBJ_PROP_PARAMS)
The ending position of the current text selection during a keystroke event. More...
FX_BOOL | selStart (OBJ_PROP_PARAMS)
The starting position of the current text selection during a keystroke event. More...
FX_BOOL | shift (OBJ_PROP_PARAMS)
true if the shift key is down during a particular event, false otherwise. More...
FX_BOOL | source (OBJ_PROP_PARAMS)
The Field object that triggered the calculation event. This object is usually different from the target of the event, which is the field that is being calculated. For dynamic stamp calculation, event.source corresponds to the Doc object that triggered the event. More...
FX_BOOL | target (OBJ_PROP_PARAMS)
The target object that triggered the event. In all mouse, focus, blur, calculate, validate, and format events, it is the Field object that triggered the event. In other events, such as page open and close, it is the Doc or this object. More...
FX_BOOL | targetName (OBJ_PROP_PARAMS)
Tries to return the name of the JavaScript being executed. Can be used for debugging purposes to help identify the code causing exceptions to be thrown. Common values of targetName include: When an exception is thrown, targetName is reported if there is an identifiable name. More...
FX_BOOL | type (OBJ_PROP_PARAMS)
The type of the current event. The type and name together uniquely identify the event. Valid types are:
Batch External
Console Bookmark
App Link
Doc Field
Page Menu. More...
FX_BOOL | value (OBJ_PROP_PARAMS)
This property has different meanings for different field events:
For example, the following JavaScript verifies that the field value is between zero and 100:
if (event.value < 0 || event.value > 100) {
app.beep(0);
app.alert("Invalid value for field " + event.target.name);
event.rc = false;
}
For example, the following JavaScript sets the calculated value of the field to the value of the SubTotal field plus tax.
var f = this.getField("SubTotal");
event.value = f.value * 1.0725;
For example, the following JavaScript formats the field as a currency type of field.
event.value = util.printf("$%.2f", event.value);
for a list box that allows multiple selections (see field.multipleSelection), the following behavior occurs. If the field value is an array (that is, multiple items are selected), event.value returns an empty string when getting, and does not accept setting. More...
FX_BOOL | willCommit (OBJ_PROP_PARAMS)
Verifies the current keystroke event before the data is committed. It can be used to check target form field values to verify, for example, whether character data was entered instead of numeric data. JavaScript sets this property to true after the last keystroke event and before the field is validated. More...

Detailed Description

Each event has a type and a name property that uniquely identify the event. This section describes all the events, listed as type/name pairs, and indicates which additional properties, if any, they define.

The rc property of an event is its return code. The description for each event describes whether it listens to (is affected by) the return code.

It is important for JavaScript writers to know when these events occur and in what order they are processed. Some methods or properties can only be accessed during certain events.

Member Function Documentation

◆ change()

FX_BOOL event::change ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Change all keystrokes to upper case.
// Custom Keystroke for text field
event.change = event.change.toUpperCase();

◆ changeEx()

FX_BOOL event::changeEx ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Various
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
This example implements a simple HTML online help file system.
Here is a combo box, which is described programmatically.
var c = this.addField({
cName: "myHelp",
cFieldType: "combobox",
nPageNum: 0,
oCoords: [72,12+3*72, 3*72, 0+3*72]
})
Now set the items in the combo box.
c.setItems([
["Online Help", "http://www.example.com/myhelp.html"],
["How to Print", "http://www.example.com/myhelp.html#print"],
["How to eMail", "http://www.example.com/myhelp.html#email"]
]);
Set the action.
c.setAction("Keystroke", "getHelp()");
This function is defined at the document level.
function getHelp() {
if ( !event.willCommit && (event.changeEx != "") )
app.launchURL(event.changeEx);
}

◆ commitKey()

FX_BOOL event::commitKey ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
To automatically display an alert dialog box after a field has been committed, add the following to the field’s format script:
if (event.commitKey != 0)
app.alert("Thank you for your new field value.");

◆ fieldFull()

FX_BOOL event::fieldFull ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Events
Keystroke
Example 1
This is a custom keystroke script for a text field that has a character limit. When the field gets filled, or if the user commits the data entered, the focus moves to another field.
if ( event.fieldFull || event.willCommit )
this.getField("NextTabField").setFocus();
Example 2
Test whether the user has overfilled the text field. A custom keystroke script for a text field. Initially, the field is set so that text does not scroll.
if ( event.fieldFull )
{
app.alert("You've filled the given space with text,"
+ " and as a result, you've lost some text. I'll set the field to"
+ " scroll horizontally, and paste in the rest of your"
+ " missing text.");
this.resetForm([event.target.name]); // Reset field to lose focus
event.target.doNotScroll = false; // Make changes
event.change = event.changeEx;
}
Field properties generally cannot be changed during a keystroke event, so it is necessary for the field to lose focus as a way to commit the data. The user then has to reset the focus and continue entering data.

◆ keyDown()

FX_BOOL event::keyDown ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ modifier()

FX_BOOL event::modifier ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ name()

FX_BOOL event::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Events
All

◆ rc()

FX_BOOL event::rc ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Events
Keystroke, Validate, Menu

◆ richChange()

FX_BOOL event::richChange ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array of Span objects
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Events
Keystroke
Example
This example changes the keystroke to upper case, alternately colors the text blue and red, and switches underlining off and on.
// Custom Keystroke event for a rich text field.
var span = event.richChange;
for ( var i=0; i<span.length; i++)
{
span[i].text = span[i].text.toUpperCase();
span[i].underline = !span[i].underline;
span[i].textColor = (span[i].underline) ? color.blue : color.red;
}
event.richChange = span;

◆ richChangeEx()

FX_BOOL event::richChangeEx ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array of Span objects
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Events
Keystroke
Example
If the text field is filled up by the user, allow additional text by setting the field to scroll.
if ( event.fieldFull )
{
app.alert("You've filled the given space with text,"
+ " and as a result, you've lost some text. I'll set the field to"
+ " scroll horizontally, and paste in the rest of your"
+ " missing text.");
this.resetForm([event.target.name]); // Reset field to lose focus
event.target.doNotScroll = false; // Make changes
if ( event.target.richText )
event.richChange = event.richChangeEx
else
event.change = event.changeEx;
}
See also event.fieldFull.

◆ richValue()

FX_BOOL event::richValue ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array of Span objects
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Events
Keystroke
Example
Turn all bold text into red underlined text.
// Custom format event for a rich text field.
var spans = event.richValue;
for ( var i = 0; i < spans.length; i++ )
{
if( spans[i].fontWeight >= 700 )
{
spans[i].textColor = color.red;
spans[i].fontWeight = 400; // change to default weight
spans[i].underline = true;
}
}
event.richValue = spans;

◆ selEnd()

FX_BOOL event::selEnd ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Merge the last change (of a text field) with the uncommitted change. The function uses both selEnd and selStart.
function AFMergeChange(event)
{
var prefix, postfix;
var value = event.value;
if(event.willCommit) return event.value;
if(event.selStart >= 0)
prefix = value.substring(0, event.selStart);
else prefix = "";
if(event.selEnd >= 0 && event.selEnd <= value.length)
postfix = value.substring(event.selEnd, value.length);
else postfix = "";
return prefix + event.change + postfix;
}

◆ selStart()

FX_BOOL event::selStart ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
See the example following selEnd.

◆ shift()

FX_BOOL event::shift ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The following is a mouse-up button action:
if (event.shift)
this.gotoNamedDest("dest2");
else
this.gotoNamedDest("dest1");

◆ source()

FX_BOOL event::source ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ target()

FX_BOOL event::target ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ targetName()

FX_BOOL event::targetName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The first line of the folder-level JavaScript file conserve.js has an error in it. When the viewer starts, an exception is thrown and the message reveals the source of the problem.
MissingArgError: Missing required argument.
App.alert:1:Folder-Level:App:conserve.js
===> Parameter cMsg.

◆ type()

FX_BOOL event::type ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ value()

FX_BOOL event::value ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Various
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ willCommit()

FX_BOOL event::willCommit ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
This example shows the structure of a keystroke event.
var value = event.value
if (event.willCommit)
// Final value checking.
else
// Keystroke-level checking.


Javascript API: Field Class Reference

Public Member Functions | List of all members
Field Class Reference

This object represents an form field (that is, a field created using the form tool or the Doc addField method). In the same manner that a form author can modify an existing field’s properties, such as the border color or font, the JavaScript user can use the Field object to perform the same modifications.

Public Member Functions

FX_BOOL | alignment (OBJ_PROP_PARAMS)
Controls how the text is laid out within the text field. Values are left center right. More...
FX_BOOL | borderStyle (OBJ_PROP_PARAMS)
The border style for a field. Valid border styles are solid dashed beveled inset underline The border style determines how the border for the rectangle is drawn. The border object is a static convenience constant that defines all the border styles of a field, as shown in the following table: |Type | Keyword | Description | -—: | :-—: | :-— | solid | border.s | Strokes the entire perimeter of the rectangle with a solid line. |beveled | border.b | Equivalent to the solid style with an additional beveled
(pushed-out appearance) border applied inside the solid border. |dashed | border.d | Strokes the perimeter with a dashed line.
inset border.i Equivalent to the solid style with an additional inset
(pushed-in appearance) border applied inside the solid border. |underline | border.u | Strokes the bottom portion of the rectangle’s perimeter. More...
FX_BOOL | buttonFitBounds (OBJ_PROP_PARAMS)
If true, the extent to which the icon may be scaled is set to the bounds of the button field. The additional icon placement properties are still used to scale and position the icon within the button face. More...
FX_BOOL | buttonPosition (OBJ_PROP_PARAMS)
Controls how the text and the icon of the button are positioned with respect to each other within the button face. The convenience position object defines all of the valid alternatives. | Icon/text | placement Keyword | | -—: | :-— | |Text Only | position.textOnly | |Icon Only | position.iconOnly | |Icon top, Text bottom | position.iconTextV| |Text top, Icon bottom | position.textIconV| |Icon left, Text right | position.iconTextH| |Text left, Icon right | position.textIconH| |Text in Icon (overlaid) | position.overlay |. More...
FX_BOOL | buttonScaleHow (OBJ_PROP_PARAMS)
Controls how the icon is scaled (if necessary) to fit inside the button face. The convenience scaleHow object defines all of the valid alternatives: |How is icon scaled | Keyword | | -—: | :-— | |Proportionally |scaleHow.proportional | |Non-proportionally |scaleHow.anamorphic |. More...
FX_BOOL | buttonScaleWhen (OBJ_PROP_PARAMS)
Controls when an icon is scaled to fit inside the button face. The convenience scaleWhen object defines all of the valid alternatives: |When is icon scaled | Keyword | | -—: | :-— | |Always |scaleWhen.always | |Never |scaleWhen.never | |If icon is too big |scaleWhen.tooBig | |If icon is too small|scaleWhen.tooSmall|. More...
FX_BOOL | calcOrderIndex (OBJ_PROP_PARAMS)
Changes the calculation order of fields in the document. When a computable text or combo box field is added to a document, the field's name is appended to the calculation order array. The calculation order array determines in what order the fields are calculated. The calcOrderIndex property works similarly to the Calculate tab used by the Form tool. More...
FX_BOOL | charLimit (OBJ_PROP_PARAMS)
Limits the number of characters that a user can type into a text field. See event.fieldFull to detect when the maximum number of characters is reached. More...
FX_BOOL | comb (OBJ_PROP_PARAMS)
If set to true, the field background is drawn as series of boxes (one for each character in the value of the field) and each character of the content is drawn within those boxes. The number of boxes drawn is determined from the charLimit property. It applies only to text fields. The setter will also raise if any of the following field properties are also set multiline, password, and fileSelect. A side-effect of setting this property is that the doNotScroll property is also set. More...
FX_BOOL | commitOnSelChange (OBJ_PROP_PARAMS)
Controls whether a field value is committed after a selection change: More...
FX_BOOL | currentValueIndices (OBJ_PROP_PARAMS)
Reads and writes single or multiple values of a list box or combo box. More...
FX_BOOL | defaultStyle (OBJ_PROP_PARAMS)
This property defines the default style attributes for the form field. If the user clicks an empty field and begins entering text without changing properties using the property toolbar, these are the properties that will be used. This property is a single Span object without a text property. Some of the properties in the default style span mirror the properties of the Field object. Changing these properties also modifies the defaultStyle property for the field and vice versa. The following table details the properties of the Field object that are also in the default style and any differences between their values. More...
FX_BOOL | defaultValue (OBJ_PROP_PARAMS)
The default value of a field ——that is, the value that the field is set to when the form is reset. For combo boxes and list boxes, either an export or a user value can be used to set the default. A conflict can occur, for example, when the field has an export value and a user value with the same value but these apply to different items in the list. In such cases, the export value is matched against first. More...
FX_BOOL | doNotScroll (OBJ_PROP_PARAMS)
If true, the text field does not scroll and the user, therefore, is limited by the rectangular region designed for the field. Setting this property to true or false corresponds to checking or unchecking the Scroll Long Text field in the Options tab of the field. More...
FX_BOOL | doNotSpellCheck (OBJ_PROP_PARAMS)
If true, spell checking is not performed on this editable text field. Setting this property to true or false corresponds to unchecking or checking the Check Spelling attribute in the Options tab of the Field Properties dialog box. More...
FX_BOOL | delay (OBJ_PROP_PARAMS)
Delays the redrawing of a field's appearance. It is generally used to buffer a series of changes to the properties of the field before requesting that the field regenerate its appearance. Setting the property to true forces the field to wait until delay is set to false. The update of its appearance then takes place, redrawing the field with its latest settings. There is a corresponding Doc delay flag if changes are being made to many fields at once. More...
FX_BOOL | display (OBJ_PROP_PARAMS)
Controls whether the field is hidden or visible on screen and in print. The values for the display property are listed in the table below. This property supersedes the older hidden and print properties. More...
FX_BOOL | doc (OBJ_PROP_PARAMS)
Returns the Doc of the document to which the field belongs. More...
FX_BOOL | editable (OBJ_PROP_PARAMS)
Controls whether a combo box is editable. If true, the user can type in a selection. If false, the user must choose one of the provided selections. More...
FX_BOOL | exportValues (OBJ_PROP_PARAMS)
An array of strings representing the export values for the field. The array has as many elements as there are annotations in the field. The elements are mapped to the annotations in the order of creation (unaffected by tab-order). For radio button fields, this property is required to make the field work properly as a group. The button that is checked at any time gives its value to the field as a whole. For check box fields, unless an export value is specified, "Yes" (or the corresponding localized string) is the default when the field is checked. "Off" is the default when the field is unchecked (the same as for a radio button field when none of its buttons are checked). More...
FX_BOOL | fileSelect (OBJ_PROP_PARAMS)
If true, sets the file-select flag in the Options tab of the text field (Field is Used for File Selection). This indicates that the value of the field represents a path of a file whose contents may be submitted with the form. The path may be entered directly into the field by the user, or the user can browse for the file. (See the browseForFileToSubmit method.) Note:The file select flag is mutually exclusive with the multiline, charLimit, password, and defaultValue properties. Also, on the Mac OS platform, when setting the file select flag, the field gets treated as read-only. Therefore, the user must browse for the file to enter into the field. (See browseForFileToSubmit.) This property can only be set during a batch or console event. See Privileged versus non-privileged context for details. The event object contains a discussion of JavaScript events. More...
FX_BOOL | fillColor (OBJ_PROP_PARAMS)
Specifies the background color for a field. The background color is used to fill the rectangle of the field. Values are defined by using transparent, gray, RGB or CMYK color. See Color arrays for information on defining color arrays and how values are used with this property. In older versions of this specification, this property was named bgColor. The use of bgColor is now discouraged, although it is still valid for backward compatibility. More...
FX_BOOL | hidden (OBJ_PROP_PARAMS)
Note:This property has been superseded by the display property and its use is discouraged. If the value is false, the field is visible to the user; if true, the field is invisible. The default value is false. More...
FX_BOOL | highlight (OBJ_PROP_PARAMS)
Defines how a button reacts when a user clicks it. The four highlight modes supported are: none —— No visual indication that the button has been clicked. invert —— The region encompassing the button's rectangle inverts momentarily. push —— The down face for the button (if any) is displayed momentarily. outline —— The border of the rectangleinverts momentarily. The convenience highlight object defines each state, as follows: More...
FX_BOOL | lineWidth (OBJ_PROP_PARAMS)
Specifies the thickness of the border when stroking the perimeter of a field's rectangle. If the stroke color is transparent, this parameter has no effect except in the case of a beveled border. Values are: 0 —— none 1 —— thin 2 —— medium 3 —— thick In older versions of this specification, this property was borderWidth. The use of borderWidth is now discouraged, although it is still valid for backward compatibility. The default value for lineWidth is 1 (thin). Any integer value can be used; however, values beyond 5 may distort the field's appearance. More...
FX_BOOL | multiline (OBJ_PROP_PARAMS)
Controls how text is wrapped within the field. If false (the default), the text field can be a single line only. If true, multiple lines are allowed and they wrap to field boundaries. More...
FX_BOOL | multipleSelection (OBJ_PROP_PARAMS)
If true, indicates that a list box allows a multiple selection of items. See also type, value, and currentValueIndices. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
This property returns the fully qualified field name of the field as a string object. if the Field object represents one individual widget, the returned name includes an appended '.' followed by the widget index. More...
FX_BOOL | numItems (OBJ_PROP_PARAMS)
The number of items in a combo box or list box. More...
FX_BOOL | page (OBJ_PROP_PARAMS)
The page number or an array of page numbers of a field. If the field has only one appearance in the document, the page property returns an integer representing the 0-based page number of the page on which the field appears. If the field has multiple appearances, it returns an array of integers, each member of which is a 0-based page number of an appearance of the field. The order in which the page numbers appear in the array is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order). If an appearance of the field is on a hidden template page, page returns a value of -1 for that appearance. More...
FX_BOOL | password (OBJ_PROP_PARAMS)
Specifies whether the field should display asterisks when data is entered in the field. (Upon submission, the actual data entered is sent.) If this property is true, data in the field is not saved when the document is saved to disk. More...
FX_BOOL | print (OBJ_PROP_PARAMS)
Note:This property has been superseded by the display property and its use is discouraged. If true, the field appears when the user prints the document. If false, the field does not appear when printing. This property can be used to hide control buttons and other fields that are not useful on the printed page. More...
FX_BOOL | radiosInUnison (OBJ_PROP_PARAMS)
If false, even if a group of radio buttons have the same name and export value, they behave in a mutually exclusive fashion, like HTML radio buttons. The default for new radio buttons is false. If true, if a group of radio buttons have the same name and export value, they turn on and off in unison. More...
FX_BOOL | readonly (OBJ_PROP_PARAMS)
The read-only characteristic of a field. If a field is read-only, the user can see the field but cannot change it. More...
FX_BOOL | rect (OBJ_PROP_PARAMS)
An array of four numbers in rotated user space that specify the size and placement of the form field. These four numbers are the coordinates of the bounding rectangle and are listed in the following order: upper-left x, upper-left y, lower-right x and lower-right y. Note:The Annotation object also has a rect property. However, the coordinates are not in rotated user space and they are in a different order than in the Field object rect property. More...
FX_BOOL | required (OBJ_PROP_PARAMS)
Specifies whether a field requires a value. If true, the fiel's value must be non-null when the user clicks a submit button that causes the value of the field to be posted. If the field value is null, the user receives a warning message and the submit does not occur. More...
FX_BOOL | richText (OBJ_PROP_PARAMS)
If true, the field allows rich text formatting. The default is false. More...
FX_BOOL | richValue (OBJ_PROP_PARAMS)
This property specifies the text contents and formatting of a rich text field. For field types other than rich text, this property is undefined. The rich text contents are represented as an array of Span objects containing the text contents and formatting of the field. More...
FX_BOOL | rotation (OBJ_PROP_PARAMS)
The rotation of a widget in counterclockwise increments. Valid values are 0, 90, 180, and 270. More...
FX_BOOL | strokeColor (OBJ_PROP_PARAMS)
Specifies the stroke color for a field that is used to stroke the rectangle of the field with a line as large as the line width. Values are defined by using transparent, gray, RGB or CMYK color. See Color arrays for information on defining color arrays and how values are used with this property. In older versions of this specification, this property was borderColor. The use of borderColor is now discouraged, although it is still valid for backward compatibility. More...
FX_BOOL | style (OBJ_PROP_PARAMS)
Allows the user to set the glyph style of a check box or radio button. The glyph style is the graphic used to indicate that the item has been selected. The style values are associated with keywords as follows. |Style | Keyword | |-—: |:-— | |check |style.ch | |cross |style.cr | |diamond |style.di | |circle |style.ci | |star |style.st | |square |style.sq |. More...
FX_BOOL | submitName (OBJ_PROP_PARAMS)
If nonempty, used during form submission instead of name. Only applicable if submitting in HTML format (that is, URL-encoded). More...
FX_BOOL | textColor (OBJ_PROP_PARAMS)
The foreground color of a field. It represents the text color for text, button, or list box fields and the check color for check box or radio button fields. Values are defined the same as the fillColor. See Color arrays for information on defining color arrays and how values are set and used with this property. In older versions of this specification, this property was fgColor. The use of fgColor is now discouraged, although it is still valid for backward compatibility. Note:An exception is thrown if a transparent color space is used to set textColor. More...
FX_BOOL | textFont (OBJ_PROP_PARAMS)
The font that is used when laying out text in a text field, combo box, list box or button. Valid fonts are defined as properties of the font object. More...
FX_BOOL | textSize (OBJ_PROP_PARAMS)
Specifies the text size (in points) to be used in all controls. In check box and radio button fields, the text size determines the size of the check. Valid text sizes range from 0 to 32767, inclusive. A value of zero means the largest point size that allows all text data to fit in the field's rectangle. More...
FX_BOOL | type (OBJ_PROP_PARAMS)
Returns the type of the field as a string. Valid types are: button checkbox combobox listbox radiobutton signature text. More...
FX_BOOL | userName (OBJ_PROP_PARAMS)
The user name (short description string) of the field. It is intended to be used as tooltip text whenever the cursor enters a field. It can also be used as a user-friendly name, instead of the field name, when generating error messages. More...
FX_BOOL | value (OBJ_PROP_PARAMS)
The value of the field data that the user has entered. Depending on the type of the field, may be a String, Date, or Number. Typically, the value is used to create calculated fields. More...
FX_BOOL | valueAsString (OBJ_PROP_PARAMS)
Returns the value of a field as a JavaScript string. It differs from value, which attempts to convert the contents of a field contents to an accepted format. For example, for a field with a value of "020", value returns the integer 20, while valueAsString returns the string "020". More...
FX_BOOL | browseForFileToSubmit (OBJ_METHOD_PARAMS)
If invoked on a text field for which the fileSelect flag is set (checked), opens a standard file-selection dialog box. The path entered through the dialog box is automatically assigned as the value of the text field. If invoked on a text field in which the fileSelect flag is clear (unchecked), an exception is thrown. More...
FX_BOOL | buttonGetCaption (OBJ_METHOD_PARAMS)
Gets the caption associated with a button. Use buttonSetCaption to set the caption. More...
FX_BOOL | buttonGetIcon (OBJ_METHOD_PARAMS)
Gets the Icon object of a specified type associated with a button. See also the buttonSetIcon method for assigning an icon to a button. More...
FX_BOOL | buttonSetCaption (OBJ_METHOD_PARAMS)
Sets the caption associated with a button. Use buttonGetCaption to get the current caption. See buttonAlignX, buttonAlignY, buttonFitBounds, buttonPosition, buttonScaleHow, and buttonScaleWhen for details on how the icon and caption are placed on the button face. More...
FX_BOOL | buttonSetIcon (OBJ_METHOD_PARAMS)
Sets the icon associated with a button. See buttonAlignX, buttonAlignY, buttonFitBounds, buttonPosition, buttonScaleHow, and buttonScaleWhen for details on how the icon and caption are placed on the button face. Use either buttonGetIcon or doc.getIcon to get an Icon object that can be used for the oIcon parameter of this method. Note:This method must be executed from script embedded within the document. Executing script containing buttonSetIcon in the console of the Foxit PDF Editor, for example, will throw a NotAllowedError exception. More...
FX_BOOL | checkThisBox (OBJ_METHOD_PARAMS)
Checks or unchecks the specified widget. Only check boxes can be unchecked. A radio button cannot be unchecked using this method, but if its default state is unchecked (see defaultIsChecked) it can be reset to the unchecked state using the resetForm. method of the Doc. Note:For a set of radio buttons that do not have duplicate export values, you can set the value to the export value of the individual widget that should be checked (or pass an empty string if none should be). More...
FX_BOOL | clearItems (OBJ_METHOD_PARAMS)
Clears all the values in a list box or combo box. Related methods and properties include numItems, getItemAt, deleteItemAt, currentValueIndices, insertItemAt and setItems. More...
FX_BOOL | defaultIsChecked (OBJ_METHOD_PARAMS)
Sets the specified widget to be checked or unchecked by default. Note:For a set of radio buttons that do not have duplicate export values, you can set the defaultValue to the export value of the individual widget that should be checked by default (or pass an empty string if none should be checked). More...
FX_BOOL | deleteItemAt (OBJ_METHOD_PARAMS)
Deletes an item in a combo box or a list box. For a list box, if the current selection is deleted, the field no longer has a current selection. If this method is invoked again on the same field and no parameter is specified, unexpected behavior can result because there is no current selection to delete. Therefore, it is important to make a new selection (such as by using the currentValueIndices method) for the method to behave as documented. More...
FX_BOOL | getArray (OBJ_METHOD_PARAMS)
Gets the array of terminal child fields (that is, fields that can have a value) for this Field object, the parent field. More...
FX_BOOL | getItemAt (OBJ_METHOD_PARAMS)
Gets the internal value of an item in a combo box or a list box. The number of items in a list can be obtained from numItems. See also insertItemAt, deleteItemAt, clearItems, currentValueIndices and setItems. More...
FX_BOOL | getLock (OBJ_METHOD_PARAMS)
Gets a Lock object, a generic object that contains the lock properties of a signature field. See also setLock. More...
FX_BOOL | insertItemAt (OBJ_METHOD_PARAMS)
Inserts a new item into a combo box or a list box. Related methods and properties include numItems, getItemAt, deleteItemAt, clearItems, currentValueIndices and setItems. More...
FX_BOOL | isBoxChecked (OBJ_METHOD_PARAMS)
Determines whether the specified widget is checked. Note:For a set of radio buttons that do not have duplicate export values, you can get the value, which is equal to the export value of the individual widget that is currently checked (or returns an empty string, if none is). More...
FX_BOOL | isDefaultChecked (OBJ_METHOD_PARAMS)
Determines whether the specified widget is checked by default (for example, when the field gets reset). Note:For a set of radio buttons that do not have duplicate export values, you can get the defaultValue, which is equal to the export value of the individual widget that is checked by default (or returns an empty string, if none is). More...
FX_BOOL | setAction (OBJ_METHOD_PARAMS)
Sets the JavaScript action of the field for a given trigger. Related methods are the Bookmark object setAction method and the Doc methods setAction, addScript, and setPageAction. Note:This method will overwrite any action already defined for the chosen trigger. More...
FX_BOOL | setFocus (OBJ_METHOD_PARAMS)
Sets the keyboard focus to this field. This can involve changing the page that the user is currently on or causing the view to scroll to a new position in the document. This method brings the document in which the field resides to the front, if it is not already there. See also bringToFront. More...
FX_BOOL | setItems (OBJ_METHOD_PARAMS)
Sets the list of items for a combo box or a list box. Related methods and properties include numItems, getItemAt, deleteItemAt, currentValueIndices and clearItems. More...
FX_BOOL | setLock (OBJ_METHOD_PARAMS)
Controls which fields are to be locked when a signature is applied to this signature field. No modifications can be made to locked fields. If the signature is cleared, all fields that were locked become unlocked. The property settings can be obtained using getLock. Note:The method can be executed during a batch, application initialization, or console event. See Privileged versus non-privileged context for details. This method cannot be applied to a field that is in a document that is already signed. More...
FX_BOOL | signatureGetModifications (OBJ_METHOD_PARAMS)
Returns an object containing information on modifications that have been made to the document after the signature field was signed. The information includes only the difference between the current and signed state of the document. Transient objects, such as objects added after the signature but then subsequently deleted, are not reported. More...
FX_BOOL | signatureGetSeedValue (OBJ_METHOD_PARAMS)
Returns a SeedValue object that contains the seed value properties of a signature field. Seed values are used to control properties of the signature, including the signature appearance, reasons for signing, and the person. See signatureSetSeedValue. More...
FX_BOOL | signatureInfo (OBJ_METHOD_PARAMS)
Returns a SignatureInfo object that contains the properties of the signature. The object is a snapshot of the signature at the time that this method is called. A security handler may specify additional properties that are specific to the security handler. Note:There are no restrictions on when this method can be called. However, the specified security handler, oSig, may not always be available. See the security.getHandler method for details. Some properties of a signature handler, for example, certificates (a property of the SignatureInfo object), may return a null value until the signature is validated. Therefore, signatureInfo should be called again after signatureValidate. More...
FX_BOOL | signatureSetSeedValue (OBJ_METHOD_PARAMS)
Sets properties that are used when signing signature fields. The properties are stored in the signature field and are not altered when the field is signed, the signature is cleared, or when resetForm is called. Use signatureGetSeedValue to obtain the property settings. When setting seed values, keep in mind the following: Note:The method can be executed during a batch, application initialization or console event. See Privileged versus non-privileged context for details. Certifying signatures are signatures with a SignatureInfo object mdp property value of allowNone, default, or defaultAndComments. Not allowed in Foxit PDF Reader. Refer to the Security Feature User Reference to obtain a deeper understanding of the use of signature seed values. More...
FX_BOOL | signatureSign (OBJ_METHOD_PARAMS)
Signs the field with the specified security handler. See also security.getHandler and securityHandler.login. Note:This method can only be executed during a batch, console, or application initialization event. See Privileged versus non-privileged context for details. The event object contains a discussion of JavaScript events. Signature fields cannot be signed if they are already signed. Use resetForm to clear signature fields. More...
FX_BOOL | signatureValidate (OBJ_METHOD_PARAMS)
Validates and returns the validity status of the signature in a signature field. This routine can be computationally expensive and take a significant amount of time depending on the signature handler used to sign the signature. Note:There are no restrictions on when this method can be called. However, the parameter oSig is not always available. See security.getHandler for details. More...

Member Function Documentation

◆ alignment()

FX_BOOL Field::alignment ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text
Example
var f = this.getField("Text Field0");
f.alignment = "center";

◆ borderStyle()

FX_BOOL Field::borderStyle ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
All
Example
The following example shows how to set the border style of a field to solid:
var f = this.getField("Text Field0");
f.borderStyle = border.d; //border.s evaluates to "solid"

◆ buttonFitBounds()

FX_BOOL Field::buttonFitBounds ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
button
Example
var a = this.getField("Push Button0");
a.buttonFitBounds = true;
console.println(a.buttonFitBounds);
a.buttonFitBounds = false;
console.println(a.buttonFitBounds);

◆ buttonPosition()

FX_BOOL Field::buttonPosition ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
button
Example
var f = this.getField("Push Button0");
console.println(f.buttonPosition);
f.buttonPosition = position.iconOnly;
console.println(f.buttonPosition);

◆ buttonScaleHow()

FX_BOOL Field::buttonScaleHow ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
button
Example
var f1 = this.getField("Push Button0");
console.println(f1.buttonScaleHow);
f1.buttonScaleHow = scaleHow.anamorphic;
console.println(f1.buttonScaleHow);

◆ buttonScaleWhen()

FX_BOOL Field::buttonScaleWhen ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
button
Example
var f1 = this.getField("Push Button0");
console.println(f1.buttonScaleWhen);
f1.buttonScaleWhen = scaleWhen.never;
console.println(f1.buttonScaleWhen);

◆ calcOrderIndex()

FX_BOOL Field::calcOrderIndex ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
combobox, text
Example
var a = this.getField("newItem");
var b = this.getField("oldItem");
a.calcOrderIndex = b.calcOrderIndex + 1;
In this example, the "newItem" field was added after the "oldItem" field. The script changes
the calcOrderIndex property of the "newItem" field so that it is calculated before the "oldItem"
field.

◆ charLimit()

FX_BOOL Field::charLimit ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text
Example
Set a limit on the number of characters that can be typed into a field.
var f = this.getField("Text Field0");
f.charLimit = 10;

◆ comb()

FX_BOOL Field::comb ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text
Example
function Field_comb()
{
var c1=this.addField("text4-0","text",0,[50,785-11*25, 400, 765-11*25]);
var c2=this.addField("text4-1","text",0,[50,785-12*25, 400, 765-12*25]);
c1.strokeColor = color.black;
c2.strokeColor = color.black;
c1.comb=true;
c1.charLimit = 12;
c2.comb=false;
c1.value="comb is true";
c2.value="comb is false";
}
Field_comb();

◆ commitOnSelChange()

FX_BOOL Field::commitOnSelChange ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
combobox, listbox
Example
var a = this.getField("Combo Box0");
console.println(a.commitOnSelChange);
a.commitOnSelChange = true;
console.println(a.commitOnSelChange);

◆ currentValueIndices()

FX_BOOL Field::currentValueIndices ( OBJ_PROP_PARAMS )
Read
Returns the options-array indices of the strings that are the value of a list box or combo box field. These indices are 0-based. If the value of the field is a single string, it returns an integer. Otherwise, it returns an array of integers sorted in ascending order. If the current value of the field is not a member of the set of offered choices (as could happen in the case of an editable combo box) it returns -1.
Write
Sets the value of a list box or combo box. It accepts a single integer or array of integers as an argument. To set a single string as the value, pass an integer that is the 0-based index of that string in the options array. Note that in the case of an editable combo box, if the desired value is not a member of the set of offered choices, you must set the value instead. Except for this case, currentValueIndices is the preferred way to set the value of a list box or combo box. To set a multiple selection for a list box that allows it, pass an array as argument to this property, containing the indices (sorted in ascending order) of those strings in the options array. If passed an array like this: Field.value=["item1", "item3"], it also selects the items. The ability for a list box to support multiple selections can be set through multipleSelection. Related methods and properties include numItems, getItemAt, insertItemAt, deleteItemAt and setItems.
Precondition
Document must be opened.
Type
Integer | Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
combobox, listbox
Example (Read)
var f = this.getField("List Box0");
var a = f.currentValueIndices;
if (typeof a == "number") // A single selection
console.println("Selection: " + f.getItemAt(a, false));
else { // Multiple selections
console.println("Selection:");
for (var i = 0; i < a.length; i ++)
console.println(" " + f.getItemAt(a[i], false));
}
Example (Write)
var f = this.getField("List Box0");
f.currentValueIndices = 3;

◆ defaultStyle()

FX_BOOL Field::defaultStyle ( OBJ_PROP_PARAMS )
Field properties | defaultStyle(Span properties) | Description
alignment | alignment | The alignment property has the same values for both the default style and the Field object.
textFont | fontFamily fontStyle fontWeight | The value of this field property is a complete font name that represents the font family, weight, and style. In the default style property, each property is represented separately. If an exact match for the font properties specified in the default style cannot be found, a similar font will be used or synthesized.
textColor | textColor | The textColor property has the same values for both the default style and the Field object.
textSize | textSize | The textSize property has the same values for both the default style and the Field object.

Note:When a field is empty, defaultStyle is the style used for newly entered text. If a field already contains text when defaultStyle is changed, the text will not pick up any changes to defaultStyle. Newly entered text uses the attributes of the text it is inserted into (or specified with the toolbar). When pasting rich text into a field, unspecified attributes in the pasted rich text are filled with those from defaultStyle. Superscript and Subscript are ignored in defaultStyle.

Precondition
Document must be opened.
Type
Span object
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
rich text
Example
Change the default style for a text field.
var style = this.getField("Text1").defaultStyle;
style.textColor = color.red;
style.textSize = 18;
// if Courier Std is not found, use a monospace font
style.fontFamily = ["Courier Std", "monospace" ];
this.getField("Text1").defaultStyle = style;

◆ defaultValue()

FX_BOOL Field::defaultValue ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all except button, signature
Example
var f = this.getField("Name");
f.defaultValue = "Enter your name here.";

◆ doNotScroll()

FX_BOOL Field::doNotScroll ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text
Example
var a = this.getField("Text Field0");
console.println(a.doNotScroll);
a.doNotScroll =true;
console.println(a.doNotScroll);

◆ doNotSpellCheck()

FX_BOOL Field::doNotSpellCheck ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
combobox (editable), text
Example
var b = this.getField("Text Field0");
console.println(b.doNotSpellCheck);
b.doNotSpellCheck = true;
console.println(b.doNotSpellCheck);

◆ delay()

FX_BOOL Field::delay ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Change the appearance of a check box. Set delay to true, makes changes, and sets delay to
false.
// Get the myCheckBox field
var f = this.getField("myCheckBox");
// Set the delay and change the fields properties
// to beveled edge and medium thickness line.
f.delay = true;
f.borderStyle = border.b;
... // A number of other changes
f.strokeWidth = 2;
f.delay = false; // Force the changes now

◆ display()

FX_BOOL Field::display ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
// Set the display property
var f = getField("myField");
f.display = display.noPrint;
// Test whether field is hidden on screen and in print
if (f.display == display.hidden) console.println("hidden");

◆ doc()

FX_BOOL Field::doc ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
function Field_doc()
{
var f=this.addField("text5-0","text",0,[50,785-13*25, 400, 765-13*25]);
f.strokeColor = color.black;
var d=f.doc;
f.value="the document's author is:"+d.author;
}
Field_doc();

◆ editable()

FX_BOOL Field::editable ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
combobox
Example
var f = this.getField("Combo Box0");
console.println(f.editable);
f.editable = true;
console.println(f.editable);

◆ exportValues()

FX_BOOL Field::exportValues ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
checkbox, radiobutton
Example
Create a radio button field and sets its export values.
var d = 40;
var f = this.addField("myRadio","radiobutton",0, [200, 510, 210, 500]);
this.addField("myRadio","radiobutton",0, [200+d, 510-d, 210+d, 500-d]);
this.addField("myRadio","radiobutton",0, [200, 510-2*d, 210, 500-2*d]);
this.addField("myRadio","radiobutton",0, [200-d, 510-d, 210-d, 500-d]);
f.strokeColor = color.black;
// Now give each radio field an export value
f.exportValues = ["North", "East", "South", "West"];

◆ fileSelect()

FX_BOOL Field::fileSelect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text

◆ fillColor()

FX_BOOL Field::fillColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Change the background color of a text field. If the current color is red, it changes to
blue, otherwise it changes to yellow. var f = this.getField("Text Field0"); if
(color.equal(f.fillColor, color.red)) f.fillColor = color.blue; else f.fillColor = color.yellow;

◆ hidden()

FX_BOOL Field::hidden ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
function Field_hidden()
{
var f1 = this.addField("text9-"+0,"text",0,[50,785-5*25, 400, 765-5*25]);
f1.strokeColor = color.black;
f1.hidden=true;
f1.value ="hidden is true";
var f2 = this.addField("text9-"+1,"text",0,[50,785-6*25, 400, 765-6*25]);
f2.strokeColor = color.black;
f2.hidden=false;
f2.value ="hidden is false";
}
Field_hidden();

◆ highlight()

FX_BOOL Field::highlight ( OBJ_PROP_PARAMS )
Type | Keyword
none | highlight.n
invert | highlight.i
push | highlight.p
outline | highlight.o
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
button
Example
Set the highlight property of a button to "invert".
var f = this.getField("Push Button0");
f.highlight = highlight.i;

◆ lineWidth()

FX_BOOL Field::lineWidth ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Change the border width of the Text Box to medium thickness
var f = this.getField("Text Field0")
f.strokeColor = color.black;
f.lineWidth = 2;

◆ multiline()

FX_BOOL Field::multiline ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text
Example
function Field_multiline()
{
var f1 = this.addField("text10-"+0,"text",1,[50,785-7*25, 400, 765-7*25]);
f1.strokeColor = color.black;
f1.multiline=true;
f1.value ="multiline"+"\n"+"is true";
var f2 = this.addField("text10-"+1,"text",1,[50,785-8*25, 400, 765-8*25]);
f2.strokeColor = color.black;
f2.multiline=false;
f2.value ="multiline"+"\n"+"is false";
}
Field_multiline();

◆ multipleSelection()

FX_BOOL Field::multipleSelection ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
listbox
Example
function Field_multipleSelection()
{
var f1 = this.addField("listbox1-"+0,"listbox",0,[50,785-19*25, 400, 765-20*25]);
f1.strokeColor = color.black;
f1.setItems(["mult-one","mult-two","mult-three"]);
f1.multipleSelection = true;
var f2 = this.addField("listbox1-"+1,"listbox",0,[50,785-21*25, 400, 765-22*25]);
f2.strokeColor = color.black;
f2.setItems(["one","two","three"]);
f2.multipleSelection = false;
}
Field_multipleSelection();

◆ name()

FX_BOOL Field::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Get a Field object and write the name of the field to the console.
var f = this.getField("Text Field0");
// Displays "myField" in the console window
console.println(f.name);

◆ numItems()

FX_BOOL Field::numItems ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
combobox, listbox
Example
Get the number of items in a list box.
var f = this.getField("List Box0");
console.println("There are " + f.numItems + " in this list box");
Face names and values of a combo box or list box can be accessed through the getItemAt
method. See that method for an additional example of numItems.

◆ page()

FX_BOOL Field::page ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer | Array
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
function Field_page()
{
var f=this.addField("text14-0","text",2,[50,785-1*25, 400, 765-1*25]);
f.strokeColor = color.black;
f.value="Field page is:"+f.page;
}
Field_page();

◆ password()

FX_BOOL Field::password ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text
Example
function Field_password()
{
var f1 = this.addField("text15-"+0,"text",0,[50,785-2*25, 400, 765-2*25]);
f1.strokeColor = color.black;
f1.password=true;
f1.value="password is true";
var f2 = this.addField("text15-"+1,"text",0,[50,785-3*25, 400, 765-3*25]);
f2.strokeColor = color.black;
f2.password=false;
f2.value="password is false";
}
Field_password();

◆ print()

FX_BOOL Field::print ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
function Field_print()
{
var f1 = this.addField("text16-"+0,"text",0,[50,785-4*25, 400, 765-4*25]);
f1.strokeColor = color.black;
f1.print=true;
f1.value="print is true";
var f2 = this.addField("text16-"+1,"text",0,[50,785-5*25, 400, 765-5*25]);
f2.strokeColor = color.black;
f2.print=false;
f2.value="print is false";
}
Field_print();

◆ radiosInUnison()

FX_BOOL Field::radiosInUnison ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
radiobutton
Example
var a = this.getField("Radio Button");
a.radiosInUnison = ture;

◆ readonly()

FX_BOOL Field::readonly ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Get a field and make it read-only.
var f = this.getField("Text Field0");
f.value = "You can't change this message!";
f.readonly = true;

◆ rect()

FX_BOOL Field::rect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example 1
Lay out a 2-inch-wide text field just to the right of the field "Text Field0".
var f = this.getField("Text Field0"); // Get the Field object
var myRect = f.rect; // and get its rectangle
myRect[0] = f.rect[2]; // The ulx for new = lrx for old
myRect[2] += 2 * 72; // Move two inches for lry
f = this.addField("myNextText", "text", this.pageNum, myRect);
f.strokeColor = color.black;
Example 2
Move an existing button field 10 points to the right.
var b = this.getField("myButton");
var aRect = b.rect; // Make a copy of b.rect
aRect[0] += 10; // Increment first x coordinate by 10
aRect[2] += 10; // Increment second x coordinate by 10
b.rect = aRect; // Update the value of b.rect

◆ required()

FX_BOOL Field::required ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all except button
Example
Make "Text Field0" into a required field.
var f = this.getField("Text Field0");
f.required = true;

◆ richText()

FX_BOOL Field::richText ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
text Related objects and properties are richValue, defaultStyle, event.richValue, event.richChange, event.richChangeEx, the Annotation object richContents property, and the Span object.
Example 1
Get a Field object and set it for rich text formatting.
var f = this.getField("Text Field0");
f.richText = true;
See Example 2 following richValue for a more complete example.
Example 2
Count the number of rich text fields in the document.
var count = 0;
for ( var i = 0; i < this.numFields; i++)
{
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if ( f.type == "text" && f.richText ) count++
}
console.println("There are a total of "+ count + " rich text fields.");

◆ richValue()

FX_BOOL Field::richValue ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array of Span objects
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
rich text Related objects and properties are richText, defaultStyle, event.richValue, event.richChange, event.richChangeEx, the Annotation object richContents property, and the Span object.
Example 1
Turn all bold text into red underlined text.
var f = this.getField("Text Field0");
var spans = f.richValue;
for ( var i = 0; i < spans.length; i++ )
{
spans[i].textColor = color.red;
spans[i].underline = true;
}
f.richValue = spans;
Example 2
Create a text field, marks it for rich text formatting, and inserts rich text.
var myDoc = app.newDoc(); // Create a blank doc
var Bbox = myDoc.getPageBox("Crop"); // Get crop box
var inch = 72;
// Add a text field at the top of the document
var f = myDoc.addField("Text1", "text", 0,
[72, Bbox[1]-inch, Bbox[2]-inch, Bbox[1]-2*inch ] );
// Add some attributes to this text field
f.strokeColor = color.black;
f.richText = true; // Rich text
f.multiline = true; // Multiline
// Now build up an array of Span objects
var spans = new Array();
spans[0] = new Object();
spans[0].text = "Attention:\r";
spans[0].textColor = color.blue;
spans[0].textSize = 18;
spans[1] = new Object();
spans[1].text = "Foxit PDF Editor \r";
spans[1].textColor = color.red;
spans[1].textSize = 20;
spans[1].alignment = "center";
spans[2] = new Object();
spans[2].text = "will soon be here!";
spans[2].textColor = color.green;
spans[2].fontStyle = "italic";
spans[2].underline = true;
spans[2].alignment = "right";
// Now give the rich field a rich value
f.richValue = spans;

◆ rotation()

FX_BOOL Field::rotation ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Create a rotated text field on each page and fill it with text.
for ( var i=0; i < this.numPages; i++) {
var f = this.addField("myRotatedText"+i,"text",i,[6, 6+72, 18, 6]);
f.rotation = 90; f.value = "Confidential";
f.textColor = color.red; f.readonly = true;
}

◆ strokeColor()

FX_BOOL Field::strokeColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Change the stroke color of each text field in the document to red.
for ( var i=0; i < this.numFields; i++)
{
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if ( f.type == "text" ) f.strokeColor = color.red;
}

◆ style()

FX_BOOL Field::style ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
checkbox, radiobutton
Example
This example sets the glyph style to circle.
var f = this.getField("Check Box0");
f.style = style.ci;

◆ submitName()

FX_BOOL Field::submitName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
var f = this.getField("Text Field0");
f.submitName = "1213";

◆ textColor()

FX_BOOL Field::textColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
This example sets the foreground color to red.
var f = this.getField("Text Field0");
f.textColor = color.red;

◆ textFont()

FX_BOOL Field::textFont ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
button, combobox, listbox, text
font Object
Text font | Keyword
Times-Roman | font.Times
Times-Bold | font.TimesB
Times-Italic | font.TimesI
Times-BoldItalic | font.TimesBI
Helvetica | font.Helv
Helvetica-Bold | font.HelvB
Helvetica-Oblique | font.HelvI
Helvetica-BoldOblique | font.HelvBI
Courier | font.Cour
Courier-Bold | font.CourB
Courier-Oblique | font.CourI
Courier-BoldOblique | font.CourBI
Symbol | font.Symbol
ZapfDingbats | font.ZapfD
Example
Set the font to Helvetica.
var f = this.getField("Text Field0");
f.textFont = font.Times;

◆ textSize()

FX_BOOL Field::textSize ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
var f = this.getField("Text Field0");
f.textSize = 28;

◆ type()

FX_BOOL Field::type ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Count the number of text fields in the document.
var count = 0;
for ( var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
if ( this.getField(fname).type == "text" ) count++; }
console.println("There are " + count + " text fields.");

◆ userName()

FX_BOOL Field::userName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all
Example
Add a tooltip to a button field.
var f = this.getField("Push Button0");
f.userName = "Press this button to submit your data.";

◆ value()

FX_BOOL Field::value ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
various
Access
R/W
Availability
Foxit PDF Editor/Foxit PDF Reader
Fields
all except button
Example
var f0 = this.getField("Text Field0");
var f1 = this.getField("Text Field1");
var f2 = this.getField("Text Field2");
f0.value= (f1.value + f2.value) * 1.0825;

◆ valueAsString()

FX_BOOL Field::valueAsString ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Fields
all except button

◆ browseForFileToSubmit()

FX_BOOL Field::browseForFileToSubmit ( OBJ_METHOD_PARAMS )
Example
The following code references a text field with the file select flag checked. It is a
mouse-up action of a button field. var f = this.getField("resumeField");
f.browseForFileToSubmit();

◆ buttonGetCaption()

FX_BOOL Field::buttonGetCaption ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nFace (optional) If specified, gets a caption of the given type:
0 ——(default) normal
caption
1 —— down caption
2 —— rollover caption
Returns
The caption string associated with the button.
Example
var a = this.addField("EN" , "button" , 0 , [50,785-2*25, 400, 765-2*25]);
a.fillColor = color.white;
a.strokeColor = color.blue;
a.buttonSetCaption("Foxit");

◆ buttonGetIcon()

FX_BOOL Field::buttonGetIcon ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nFace (optional) If specified, gets an icon of the given type:
0 ——(default) normal icon
1 —— down icon
2 ——rollover icon
Returns
The Icon object.
Example
// Swap two button icons.
var f = this.getField("Button1");
var g = this.getField("Button2");
var temp = f.buttonGetIcon();
f.buttonSetIcon(g.buttonGetIcon());
g.buttonSetIcon(temp);

◆ buttonSetCaption()

FX_BOOL Field::buttonSetCaption ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cCaption The caption associated with the button.
nFace (optional) If specified, sets a caption of the given type:
0 ——(default) normal caption
1 ——down caption
2 —— rollover caption
Example
var f = this.getField("myButton");
f.buttonSetCaption("Hello");

◆ buttonSetIcon()

FX_BOOL Field::buttonSetIcon ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
oIcon The Icon object associated with the button.
nFace (optional) If specified, sets an icon of the given type:
0 —— (default) normal
icon
1 —— down icon
2 —— rollover icon
Example
function Field_buttonSetIcon()
{
var f1 = this.getField("button icon source");
var icon1 = f1.buttonGetIcon();
var f2 = this.getField("button icon target");
f2.buttonSetIcon(icon1);
}
Field_buttonSetIcon();

◆ checkThisBox()

FX_BOOL Field::checkThisBox ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nWidget The 0-based index of an individual check box or radio button widget for this field. The index is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order).
Every entry in the Fields panel has a suffix giving this index; for example, MyField #0.
bCheckIt (optional) Specifies whether the widget should be checked. The default is true.
Example
Check a check box.
var f = this.getField("ChkBox");
f.checkThisBox(0,true);

◆ clearItems()

FX_BOOL Field::clearItems ( OBJ_METHOD_PARAMS )
Example
Clear the field "myList" of all items.
this.getField("myList").clearItems();

◆ defaultIsChecked()

FX_BOOL Field::defaultIsChecked ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nWidget The 0-based index of an individual radio button or check box widget for this field. The index is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order).
Every entry in the Fields panel has a suffix giving this index (for example, MyField #0).
bIsDefaultChecked (optional) If true (the default), the widget should be checked by default (for example, when the field gets reset). If false, it should be unchecked by default.
Returns
true on success.
Example
Change the default of "ChkBox" to checked, then reset the field to reflect the default
value. var f = this.getField("ChkBox"); f.defaultIsChecked(0,true); this.resetForm(["ChkBox"]);

◆ deleteItemAt()

FX_BOOL Field::deleteItemAt ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nIdx (optional) The 0-based index of the item in the list to delete. If not specified, the currently selected item is deleted.
Example
Delete the current item in the list, then select the top item in the list.
var a = this.getField("MyListBox");
a.deleteItemAt(); // Delete current item, and...
a.currentValueIndices = 0; // select top item in list

◆ getArray()

FX_BOOL Field::getArray ( OBJ_METHOD_PARAMS )
Returns
An array of Field objects
Example
Make a calculation of the values of the child fields of the parent field.
// f has 3 children: f.v1, f.v2, f.v3
var f = this.getField("f");
var a = f.getArray();
var v = 0.0;
for (j =0; j < a.length; j++) v += a[j].value;
// v contains the sum of all the children of field "f"

◆ getItemAt()

FX_BOOL Field::getItemAt ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nIdx The 0-based index of the item in the list or -1 for the last item in the list.
bExportValue (optional) Specifies whether to return an export value:
If true (the default), if the item has an export value, it is returned. If there is no export value, the item name is returned.
If false, the method returns the item name.
Returns
The export value or name of the specified item.
Example
In the two examples that follow, assume there are three items on "myList": "First" with an
export value of 1; "Second", with an export value of 2; and "Third", with no export value.
// Returns value of first item in list, which is 1
var f = this.getField("myList");
var v = f.getItemAt(0);
The following example shows the use of the second optional parameter. By setting it to
false, the item name (face value) can be obtained, even if there is an export value.
for (var i=0; i < f.numItems; i++)
console.println(f.getItemAt(i,true) + ": " + f.getItemAt(i,false));
The output to the console reads:
1: First
2: Second
Third: Third

◆ getLock()

FX_BOOL Field::getLock ( OBJ_METHOD_PARAMS )
Returns
The Lock object for the field.

◆ insertItemAt()

FX_BOOL Field::insertItemAt ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cName The item name that will appear in the form.
cExport (optional) The export value of the field when this item is selected. If not provided, the cName is used as the export value.
nIdx (optional) The index in the list at which to insert the item. If 0 (the default), the new item is inserted at the top of the list. If -1, the new item is inserted at the end of the list.
Example
var l = this.getField("myList");
l.insertItemAt("sam", "s", 0); // inserts sam to top of list l

◆ isBoxChecked()

FX_BOOL Field::isBoxChecked ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nWidget The 0-based index of an individual radio button or check box widget for this field. The index is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order).
Every entry in the Fields panel has a suffix giving this index, for example, MyField #0.
Returns
true if the specified widget is currently checked, false otherwise.
Example
Determine the state of the check box and report back with an alert box.
var f = this.getField("ChkBox");
var cbStatus = (f.isBoxChecked(0)) ? " " : " not ";
app.alert("The box is" + cbStatus + "checked");

◆ isDefaultChecked()

FX_BOOL Field::isDefaultChecked ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nWidget The 0-based index of an individual radio button or check box widget for this field. The index is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order).
Every entry in the Fields panel has a suffix giving this index, for example, MyField #0.
Returns
true if the specified widget is checked by default, false otherwise.
Example
Determine if the specified check box is checked by default.
var f = this.getField("ChkBox");
var cbStatus = (f.isDefaultChecked(0)) ? "Checked" : "Unchecked";
app.alert("The Default: " + cbStatus);

◆ setAction()

FX_BOOL Field::setAction ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cTrigger A string that sets the trigger for the action. Values are:
MouseUp
MouseDown
MouseEnter
MouseExit
OnFocus
OnBlur
Keystroke
Validate
Calculate
Format
For a list box, use the Keystroke trigger for the Selection Change event.
cScript The JavaScript code to be executed when the trigger is activated.
Example
Set up a button field with addField, add some properties, and a mouse-up action using
setAction. var f = this.addField("actionField", "button", 0 , [20, 100, 100, 20]);
f.setAction("MouseUp", "app.beep(0);");
f.delay = true;
f.fillColor = color.ltGray;
f.buttonSetCaption("Beep");
f.borderStyle = border.b;
f.lineWidth = 3;
f.strokeColor = color.red;
f.highlight = highlight.p;
f.delay = false;

◆ setFocus()

FX_BOOL Field::setFocus ( OBJ_METHOD_PARAMS )
Example
Search for a certain open document, then focus on the field of interest. This script uses
app.activeDocs, which requires the disclosed property of the documents to be true, or the script
to be run during console, batch or menu events. var d = app.activeDocs; for (var i = 0; i <
d.length; i++) { if (d[i].info.Title == "Response Document") {
d[i].getField("name").value="Enter your name here: "
// also brings the doc to front.
d[i].getField("name").setFocus();
break;
}
}

◆ setItems()

FX_BOOL Field::setItems ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
oArray An array in which each element is either an object convertible to a string or another array:
For an element that can be converted to a string, the user and export values for the list item are equal to the string.
For an element that is an array, the array must have two subelements convertible to strings, where the first is the user value and the second is the export value.
Examples
Get various fields (combo or list) and set items in the list using various techniques.
var l = this.getField("ListBox");
l.setItems(["One", "Two", "Three"]);
var c = this.getField("StateBox");
c.setItems([["California", "CA"],["Massachusetts", "MA"],
["Arizona", "AZ"]]);
var c = this.getField("NumberBox");
c.setItems(["1", 2, 3, ["PI", Math.PI]]);

◆ setLock()

FX_BOOL Field::setLock ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter | instruction
oLock | A Lock object containing the lock properties.
Returns
true if successful, otherwise false or throws an exception.
Lock Object
A generic JavaScript object containing lock properties. This object is passed to setLock and returned by getLock for a signature field. It contains the following properties.
Property Type Access Description
action String R/W The language-independent name of the action. Values are:
All ¡ª All fields in the document are to be locked.
Include ¡ª Only the fields specified in fields are to be locked.
Exclude ¡ª All fields except those specified in fields are to be locked.
fields Array of Strings R/W An array of strings containing the field names. Required if the value of action is Include or Exclude.

◆ signatureGetModifications()

FX_BOOL Field::signatureGetModifications ( OBJ_METHOD_PARAMS )
Returns
An object containing modification information. The object has the following properties:
Property | Type | Description
formFieldsCreated | Array of Field objects | Array of form fields created after signing.
formFieldsDeleted | Array of Generic objects | Array of form fields deleted after signing. Each generic object in the array is a string of the form name : type.
formFieldsFilledIn | Array of Field objects | Array of form fields filled in after signing.
formFieldsModified | Array of Field objects | Array of form fields modified after signing. In this context, form field fill-in does not constitute modification.
annotsCreated | Array of Annotation objects | Array of annotations created after signing. If the annotation is transient (for example, a dynamically created pop-up), the corresponding element of the array is a string of the form author : name : type.
annotsDeleted | Array of Generic objects | Array of annotations deleted after signing. Each generic object in the array is of the form author : name : type.
annotsModified | Array of Annotation objects | Array of annotations modified after signing. If the annotation is transient (for example, a dynamically created pop-up), the corresponding element of the array is a string of the form author : name : type.
numPagesCreated | Integer | Number of pages added after signing.
numPagesDeleted | Integer | Number of pages deleted after signing.
numPagesModified Integer Number of pages whose content has been modified after signing (add/delete/modify of annotations/form fields are not considered as page modification for this purpose).
Example
Write modification information back to the console.
var sigField = this.getField( "mySignature" );
var sigMods = sigField.signatureGetModifications();
var formFieldsCreated = sigMods.formFieldsCreated;
for( var i = 0; i < formFieldsCreated.length; i++ )
console.println( formFieldsCreated[i].name );
var formFieldsDeleted = sigMods.formFieldsDeleted;
for( var i = 0; i < formFieldsDeleted.length; i++ )
console.println( formFieldsDeleted[i].name );
var formFieldsFilledIn = sigMods.formFieldsFilledIn;
for( var i = 0; i < formFieldsFilledIn.length; i++ )
console.println( formFieldsFilledIn[i].name );
var formFieldsModified = sigMods.formFieldsModified;
for( var i = 0; i < formFieldsModified.length; i++ )
console.println( formFieldsModified[i].name );
console.println( sigMods.numPagesDeleted );

◆ signatureGetSeedValue()

FX_BOOL Field::signatureGetSeedValue ( OBJ_METHOD_PARAMS )
Returns
A SeedValue object.
Example
Access the seed value for a signature field.
var f = this.getField( "sig0" );
var seedValue = f.signatureGetSeedValue();
// displays the seed value filter and flags
console.println( "Filter name:" + seedValue.filter);
console.println( "Flags:" + seedValue.flags);
// displays the certificate seed value constraints
var certSpec = seedValue.certspec;
console.println( "Issuer:" + certspec.issuer);

◆ signatureInfo()

FX_BOOL Field::signatureInfo ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Returns
A SignatureInfo object that contains the properties of the signature. This type of object is also used when signing signature fields, signing FDF objects, or with the FDF object signatureValidate method.
Example
Access SignatureInfo object properties.
// Get all info
var f = getField( "Signature1" );
f.signatureValidate();
var s = f.signatureInfo();
console.println( "Signature Attributes:" );
for(i in s) console.println( i + " = " + s[i] );
// Get particular info
var f = this.getField("Signature1"); // uses the ppklite sig handler
var Info = f.signatureInfo();
// Some standard signatureInfo properties
console.println("name = " + Info.name);
console.println("reason = " + Info.reason);
console.println("date = " + Info.date);

◆ signatureSetSeedValue()

FX_BOOL Field::signatureSetSeedValue ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter | instruction
oSigSeedValue | A SeedValue object containing the signature seed value properties.
SeedValue Object
A generic JavaScript object, passed to signatureSetSeedValue and returned by signatureGetSeedValue, which represents a signature seed value. It has the following properties:
Property | Type | Access | Description
certspec | object | R/W | A seed value CertificateSpecifier object. see CertificateSpecifier Object for a listing of the properties of this object.
digestMethod | Array of strings | R/W | An array of acceptable digest methods to use while signing. the value is always SHA1 in Foxit PDF Editor.
filter String R/W The language-independent name of the security handler to be used when signing.
If filter is specified and the flags property indicates this entry is a required constraint, then the signature handler specified by this entry must be used when signing; otherwise, signing must not take place. If flags indicates that this is an optional constraint, then this handler should be used if it is available. If it is not available, a different handler can be used instead.
flags Number R/W A set of bit flags controlling which of the following properties of this object are required. The value is the logical OR of the following values, which are set if the corresponding property is required:
1: filter
2: subFilter
4: version
8: reasons
16: legalAttestations
32: shouldAddRevInfo
64: digestMethod
128: lockDocument
256: appearanceFilter
Usage: 1 specifies filter, 3 specifies filter and sub-filter, and 11 specifies filter, sub-filter, and reasons. If this field is not present, all properties are optional.
legalAttestations Array of Strings R/W A list of legal attestations that the user can use when creating an Modification Detection and Prevention (MDP) (certified) signature.
The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.
mdp String R/W The MDP setting to use when signing the field. Values are
allowNone
default
defaultAndComments
While allowAll is a legal value, it cancels out the effect of MDP and no certification signature can be used for this field, resulting in the signature being an approval signature, not an certification signature.
Values are unique identifiers and are described in the table titled Modification Detection and Prevention (MDP) Values.
reasons Array of Strings R/W A list of reasons that the user is allowed to use when signing.
If this array has a single element and that element is a single period '.' and if the reasons are marked as required by the flags property, then Foxit PDF Editor will suppress the UI for specifying a reason during signing. This overrides the users preference.
If this array is empty and reasons are marked as required, an exception will be thrown.
subFilter Array of Strings R/W An array of acceptable formats to use for the signature. Refer to the Signature Info object's subFilter property for a list of known formats.
The first name in the array that matches an encoding supported by the signature handler should be the encoding that is actually used for signing. If subFilter is specified and the flags property indicates that this entry is a required constraint, then the first matching encodings must be used when signing; otherwise, signing must not take place. If the flags property indicates that this is an optional constraint, then the first matching encoding should be used if it is available. If it is not available, a different encoding can be used.
timeStampspec Object R/W A Seed Value timeStamp Specifier object. It uses the url and flags properties to specify a timestamp server. See Seed value timeStamp specifier object.
version Number R The minimum required version number of the signature handler to be used to sign the signature field. Valid values are 1 and 2. A value of 1 specifies that the parser must be able to recognize all seed value dictionary entries specified in PDF 1.5. A value of 2 specifies that it must be able to recognize all seed value dictionary entries specified in PDF 1.7 and earlier.
The flags property indicates whether this is a required constraint.
Note:The PDF Reference version 1.6 and earlier, erroneously indicates that the V entry (the key that corresponds to the version parameter) is of type integer. This entry is of type real.
CertificateSpecifier Object
This generic JavaScript object contains the certificate specifier properties of a signature seed value. Used in the certSpec property of the SeedValue object. This object contains the following properties:
Property Type Access Description
flags Number R/W A set of bit flags controlling which of the following properties of this object are required. The value is the logical OR of the following values, which are set if the corresponding property is required:
1: subject
2: issuer
4: oid
8: subjectDN
16: Reserved
32: keyUsage
64: url
If this field is not present, all properties are optional.
issuer Array of Certificate objects R/W An array of Certificate objects that are acceptable for signing.
Note:If specified, the signing certificate must be issued by a certificate that is an exact match with one of the certificates in this array.
The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.
keyUsage Object R Array of integers, where each integer specifies the acceptable key-usage extension that must be present in the signing certificate.
Each integer is constructed as follows:
There are two bits used for each key-usage type (defined in RFC 3280) starting from the least significant bit:
digitalSignature(bits 2,1),
nonRepudiation(4,3)
keyEncipherment(6,5)
dataEncipherment(8,7)
keyAgreement(10,9)
keyCertSign(12,11)
cRLSign(14,13)
encipherOnly(16,15)
decipherOnly(18,17)
The value of the two bits have the following semantics:
00: the corresponding keyUsage must not be set
01: the corresponding keyUsage must be set
10 and 11: the state of the corresponding keyUsage doesn't matter.
For example, if it is required that the key-usage type digitalSignature be set and the state of all other key-usage types do not matter, then the corresponding integer would be 0x7FFFFFFD. That is, to represent digitalSignature, set 01 for bits 2 and 1 respectively, and set 11 for all other key-usage types.
The value of the corresponding flag in the flags property indicates whether this is a required constraint.
subject Array of Certificate objects R/W An array of Certificate objects that are acceptable for signing.
Note:If specified, the signing certificate must be an exact match with one of the certificates in this array.
The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.
subjectDN Array of objects R/W Array of objects, where each object specifies a Subject Distinguished Name (DN) that is acceptable for signing. A signing certificate satisfies a DN requirement if it at least contains all the attributes specified in the DN (it can therefore contain additional DN attributes). If this entry is specified, the signing certificate must satisfy at least one of the DNs in the array.
DN attribute restrictions are specified in this object by adding them as properties. The properties'key names can either be the corresponding attributes'friendly names or OIDs (as defined in RFC 3280). The properties'value must be of type string.
The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.
Example 1: {cn:"Alice", ou:"Engineering", o:"Acme Inc"}. The friendly names for the DN attributes (cn, o, ou, and so on) are the ones defined in RDN (see RDN).
Example 2: {cn:"Joe Smith", ou:
"Engineering", 2.5.4.43:"JS"}, where OID 2.5.4.43 is used to carry out matching for the ¡°Initials¡± attribute. The following is sample code to define the above DN:
var subjectDN = {cn:"Joe Smith", ou:"Engineering"};
subjectDN["2.4.5.43"] = "JS";
Attributes whose value is of type DirectoryString or IA5String can be specified as shown in the example above, whereas for all other value types, for example, dateOfBirth whose value is of type GeneralizedTime, the values need to be specified as a hex-encoded binary string.
For more information about the various attributes and their types, refer to RFC 3280.
url String R/W A URL that can be used to enroll for a new credential if a matching credential is not found.
A degenerate use of this property is when the URL points to a web service that is a DigitalID store (such as a signature web service that can be used for server-based signing). In that case, the URL indicates that as long as the signer has a DigitalID from that web service, it is acceptable for signing.
The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.
urlType String R/W String indicating the type of URL specified by the url property. These are the valid values for Foxit PDF Editor:
"HTML": The URL points to an HTML website and Foxit PDF Editor will use the web browser to display its contents. The the value of the url bit of the flags property is ignored.
"ASSP": The URL references a signature web service that can be used for server-based signing. If the url bit of the flags property indicates that this is a required constraint, this implies that the credential used when signing must come from this server.
If this attribute isn't present, it's assumed that the URL points to a HTML site.
Seed value timeStamp specifier object
The properties of the seed value timeStamp specifier object are as follows:
Property | Type | Access | Description
url | String | R/W | URL of the timeStamp server providing an RFC 3161 compliant timeStamp.
flags Number R/W A bit flag controlling whether the time stamp is required (1) or not required (0). The default is 0.
Example 1
var f = this.getField("Signature");
var testCert = security.importFromFile("Certificate", "/f/testcert.cer");
f.signatureSetSeedValue({
reasons: ["This is a reason", "This is a better reason"]});

◆ signatureSign()

FX_BOOL Field::signatureSign ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
oSig Specifies the SecurityHandler object to be used for signing. Throws an exception if the specified handler does not support signing operations. Some security handlers require that the user be logged in before signing can occur. If oSig is not specified, this method selects a handler based on user preferences or by prompting the user if bUI is true.
oInfo (optional) A SignatureInfo object specifying the writable properties of the signature. See also signatureInfo.
cDIPath (optional) The device-independent path to the file to save to following the application of the signature. If not specified, the file is saved back to its original location.
bUI (optional) A Boolean value specifying whether the security handler should show the user interface when signing. If true, oInfo and cDIPath are used as default values in the signing dialog boxes. If false (the default), the signing occurs without a user interface.
cLegalAttest (optional) A string that can be provided when creating an certification signature.
Certification signatures are signatures where the mdp property of the SignatureInfo object has a value other than allowAll. When creating an certification signature, the document is scanned for legal warnings and these warnings are embedded in the document. A caller can determine what legal warnings are found by first calling the Doc getLegalWarnings method. If warnings are to be embedded, an author may provide an attestation as to why these warnings are being applied to a document.
Returns
true if the signature was applied successfully, false otherwise.
Example 1
Sign the "Signature" field with the PPKLite signature handler:
var myEngine = security.getHandler( "Adobe.PPKLite" );
myEngine.login( "dps017", "/c/profile/dps.pfx" );
var f = this.getField("Signature");
// Sign the field
f.signatureSign( myEngine,
{ password: "dps017", // provide password
location: "San Jose, CA", // ... see note below
reason: "I am approving this document",
contactInfo: "dpsmith@example.com",
appearance: "Fancy"});
Note:In the above example, a password was provided. This may or may not have been necessary
depending whether the Password Timeout had expired. The Password Timeout can be set
programmatically by securityHandler.setPasswordTimeout.
Example 2
Sign an certification signature field.
var myEngine = security.getHandler( "Adobe.PPKLite" );
myEngine.login( "dps017", "/c/profile/dps.pfx" );
var f = this.getField( "AuthorSigFieldName" );
var s = { reason: "I am the author of this document",
mdp: "allowNone" };
f.signatureSign({
oSig: myEngine,
oInfo: s,
bUI: false,
cLegalAttest: "To reduce file size, fonts are not embedded."
});

◆ signatureValidate()

FX_BOOL Field::signatureValidate ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter | instruction
oSig | (optional) The security handler to be used to validate the signature. Its value is either a SecurityHandler object or a SignatureParameters object. If this handler is not specified, the method uses the security handler returned by the signature's handlerName property.
bUI | (optional) If true, allows the UI to be shown when validating, if necessary. The UI may be used to select a validation handler if none is specified. The default is false.
Returns
The validity status of the signature. Validity values are:
-1 —— Not a signature field
0 —— Signature is blank
1 —— Unknown status
2 —— Signature is invalid
3 —— Signature of document is valid, identity of signer could not be verified
4 —— Signature of document is valid and identity of signer is valid.
See the signVisible and statusText properties of the SignatureInfo object.
Precondition
Document must be opened.
SignatureParameters object
A generic object with the following properties that specify which security handlers are to be used for validation by signatureValidate:
parameter | instruction
oSecHdlr | The security handler object to use to validate this signature.
bAltSecHdlr | If true, an alternate security handler, selected based on user preference settings, may be used to validate the signature. The default is false, which means that the security handler returned by the signature's handlerName property is used to validate the signature. This parameter is not used if oSecHdlr is provided.
Example
Validate a signature, then report to the console.
var f = this.getField("Signature1") // Get signature field
var status = f.signatureValidate();
var sigInfo = f.signatureInfo();
if ( status < 3 )
var msg = "Signature not valid! " + sigInfo.statusText;
else
var msg = "Signature valid! " + sigInfo.statusText;
app.alert(msg);


Javascript API: FullScreen Class Reference

Public Member Functions | List of all members
FullScreen Class Reference

The interface to fullscreen (presentation mode) preferences and properties. To acquire a fullScreen object, use app.fs.

Public Member Functions

FX_BOOL | backgroundColor (OBJ_PROP_PARAMS)
The background color of the screen in full screen mode. See Color arrays for details. More...
FX_BOOL | cursor (OBJ_PROP_PARAMS)
Determines the behavior of the pointer in full screen mode. The convenience cursor object defines all the valid cursor behaviors: More...
FX_BOOL | isFullScreen (OBJ_PROP_PARAMS)
If true, the viewer is in full screen mode rather than regular viewing mode, which is possible only if one or more documents are open for viewing. Note:A PDF document being viewed from within a web browser cannot be put into full screen mode. More...
FX_BOOL | timeDelay (OBJ_PROP_PARAMS)
The default number of seconds before the page automatically advances in full screen mode. See useTimer to activate or deactivate automatic page turning. More...
FX_BOOL | useTimer (OBJ_PROP_PARAMS)
Specifies whether automatic page turning is enabled in full screen mode. Use timeDelay to set the default time interval before proceeding to the next page. More...
FX_BOOL | usePageTiming (OBJ_PROP_PARAMS)
Specifies whether automatic page turning will respect the values specified for individual pages in full screen mode. Set transition properties of individual pages using setPageTransitions. More...
FX_BOOL | loop (OBJ_PROP_PARAMS)
Specifies whether the document will loop around to the beginning of the document in response to a page advance (whether generated by mouse click, keyboard, or timer) in full screen mode. More...
FX_BOOL | transitions (OBJ_PROP_PARAMS)
An array of strings representing valid transition names implemented in the viewer. No Transition is equivalent to setting defaultTransition to the empty string: app.fs.defaultTransition = "";. More...
FX_BOOL | defaultTransition (OBJ_PROP_PARAMS)
The default transition to use when advancing pages in full screen mode. Use transitions to obtain list of valid transition names supported by the viewer. “No Transition” is equivalent to app.fs.defaultTransition = ""; More...

Member Function Documentation

◆ backgroundColor()

FX_BOOL FullScreen::backgroundColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Color Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
app.fs.backgroundColor = color.ltGray;

◆ cursor()

FX_BOOL FullScreen::cursor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
app.fs.cursor = cursor.visible;

◆ isFullScreen()

FX_BOOL FullScreen::isFullScreen ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
app.fs.isFullScreen = true;
In the above example, the viewer is set to full screen mode. If isFullScreen was previously false, the default viewing mode would be set. (The default viewing mode is defined as the original mode the Foxit PDF Editor application was in before full screen mode was initiated.)

◆ timeDelay()

FX_BOOL FullScreen::timeDelay ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Set full screen properties, then go into full screen mode.
app.fs.timeDelay = 5; // Delay 5 seconds
app.fs.useTimer = true; // Activate automatic page turning
app.fs.usePageTiming = true; // Allow page override
app.fs.isFullScreen = true; // Go into full screen

◆ useTimer()

FX_BOOL FullScreen::useTimer ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ usePageTiming()

FX_BOOL FullScreen::usePageTiming ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ loop()

FX_BOOL FullScreen::loop ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ transitions()

FX_BOOL FullScreen::transitions ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Produce a listing of the currently supported transition names.
console.println("[" + app.fs.transitions + "]");

◆ defaultTransition()

FX_BOOL FullScreen::defaultTransition ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Put the document into presentation mode.
app.fs.defaultTransition = "WipeDown";
app.fs.isFullScreen = true;


Javascript API: global Class Reference

Public Member Functions | List of all members
global Class Reference

This is a static JavaScript object that allows you to share data between documents and to have data be persistent across sessions. Such data is called persistent global data. Global data-sharing and notification across documents is done through a subscription mechanism, which allows you to monitor global data variables and report their value changes across documents.

Public Member Functions

FX_BOOL setPersistent (OBJ_METHOD_PARAMS)
Controls whether a specified variable is persistent across invocations of Foxit PDF Editor. Persistent global data only applies to variables of type Boolean, Number, or String. Upon application exit, persistent global variables are stored in the glob.js file located in the user’s folder for folder-level scripts and re-loaded at application start. For Foxit PDF Editor 6.0 or later, there is a 2-4 KB limit on the size of this file. Any data added to the string after this limit is dropped. When specifying persistent global variables, you should use a naming convention. For example, you can give your variables the form myCompany_variableName. This prevents collisions with other persistent global variable names throughout the documents. More...

Member Function Documentation

◆ setPersistent()

FX_BOOL global::setPersistent ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cVariable The variable (global property) for which to set persistence.
bPersist If true, the property will exist across Foxit PDF Editor viewer sessions. If false (the default) the property will be accessible across documents but not across the Foxit PDF Editor viewer sessions.
Example
Make the radius property persistent and accessible for other documents.
global.radius = 8; // Declare radius to be global
global.setPersistent("radius", true); // Now say it’s persistent
The volume calculation, defined above, will now yield the same result across viewer sessions, or until the value of global.radius is changed.


Javascript API: HostContainer Class Reference

Public Member Functions | List of all members
HostContainer Class Reference

This object manages communication between a PDF document and a corresponding host container that the document is contained within, such as an HTML page. The host container for a document is specified by the Doc hostContainer property.\0 The Embedded PDF object provides the corresponding API for the object model of the container application.

Public Member Functions

FX_BOOL | messageHandler (OBJ_PROP_PARAMS)
A notification object that is called if a script in the host container calls the postMessage method. This object may expose the following methods and properties: Note:Instead of specifying a method, onDisclose may specify the value HostContainerDisclosurePolicy.SameOriginPolicy, which means that the document will be disclosed to the host container if they both originate from the same location. In this case, the origination is determined by the scheme, server, and port. The scheme must be http, https, or ftp for the document to be disclosed. When these methods are invoked, the this object will be the messageHandler instance that the method is being called on. Other methods and properties can be added to messageHandler provided that they do not begin with on. If messageHandler is set to null or an object without an onMessage method, messages sent by postMessage are queued until the property is set to a valid messageHandler instance. Messages are guaranteed to be delivered in the order in which they are posted and errors are guaranteed to be delivered in the order in which they occurred. However, there is no correspondence between the delivery order of messages and errors. Exceptions thrown from within the handler methods will be discarded. If an exception is thrown from within onDisclose, the function will be treated as a failure. Messages and errors will not be delivered while inside an onMessage / onError / onDisclose handler. More...
FX_BOOL | postMessage (OBJ_METHOD_PARAMS)
Sends a message asynchronously to the message handler for the host container of the PDF document. For this message to be delivered, the host container (for example, an <OBJECT> element in an HTML page) must have registered for notification by setting its messageHandler property. The message is passed to the onMessage method of the messageHandler. The messages are submitted to a queue until they are delivered. If the queue exceeds a maximum number of messages, a parameter error is thrown until some of the messages in the queue have been delivered. More...

Member Function Documentation

◆ messageHandler()

FX_BOOL HostContainer::messageHandler ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
A generic host container message handler.
this.hostContainer.messageHandler =
{
onMessage: function(aMessage)
{
for(var i = 0; i < aMessage.length; i++)
console.println("Recv’d Msg[ " + i + "]: " + aMessage[i]);
},
onError: function(error, aMessage){ },
onDisclose: HostContainerDisclosurePolicy.SameOriginPolicy
};

◆ postMessage()

FX_BOOL HostContainer::postMessage ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
aMessage An array of one or more strings that are passed to the onMessage method of the messageHandler property.
Example
var aMessage = [“MyMessageName”, “Message Body”];
this.hostContainer.postMessage(aMessage);


Javascript API: Icon Class Reference

List of all members
Icon Class Reference

This generic JavaScript object is an opaque representation of a Form XObject appearance stored in the Doc icons property. It is used with Field objects of type button. The icon object contains the following property: *. More...

Detailed Description

Property | Type | Access | Description
name | string | R | The name of the icon. An icon has a name if it exists in the document-level named icons tree.


Javascript API: identity Class Reference

Public Member Functions | List of all members
identity Class Reference

This is a static object that identifies the current user of the application.

Public Member Functions

FX_BOOL | corporation (OBJ_PROP_PARAMS)
The corporation name that the user has entered in the Identity preferences panel. More...
FX_BOOL | email (OBJ_PROP_PARAMS)
The email address that the user has entered in the Identity preferences panel. More...
FX_BOOL | loginName (OBJ_PROP_PARAMS)
The login name as registered by the operating system. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The user name that the user entered in the Identity preferences panel. More...

Member Function Documentation

◆ corporation()

FX_BOOL identity::corporation ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ email()

FX_BOOL identity::email ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ loginName()

FX_BOOL identity::loginName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ name()

FX_BOOL identity::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The following can be executed in the console, or, perhaps, a folder-level JavaScript.
console.println("Your name is " + identity.name);
console.println("Your e-mail is " + identity.email);


Javascript API: Index Class Reference

Public Member Functions | List of all members
Index Class Reference

An object that represents a Catalog-generated index. It is non-creatable and returned by various methods of the search object and catalog object. You use this object to perform various indexing operations using Catalog. You can find the status of the index with a search.

Public Member Functions

FX_BOOL | available (OBJ_PROP_PARAMS)
Specifies whether the index is available for selection and searching. An index may be unavailable if a network connection is down or a CD-ROM is not inserted, or if the index administrator has brought the index down for maintenance purposes. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The name of the index as specified by the index administrator at indexing time. See search.indexes, which returns an array of the Index objects currently accessed by the search engine. More...
FX_BOOL | path (OBJ_PROP_PARAMS)
The device-dependent path where the index resides. See the PDF Reference for exact syntax of the path. More...
FX_BOOL | selected (OBJ_PROP_PARAMS)
Specifies whether the index participates in the search. If true, the index is searched as part of the query. If false it is not searched. Setting or unsetting this property is equivalent to checking the selection status in the index list dialog box. More...

Member Function Documentation

◆ available()

FX_BOOL Index::available ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ name()

FX_BOOL Index::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
This example enumerates all of the indexes and writes their names to the console.
for (var i = 0; i < search.indexes.length; i++) {
console.println("Index[" + i + "] = " + search.indexes[i].name);
}

◆ path()

FX_BOOL Index::path ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ selected()

FX_BOOL Index::selected ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader


Javascript API: Link Class Reference

Public Member Functions | List of all members
Link Class Reference

This object is used to set and get the properties and to set the JavaScript action of a link.

Public Member Functions

FX_BOOL | borderColor (OBJ_PROP_PARAMS)
The border color of a Link object. See Color arrays for information on defining color arrays and how colors are used with this property. More...
FX_BOOL | borderWidth (OBJ_PROP_PARAMS)
The border width of the Link object. More...
FX_BOOL | highlightMode (OBJ_PROP_PARAMS)
The visual effect to be used when the mouse button is pressed or held down inside an active area of a link. The valid values are: None Invert Outline Push The default is Invert. More...
FX_BOOL | rect (OBJ_PROP_PARAMS)
The rectangle in which the link is located on the page. Contains an array of four numbers, the coordinates in rotated user space of the bounding rectangle, listed in the following order: upper-left x, upper-left y, lower-right x and lower-right y. More...
FX_BOOL | setAction (OBJ_METHOD_PARAMS)
Sets the specified JavaScript action for the MouseUp trigger for the Link object. Note:This method will overwrite any action already defined for this link. More...

Member Function Documentation

◆ borderColor()

FX_BOOL Link::borderColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ borderWidth()

FX_BOOL Link::borderWidth ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ highlightMode()

FX_BOOL Link::highlightMode ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ rect()

FX_BOOL Link::rect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ setAction()

FX_BOOL Link::setAction ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cScript The JavaScript action to use.


Javascript API: MediaPlayer Class Reference

Public Member Functions | List of all members
MediaPlayer Class Reference

A MediaPlayer object represents an instance of a multimedia player such as QuickTime, Windows Media Player, or others. Its settings and events properties let you manipulate the player from JavaScript code and handle events that the player triggers. MediaPlayer is not part of a PDF file; it is a transient object created in memory when needed.

Public Member Functions

FX_BOOL | isOpen (OBJ_PROP_PARAMS)
A Boolean value that is true if the media player is currently open. Use MediaPlayer.open and MediaPlayer.close to open or close a player. More...
FX_BOOL | settings (OBJ_PROP_PARAMS)
Includes all of the settings that are used to create a MediaPlayer. See MediaSettings object for a complete list. Note: changing a property in MediaPlayer.settings after the player has been created has no effect. This may be changed in a future release to make these settings live. For compatibility with current and future releases, avoid changing any settings properties while a player is open. More...
FX_BOOL | visible (OBJ_PROP_PARAMS)
A Boolean value controlling whether the player is visible. Unlike MediaPlayer.settings.visible, this property takes effect immediately. If the player is not open, reading this property returns undefined and setting it throws an exception. Setting this property may trigger events. For example, if the player is visible and has the focus, making it invisible triggers a Blur event. More...
FX_BOOL | open (OBJ_METHOD_PARAMS)
Attempts to open the media player as specified by MediaPlayer.settings. If the player is already open, an exception is thrown. If the player was previously opened and then closed, open may be called to open the player again. This uses the same JavaScript object as before but opens a new instance of the actual media player. In this case, for example, the new player does not remember the playback position from the old player. For a docked player, a GetRect event (onGetRect) is triggered when the player is opened. If MediaPlayer.settings.autoPlay is true (the default), playback begins and a Play event (onPlay/afterPlay) is triggered. The open method may result in a security prompt dialog box, depending on the user’s settings. It may also result in events being triggered in objects such as other media players and screen annotations. For example, if another media player has the keyboard focus, it will receive a Blur event (onBlur/afterBlur). If bAllowSecurityUI is false, the open method never displays a security prompt, but returns a failure code instead. For a media player in a floating window, additional security checks are made against the user’s settings. For example, the user may specify that title bars are required on all floating player windows. If MediaPlayer.settings.floating contains options that the user does not allow, bAllowFloatOptionsFallback controls what happens. If it is false, playback is disallowed and an error code is returned. If it is true, the options in MediaPlayer.settings.floating are changed as needed to conform to the user’s security settings and open proceeds with those changed settings. The return value is an object that currently contains one property, code, which is a result code from the app.media.openCode enumeration. If your PDF is opened in a future version of Foxit PDF Editor, there may be additional properties in this object, or a code value added in that future version. Be sure to handle any such values gracefully. More...
FX_BOOL | close (OBJ_METHOD_PARAMS)
Closes the media player if it is open. Does nothing (and is not an error) if the player is closed. The eReason parameter should be a value from the app.media.closeReason enumeration. This value is passed through to the event.media.closeReason property for the Close event (see onClose and afterClose) that the close method is triggered. If the player has the keyboard focus, a Blur event (onBlur/afterBlur) is triggered before the Close event. Other events, such as Status (onStatus/afterStatus) and Stop (onStop/afterStop), may also be triggered depending on the particular media player. More...
FX_BOOL | stop (OBJ_METHOD_PARAMS)
Stops playback of the current media, if it is playing or paused, and triggers a Stop event (onStop/afterStop). The Stop event may occur during execution of the stop method or afterward, depending on the player. Does nothing if the media is not playing or paused. Throws an exception if the player is not open. After playback stops, the player sets the media position to either the beginning or end of media, depending on the player. If MediaPlayer.play is called after this, playback starts at the beginning of media.
FX_BOOL | seek (OBJ_METHOD_PARAMS)
Sets the current media’s playback location to the position described by the MediaOffset object contained in oMediaOffset. If the media is playing, it continues playing at the new location. If the media is paused, it moves to the new location and remains paused there. If the media is stopped, the result will vary depending on the player. Media players handle seek errors in different ways. Some ignore the error and others throw a JavaScript exception. Most, but not all, media players trigger a Seek event (onSeek/afterSeek) when a seek is completed. The seek operation may take place during the execution of the seek method or later, depending on the player. If seek returns before the seek operation is completed and you call another player method before the seek is completed, the results will vary depending on the player. More...
FX_BOOL | play (OBJ_METHOD_PARAMS)
Starts playback of the current media and triggers a Play event (onPlay/afterPlay). The Play event may occur during the play call or afterward, depending on the player. If the media is already playing, it continues playing and no event is triggered. If it is paused, rewinding, or fast forwarding, it resumes playback at the current position. If it is stopped, either at the beginning or end of media, playback starts from the beginning. More...

Member Function Documentation

◆ isOpen()

FX_BOOL MediaPlayer::isOpen ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ settings()

FX_BOOL MediaPlayer::settings ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
MediaSettings object
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ visible()

FX_BOOL MediaPlayer::visible ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Play the audio only of a video clip
// Assume a definition of args
var player = app.media.openPlayer(args);
player.visible = false;

◆ open()

FX_BOOL MediaPlayer::open ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
bAllowSecurityUI (optional) The default is true. See the description of this parameter given above.
bAllowFloatOptionsFallback (optional) The default is true. See the description of this parameter given above.
Returns
An object with a code property
Example
See Example 1 following createPlayer for an example of usage.
Calls app.media.createPlayer to create a MediaPlayer object and then calls MediaPlayer.open to open the player. This method triggers several events, which may include Ready (see onReady and afterReady), Play (see onPlay and afterPlay), and Focus (see onFocus and afterFocus). See the EventListener object for a general description of these events. The method alerts the user and returns null on failure. It does not throw exceptions.
Precondition
Document must be opened.
Parameters
parameter instruction
args (optional) A PlayerArgs object.
Returns
A MediaPlayer object, or null on failure
Example 1
This minimal example is a custom JavaScript from the Actions tab in the Multimedia Properties panel of a screen annotation. To override the parameters specified by the UI of the screen annotation, the args parameter is passed.
app.media.openPlayer();
Override settings.repeat: if repeat is set to 1, change it to 2. Otherwise, set it to 1.
var nRepeat =
( event.action.rendition.getPlaySettings().repeat == 1 ) ? 2 : 1;
var args = { settings: { repeat: nRepeat } };
app.media.openPlayer(args);
See the event object for an explanation of event.action.rendition. The above example also uses Rendition.getPlaySettings to access the settings associated with the rendition to be played (the one associated with the screen annotation).
Example 2
The following script is executed from a mouse-up action of a form button. It plays a docked media clip in a screen annotation.
app.media.openPlayer({
rendition: this.media.getRendition( "myClip" ),
annot: this.media.getAnnot( {nPage:0,cAnnotTitle:"myScreen"} ),
settings: { windowType: app.media.windowType.docked }
});
Example 3
This example is a custom JavaScript from the Actions tab in the Multimedia Properties of a screen annotation. The user clicks the annotation and a randomly chosen movie clip is played.
// These are placed at the top level of the document JavaScript
var myRenditions = new Array();
myRenditions[0] = "myClip1";
myRenditions[1] = "myClip2";
myRenditions[2] = "myClip3";
// This code is a custom JavaScript of a ScreenAnnot. All renditions
// are docked and are played in the ScreenAnnot.
var l = myRenditions.length;
randomIndex = Math.floor( Math.random() * l ) % l;
var rendition = this.media.getRendition(myRenditions[randomIndex]);
var settings = app.media.getRenditionSettings({ rendition: rendition });
var args = { rendition: rendition, settings: settings }
app.media.openPlayer(args);

◆ close()

FX_BOOL MediaPlayer::close ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
eReason eReason is a value from the app.media.closeReason enumeration.

◆ seek()

FX_BOOL MediaPlayer::seek ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
oMediaOffset A MediaOffset object, the properties of which indicate the playback location to be set.
Example 1
// Rewind the media clip
player.seek({ time: 0 });
// Play starting from marker "First"
player.seek({ marker: "First" });
// Play starting five seconds after marker "One"
player.seek({ marker: "One", time: 5 });
Example 2
The following script randomly plays (famous) quotations. The media is an audio clip (.wma) of famous quotations, which supports markers and scripts. The afterReady listener counts the number of markers, one at the beginning of each quotation. At the end of each quotation, there is also an embedded command script. The afterScript listener watches for these commands and if it is a “pause” command, it pauses the player.
var nMarkers=0;
var events = new app.media.Events;
events.add({
// Count the number of quotes in this audio clip, save as nMarkers
afterReady: function()
{
var g = player.markers;
while ( (index = g.get( { index: nMarkers } ) ) != null )
nMarkers++;
},
// Each quote should be followed by a script, if the command is to
// pause, then pause the player.
afterScript: function( e ) {
if ( e.media.command == "pause" ) player.pause();
}
});
var player = app.media.openPlayer({
rendition: this.media.getRendition( "myQuotes" ),
settings: { autoPlay: false },
events: events
});
// Randomly choose a quotation
function randomQuote() {
var randomMarker, randomMarkerName;
console.println("nMarkers = " + nMarkers);
// Randomly choose an integer between 1 and nMarkers, inclusive
randomMarker = Math.floor(Math.random() * 100) % ( nMarkers ) + 1;
// Indicate what quotation we are playing
this.getField("Quote").value = "Playing quote " + randomMarker;
// The marker names are "quote 1", "quote 2", "quote 3", etc.
randomMarkerName = "quote " + randomMarker;
// See the marker with the name randomMarkerName
player.seek( { marker: randomMarkerName } );
player.play();
}
Action is initiated by the mouse-up button action such as
try { randomQuote() } catch(e) {}

◆ play()

FX_BOOL MediaPlayer::play ( OBJ_METHOD_PARAMS )
Example
See Example 2 following seek for an example of usage.


Javascript API: OCG Class Reference

Public Member Functions | List of all members
OCG Class Reference

An OCG object represents an optional content group in a PDF file. Content in the file can belong to one or more optional content groups. Content belonging to one or more OCGs is referred to as optional content and its visibility is determined by the states (ON or OFF) of the OCGs to which it belongs. In the simplest case, optional content belongs to a single OCG, with the content being visible when the OCG is on and hidden when the OCG is off. More advanced visibility behavior can be achieved by using multiple OCGs and different visibility mappings. Use the Doc getOCGs method to get an array of OCG objects for a PDF document. The Doc methods addWatermarkFromFile and addWatermarkFromText add watermarks in an OCG. See the PDF Reference for additional details on optional content groups.

Public Member Functions

FX_BOOL | name (OBJ_PROP_PARAMS)
The text string seen in the UI for this OCG. It can be used to identify OCGs, although it is not necessarily unique. More...
FX_BOOL | state (OBJ_PROP_PARAMS)
Represents the current on/off state of this OCG. Changing the state of an OCG does not dirty the document, the OCGs revert to their initial state when the document is loaded again. More...
FX_BOOL | initState (OBJ_PROP_PARAMS)
This property is used to determine whether this OCG is on or off by default. See the states Object for possible values. More...
FX_BOOL | locked (OBJ_PROP_PARAMS)
This property is used to determine whether this OCG is locked. If an OCG is locked, its on/off state cannot be toggled through the UI. More...
FX_BOOL | setAction (OBJ_METHOD_PARAMS)
Registers a JavaScript expression to be evaluated after every state change for this OCG. Setting an action for an OCG does not dirty the document, therefore, the assignment of action must be made when the document is first opened, as document level script, or dynamically through user interaction. Note:This method will overwrite any action already defined for this OCG. More...

Member Function Documentation

◆ name()

FX_BOOL OCG::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
A function that toggle all Watermark OCGs.
function ToggleWatermark(doc)
{
var ocgArray = doc.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
if (ocgArray[i].name == "Watermark") {
ocgArray[i].state = !ocgArray[i].state;
}
}
}

◆ state()

FX_BOOL OCG::state ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Turn on all the OCGs in the given document.
function TurnOnOCGsForDoc(doc)
{
var ocgArray = doc.getOCGs();
for (var i=0; i < ocgArray.length; i++)
ocgArray[i].state = true;
}

◆ initState()

FX_BOOL OCG::initState ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Set an initial state of an OCG to off.
var ocgs = this.getOCGs();
ocgs[0].initState.constants.states.off;

◆ locked()

FX_BOOL OCG::locked ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ setAction()

FX_BOOL OCG::setAction ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cExpr The expression to be evaluated after the OCG state changes.
Example
The function below is used to assign a beep sound to an OCG passed to it. The script that
follows the function definition assigns a beeping action to the first OCG, as listed in the
array returned by the getOCGs method.
Beep when the given ocg is changed *
function BeepOnChange(ocg)
{
ocg.setAction("app.beep()");
}
var ocgs = this.getOCGs();
BeepOnChange(ocgs[0]);


Javascript API: PrintParams Class Reference

Public Member Functions | List of all members
PrintParams Class Reference

This is a generic object that controls printing parameters that affect any document printed using JavaScript. Changing this object does not change the user preferences or make any permanent changes to the document.

Public Member Functions

FX_BOOL | binaryOK (OBJ_PROP_PARAMS)
true if a binary channel to the printer is supported. The default is true. More...
FX_BOOL | bitmapDPI (OBJ_PROP_PARAMS)
The dots per inch (DPI) to use when producing bitmaps or rasterizing transparency. The valid range is 1 to 9600. If the document protections specify a maximum printing resolution, the lower of the two values is used. The default is 300. Illegal values are treated as 300. See also gradientDPI. More...
FX_BOOL | booklet (OBJ_PROP_PARAMS)
An object used to set the parameters for booklet printing. The properties of the booklet object are listed in the table below. More...
FX_BOOL | constants (OBJ_PROP_PARAMS)
Each instance of a PrintParams object inherits this property, which is a wrapper that holds various constant values. The values are all integers allowing read access only. They are used as option values of some of the other properties of the PrintParams object, and their values are listed with the properties to which they apply. More...
FX_BOOL | DuplexType (OBJ_PROP_PARAMS)
Sets the printing duplex mode to simplex, duplex long edge, or duplex short edge feed. This property appears as DuplexMode under the Advanced tab of the Document Properties dialog box. More...
FX_BOOL | fileName (OBJ_PROP_PARAMS)
The device-independent path for a file name to be used instead of sending the print job to the printer (Print to File). The path may be relative to the location of the current document. When printing to a file, if the interaction level (see interactive) is set to full, it is lowered to automatic. The default value is the empty string (no file name). Note:Printing to a file produces output suitable for the printer, for example, Postscript or GDI commands. When printerName is an empty string andfileName is specified, the current document is saved as a PostScript file. More...
FX_BOOL | firstPage (OBJ_PROP_PARAMS)
The first page number of the document to print. The number is 0-based. The first page of any document is 0, regardless of page number labels. The default value is 0, and values that are out of the document’s page range are treated as 0. See also lastPage. More...
FX_BOOL | flags (OBJ_PROP_PARAMS)
A bit field of flags to control printing. These flags can be set or cleared using bitwise operations through the constants flagValues object. Zero or more flags can be set; unsupported flags are ignored. The flags default to those set by user preferences. More...
FX_BOOL | interactive (OBJ_PROP_PARAMS)
Specifies the level of interaction between the user and the print job. The value of this property is set through the constants interactionLevel object. The default is full. More...
FX_BOOL | lastPage (OBJ_PROP_PARAMS)
The last 0-based page number of the document to print. The term “0-based” means the first page of any document is 0, regardless of page number labels. If the value is less than firstPage or outside the legal range of the document, this reverts to the default value. The default value is the number of pages in the document less one. More...
FX_BOOL | nUpAutoRotate (OBJ_PROP_PARAMS)
A Boolean value that if true, automatically rotates each page to match the page orientation to the available paper area during Multiple Pages Per Sheet printing. The default is false, but nUpAutoRotate obeys the print settings. Multiple Pages Per Sheet is obtained by setting pageHandling to nUp. More...
FX_BOOL | nUpNumPagesH (OBJ_PROP_PARAMS)
The number of pages to lay out in the horizontal direction when printing Multiple Pages Per Sheet. The default is 2, but nUpNumPagesH obeys the print settings. Multiple Pages Per Sheet is obtained by setting pageHandling to nUp. More...
FX_BOOL | nUpNumPagesV (OBJ_PROP_PARAMS)
The number of pages to be laid out in the vertical direction when printing Multiple Pages Per Sheet. The default is 2, but nUpNumPagesV obeys the print settings. Multiple Pages Per Sheet is obtained by setting pageHandling to nUp. See nUpNumPagesH for an example. More...
FX_BOOL | nUpPageBorder (OBJ_PROP_PARAMS)
A Boolean value that if true, draws and prints a page boundary around each of the pages during Multiple Pages Per Sheet printing. The default is false, but nUpPageBorder obeys the print settings. Multiple Pages Per Sheet is obtained by setting pageHandling to nUp. See nUpNumPagesH for an example. More...
FX_BOOL | nUpPageOrders (OBJ_PROP_PARAMS)
When printing multiple pages per sheet, the nUpPageOrder property determines how the multiple pages are laid out on the sheet. The value of the nUpPageOrder property is set through the constants nUpPageOrders object. The default is Horizontal, but nUpPageOrder obeys the print settings. Multiple Pages Per Sheet is obtained by setting pageHandling to nUp. More...
FX_BOOL | NumCopies (OBJ_PROP_PARAMS)
Sets the number of copies to be printed for this print job. More...
FX_BOOL | pageHandling (OBJ_PROP_PARAMS)
Takes one of seven values specified by the constants handling object. If set to an illegal value, it is treated as shrink. The default is shrink. More...
FX_BOOL | pageSubset (OBJ_PROP_PARAMS)
Select even, odd, or all the pages to print. The value of pageSubset is set through the constants subsets object. The default is all. More...
FX_BOOL | printAsImage (OBJ_PROP_PARAMS)
Set to true to send pages as large bitmaps. This can be slow and more jagged looking but can work around problems with a printer’s PostScript interpreter. Set bitmapDPI to increase or decrease the resolution of the bitmap. If interaction (see interactive) is full, the user’s printer preferences for printAsImage will be used. The default is false. More...
FX_BOOL | printContent (OBJ_PROP_PARAMS)
Sets the contents of the print job. The value of the printContents property is set through the constants printContents object. The default is doc. More...
FX_BOOL | printRange (OBJ_PROP_PARAMS)
Use the printRange property to print multiple sets of pages, each having a different page range. The parameter format is an array of pairs (nStart, nEnd), where nStart and nEnd are 0-based index pages of the PDF document. More...
FX_BOOL | printerName (OBJ_PROP_PARAMS)
The name of the destination printer. This property is a Windows and, beginning with version 9.0, a Mac OS feature. By default, printerName is set to the name of the default printer. If printerName is set to an empty string, the printer used is either the last printer used by Foxit PDF Editor/Foxit PDF Reader (if printing occurred during the current session) or the System Default printer. When printerName is an empty string and fileName is a nonempty string, the current document is saved as a PostScript file. See Example 2 below. See also app.printerNames. More...
FX_BOOL | reversePages (OBJ_PROP_PARAMS)
Set to true to print pages in reverse order (last to first). The default value is false. More...
FX_BOOL | tileLabel (OBJ_PROP_PARAMS)
Label each page of tiled output. Labeled pages indicate row and column, file name, and print date. The default is false. More...
FX_BOOL | tileMark (OBJ_PROP_PARAMS)
Tile marks indicate where to cut the page and where overlap occurs. The value is set through the constants tileMarks object. If set to an illegal value, it is treated as none. The default is none. More...
FX_BOOL | tileOverlap (OBJ_PROP_PARAMS)
The number of points that tiled pages have in common. Value must be between 0 and 144. Illegal values are treated as 0. The default value is 0. More...
FX_BOOL | tileScale (OBJ_PROP_PARAMS)
The amount that tiled pages are scaled. Pages that are not tiled are unaffected by this value. The default is unscaled (1.0). Larger values increase the size of the printout (for example, 2.0 is twice as large, a value of 0.5 is half as large). The value of tileScale must be between 0.01 and 99.99. Illegal values are treated as 1.0, which is the default value. More...

Member Function Documentation

◆ binaryOK()

FX_BOOL PrintParams::binaryOK ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ bitmapDPI()

FX_BOOL PrintParams::bitmapDPI ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ booklet()

FX_BOOL PrintParams::booklet ( OBJ_PROP_PARAMS )
Property | Type | Access | Description
binding | Integer | R/W | When printing a booklet, the binding property determines the paper binding direction and the page arrange order. The value of binding is set through the constants bookletBindings object, given below. The default is Left.
duplexMode | Integer | R/W | When printing a booklet, the duplexMode property determines the duplex printing mode. The value of duplexMode property is set through the constants duplexMode object, given below. The default is BothSides. When the output device doesn't support automatic duplex functionality, a manual duplex can be performed by two separated printings of front and back sides.
subsetFrom | Integer | R/W | When printing a booklet, subsetFrom determines the first booklet sheet to be printed. Independently from the general page range selection, only a subset of the final booklet result is printed by this option.Valid sheet numbers start from 0, which is the first sheet. The default value is 0.The special value of -1 represents the last sheet. More generally, the negative integer -N represents the sheet that is (N-1) from the last sheet. Thus, -2 is the sheet just before the last sheet, -3 is the sheet that is 2 sheets from the last one.See the additional note below on booklet subsetting.
subsetTo | Integer | R/W | When printing a booklet, subsetTo determines the last booklet sheet to be printed. Independently from the general page range selection, only a subset of the final booklet result is printed by this option.Valid sheet numbers start from 0, but the value -1 represents the last sheet. The default value is -1.The negative integer -N represents the sheet that is (N-1) from the last sheet. Thus, -2 is the sheet just before the last sheet, -3 is the sheet that is 2 sheets from the last one.See the additional note below on booklet subsetting.

The bookletBindings object has properties used to set the value of booklet.binding.

constants.bookletBindings object
Property | Description
Left | Left-side binding for Western-style left-to-right reading direction. The paper is folded on the short side.
Right | Right-side binding for text with right-to-left reading direction or Japanese-style vertical writing. The paper is folded on the short side.
LeftTall | Left-side binding for Western-style left-to-right reading direction. The paper is folded on the long side producing long and narrow pages.
RightTall | Right-side binding for text with right-to-left reading direction or Japanese-style vertical writing. The paper is folded on the long side producing long and narrow pages.
The bookletDuplexModes object has properties used to set the value of booklet.duplexMode.
constants.bookletDuplexModes object
Property | Description
BothSides | Automatically prints both sides of the paper. The selected printer must support automatic duplex printing.
FrontSideOnly | Only prints all pages that appear on the front side of the paper. Reinsert the printed pages and print again with BacksideOnly mode to complete a manual duplex printing.
BackSideOnly | Only prints all pages that appear on the back side of the paper.
Precondition
Document must be opened.
Type
object
Access
R/W
Note:
(Booklet subsetting using subsetFrom and subsetTo) Since the booklet output can change by the source page range (by setting firstPage and lastPage properties of the PrintParams object), the same effect cannot be achieved easily by changing these page range properties. For example. the first (2-side) sheet of an 8-page booklet job has a page number sequence of [8, 1, 2, 7] while the first sheet of 16-page booklet job has a page number sequence of [16, 1, 2, 15]. The subsetFrom and subsetTo properties are useful for printing certain pages of a booklet document with different devices or media. A typical example would be printing the cover and the inside cover in color while rest of the document is in black and white. Another common example is printing the cover page on thicker colored paper.
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example 1 (binding)
Set up booklet printing for right-side binding of text, and print.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.binding = pp.constants.bookletBindings.Right;
this.print(pp);
Example 2 (duplexMode)
Print booklet in duplex mode, printing only the front pages.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.duplexMode = pp.constants.bookletDuplexModes.FrontSideOnly;
this.print(pp);
Example 3 (subsetFrom and subsetTo)
Set up booklet printing to print the second sheet only and print.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.subsetFrom = 1;
pp.booklet.subsetTo = 1;
this.print(pp);
Set booklet printing from the second sheet to the last sheet.
pp.booklet.subsetFrom = 1;
pp.booklet.subsetTo = -1;
Set booklet printing to print last sheet only.
pp.booklet.subsetFrom = -1;
pp.booklet.subsetTo = -1;
Set booklet printing to print last sheet two sheets.
pp.booklet.subsetFrom = -2;
pp.booklet.subsetTo = -1;
Set booklet printing to print all pages except the last two.
pp.booklet.subsetFrom = 0;
pp.booklet.subsetTo = -3;

◆ constants()

FX_BOOL PrintParams::constants ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Constant object | Contains constant values for this property
bookletBindings | booklet
bookletDuplexModes | booklet
duplexTypes | DuplexType
fontPolicies | fontPolicy
handling | pageHandling
interactionLevel | interactive
nUpPageOrders | nUpPageOrder
printContents | printContent
flagValues | flags
rasterFlagValues | rasterFlags
subsets | pageSubset
tileMarks | tileMark
usages | usePrinterCRD\nuseT1Conversion
Type
object
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ DuplexType()

FX_BOOL PrintParams::DuplexType ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
constants.duplexTypes Object
The duplex options are accessed through the constants.duplexType object. The properties of this object are listed in the table that follows.
Property | Description
Simplex | Prints on one side of the paper.
DuplexFlipLongEdge | Prints on both sides of the paper; the paper flips along the long edge.
DuplexFlipShortEdge | Prints on both sides of the paper; the paper flips along the short edge.
The selected printer should support duplex printing, if either DuplexFlipLongEdge or DuplexFlipShortEdge is used.
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Set printing to duplex short edge feed and print.
var pp = this.getPrintParams();
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge;
this.print(pp);

◆ fileName()

FX_BOOL PrintParams::fileName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var pp = this.getPrintParams();
pp.fileName = "/c/print/myDoc.prn";
this.print(pp);
Example 2
Save the current document as a PostScript file.
var pp = this.getPrintParams();
pp.fileName = "/c/temp/myDoc.ps";
pp.printerName = "";
this.print(pp);

◆ firstPage()

FX_BOOL PrintParams::firstPage ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
var pp = this.getPrintParams();
pp.firstPage = 0;
pp.lastPage = 9;
this.print(pp);

◆ flags()

FX_BOOL PrintParams::flags ( OBJ_PROP_PARAMS )
constants.flagValues object
The table below lists the properties of the flagValues object; unless otherwise noted, these properties are not available in Foxit PDF Reader.
Property | Description
applyOverPrint | Do overprint preview when printing. Turn off if overprinting is natively supported.
applySoftProofSettings | Use the soft proofing settings before doing color management.
applyWorkingColorSpaces | Apply working color spaces when printing.
emitHalftones | Emit the halftones specified in the document.
emitPostScriptXObjects | PostScript only, do include PostScript XObjects’ content in output.
emitFormsAsPSForms | Converts Form XObjects to PS forms. The default is off.
maxJP2KRes | Use the maximum resolution of JPeg2000 images instead of the best matching resolution.
setPageSize | Enable setPageSize. Choose the paper tray by the PDF page size. Available in Foxit PDF Reader.
suppressBG | Do not emit the BlackGeneration in the document.
suppressCenter | Do not center the page. Available in Foxit PDF Reader.
suppressCJKFontSubst | Suppress CJK Font Substitution on Printer—does not apply when kAVEmitFontAllFonts is used.
suppressCropClip | Do not emit the cropbox page clip. Available in Foxit PDF Reader.
suppressRotate | Do not rotate the page. Available in Foxit PDF Reader.
suppressTransfer | Do not emit the transfer functions in the document.
suppressUCR | Do not emit UnderColorRemovals in the document.
useTrapAnnots | Print TrapNet and PrinterMark annotations, even if the print setting is “document only”.
usePrintersMarks | Print PrinterMark annotations, even if the print setting is “document only”. Available in Acrobat Pro only.
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example 1
In the Output options section of the Advanced Print Setup dialog box, check the Apply Output Preview Settings check box.
pp = getPrintParams();
fv = pp.constants.flagValues;
// or pp.flags |= fv.applySoftProofSettings;;
pp.flags = pp.flags | fv.applySoftProofSettings;
this.print(pp);
Example 2
Uncheck Auto-Rotate and Center (checked by default) in the Print dialog box.
pp = getPrintParams();
fv = pp.constants.flagValues;
pp.flags |= (fv.suppressCenter | fv.suppressRotate);
this.print(pp);
Example 3
In the PostScript options section of the Advanced Print Setup dialog box, check the Emit Undercolor Removal/Black Generation check box.
pp = getPrintParams();
fv = pp.constants.flagValues;
pp.flags &= ~(fv.suppressBG | fv.suppressUCR)
this.print(pp)

◆ interactive()

FX_BOOL PrintParams::interactive ( OBJ_PROP_PARAMS )
Note:
Non-interactive printing can only be executed during batch, console, and menu events. Printing is made non-interactive by setting bUI to false when calling the Doc print method or by setting the interactive property to silent, for example,
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
Outside of batch, console, and menu events, the values of bUI and of interactive are ignored, and a print dialog box will always be presented.
See also Privileged versus non-privileged context.
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
constants.interactionLevel Object
Property | Description
automatic | No print dialog box is displayed. During printing, a progress monitor and cancel dialog box are displayed and removed automatically when printing is complete.
full | Displays the print dialog box, allowing the user to change print settings and requiring the user to press OK to continue. During printing, a progress monitor and cancel dialog box is displayed and removed automatically when printing is complete.
silent | No print dialog box is displayed. No progress or cancel dialog box is displayed. Even error messages are not displayed.
Example
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
pp.printerName = "Foxit PDF";
this.print(pp);

◆ lastPage()

FX_BOOL PrintParams::lastPage ( OBJ_PROP_PARAMS )

See firstPage for an example.

Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ nUpAutoRotate()

FX_BOOL PrintParams::nUpAutoRotate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ nUpNumPagesH()

FX_BOOL PrintParams::nUpNumPagesH ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Perform Multiple Pages Per Sheet printing on this document, set up parameters, and print.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;
pp.nUpNumPagesH = 3;
pp.nUpNumPagesV = 3;
pp.nUpPageBorder=true;
pp.nUpAutoRotate=true;
this.print(pp);

◆ nUpNumPagesV()

FX_BOOL PrintParams::nUpNumPagesV ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ nUpPageBorder()

FX_BOOL PrintParams::nUpPageBorder ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ nUpPageOrders()

FX_BOOL PrintParams::nUpPageOrders ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
constants.nUpPageOrders Object
Property | Description
Horizontal | Pages are placed from left to right, from top to bottom.
HorizontalReversed | Pages are placed from right to left, from top to bottom.
Vertical | Pages are placed from top to bottom, from left to right.
Example
Perform Multiple Pages Per Sheet printing on this document, set the parameters, and print.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);

◆ NumCopies()

FX_BOOL PrintParams::NumCopies ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Set print job for duplex printing with two copies.
var pp = this.getPrintParams();
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge;
pp.NumCopies = 2;
this.print(pp);

◆ pageHandling()

FX_BOOL PrintParams::pageHandling ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
constants.handling Object
Property | Reader | Description
none | No page scaling is applied.
fit | Pages are enlarged or shrunk to fit the printer’s paper.
shrink | Small pages are printed small, and large pages are shrunk to fit on the printer’s paper.
tileAll | No | All pages are printed using tiling settings. This can be used to turn a normal-sized page into a poster by setting the tileScale property greater than 1.
tileLarge | No | Small or normal pages are printed in the original size and large pages are printed on multiple sheets of paper.
nUp | (Version 7.0) Pages are rescaled to print multiple pages on each printer page.\nProperties related to Multiple Pages Per Sheet printing are nUpAutoRotate, nUpNumPagesH, nUpNumPagesV, nUpPageBorder and nUpPageOrder.
booklet | (Version 8.0) Prints multiple pages on the same sheet of paper in the order required to read correctly when folded. The properties of the booklet object are used to set the parameters for booklet printing.
Example 1
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.shrink;
this.print(pp);
Example 2
Perform Multiple Pages Per Sheet printing on this document, set the parameters and print.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);
Example 3 (Version 8.0)
Print document as a booklet, taking all the default settings.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
this.print(pp);

◆ pageSubset()

FX_BOOL PrintParams::pageSubset ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
constants.subsets Object
Property | Description
all | Print all pages in the page range.
even | Print only the even pages. Page labels are ignored, and the document is treated as if it were numbered 1 through n, the number of pages.
odd | Print only the odd pages.
Example
var pp = this.getPrintParams();
pp.pageSubset = pp.constants.subsets.even;
this.print(pp);

◆ printAsImage()

FX_BOOL PrintParams::printAsImage ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ printContent()

FX_BOOL PrintParams::printContent ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
constants.printContents Object
Property | Description
doc | Print the document contents, not comments.
docAndComments | Print the document contents and comments.
formFieldsOnly | Print the contents of form fields only. Useful for printing onto pre-preprinted forms.
Example
Set printer to silently print form fields only.
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
pp.printContent = pp.constants.printContents.formFieldsOnly;
this.print(pp);

◆ printRange()

FX_BOOL PrintParams::printRange ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Exceptions
The ESErrorInvalidArgs exception occurs when:
1.the format of the specified parameters is invalid.
2.the startPage and endPage values are less than 0.
3.the startPage and endPage values are greater than or equal to totalPages in the PDF.
Example 1
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.full;
pp.printRange=[[1, 1], [3, 4]];
this.print(pp);

◆ printerName()

FX_BOOL PrintParams::printerName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example 1
Set the printer, and print.
var pp = this.getPrintParams();
pp.printerName = "hp officejet d series";
this.print(pp);
Example 2
Save the current document as a PostScript file.
var pp = this.getPrintParams();
pp.fileName = "/c/temp/myDoc.ps";
pp.printerName = "";
this.print(pp);

◆ reversePages()

FX_BOOL PrintParams::reversePages ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ tileLabel()

FX_BOOL PrintParams::tileLabel ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ tileMark()

FX_BOOL PrintParams::tileMark ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
constants.tileMarks Object
Property | Description
none | No tile marks
west | Western style tile marks
east | Eastern style tile marks

◆ tileOverlap()

FX_BOOL PrintParams::tileOverlap ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ tileScale()

FX_BOOL PrintParams::tileScale ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader


Javascript API: RDN Class Reference

List of all members
RDN Class Reference

This generic object represents a Relative Distinguished Name. It is used by securityHandler. newUser and the certificate.issuerDN and subjectCN properties. It has the following properties. *. More...

Detailed Description

Property | Type | Access | Description
c | string | R | Country or region. Must be a two-character upper case ISO 3166 standard string (for example, “US”).
cn | string | R | Common name (for example, “John Smith”)
e | string | R | Email address (for example, “jsmith@example.com”)
l | string | R | Locality or province
o | string | R | Organization name (for example, “Adobe Systems Incorporated”)
ou | string | R | Organizational unit (for example, “Foxit PDF Editor Engineering”)
st | string | R | State


Javascript API: ReadStream Class Reference

List of all members
ReadStream Class Reference

A ReadStream object is an object literal that represents a stream of data. It contains a method to allow reading the data stream. More...

Detailed Description

*

ReadStream properties
Property | Type | Access | Description
read | nBytes | String | The read method takes the number of bytes to read and returns a hex-encoded string with the data from the stream. The read method is a destructive operation on the stream and returns a zero length string to indicate the end of the stream.


Javascript API: Rendition Class Reference

Public Member Functions | List of all members
Rendition Class Reference

A Rendition contains information needed to play a media clip, including embedded media data (or a URL) and playback settings. It corresponds to a Rendition in the Foxit PDF Editor authoring user interface.

Public Member Functions

FX_BOOL | uiName (OBJ_PROP_PARAMS)
The name of the Rendition, as found in the N entry in its dictionary in the PDF file. More...
FX_BOOL | altText (OBJ_PROP_PARAMS)
The alternate text string for the annotation (an empty string if no alternate text was specified). More...

Member Function Documentation

◆ uiName()

FX_BOOL Rendition::uiName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The following is executed as a Rendition action.
console.println("Preparing to play \""
+ event.action.rendition.uiName + "\"");
See the event object for a description of event.action.rendition.

◆ altText()

FX_BOOL Rendition::altText ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Get an annotation and write its altText to the debug console.
var annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
console.println( "annot.altText = " + annot.altText );
The alternate text string for the rendition (an empty string if no alternate text was specified). This property is available only if the type of the rendition is app.media.renditionType.media (a MediaRendition).
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Get the altText of a rendition.
this.media.getRendition("myClip").altText;
See the examples that follow app.media.getAltTextSettings.


Javascript API: ScreenAnnot Class Reference

Public Member Functions | List of all members
ScreenAnnot Class Reference

A ScreenAnnot object represents a screen annotation, which is a rectangular area within a PDF document viewed on the display screen. A ScreenAnnot may have Renditions and RenditionActions associated with it for multimedia playback.

Public Member Functions

FX_BOOL | page (OBJ_PROP_PARAMS)
The page number of the PDF file in which the screen annotation is located. More...
FX_BOOL | rect (OBJ_PROP_PARAMS)
The rectangle of the screen annotation in default user coordinates. Changing this property dirties the PDF file; the new setting is saved if the PDF file is saved. innerDeviceRect and outerDeviceRect are also updated to reflect the new rectangle. More...

Member Function Documentation

◆ page()

FX_BOOL ScreenAnnot::page ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ rect()

FX_BOOL ScreenAnnot::rect ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
TType
Array of 4 Numbers
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Adjust the position of the annotation slightly.
var annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
var aRect = annot.rect;
aRect[0] += 10;
aRect[2] += 10;
annot.rect = aRect;


Javascript API: search Class Reference

Public Member Functions | List of all members
search Class Reference

The search object is a static object that accesses the functionality provided by the Foxit PDF Editor Search plug-in. This plug-in must be installed to interface with the search object (see available). See also the Index object, which is returned by some of the methods of the search object. The results for query calls are displayed in the Find dialog box of Foxit PDF Editor.

Public Member Functions

FX_BOOL | matchWholeWord (OBJ_PROP_PARAMS)
Specifies whether search finds only occurrences of complete words that are specified in the query. For example, when this option is set to true, if you search for the word “stick”, the words “tick” and “sticky” will not be highlighted. The default is false. More...
FX_BOOL | attachments (OBJ_PROP_PARAMS)
Determines whether any PDF file attachments should be searched along with the base document. The default is false. This property is ignored on the Mac OS platform when searching a document from within the Safari web browser. As a result, attachments are not searched inside Safari. More...
FX_BOOL | bookmarks (OBJ_PROP_PARAMS)
Specifies whether bookmarks are searched for the query. The default is false. More...
FX_BOOL | docText (OBJ_PROP_PARAMS)
Specifies whether the document text is searched for the query. The default is true. More...
FX_BOOL | ignoreAccents (OBJ_PROP_PARAMS)
Specifies whether accents and diacriticals are ignored while searching the query term. The default is false. More...
FX_BOOL | markup (OBJ_PROP_PARAMS)
Specifies whether markup (annotations) are searched for the query. The default is false. More...
FX_BOOL | matchCase (OBJ_PROP_PARAMS)
Specifies whether the search query is case sensitive. The default is false. More...
FX_BOOL | maxDocs (OBJ_PROP_PARAMS)
The maximum number of documents that will be returned as part of the search query. The default is 100 documents. More...
FX_BOOL | proximity (OBJ_PROP_PARAMS)
Specifies whether the search query will reflect the proximity of words in the results ranking when performing the search that contains AND Boolean clauses. The default is false. See the sections in the Foxit PDF Editor Help pertaining to Search capabilities for a more thorough discussion of proximity. More...
FX_BOOL | stem (OBJ_PROP_PARAMS)
Specifies whether the search query will take the stemming of words (for example, run, runs, running) into account when performing the search. The default is false. See the sections in the Foxit PDF Editor Help pertaining to Search capabilities for a more thorough discussion of stemming. More...
FX_BOOL | wordMatching (OBJ_PROP_PARAMS)
How individual words in the query will be matched to words in the document. Values are
MatchPhrase
MatchAllWords
MatchAnyWord
BooleanQuery (default)
This property is relevant only when a query has more than one word. The BooleanQuery option is ignored when searching the active document. More...
FX_BOOL | ignoreAsianCharacterWidth (OBJ_PROP_PARAMS)
Specifies whether the Kana characters in the document exactly match the search query. The default is false. More...
FX_BOOL | query (OBJ_METHOD_PARAMS)
Searches the specified document or index for the specified text. Properties associated with the search object (such as matchCase, matchWholeWord, stem) may affect the result. More...
FX_BOOL | addIndex (OBJ_METHOD_PARAMS)
Adds the specified index to the list of searchable indexes. More...
FX_BOOL | removeIndex (OBJ_METHOD_PARAMS)
Removes the specified Index object from the index list. More...

Member Function Documentation

◆ matchWholeWord()

FX_BOOL search::matchWholeWord ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ attachments()

FX_BOOL search::attachments ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ bookmarks()

FX_BOOL search::bookmarks ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ docText()

FX_BOOL search::docText ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ ignoreAccents()

FX_BOOL search::ignoreAccents ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ markup()

FX_BOOL search::markup ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ matchCase()

FX_BOOL search::matchCase ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ maxDocs()

FX_BOOL search::maxDocs ( OBJ_PROP_PARAMS )
Type
Integer
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ proximity()

FX_BOOL search::proximity ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ stem()

FX_BOOL search::stem ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ wordMatching()

FX_BOOL search::wordMatching ( OBJ_PROP_PARAMS )
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ ignoreAsianCharacterWidth()

FX_BOOL search::ignoreAsianCharacterWidth ( OBJ_PROP_PARAMS )
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ query()

FX_BOOL search::query ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cQuery The text for which to search.
cWhere (optional) Specifies where the text should be searched. Values are:
ActiveDoc
Folder
Index
ActiveIndexes
The default is ActiveIndexes.
cDIPath (optional) A device-independent path to a folder or Catalog index on the user's computer.
When cWhere is Folder or Index, this parameter is required.
Examples
Search for the word “Foxit PDF Editor”.
cWhere Query
ActiveIndexes search.query("Foxit PDF Editor"); // "ActiveIndexes" is the default.
search.query("Foxit PDF Editor", "ActiveIndexes");
ActiveDoc search.query("Foxit PDF Editor", "ActiveDoc");
Folder search.query("Foxit PDF Editor","Folder","/c/myDocuments");
search.query("Foxit", "Folder","\\10.103.2.20\\Testfile");
Index search.query("Foxit PDF Editor", "Index","E:\\Foxit PDF Editor\\query-test.xml");

◆ addIndex()

FX_BOOL search::addIndex ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
cDIPath A device-independent path to an index file on the user’s hard drive.
cDIPath (optional) Whether the index should be selected for searching.
Returns
An Index object.
Example
search.addIndex("E:\\work\\search\\test1.xml", true)
search.proximity = true;
search.wordMatching = "MatchAllWords";
search.query("22 aa", "ActiveIndexes");

◆ removeIndex()

FX_BOOL search::removeIndex ( OBJ_METHOD_PARAMS )
Parameters
parameter instruction
index The Index object to remove from the index list.


Javascript API: security Class Reference

Public Member Functions | List of all members
security Class Reference

The security object is a static JavaScript object that exposes security-related PDF functions such as encryption and digital signatures. Security functions are performed using a SecurityHandler object, which is obtained from the security object using the getHandler method.

Public Member Functions

FX_BOOL | handlers (OBJ_PROP_PARAMS)
An array containing the language-independent names of the available security handlers that can be used for encryption or signatures. See also getSecurityPolicies. The following information applies to different versions of Foxit PDF Editor: More...
FX_BOOL | getHandler (OBJ_METHOD_PARAMS)
Obtains a SecurityHandler object. The caller can create as many new engines as desired and each call to getHandler creates a new engine. However, there is only one UI engine. Note:This method is available from batch, console, and app initialization events. See Privileged versus non-privileged context for details. Backward Compatibility: invoking getHandler with cName as “Foxit.PPKMS” returns the engine associated with Foxit.PPKLite handler. More...
FX_BOOL | importFromFile (OBJ_METHOD_PARAMS)
Reads a raw data file and returns the data as an object with a type specified by cType. The file being imported must be a valid certificate. See also security.exportToFile. More...

Member Function Documentation

◆ handlers()

FX_BOOL security::handlers ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Get the list of security handlers available on this system:
for ( var i=0; i < security.handlers.length; i++ )
console.println(security.handlers[i])
The output to the console might be
Adobe.APS
Adobe.PPKLite
Adobe.PPKMS
Adobe.AAB

◆ getHandler()

FX_BOOL security::getHandler ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cName The language-independent name of the security handler, as returned by the handlers property.
constant strings are defined for each of the valid handlers. See security constants, in particular the HandlerName object object.
bUIEngine (optional) If true, the method returns the existing security handler instance that is associated with the Foxit PDF Editor user interface (so that, for example, a user can log in through the user interface). If false (the default), returns a new engine.
Returns
The SecurityHandler object specified by cName. If the handler is not present, returns a null object.
Example
Select the Foxit.PPKLite SecurityHandler.
// Validate signatures on open
security.validateSignaturesOnOpen = true;
// List all available signature handlers
var a = security.handlers;
for (var i = 0; i < a.length; i++)
console.println("a["+i+"] = "+a[i]);
// Use "Foxit.PPKLite" handler engine for the UI
var ppklite = security.getHandler(
security.PPKLiteHandler, true);
// Log in
ppklite.login("dps017", "/C/profiles/DPSmith.pfx");
See also the example following signatureSign for a continuation of this example.

◆ importFromFile()

FX_BOOL security::importFromFile ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cType The type of object to be returned by this method. The only supported type is “Certificate”.
cDIPath (optional) When bUI is false, this parameter is required and specifies the device-independent path to the file to be opened.
If bUI is true, this is the seed path used in the open dialog box.
bUI (optional) true if the user should be prompted to select the file that is to be imported. The default is false.
cMsg (optional) If bUI is true, the title to use in the open dialog box. If cMsg is not specified, the default title is used.
Returns
A Certificate object.
Example
var oMyCert = security.importFromFile("Certificate", "/c/myCert.cer");


Javascript API: SecurityHandler Class Reference

Public Member Functions | List of all members
SecurityHandler Class Reference

SecurityHandler objects are used to access security handler capabilities such as signatures, encryption, and directories. Different security handlers have different properties and methods. This section documents the full set of properties and methods that security objects may have. Individual SecurityHandler objects may or may not implement these properties and methods.

Public Member Functions

FX_BOOL | appearances (OBJ_PROP_PARAMS)
An array containing the language-dependent names of the available user-configured appearances for the specified security handler. Appearances are used to create the on-page visual representation of a signature when signing a signature field. The name of an appearance can be specified as a signature info object property when signing a signature field using the Field object signatureSign method. Foxit PDF Editor provides a standard signature appearance module that is used by Foxit signature plug-ins and that can also be used by third-party signature plug-ins. This standard signature appearance module is preconfigured with one appearance and can be configured by users to contain more appearances. The name of the one pre-configured appearance, called Standard Text in the user interface, is not returned by this property. If a security handler does not support selection of appearances, this property will return null. More...
FX_BOOL | digitalIDs (OBJ_PROP_PARAMS)
The certificates that are associated with the currently selected digital IDs for this security handler. More...
FX_BOOL | isLoggedIn (OBJ_PROP_PARAMS)
Returns true if currently logged into this SecurityHandler object. See the login method. Different security handlers will have their own rules for determining the value of this property. The Foxit.PPKLite handler will return true if a user is logged in to a profile file (also called credential file, implemented as a PKCS#12 file). Foxit.PPKMS will always return true. More...
FX_BOOL | loginName (OBJ_PROP_PARAMS)
The name associated with the actively selected signing digital ID for the security handler. This may require that the login method be called to select a signing credential. The return value is null if a signing credential is not selected or if the security handler does not support this property. More...
FX_BOOL | loginPath (OBJ_PROP_PARAMS)
The device-independent path to the user’s profile file used to log in to the security handler. The return value is null if no one is logged in, if the security handler does not support this property, or if this property is irrelevant for the currently logged in user. More...
FX_BOOL | name (OBJ_PROP_PARAMS)
The language-independent name of the security handler. Example values for the Default Certificate, Windows Certificate, and Entrust Security Handlers are Foxit.PPKLite, Foxit.PPKMS, and Entrust.PPKEF. All security handlers must support this property. More...
FX_BOOL | uiName (OBJ_PROP_PARAMS)
The language-dependent string for the security handler. This string is suitable for user interfaces. All security handlers must support this property. More...
FX_BOOL | signAuthor (OBJ_PROP_PARAMS)
Specifies whether the security handler is capable of generating certified documents. A certified document is signed with both a byte-range signature and an object signature. Object signatures, which are generated by traversing the document’s object tree, are used to detect and prevent modifications to a document. See the mdp property of the SignatureInfo object for details regarding modification detection and prevention (MDP) settings. More...
FX_BOOL | signInvisible (OBJ_PROP_PARAMS)
Specifies whether the security handler is capable of generating invisible signatures. More...
FX_BOOL | signValidate (OBJ_PROP_PARAMS)
Indicates whether the security handler is capable of validating signatures. More...
FX_BOOL | signVisible (OBJ_PROP_PARAMS)
Specifies whether the security handler is capable of generating visible signatures. More...
FX_BOOL | login (OBJ_METHOD_PARAMS)
Provides a mechanism by which digital IDs can be accessed and selected for a particular Security Handler. Through the user interface, a default digital ID can be selected that persists either eternally or for as long as the application is running. If such a selection has been made through the UI, it might not be necessary to log into a Security Handler prior to using the digital ID. Parameters tend to be specific to a particular handler. The behavior for Foxit.PPKLite and Foxit.PPKMS handlers is specified below. The parameters cPassword and cDIPath are provided for backward compatibility, or they can be included as properties of the oParams object. See also logout, newUser, and loginName. More...
FX_BOOL | logout (OBJ_METHOD_PARAMS)
Logs out for the SecurityHandler object. This method is used by Foxit.PPKLite, not by Foxit.PPKMS. Also see the login method. More...
FX_BOOL | newUser (OBJ_METHOD_PARAMS)
Supports enrollment with Foxit.PPKLite and Foxit.PPKMS security handlers by creating a new self-sign credential. Note:This method will not allow the user to overwrite an existing file. More...

Member Function Documentation

◆ appearances()

FX_BOOL SecurityHandler::appearances ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ digitalIDs()

FX_BOOL SecurityHandler::digitalIDs ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Object
Access
R
The return value is a generic object with the following properties:
Property | Type | Version | Description
oEndUserSignCert | Certificate object | 6.0 | The certificate that is associated with the currently selected digital IDs that is to be used by this SecurityHandler object when signing. The property is undefined if there is no current selection.
oEndUserCryptCert | Certificate object | 6.0 | The certificate that is associated with the currently selected digital IDs that is to be used when encrypting a document with this SecurityHandler object. The property is undefined if there is no current selection.
certs | Array of Certificate objects | 6.0 | An array of certificates corresponding to the list of all digital IDs that are available for this SecurityHandler object.
stores | Array of Strings | 6.0 | An array of strings, one for every Certificate object, identifying the store where the digital ID is stored. The string values are up to the security handler. For Adobe.PPKLite the valid values are ‘PKCS12’ and ‘MSCAPI’.
Availability:
Foxit PDF Editor/Foxit PDF Reader The return value is a generic object with the following properties: The Foxit.PPKLite security handler returns all currently available digital IDs present in Password-protected digital ID files (both PKCS#12 and APF) and, on Windows, IDs present in the Windows (MSCAPI) store. Both oEndUserSignCert and oEndUserCryptCert properties can be set using the user-interface. oEndUserSignCert can also be set using the login method. This means that oEndUserCryptCert will only be returned when using a Security Handler object that is obtained using the getHandler method with bUIEngine set to true.
Example
Export to a file the certificate that is associated with the currently selected digital IDs.
var sh = security.getHandler( "Foxit.PPKMS", true );
var ids = sh.digitalIDs;
var oCert = ids.oEndUserSignCert;
security.exportToFile( oCert, "/c/MySigningCert.cer" );

◆ isLoggedIn()

FX_BOOL SecurityHandler::isLoggedIn ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Generic script to illustrate isLoggedIn.
var ppklite = security.getHandler("Adobe.PPKLite", true);
console.println( "Is logged in = " + ppklite.isLoggedIn ); // False
ppklite.login( "dps017", "/C/signatures/DPSmith.pfx");
console.println( "Is logged in = " + ppklite.isLoggedIn ); // True

◆ loginName()

FX_BOOL SecurityHandler::loginName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ loginPath()

FX_BOOL SecurityHandler::loginPath ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ name()

FX_BOOL SecurityHandler::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ uiName()

FX_BOOL SecurityHandler::uiName ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ signAuthor()

FX_BOOL SecurityHandler::signAuthor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ signInvisible()

FX_BOOL SecurityHandler::signInvisible ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ signValidate()

FX_BOOL SecurityHandler::signValidate ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ signVisible()

FX_BOOL SecurityHandler::signVisible ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ login()

FX_BOOL SecurityHandler::login ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cPassword (optional) The password necessary to access the password-protected digital ID. This parameter is supported by Foxit.PPKLite for accessing digital ID files and PKCS#11 devices.
cDIPath (optional) A device-independent path to the password-protected digital ID file or a PKCS#11 library. This parameter is supported by Foxit.PPKLite.
oParams (optional) A LoginParameters object with parameters that are specific to a particular SecurityHandler object. The common fields in this object are described below. These fields include the cDIPath and cPassword values, thus allowing the parameter list to be expressed in different ways.
bUI (optional) Set to true if the user interface should be used to log the user in. If set to false, the default engine associated with the user interface is not used and the logged in state for the digital ID is not shown in the Security Settings dialog box. This attribute should be supported by all security handlers that support this method.
Returns
Returns true if the login succeeded, false otherwise.
Precondition
Document must be opened.
LoginParameters Object
This generic JavaScript object contains parameters for the login method. It has the following properties:
Property Type
Version
Description
cDIPath String
5.0
The path to a file that contains the digital ID or a PKCS#11 library. Supported by Foxit.PPKLite security handler.
cPassword String
6.0
A password that is used to authenticate the user. This password may be used to access a password-protected digital ID file or a PKCS#11 device. Supported by Foxit.PPKLite security handler. Note that Foxit PDF Editor does not guarantee that this password is obfuscated in memory.
cPFX String
7.0
(optional) A hex-encoded PFX to log in to. If this parameter is specified, it takes precedence over cDIPath.
Note:This parameter is only used internally. Currently, there is no way to retrieve a hex encoded PFX file through JavaScript.
oEndUserSignCert generic
object
6.0
Selects a digital ID for the purpose of performing end-user signing. The value of this property is a Certificate object (or a generic object with the same property names as a Certificate object), which defines the certificate that is being selected.
It may not be necessary to call this method for a particular handler. For example, if logged in to a PKCS#12 file containing one signing digital ID with Foxit.PPKLite, a signing credential does not need to be selected. All security handlers must be able to process the binary and SHA1Hash properties of this object. This object can be empty if bUI is true.
cMsg String
6.0
A message to display in the login dialog box, if bUI is true.
cURI String
7.0
URI used to connect to a server. Supported by Foxit.APS and Foxit.PPKLite handlers. In the case of Foxit.PPKLite, the URI specifies a Roaming Credential server.
cUserId String
7.0
User name used when connecting to a server. Supported by the Foxit.APS and Foxit.PPKLite handlers.
cDomain String
7.0
Domain name used when connecting to a server. Only supported by the Foxit.APS handler.
iSlotID Integer
7.0
Specifies the slot ID of a PKCS#11 device to log into. This parameter is supported by the Foxit.PPKLite handler only.
cTokenLabel String
7.0
Specifies the token label of a PKCS#11 device to log into. This parameter is supported by the Foxit.PPKLite handler only.
Example 1
Log in and log out.
// Use the "Foxit.PPKLite" security handler object for the UI
var ppklite = security.getHandler( security.PPKLiteHandler, true );
var oParams = { cPassword: "dps017", cDIPath: "/C/DPSmith.pfx" }
ppklite.login( oParams );
<..... make a signature field and sign it ......>
ppklite.logout();
Use UI to select a credential, when already logged in.
ppklite.login(
{ oParams:
{ oEndUserSignCert: {},
cMsg: "Select your Digital ID" },
bUI : true
} );
Log in and select the signing credentials
var oCert = { SHA1Hash: "00000000" };
ppklite.login(
{ oParams:
{ cDIPath: "/C/test/DPSmith.pfx",
cPassword: "dps017",
oEndUserSignCert: oCert,
cMsg: "Select your Digital ID"
},
bUI : true
});
Example 2
Use the "Adobe.PPKMS" security handler object, and select the credentials to use when signing.
var ppkms = security.getHandler( "Adobe.PPKMS" );
var oCert = myCerts[0];
ppkms.login( { oParams: { oEndUserSignCert: oCert } } );
Example 3
Use security.APSHandler, see security constants.
var aps = security.getHandler( security.APSHandler, true );
var oParams = { cUserName: "Foxit PDF Editor", cPassword: "Foxitdon" };
aps.login( oParams );
<..... encrypt a document using this handle and a policy id .....>
aps.logout();
See signatureSign for details on signing a PDF document.

◆ logout()

FX_BOOL SecurityHandler::logout ( OBJ_METHOD_PARAMS )
Returns
Returns true if the logout succeeded, false otherwise. Previous Foxit PDF Editor releases did not generate a return value.

◆ newUser()

FX_BOOL SecurityHandler::newUser ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cPassword (optional) The password necessary to access the password-protected digital ID file. This parameter is ignored by Foxit.PPKMS.
cDIPath (optional) The device-independent path to the password-protected digital ID file. This parameter is ignored by Foxit.PPKMS.
Note: the parameter cDIPath must be a safe path (see Safe path) and end with the extension .pfx.
oRDN The relative distinguished name (RDN) as an RDN object, containing the issuer or subject name for a certificate. The only required field is cn. If the country c is provided, it must be two characters, using the ISO 3166 standard (for example, “US”).
oCPS (optional) A generic object containing certificate policy information that will be embedded in the Certificate Policy extension of the certificate. The object has these properties:
oid is required and indicates the certificate policy object identifier.
url (optional) is a URL that points to detailed information about the policy under which the certificate has been issued
notice (optional) is an abridged version of the information, embedded in the certificate.
bUI (optional) If true, the user interface can be used to enroll. This parameter is supported by all security handlers that support this method.
cStore (optional) A string identifying the store where the generated credential has to be stored. For the Foxit.PPKLite security handler, the valid store identifiers are “PKCS12” and “MSCAPI”. If this parameter is omitted and cDIPath is provided, the generated credential is stored in a PKCS#12 file, else it is stored in the CAPI store.
Returns
true if successful, throws an exception if not successful.
Example 1
Create a new PPKLite self-sign credential
var ppklite = security.getHandler(security.PPKLiteHandler);
var oRDN = { cn: "Fred NewUser", c: "US" };
var oCPS = {oid: "1.2.3.4.5",
url: "http://www.example.com/mycps.html",
notice: "This is a self generated certificate, hence the "
+ "recipient must verify it’s authenticity through an out "
+ "of band mechanism" };
ppklite.newUser( "testtest", "/d/temp/FredNewUser.pfx", oRDN, oCPS);
// Alternate generic object syntax, allowing additional parameters
var oParams = {
cPassword : "myPassword",
cDIPath : "/d/temp/FredNewUser.pfx",
oRDN : oRDN,
oCPS : oCPS,
bUI : false
};
ppklite.newUser( oParams );
Example 2
Use a certificate from an existing signed field to create the RDN
var f = this.getField( "mySignature" );
f.signatureValidate();
var sigInfo = f.signatureInfo();
var certs = sigInfo.certificates;
var oSubjectDN = certs[0].subjectDN;
ppklite.newUser({
cPassword: "dps017",
cDIPath: "/c/temp/DPSmith.pfx",
oRDN: oSubjectDN
});


Javascript API: SignatureInfo Class Reference

List of all members
SignatureInfo Class Reference

A generic JavaScript object that contains the properties of a digital signature. Some properties are supported by all handlers, and additional properties can be supported. More...

Detailed Description

The SignatureInfo object is returned by the Field object methods signatureValidate and signatureInfo and is passed to the FDF object methods signatureSign and signatureValidate.

Writable properties can be specified when signing the object.*

SignatureInfo properties
Property | Type | Access | Description
date | Date object | R | The date and time that the signature was created, returned as a JavaScript Date object.
dateTrusted | Boolean | R | A Boolean value that indicates whether the date is from a trusted source. If this value is not present, the date should be assumed to be from an untrusted source (for example, the signer’s computer system time).
digestMethod | String | R/W | The digest method to be used for signing. the valid values are SHA1, SHA256, SHA384, SHA512 and RIPEMD160. It is important that the caller knows that a particular signature handler can support this digest method.
handlerName | String | R | The language-independent name of the security handler that was specified as the Filter attribute in the signature dictionary. It is usually the name of the security handler that created the signature, but can also be the name of the security handler that the creator wants to be used when validating the signature.
handlerUserName | String | R | The language-dependent name corresponding to the security handler specified by handlerName. It is available only when the named security handler is available.
handlerUIName | String | R | The language-dependent name corresponding to the security handler specified by handlerName. It is available only when the named security handler is available.
location | String | R/W | Optional user-specified location when signing. It can be a physical location (such as a city) or hostname.
mdp | String | R/W | he Modification Detection and Prevention (MDP) setting that was used to sign the field or FDF object being read, or the MDP setting to use when signing. Values are:\0 allowNone\0 allowAll\0 default\0 defaultAndComments\0 See Modification Detection and Prevention (MDP) Values for details. The value of allowAll, the default, means that MDP is not used for the signature, resulting in this not being an certification signature.
name | String | R | Name of the user that created the signature.
reason | String | R/W | The user-specified reason for signing.
sigValue | String | R | Raw bytes of the signature, as a hex encoded string.
status | Number | R | The validity status of the signature, computed during the last call to signatureValidate. See the return codes of the status property in the table status and idValidity properties.
statusText | String | R | The language-dependent text string, suitable for user display, denoting the signature validity status, computed during the last call to the signatureValidate.
subFilter | String | R/W | The format to use when signing. Consult the PDF Reference for a complete list of supported values.
timeStamp | String | W | The URL of the server for time-stamping the signature. The only schemes and transport protocols supported for fetching time stamps are http or https. This property is write-only. If the signature is time stamped, during verification the property dateTrusted will be set to true (provided the time stamp signature is trusted) and the verifyDate and the signing date will be the same.
verifyDate | Date object | R | The date and time that the signature was either signed or verified (if the signature was verified). If the signature is signed with a timestamp, verifyDate should be the signing date; if the signature is signed without a timestamp, verifyDate will be the verifying date. The property returns a JavaScript Date object.
verifyHandlerName | String | R | The language-independent name of the security handler that was used to validate this signature. This will be null if the signature has not been validated (that is, if the status property has a value of 1).
verifyHandlerUIName | String | R | The language-dependent name corresponding to the security handler specified by verifyHandlerName. This will be null if the signature has not been validated, that is, if the status property has a value of 1).
appearance | String | W | The name of the user-configured appearance to use when signing this field. PPKLite and PPKMS use the standard appearance handler. In this situation, the appearance names can be found in the signature appearance configuration dialog box of the Security user preferences. The default, when not specified, is to use the Standard Text appearance. Used only for visible signature fields.
certificates | Array | R | Array containing a hierarchy of certificates that identify the signer. The first element in the array is the signer’s certificate. Subsequent elements include the chain of certificates up to the certificate authority that issued the signer’s certificate. For self-signed certificates this array will contain only one entry.
byteRange | Array | R | An array of numbers indicating the bytes that are covered by this signature.
docValidity | Number | R | The validity status of the document byte range digest portion of the signature, computed during the last call to signatureValidate. All PDF document signature field signatures include a byte range digest.
idPrivValidity | Number | R | The validity of the identity of the signer. This value is specific to the handler. This value is 0 unless the signature has been validated, that is, if the status property has a value of 1.
idValidity | Number | R | The validity of the identity of the signer as number. See the return codes of the idValidity property in the table status and idValidity properties.
objValidity | Number | R | The validity status of the object digest portion of the signature, computed during the last call to signatureValidate. For PDF documents, signature field certification signatures and document-level application rights signatures include object digests. All FDF files are signed using object digests. See Validity Values for details of the return codes.
password | String | W | A password required as authentication when accessing a private key that is to be used for signing. This may or may not be required, dependent on the policies of the security handler.


Javascript API: Span Class Reference

Public Member Functions | List of all members
Span Class Reference

A generic object that represents a length of text and its associated properties in a rich text form field or annotation. A rich text value consists of an array of span objects representing the text and formatting.

Public Member Functions

FX_BOOL | alignment (OBJ_PROP_PARAMS)
The horizontal alignment of the text. Alignment for a line of text is determined by the first span on the line. The values of alignment are left center right The default value is left. More...
FX_BOOL | fontFamily (OBJ_PROP_PARAMS)
The font family used to draw the text. It is an array of family names to be searched for in order. The first entry in the array is the font name of the font to use. The second entry is an optional generic family name to use if an exact match of the first font is not found. The generic family names are symbol, serif, sans-serif, cursive, monospace, fantasy The default generic family name is sans-serif. More...
FX_BOOL | fontStretch (OBJ_PROP_PARAMS)
Specifies the normal, condensed or extended face from a font family to be used to draw the text. The values of fontStretch are ultra-condensed, extra-condensed, condensed, semi-condensed, normal, semi-expanded, expanded, extra-expanded, ultra-expanded The default value is normal. More...
FX_BOOL | fontWeight (OBJ_PROP_PARAMS)
The weight of the font used to draw the text. For the purposes of comparison, normal is anything under 700 and bold is greater than or equal to 700. The values of fontWeight are 100,200,300,400,500,600,700,800,900 The default value is 400. More...
FX_BOOL | fontStyle (OBJ_PROP_PARAMS)
Specifies the text is drawn with an italic or oblique font. italic normal The default is normal. More...
FX_BOOL | strikethrough (OBJ_PROP_PARAMS)
If strikethrough is true, the text is drawn with a strikethrough. The default is false. More...
FX_BOOL | subscript (OBJ_PROP_PARAMS)
Specifies the text is subscript. If true, subscript text is drawn with a reduced point size and a lowered baseline. The default is false. More...
FX_BOOL | superscript (OBJ_PROP_PARAMS)
Specifies the text is superscript. If true, superscript text is drawn with a reduced point size and a raised baseline. The default is false. More...
FX_BOOL | text (OBJ_PROP_PARAMS)
The text within the span. More...
FX_BOOL | textColor (OBJ_PROP_PARAMS)
A color array representing the RGB color to be used to draw the text (see the color object). The default color is black. More...
FX_BOOL | textSize (OBJ_PROP_PARAMS)
The point size of the text. The value of textSize can be any number between 0 and 32767, inclusive. A text size of zero means to use the largest point size that will allow all text data to fit in the field’s rectangle. The default text size is 12.0. More...
FX_BOOL | underline (OBJ_PROP_PARAMS)
If underline is true, the text is underlined. The default is false. More...

Member Function Documentation

◆ alignment()

FX_BOOL Span::alignment ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The example following superscript uses alignment.

◆ fontFamily()

FX_BOOL Span::fontFamily ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Set the defaultStyle font family for a rich text field.
f = this.getField("Text1");
style = f.defaultStyle;
// If Courier Std is not found on the user’s system, use a monospace font
style.fontFamily = ["Courier Std", "monospace" ];
f.defaultStyle = style;

◆ fontStretch()

FX_BOOL Span::fontStretch ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ fontWeight()

FX_BOOL Span::fontWeight ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ fontStyle()

FX_BOOL Span::fontStyle ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ strikethrough()

FX_BOOL Span::strikethrough ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ subscript()

FX_BOOL Span::subscript ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ superscript()

FX_BOOL Span::superscript ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
Write rich text to a rich text field using various properties. See the Field object
richValue property for more details and examples. var f = this.getField("myRichField");
// Create an array to hold the Span objects
var spans = new Array();
// Each Span object is an object, so we must create one
spans[0] = new Object();
spans[0].alignment = "center";
spans[0].text = "The answer is x";
spans[1] = new Object();
spans[1].text = "2/3";
spans[1].superscript = true;
spans[2] = new Object();
spans[2].superscript = false;
spans[2].text = ". ";
spans[3] = new Object();
spans[3].underline = true;
spans[3].text = "Did you get it right?";
spans[3].fontStyle = "italic";
spans[3].textColor = color.red;
// Now assign our array of Span objects to the field using // field.richValue
f.richValue = spans;

◆ text()

FX_BOOL Span::text ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The example following superscript uses text.

◆ textColor()

FX_BOOL Span::textColor ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Color Array
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The example following superscript uses textColor.

◆ textSize()

FX_BOOL Span::textSize ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Number
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The example following the Field object richValue property uses textSize.

◆ underline()

FX_BOOL Span::underline ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader
Example
The example following superscript uses underline.


Javascript API: Template Class Reference

Public Member Functions | List of all members
Template Class Reference

Template objects are named pages within the document. These pages may be hidden or visible and can be copied or spawned. They are typically used to dynamically create content (for example, to add pages to an invoice on overflow).

Public Member Functions

FX_BOOL | name (OBJ_PROP_PARAMS)
The name of the template that was supplied when the template was created. More...
FX_BOOL | hidden (OBJ_PROP_PARAMS)
Determines whether the template is hidden. Hidden templates cannot be seen by the user until they are spawned or are made visible. When an invisible template is made visible, it is appended to the document. More...
FX_BOOL | spawn (OBJ_METHOD_PARAMS)
Creates a new page in the document based on the template. More...

Member Function Documentation

◆ name()

FX_BOOL Template::name ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
String
Access
R
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ hidden()

FX_BOOL Template::hidden ( OBJ_PROP_PARAMS )
Precondition
Document must be opened.
Type
Boolean
Access
R/W
Availability:
Foxit PDF Editor/Foxit PDF Reader

◆ spawn()

FX_BOOL Template::spawn ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
nPage (optional) The 0-based index of the page number after which or on which the new page will be created, depending on the value of bOverlay. The default is 0.
bRename (optional) Specifies whether form fields on the page should be renamed. The default is true.
bOverlay (optional) If true (the default), the template is overlaid on the specified page. If false, it is inserted as a new page before the specified page.
To append a page to the document, set bOverlay to false and set nPage to the number of pages in the document.
Note:For certified documents or documents with “Advanced Form Features rights”), the bOverlay parameter is disabled. A template cannot be overlaid for these types of documents.
oXObject (optional) The value of this parameter is the return value of an earlier call to spawn.
Returns
this method returned nothing. Now, spawn returns an object representing the page contents of the page spawned. This return object can then be used as the value of the optional parameter oXObject for subsequent calls to spawn. Note:Repeatedly spawning the same page can cause a large increase in the file size. To avoid this problem, spawn now returns an object that represents the page contents of the spawned page. This return value can be used as the value of the oXObject parameter in subsequent calls to the spawn method to spawn the same page.
Example 1
Spawn all templates and appends them one by one to the end of the document.
var a = this.templates;
for (i = 0; i < a.length; i++)
a[i].spawn(this.numPages, false, false);
Example 2
Spawn the same template 31 times using the oXObject parameter and return value. Using this technique avoids overly inflating the file size.
var t = this.templates;
var T = t[0];
var XO = T.spawn(this.numPages, false, false);
for (var i=0; i<30; i++) T.spawn(this.numPages, false, false, XO);


Javascript API: util Class Reference

Public Member Functions | List of all members
util Class Reference

A static JavaScript object that defines a number of utility methods and convenience functions for string and date formatting and parsing.

Public Member Functions

FX_BOOL | printd (OBJ_METHOD_PARAMS)
Returns a date using a specified format. More...
FX_BOOL | printf (OBJ_METHOD_PARAMS)
Formats one or more arguments as a string according to a format string. It is similar to the C function of the same name. This method converts and formats incoming arguments into a result string according to a format string (cFormat). The format string consists of two types of objects: Each conversion specification is constructed as follows: %[,nDecSep][cFlags][nWidth][.nPrecision]cConvChar The following table describes the components of a conversion specification. More...
FX_BOOL | printx (OBJ_METHOD_PARAMS)
Formats a source string, cSource, according to a formatting string, cFormat. A valid format for cFormat is any string that may contain special masking characters: More...
FX_BOOL | scand (OBJ_METHOD_PARAMS)
Converts a date into a JavaScript Date object according to the rules of a format string. This routine is much more flexible than using the date constructor directly. Note:Given a two-digit year for input, scand uses the date horizon heuristic to resolve the ambiguity. If the year is less than 50, it is assumed to be in the 21st century (that is, add 2000). If it is greater than or equal to 50, it is in the 20th century (add 1900). The supplied date cDate should be in the same format as described by cFormat. More...
FX_BOOL | iconStreamFromIcon (OBJ_METHOD_PARAMS)
Converts an XObject-based Icon object into an Icon Stream object. More...

Member Function Documentation

◆ printd()

FX_BOOL util::printd ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cFormat The date and time format. It can be one of the following types:
A string that is a pattern of supported substrings that are place-holders for date and time data. Recognized date and time strings are shown in the table below.
a number specifying the format. Supported values (along with examples of each format) are:
0 — PDF date format. Example: D:20000801145605+07'00'
1 — Universal. Example: D:20000801145605+07'00'
2 — Localized string. Example: 2000/08/01 14:56:05
if bXFAPicture is true, this parameter is interpreted using the XFA Picture Clause format.
oDate A Date object to format. Date objects can be obtained from the Date constructor of core JavaScript or from the util.scand method.
bXFAPicture (optional) A Boolean value specifying whether the value of cFormat is interpreted using the XFA Picture Clause format, which gives extensive support for localized times and dates. See the sections on date and time pictures in XFA Specification, Version 2.2, for additional discussion. This specification is available through the Foxit PDF Editor Developer Center.
The default is false.
Returns
The formatted date string.
cFormat String Patterns
String Effect
Example
mmmm Long month
September
mmm Abbreviated month
Sep
mm Numeric month with leading zero
09
m Numeric month without leading zero
9
dddd Long day
Wednesday
ddd Abbreviated day
Wed
dd Numeric date with leading zero
03
d Numeric date without leading zero
3
yyyy Long year
1997
yy Abbreviated Year
97
HH 24 hour time with leading zero
09
H 24 hour time without leading zero
9
hh 12 hour time with leading zero
09
h 12 hour time without leading zero
9
MM minutes with leading zero
08
M minutes without leading zero
8
ss seconds with leading zero
05
s seconds without leading zero
5
tt am/pm indication
am
t single digit am/pm indication
a
j Japanese Emperor Year (abbreviated)
Note: this format string has been deprecated in favor of the XFA Picture Clause format.

jj Japanese Emperor Year
Note:this format string has been deprecated in favor of the XFA Picture Clause format.

\ use as an escape character

Example 1
Format the current date in long format:
var d = new Date();
console.println("Today is " + util.printd("mmmm dd, yyyy", d));
Example 2
Display the date in a local format
console.println(util.printd(2, new Date() ));
Example 3
Use the XFA-Picture Clause to write the current date to the console.
// Execute in console
console.println(
util.printd("EEE, 'the' D 'of' MMMM, YYYY", new Date(), true));
// The output on this day is
Tue, the 13 of July, 2004
Locale-Sensitive Picture Clauses. Normally processing of picture clauses occurs in the ambient locale. It is possible, however, to indicate that picture processing be done in a specific locale. This is of use when formatting or parsing data that is locale-specific and different from the ambient locale. The syntax for this extension to compound picture clauses is:
category-name(locale-name){picture-symbols}
The code executed in the console,
util.printd("date(fr){DD MMMM, YYYY}", new Date(), true)
yields the output on this day,
13 juillet, 2004
The XFA-Picture Clause gives extensive support for Chinese, Chinese (Taiwan), Japanese, and Korean (CCJK) times and dates. The example below, a custom format script of a text field, gives the current date formatted for a Japanese locale.
event.value = util.printd("date(ja){ggYY/M/D}", new Date(), true)

◆ printf()

FX_BOOL util::printf ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cFormat The format string to use.
arguments The optional arguments(s) that contain the data to be inserted in place of the tags specified in the first parameter, the format string. The number of optional arguments must be the same as the number of % tags.
Note:The util.printf function does not accept an object literal with properties that contain the arguments. Arguments are entered in the usual comma-delimited list.
Returns
A result string formatted as specified.
Example
Take an irrational number and display it using various formats of util.printf.
var n = Math.PI * 100;
console.clear();
console.show();
console.println(util.printf("Decimal format: %d", n));
console.println(util.printf("Hex format: %x", n));
console.println(util.printf("Float format: %.2f", n));
console.println(util.printf("String format: %s", n));
The output of the above script is as follows:
Decimal format: 314
Hex format: 13A
Float format: 314.16
String format: 314.159265358979

◆ printx()

FX_BOOL util::printx ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cFormat The formatting string to use.
cSource The source string to use.
Returns
The formatted string.
Example
Format a string as a U.S. telephone number.
var v = "aaa14159697489zzz";
v = util.printx("9 (999) 999-9999", v);
console.println(v);

◆ scand()

FX_BOOL util::scand ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
cFormat The rules to use for formatting the date. cFormat uses the same syntax as found in printd.
cDate The date to convert.
Returns
The converted Date object, or null if the conversion fails.
Example 1
* Turn the current date into a string. *
var cDate = util.printd("mm/dd/yyyy", new Date());
console.println("Today’s date: " + cDate);
* Parse it back into a date. *
var d = util.scand("mm/dd/yyyy", cDate);
* Output it in reverse order. *
console.println("Yet again: " + util.printd("yyyy mmm dd", d));
Example 2
Retrieve a text field value, see if it is a date of the acceptable format, then report results in an alert box or the console window.
The method returns null if the conversions fails, which can occur if the user inputs a data different than what is expected. In this case, test the return value for null.
var d= util.scand("mm/dd/yyyy", this.getField("myDate").value);
if ( d== null )
app.alert("Please enter a valid date of the form" +
" \"mm/dd/yyyy\".")
else {
console.println("You entered the date: "
+ util.printd("mmmm dd, yyyy",d));
}

◆ iconStreamFromIcon()

FX_BOOL util::iconStreamFromIcon ( OBJ_METHOD_PARAMS )
Precondition
Document must be opened.
Parameters
parameter instruction
oIcon An Icon object to be converted into an Icon Stream object.
Returns
Icon Stream object This method allows an icon obtained from the Doc importIcon or getIcon methods to be used in a method such as app.addToolButton, which would otherwise accept only an Icon Stream object as an input parameter.
Example
Import an icon into the document-level named icons tree and add a toolbutton to the application.
this.importIcon("myIcon", "/C/temp/myIcon.jpg", 0);
var oIcon = util.iconStreamFromIcon(this.getIcon("myIcon"));
app.addToolButton({
cName: "myButton",
oIcon: oIcon,
cExec: "console.println('My Button!');",
cTooltext: "My button!",
nPos: 0
});


Javascript API: Class Index

Class Index
a | b | c | d | e | f | g | h | i | l | m | o | p | r | s | t | u
a
console
h
o
search
d
security
Annot3D HostContainer OCG SecurityHandler
Annotation Data
i
p
SignatureInfo
app Doc Span
app_media doc_media Icon PrintParams
t
attachment
e
identity
r
b
Index Template
event
l
RDN
u
Bookmark
f
ReadStream
c
Link Rendition util
Field
m
s
Certificate FullScreen
color
g
MediaPlayer ScreenAnnot
global
a | b | c | d | e | f | g | h | i | l | m | o | p | r | s | t | u


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- a -

  • activated() : Annot3D
  • activeDocs() : app
  • addAnnot() : Doc
  • addField() : Doc
  • addIcon() : Doc
  • addIndex() : search
  • addLink() : Doc
  • addMenuItem() : app
  • addWatermarkFromFile() : Doc
  • addWatermarkFromText() : Doc
  • addWeblinks() : Doc
  • alert() : app
  • align() : app_media
  • alignment() : Annotation , Field , Span
  • altText() : Rendition
  • AnnotCanBeFetched() : Doc
  • AP() : Annotation
  • appearances() : SecurityHandler
  • arrowBegin() : Annotation
  • arrowEnd() : Annotation
  • attachIcon() : Annotation
  • attachments() : search
  • author() : Annotation , Doc
  • available() : Index


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- b -

  • backgroundColor() : FullScreen
  • baseURL() : Doc
  • beep() : app
  • binary() : Certificate
  • binaryOK() : PrintParams
  • bitmapDPI() : PrintParams
  • booklet() : PrintParams
  • bookmarkRoot() : Doc
  • bookmarks() : search
  • borderColor() : Link
  • borderEffectIntensity() : Annotation
  • borderEffectStyle() : Annotation
  • borderStyle() : Field
  • borderWidth() : Link
  • browseForDoc() : app
  • browseForFileToSubmit() : Field
  • buttonFitBounds() : Field
  • buttonGetCaption() : Field
  • buttonGetIcon() : Field
  • buttonPosition() : Field
  • buttonScaleHow() : Field
  • buttonScaleWhen() : Field
  • buttonSetCaption() : Field
  • buttonSetIcon() : Field


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- c -

  • calcOrderIndex() : Field
  • calculate() : app , Doc
  • calculateNow() : Doc
  • callout() : Annotation
  • canResize() : app_media
  • caretSymbol() : Annotation
  • change() : event
  • changeEx() : event
  • charLimit() : Field
  • checkThisBox() : Field
  • children() : Bookmark
  • clear() : console
  • clearInterval() : app
  • clearItems() : Field
  • clearTimeOut() : app
  • close() : MediaPlayer
  • closeDoc() : Doc
  • closeReason() : app_media
  • comb() : Field
  • commitKey() : event
  • commitOnSelChange() : Field
  • constants() : app , PrintParams
  • contents() : Annotation
  • contentStream() : attachment
  • convert() : color
  • corporation() : identity
  • createChild() : Bookmark
  • createPlayer() : app_media
  • createTemplate() : Doc
  • creationDate() : Annotation , attachment , Data , Doc
  • creator() : Doc
  • currentValueIndices() : Field
  • cursor() : FullScreen


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- d -

  • dash() : Annotation
  • dataObjects() : Doc
  • defaultIsChecked() : Field
  • defaultStyle() : Field
  • defaultTransition() : FullScreen
  • defaultValue() : Field
  • delay() : Annotation , Doc , Field
  • deleteItemAt() : Field
  • deletePages() : Doc
  • description() : Data
  • destroy() : Annotation
  • digitalIDs() : SecurityHandler
  • dirty() : Doc
  • display() : Field
  • doc() : Annotation , Bookmark , Field
  • doCaption() : Annotation
  • docText() : search
  • documentFileName() : Doc
  • doNotScroll() : Field
  • doNotSpellCheck() : Field
  • DuplexType() : PrintParams
  • dynamicXFAForm() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- e -

  • editable() : Field
  • email() : identity
  • equal() : color
  • execDialog() : app
  • execMenuItem() : app
  • exportAsFDF() : Doc
  • exportAsText() : Doc
  • exportAsXFDF() : Doc
  • exportAsXFDFStr() : Doc
  • exportDataObject() : Doc
  • exportValues() : Field
  • external() : Doc
  • extractPages() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- f -

  • fieldFull() : event
  • fileName() : PrintParams
  • fileSelect() : Field
  • filesize() : Doc
  • fillColor() : Annotation , Field
  • firstPage() : PrintParams
  • flags() : PrintParams
  • flattenPages() : Doc
  • fontFamily() : Span
  • fontStretch() : Span
  • fontStyle() : Span
  • fontWeight() : Span
  • formsVersion() : app
  • fs() : app
  • fullscreen() : app


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- g -

  • gestures() : Annotation
  • getAnnot() : Doc , doc_media
  • getAnnots() : Doc
  • getArray() : Field
  • getDataObject() : Doc
  • getField() : Doc
  • getHandler() : security
  • getIcon() : Doc
  • getItemAt() : Field
  • getLinks() : Doc
  • getLock() : Field
  • getNthFieldName() : Doc
  • getOCGOrder() : Doc
  • getOCGs() : Doc
  • getOpenPlayers() : doc_media
  • getPageBox() : Doc
  • getPageNthWord() : Doc
  • getPageNthWordQuads() : Doc
  • getPageNumWords() : Doc
  • getPageRotation() : Doc
  • getPageTransition() : Doc
  • getPlayers() : app_media
  • getPrintParams() : Doc
  • getRendition() : doc_media
  • getTemplate() : Doc
  • getURL() : Doc
  • getURLData() : app_media
  • gotoNamedDest() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- h -

  • handlers() : security
  • hidden() : Annotation , Field , Template
  • hide() : console
  • highlight() : Field
  • highlightMode() : Link
  • hostContainer() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- i -

  • icons() : Doc
  • iconStreamFromIcon() : util
  • ifOffScreen() : app_media
  • ignoreAccents() : search
  • ignoreAsianCharacterWidth() : search
  • importAnFDF() : Doc
  • importAnXFDF() : Doc
  • importDataObject() : Doc
  • importFromFile() : security
  • importTextData() : Doc
  • info() : Doc
  • initState() : OCG
  • innerRect() : Annot3D
  • inReplyTo() : Annotation
  • insertChild() : Bookmark
  • insertItemAt() : Field
  • insertPages() : Doc
  • intent() : Annotation
  • interactive() : PrintParams
  • isBoxChecked() : Field
  • isDefaultChecked() : Field
  • isFullScreen() : FullScreen
  • isLoggedIn() : SecurityHandler
  • isOpen() : MediaPlayer
  • issuerDN() : Certificate


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- k -

  • keyDown() : event
  • keyUsage() : Certificate
  • keywords() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- l -

  • language() : app
  • lastPage() : PrintParams
  • launchURL() : app
  • layout() : Doc
  • leaderExtend() : Annotation
  • leaderLength() : Annotation
  • lineEnding() : Annotation
  • lineWidth() : Field
  • listMenuItems() : app
  • lock() : Annotation
  • locked() : OCG
  • login() : SecurityHandler
  • loginName() : identity , SecurityHandler
  • loginPath() : SecurityHandler
  • logout() : SecurityHandler
  • loop() : FullScreen


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- m -

  • mailDoc() : Doc
  • mailForm() : Doc
  • mailMsg() : app
  • markup() : search
  • matchCase() : search
  • matchWholeWord() : search
  • maxDocs() : search
  • MD5Hash() : Certificate
  • media() : app , Doc
  • messageHandler() : HostContainer
  • MIMEType() : attachment , Data
  • modDate() : Annotation , attachment , Data , Doc
  • modifier() : event
  • mouseX() : Doc
  • mouseY() : Doc
  • movePage() : Doc
  • multiline() : Field
  • multipleSelection() : Field


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- n -

  • name() : Annot3D , Annotation , attachment , Bookmark , Data , event , Field , identity , Index , OCG , SecurityHandler , Template
  • newDoc() : app
  • newFDF() : app
  • newPage() : Doc
  • newUser() : SecurityHandler
  • noteIcon() : Annotation
  • noView() : Annotation
  • NumCopies() : PrintParams
  • numFields() : Doc
  • numItems() : Field
  • numPages() : Doc
  • nUpAutoRotate() : PrintParams
  • nUpNumPagesH() : PrintParams
  • nUpNumPagesV() : PrintParams
  • nUpPageBorder() : PrintParams
  • nUpPageOrders() : PrintParams


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- o -

  • opacity() : Annotation
  • open() : Bookmark , MediaPlayer
  • openDoc() : app
  • openPlayer() : app_media
  • over() : app_media


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- p -

  • page() : Annot3D , Annotation , Doc , Field , ScreenAnnot
  • pageHandling() : PrintParams
  • pageNum() : Doc
  • pageSubset() : PrintParams
  • pageWindowRect() : Doc
  • parent() : Bookmark
  • password() : Field
  • path() : attachment , Data , Doc , Index
  • platform() : app
  • play() : MediaPlayer
  • point() : Annotation
  • points() : Annotation
  • popUpMenu() : app
  • popUpMenuEx() : app
  • popupOpen() : Annotation
  • popupRect() : Annotation
  • postMessage() : HostContainer
  • print() : Annotation , Doc , Field
  • printAsImage() : PrintParams
  • printContent() : PrintParams
  • printd() : util
  • printerName() : PrintParams
  • printerNames() : app
  • printf() : util
  • println() : console
  • printRange() : PrintParams
  • printx() : util
  • privateKeyValidityEnd() : Certificate
  • privateKeyValidityStart() : Certificate
  • producer() : Doc
  • proximity() : search


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- q -

  • quads() : Annotation
  • query() : search


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- r -

  • radiosInUnison() : Field
  • rc() : event
  • readOnly() : Annotation
  • readonly() : Field
  • rect() : Annotation , Field , Link , ScreenAnnot
  • refType() : Annotation
  • remove() : Bookmark
  • removeDataObject() : Doc
  • removeField() : Doc
  • removeIcon() : Doc
  • removeIndex() : search
  • removeLinks() : Doc
  • removeTemplate() : Doc
  • removeWeblinks() : Doc
  • replacePages() : Doc
  • required() : Field
  • resetForm() : Doc
  • response() : app
  • reversePages() : PrintParams
  • richChange() : event
  • richChangeEx() : event
  • richText() : Field
  • richValue() : event , Field
  • rotation() : Field
  • runtimeHighlight() : app
  • runtimeHighlightColor() : app


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- s -

  • scand() : util
  • scroll() : Doc
  • securityHandler() : Doc
  • seek() : MediaPlayer
  • selected() : Index
  • selEnd() : event
  • selStart() : event
  • serialNumber() : Certificate
  • setAction() : Bookmark , Field , Link , OCG
  • setFocus() : Field
  • setInterval() : app
  • setItems() : Field
  • setLock() : Field
  • setOCGOrder() : Doc
  • setPageBoxes() : Doc
  • setPageRotations() : Doc
  • setPageTabOrder() : Doc
  • setPageTransitions() : Doc
  • setPersistent() : global
  • setTimeOut() : app
  • settings() : MediaPlayer
  • SHA1Hash() : Certificate
  • shift() : event
  • show() : console
  • signatureGetModifications() : Field
  • signatureGetSeedValue() : Field
  • signatureInfo() : Field
  • signatureSetSeedValue() : Field
  • signatureSign() : Field
  • signatureValidate() : Field
  • signAuthor() : SecurityHandler
  • signInvisible() : SecurityHandler
  • signValidate() : SecurityHandler
  • signVisible() : SecurityHandler
  • size() : attachment , Data
  • soundIcon() : Annotation
  • source() : event
  • spawn() : Template
  • spawnPageFromTemplate() : Doc
  • state() : OCG
  • stem() : search
  • stop() : MediaPlayer
  • strikethrough() : Span
  • strokeColor() : Annotation , Field
  • style() : Annotation , Field
  • subject() : Annotation , Doc
  • subjectCN() : Certificate
  • subjectDN() : Certificate
  • submitForm() : Doc
  • submitName() : Field
  • subscript() : Span
  • superscript() : Span
  • syncAnnotScan() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- t -

  • target() : event
  • targetName() : event
  • templates() : Doc
  • text() : Span
  • textColor() : Field , Span
  • textFont() : Annotation , Field
  • textSize() : Annotation , Field , Span
  • thermometer() : app
  • tileLabel() : PrintParams
  • tileMark() : PrintParams
  • tileOverlap() : PrintParams
  • tileScale() : PrintParams
  • timeDelay() : FullScreen
  • title() : Doc
  • toggleNoView() : Annotation
  • transitions() : FullScreen
  • type() : Annotation , event , Field


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- u -

  • uiName() : Rendition , SecurityHandler
  • underline() : Span
  • URL() : Doc
  • usePageTiming() : FullScreen
  • userName() : Field
  • useTimer() : FullScreen


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- v -

  • validityEnd() : Certificate
  • validityStart() : Certificate
  • value() : event , Field
  • valueAsString() : Field
  • vertices() : Annotation
  • viewerType() : app
  • viewerVariation() : app
  • viewerVersion() : app
  • visible() : MediaPlayer


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- w -

  • width() : Annotation
  • willCommit() : event
  • windowType() : app_media
  • wordMatching() : search


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- x -

  • xfa() : Doc


Javascript API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- z -

  • zoom() : Doc
  • zoomType() : Doc


Javascript API: Class Members - Functions

- a -

  • activated() : Annot3D
  • activeDocs() : app
  • addAnnot() : Doc
  • addField() : Doc
  • addIcon() : Doc
  • addIndex() : search
  • addLink() : Doc
  • addMenuItem() : app
  • addWatermarkFromFile() : Doc
  • addWatermarkFromText() : Doc
  • addWeblinks() : Doc
  • alert() : app
  • align() : app_media
  • alignment() : Annotation , Field , Span
  • altText() : Rendition
  • AnnotCanBeFetched() : Doc
  • AP() : Annotation
  • appearances() : SecurityHandler
  • arrowBegin() : Annotation
  • arrowEnd() : Annotation
  • attachIcon() : Annotation
  • attachments() : search
  • author() : Annotation , Doc
  • available() : Index


Javascript API: Class Members - Functions

- b -

  • backgroundColor() : FullScreen
  • baseURL() : Doc
  • beep() : app
  • binary() : Certificate
  • binaryOK() : PrintParams
  • bitmapDPI() : PrintParams
  • booklet() : PrintParams
  • bookmarkRoot() : Doc
  • bookmarks() : search
  • borderColor() : Link
  • borderEffectIntensity() : Annotation
  • borderEffectStyle() : Annotation
  • borderStyle() : Field
  • borderWidth() : Link
  • browseForDoc() : app
  • browseForFileToSubmit() : Field
  • buttonFitBounds() : Field
  • buttonGetCaption() : Field
  • buttonGetIcon() : Field
  • buttonPosition() : Field
  • buttonScaleHow() : Field
  • buttonScaleWhen() : Field
  • buttonSetCaption() : Field
  • buttonSetIcon() : Field


Javascript API: Class Members - Functions

- c -

  • calcOrderIndex() : Field
  • calculate() : app , Doc
  • calculateNow() : Doc
  • callout() : Annotation
  • canResize() : app_media
  • caretSymbol() : Annotation
  • change() : event
  • changeEx() : event
  • charLimit() : Field
  • checkThisBox() : Field
  • children() : Bookmark
  • clear() : console
  • clearInterval() : app
  • clearItems() : Field
  • clearTimeOut() : app
  • close() : MediaPlayer
  • closeDoc() : Doc
  • closeReason() : app_media
  • comb() : Field
  • commitKey() : event
  • commitOnSelChange() : Field
  • constants() : app , PrintParams
  • contents() : Annotation
  • contentStream() : attachment
  • convert() : color
  • corporation() : identity
  • createChild() : Bookmark
  • createPlayer() : app_media
  • createTemplate() : Doc
  • creationDate() : Annotation , attachment , Data , Doc
  • creator() : Doc
  • currentValueIndices() : Field
  • cursor() : FullScreen


Javascript API: Class Members - Functions

- d -

  • dash() : Annotation
  • dataObjects() : Doc
  • defaultIsChecked() : Field
  • defaultStyle() : Field
  • defaultTransition() : FullScreen
  • defaultValue() : Field
  • delay() : Annotation , Doc , Field
  • deleteItemAt() : Field
  • deletePages() : Doc
  • description() : Data
  • destroy() : Annotation
  • digitalIDs() : SecurityHandler
  • dirty() : Doc
  • display() : Field
  • doc() : Annotation , Bookmark , Field
  • doCaption() : Annotation
  • docText() : search
  • documentFileName() : Doc
  • doNotScroll() : Field
  • doNotSpellCheck() : Field
  • DuplexType() : PrintParams
  • dynamicXFAForm() : Doc


Javascript API: Class Members - Functions

- e -

  • editable() : Field
  • email() : identity
  • equal() : color
  • execDialog() : app
  • execMenuItem() : app
  • exportAsFDF() : Doc
  • exportAsText() : Doc
  • exportAsXFDF() : Doc
  • exportAsXFDFStr() : Doc
  • exportDataObject() : Doc
  • exportValues() : Field
  • external() : Doc
  • extractPages() : Doc


Javascript API: Class Members - Functions

- f -

  • fieldFull() : event
  • fileName() : PrintParams
  • fileSelect() : Field
  • filesize() : Doc
  • fillColor() : Annotation , Field
  • firstPage() : PrintParams
  • flags() : PrintParams
  • flattenPages() : Doc
  • fontFamily() : Span
  • fontStretch() : Span
  • fontStyle() : Span
  • fontWeight() : Span
  • formsVersion() : app
  • fs() : app
  • fullscreen() : app


Javascript API: Class Members - Functions

- g -

  • gestures() : Annotation
  • getAnnot() : Doc , doc_media
  • getAnnots() : Doc
  • getArray() : Field
  • getDataObject() : Doc
  • getField() : Doc
  • getHandler() : security
  • getIcon() : Doc
  • getItemAt() : Field
  • getLinks() : Doc
  • getLock() : Field
  • getNthFieldName() : Doc
  • getOCGOrder() : Doc
  • getOCGs() : Doc
  • getOpenPlayers() : doc_media
  • getPageBox() : Doc
  • getPageNthWord() : Doc
  • getPageNthWordQuads() : Doc
  • getPageNumWords() : Doc
  • getPageRotation() : Doc
  • getPageTransition() : Doc
  • getPlayers() : app_media
  • getPrintParams() : Doc
  • getRendition() : doc_media
  • getTemplate() : Doc
  • getURL() : Doc
  • getURLData() : app_media
  • gotoNamedDest() : Doc


Javascript API: Class Members - Functions

- h -

  • handlers() : security
  • hidden() : Annotation , Field , Template
  • hide() : console
  • highlight() : Field
  • highlightMode() : Link
  • hostContainer() : Doc


Javascript API: Class Members - Functions

- i -

  • icons() : Doc
  • iconStreamFromIcon() : util
  • ifOffScreen() : app_media
  • ignoreAccents() : search
  • ignoreAsianCharacterWidth() : search
  • importAnFDF() : Doc
  • importAnXFDF() : Doc
  • importDataObject() : Doc
  • importFromFile() : security
  • importTextData() : Doc
  • info() : Doc
  • initState() : OCG
  • innerRect() : Annot3D
  • inReplyTo() : Annotation
  • insertChild() : Bookmark
  • insertItemAt() : Field
  • insertPages() : Doc
  • intent() : Annotation
  • interactive() : PrintParams
  • isBoxChecked() : Field
  • isDefaultChecked() : Field
  • isFullScreen() : FullScreen
  • isLoggedIn() : SecurityHandler
  • isOpen() : MediaPlayer
  • issuerDN() : Certificate


Javascript API: Class Members - Functions

- k -

  • keyDown() : event
  • keyUsage() : Certificate
  • keywords() : Doc


Javascript API: Class Members - Functions

- l -

  • language() : app
  • lastPage() : PrintParams
  • launchURL() : app
  • layout() : Doc
  • leaderExtend() : Annotation
  • leaderLength() : Annotation
  • lineEnding() : Annotation
  • lineWidth() : Field
  • listMenuItems() : app
  • lock() : Annotation
  • locked() : OCG
  • login() : SecurityHandler
  • loginName() : identity , SecurityHandler
  • loginPath() : SecurityHandler
  • logout() : SecurityHandler
  • loop() : FullScreen


Javascript API: Class Members - Functions

- m -

  • mailDoc() : Doc
  • mailForm() : Doc
  • mailMsg() : app
  • markup() : search
  • matchCase() : search
  • matchWholeWord() : search
  • maxDocs() : search
  • MD5Hash() : Certificate
  • media() : app , Doc
  • messageHandler() : HostContainer
  • MIMEType() : attachment , Data
  • modDate() : Annotation , attachment , Data , Doc
  • modifier() : event
  • mouseX() : Doc
  • mouseY() : Doc
  • movePage() : Doc
  • multiline() : Field
  • multipleSelection() : Field


Javascript API: Class Members - Functions

- n -

  • name() : Annot3D , Annotation , attachment , Bookmark , Data , event , Field , identity , Index , OCG , SecurityHandler , Template
  • newDoc() : app
  • newFDF() : app
  • newPage() : Doc
  • newUser() : SecurityHandler
  • noteIcon() : Annotation
  • noView() : Annotation
  • NumCopies() : PrintParams
  • numFields() : Doc
  • numItems() : Field
  • numPages() : Doc
  • nUpAutoRotate() : PrintParams
  • nUpNumPagesH() : PrintParams
  • nUpNumPagesV() : PrintParams
  • nUpPageBorder() : PrintParams
  • nUpPageOrders() : PrintParams


Javascript API: Class Members - Functions

- o -

  • opacity() : Annotation
  • open() : Bookmark , MediaPlayer
  • openDoc() : app
  • openPlayer() : app_media
  • over() : app_media


Javascript API: Class Members - Functions

- p -

  • page() : Annot3D , Annotation , Doc , Field , ScreenAnnot
  • pageHandling() : PrintParams
  • pageNum() : Doc
  • pageSubset() : PrintParams
  • pageWindowRect() : Doc
  • parent() : Bookmark
  • password() : Field
  • path() : attachment , Data , Doc , Index
  • platform() : app
  • play() : MediaPlayer
  • point() : Annotation
  • points() : Annotation
  • popUpMenu() : app
  • popUpMenuEx() : app
  • popupOpen() : Annotation
  • popupRect() : Annotation
  • postMessage() : HostContainer
  • print() : Annotation , Doc , Field
  • printAsImage() : PrintParams
  • printContent() : PrintParams
  • printd() : util
  • printerName() : PrintParams
  • printerNames() : app
  • printf() : util
  • println() : console
  • printRange() : PrintParams
  • printx() : util
  • privateKeyValidityEnd() : Certificate
  • privateKeyValidityStart() : Certificate
  • producer() : Doc
  • proximity() : search


Javascript API: Class Members - Functions

- q -

  • quads() : Annotation
  • query() : search


Javascript API: Class Members - Functions

- r -

  • radiosInUnison() : Field
  • rc() : event
  • readOnly() : Annotation
  • readonly() : Field
  • rect() : Annotation , Field , Link , ScreenAnnot
  • refType() : Annotation
  • remove() : Bookmark
  • removeDataObject() : Doc
  • removeField() : Doc
  • removeIcon() : Doc
  • removeIndex() : search
  • removeLinks() : Doc
  • removeTemplate() : Doc
  • removeWeblinks() : Doc
  • replacePages() : Doc
  • required() : Field
  • resetForm() : Doc
  • response() : app
  • reversePages() : PrintParams
  • richChange() : event
  • richChangeEx() : event
  • richText() : Field
  • richValue() : event , Field
  • rotation() : Field
  • runtimeHighlight() : app
  • runtimeHighlightColor() : app


Javascript API: Class Members - Functions

- s -

  • scand() : util
  • scroll() : Doc
  • securityHandler() : Doc
  • seek() : MediaPlayer
  • selected() : Index
  • selEnd() : event
  • selStart() : event
  • serialNumber() : Certificate
  • setAction() : Bookmark , Field , Link , OCG
  • setFocus() : Field
  • setInterval() : app
  • setItems() : Field
  • setLock() : Field
  • setOCGOrder() : Doc
  • setPageBoxes() : Doc
  • setPageRotations() : Doc
  • setPageTabOrder() : Doc
  • setPageTransitions() : Doc
  • setPersistent() : global
  • setTimeOut() : app
  • settings() : MediaPlayer
  • SHA1Hash() : Certificate
  • shift() : event
  • show() : console
  • signatureGetModifications() : Field
  • signatureGetSeedValue() : Field
  • signatureInfo() : Field
  • signatureSetSeedValue() : Field
  • signatureSign() : Field
  • signatureValidate() : Field
  • signAuthor() : SecurityHandler
  • signInvisible() : SecurityHandler
  • signValidate() : SecurityHandler
  • signVisible() : SecurityHandler
  • size() : attachment , Data
  • soundIcon() : Annotation
  • source() : event
  • spawn() : Template
  • spawnPageFromTemplate() : Doc
  • state() : OCG
  • stem() : search
  • stop() : MediaPlayer
  • strikethrough() : Span
  • strokeColor() : Annotation , Field
  • style() : Annotation , Field
  • subject() : Annotation , Doc
  • subjectCN() : Certificate
  • subjectDN() : Certificate
  • submitForm() : Doc
  • submitName() : Field
  • subscript() : Span
  • superscript() : Span
  • syncAnnotScan() : Doc


Javascript API: Class Members - Functions

- t -

  • target() : event
  • targetName() : event
  • templates() : Doc
  • text() : Span
  • textColor() : Field , Span
  • textFont() : Annotation , Field
  • textSize() : Annotation , Field , Span
  • thermometer() : app
  • tileLabel() : PrintParams
  • tileMark() : PrintParams
  • tileOverlap() : PrintParams
  • tileScale() : PrintParams
  • timeDelay() : FullScreen
  • title() : Doc
  • toggleNoView() : Annotation
  • transitions() : FullScreen
  • type() : Annotation , event , Field


Javascript API: Class Members - Functions

- u -

  • uiName() : Rendition , SecurityHandler
  • underline() : Span
  • URL() : Doc
  • usePageTiming() : FullScreen
  • userName() : Field
  • useTimer() : FullScreen


Javascript API: Class Members - Functions

- v -

  • validityEnd() : Certificate
  • validityStart() : Certificate
  • value() : event , Field
  • valueAsString() : Field
  • vertices() : Annotation
  • viewerType() : app
  • viewerVariation() : app
  • viewerVersion() : app
  • visible() : MediaPlayer


Javascript API: Class Members - Functions

- w -

  • width() : Annotation
  • willCommit() : event
  • windowType() : app_media
  • wordMatching() : search


Javascript API: Class Members - Functions

- x -

  • xfa() : Doc


Javascript API: Class Members - Functions

- z -

  • zoom() : Doc
  • zoomType() : Doc


Javascript API: File List

File List
Here is a list of all documented files with brief descriptions:
3d.h | JavaScript API for Bookmark
annotation.h | JavaScript API for attachment
app.h | JavaScript API for app
bookmark.h | JavaScript API for Bookmark
certificate.h | JavaScript API for Certificate
collab.h |
color.h | JavaScript API for Color
console.h | JavaScript API for console
consts.h |
cpdfdrmauth.h |
cpdfevents.h |
cursor.h |
data.h |
database.h |
dialog.h |
document.h | JavaScript API for Doc object
event.h |
events.h |
fdf.h |
field.h | JavaScript API for Field
fullscreen.h |
global.h | JavaScript API for global
hostcontainer.h |
icon.h |
identity.h |
javascript.h |
jhelper.h |
jjs_root.h |
js_context.h |
js_cpdfpanelview.h |
js_cpdfuser.h |
js_define.h |
js_eventhandler.h |
js_globaldata.h |
js_htmlview.h |
js_http.h |
js_i18n.h |
js_interface.h |
js_module.h |
js_object.h |
js_resource.h |
js_runtime.h |
js_value.h |
js_wrapperTools.h |
link.h | JavaScript API for Link
media.h |
ocg.h | JavaScript API for OCG
printparams.h |
publicmethods.h |
report.h |
scope_guard.h |
search.h | JavaScript API for Index
securityhandler.h |
soap.h |
span.h | JavaScript API for Span
template.h | JavaScript API for Template
tools.h |
util.h | JavaScript API for util


Javascript API: 3d.h File Reference

  • src
  • javascript
  • inc
Classes
3d.h File Reference

JavaScript API for Bookmark. More...

Go to the source code of this file.

Classes

class Annot3D
A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest. More...


Javascript API: annotation.h File Reference

  • src
  • javascript
  • inc
Classes
annotation.h File Reference

JavaScript API for attachment. More...

Go to the source code of this file.

Classes

class | attachment
The annotAttachment object represents the file stored as the attachment for a FileAttachment type annotation. annotAttachment is similar to the Data object and represents the file content and metadata of the attachment. More...
class | Annotation
This object represents an Foxit PDF Editor annotation. Annotations can be created using the Foxit PDF Editor annotation tool or by using the Doc object method addAnnot. Before an annotation can be accessed, it must be bound to a JavaScript variable through a Doc object method such as getAnnot: var a = this.getAnnot(0, "f70f59c4-2dc8-4512-b15c-abdc90376c36"); The script can then manipulate the annotation named"f70f59c4-2dc8-4512-b15c-abdc90376c36" on page 1 (0-based page numbering system) by means of the variable a. For example, the following code first stores the type of annotation in the variable thetype, then changes the author to “John Q. Public”. var thetype = a.type; // read property a.author = "John Q. Public"; // write property Another way of accessing the Annotation object is through the Doc object getAnnots method. More...

Detailed Description

JavaScript API for Annotation.


Javascript API: app.h File Reference

  • src
  • javascript
  • inc
Classes
app.h File Reference

JavaScript API for app. More...

Go to the source code of this file.

Classes

class app
This object is used to set and get the properties and to set the JavaScript action of a link. More...


Javascript API: bookmark.h File Reference

  • src
  • javascript
  • inc
Classes
bookmark.h File Reference

JavaScript API for Bookmark. More...

Go to the source code of this file.

Classes

class Bookmark
A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest. More...


Javascript API: certificate.h File Reference

  • src
  • javascript
  • inc
Classes
certificate.h File Reference

JavaScript API for Certificate. More...

Go to the source code of this file.

Classes

class | RDN
This generic object represents a Relative Distinguished Name. It is used by securityHandler. newUser and the certificate.issuerDN and subjectCN properties. It has the following properties. *. More...
class | Certificate
The Certificate object provides read-only access to the properties of an X.509 public key certificate. More...


Javascript API: collab.h Source File

  • src
  • javascript
  • inc
collab.h
1 #ifndef _COLLAB_H_
2 #define _COLLAB_H_
3
4 namespace javascript {
5 class Collab : public CFXJS_EmbedObj
6 {
7 public:
8 Collab(CFXJS_Object* pJSObject);
9 virtual ~Collab();
10
11 public:
12 FX_BOOL user(OBJ_PROP_PARAMS);
13 FX_BOOL addStateModel(OBJ_METHOD_PARAMS);
14
15 public:
16 static FX_BOOL ParserParams(FXJSE_HVALUE HValue, CFXJS_Runtime* pRuntime, StateModel& stateModel);
17 };
18
19 class CFXJS_Collab : public CFXJS_Object
20 {
21 public:
22 CFXJS_Collab(CFXJS_Runtime* pRuntime)
23 : CFXJS_Object(pRuntime)
24 {
25 }
26 virtual ~CFXJS_Collab() {}
27
28 DECLARE_JS_CLASS(CFXJS_Collab);
29 JS_STATIC_METHOD(addStateModel, Collab);
30 JS_STATIC_PROP(user, Collab);
31 };
32 } // namespace javascript
33 #endif //_COLLAB_H_


Javascript API: color.h File Reference

  • src
  • javascript
  • inc
Classes
color.h File Reference

JavaScript API for Color. More...

Go to the source code of this file.

Classes

class color
The color object is a convenience static object that defines the basic colors. Use this object to set a property or call a method that requires a color array. More...


Javascript API: console.h File Reference

  • src
  • javascript
  • inc
Classes
console.h File Reference

JavaScript API for console. More...

Go to the source code of this file.

Classes

class console
The console object is a static object that enables access to the Foxit PDF Editor JavaScript Console for executing JavaScript and displaying debug messages. More...


Javascript API: consts.h Source File

  • src
  • javascript
  • inc
consts.h
1 #ifndef _CONSTS_H_
2 #define _CONSTS_H_
3
4 namespace javascript {
5 class CFXJS_Border : public CFXJS_Object
6 {
7 public:
8 CFXJS_Border(CFXJS_Runtime* pRuntime)
9 : CFXJS_Object(pRuntime){};
10 virtual ~CFXJS_Border(void){};
11
12 DECLARE_JS_CLASS_CONST();
13 };
14
15 /* ------------------------------ display ------------------------------ */
16
17 class CFXJS_Display : public CFXJS_Object
18 {
19 public:
20 CFXJS_Display(CFXJS_Runtime* pRuntime)
21 : CFXJS_Object(pRuntime){};
22 virtual ~CFXJS_Display(void){};
23
24 DECLARE_JS_CLASS_CONST();
25 };
26
27 /* ------------------------------ font ------------------------------ */
28
29 class CFXJS_Font : public CFXJS_Object
30 {
31 public:
32 CFXJS_Font(CFXJS_Runtime* pRuntime)
33 : CFXJS_Object(pRuntime){};
34 virtual ~CFXJS_Font(void){};
35
36 DECLARE_JS_CLASS_CONST();
37 };
38
39 /* ------------------------------ highlight ------------------------------ */
40
41 class CFXJS_Highlight : public CFXJS_Object
42 {
43 public:
44 CFXJS_Highlight(CFXJS_Runtime* pRuntime)
45 : CFXJS_Object(pRuntime){};
46 virtual ~CFXJS_Highlight(void){};
47
48 DECLARE_JS_CLASS_CONST();
49 };
50
51 /* ------------------------------ position ------------------------------ */
52
53 class CFXJS_Position : public CFXJS_Object
54 {
55 public:
56 CFXJS_Position(CFXJS_Runtime* pRuntime)
57 : CFXJS_Object(pRuntime){};
58 virtual ~CFXJS_Position(void){};
59
60 DECLARE_JS_CLASS_CONST();
61 };
62
63 /* ------------------------------ scaleHow ------------------------------ */
64
65 class CFXJS_ScaleHow : public CFXJS_Object
66 {
67 public:
68 CFXJS_ScaleHow(CFXJS_Runtime* pRuntime)
69 : CFXJS_Object(pRuntime){};
70 virtual ~CFXJS_ScaleHow(void){};
71
72 DECLARE_JS_CLASS_CONST();
73 };
74
75 /* ------------------------------ scaleWhen ------------------------------ */
76
77 class CFXJS_ScaleWhen : public CFXJS_Object
78 {
79 public:
80 CFXJS_ScaleWhen(CFXJS_Runtime* pRuntime)
81 : CFXJS_Object(pRuntime){};
82 virtual ~CFXJS_ScaleWhen(void){};
83
84 DECLARE_JS_CLASS_CONST();
85 };
86
87 /* ------------------------------ style ------------------------------ */
88
89 class CFXJS_Style : public CFXJS_Object
90 {
91 public:
92 CFXJS_Style(CFXJS_Runtime* pRuntime)
93 : CFXJS_Object(pRuntime){};
94 virtual ~CFXJS_Style(void){};
95
96 DECLARE_JS_CLASS_CONST();
97 };
98
99 /* ------------------------------ zoomtype ------------------------------ */
100
101 class CFXJS_Zoomtype : public CFXJS_Object
102 {
103 public:
104 CFXJS_Zoomtype(CFXJS_Runtime* pRuntime)
105 : CFXJS_Object(pRuntime){};
106 virtual ~CFXJS_Zoomtype(void){};
107
108 DECLARE_JS_CLASS_CONST();
109 };
110
111 /* ------------------------------ CJS_GlobalConsts ------------------------------ */
112
113 class CFXJS_GlobalConsts : public CFXJS_Object
114 {
115 public:
116 static int Init(CFXJS_Runtime* pRuntime);
117 };
118
119 /* ------------------------------ CJS_GlobalArrays ------------------------------ */
120
121 class CFXJS_GlobalArrays : public CFXJS_Object
122 {
123 public:
124 static int Init(CFXJS_Runtime* pRuntime);
125 };
126 } // namespace javascript
127
128 #endif //_CONSTS_H_


Javascript API: cpdfdrmauth.h Source File

  • src
  • javascript
  • inc
cpdfdrmauth.h
1 #ifndef CPDFDRMAUTH_H
2 #define CPDFDRMAUTH_H
3 namespace javascript {
4 class DRMAuth : public CFXJS_EmbedObj
5 {
6 public:
7 DRMAuth(CFXJS_Object* pJSObject);
8 virtual ~DRMAuth();
9
10 public:
11 // method
12 FX_BOOL setKey(OBJ_METHOD_PARAMS);
13 FX_BOOL setRequestPerm(OBJ_METHOD_PARAMS);
14
15 // prop
16 FX_BOOL guid(OBJ_PROP_PARAMS);
17 };
18
19 class CFXJS_DRMAuth : public CFXJS_Object
20 {
21 public:
22 CFXJS_DRMAuth(CFXJS_Runtime* pRuntime)
23 : CFXJS_Object(pRuntime){};
24 virtual ~CFXJS_DRMAuth(void){};
25
26 DECLARE_JS_CLASS(CFXJS_DRMAuth);
27
28 // method
29 JS_STATIC_METHOD(setKey, DRMAuth);
30 JS_STATIC_METHOD(setRequestPerm, DRMAuth);
31
32 // prop
33 JS_STATIC_PROP(guid, DRMAuth);
34 };
35 } // namespace javascript
36 #endif // CPDFDRMAUTH_H


Javascript API: cpdfevents.h Source File

  • src
  • javascript
  • inc
cpdfevents.h
1 #ifndef CPDFEVENTS_H
2 #define CPDFEVENTS_H
3 namespace javascript {
4
5 class methodProxy : public CFXJS_EmbedObj
6 {
7 public:
8 methodProxy(CFXJS_Object* pJSObject);
9 virtual ~methodProxy(){};
10
11 public:
12 FX_BOOL registerFunction(OBJ_METHOD_PARAMS);
13 FX_BOOL unRegisterFunction(OBJ_METHOD_PARAMS);
14 };
15
16 class CFXJS_HtmlCallbacks : public CFXJS_Object
17 {
18 public:
19 CFXJS_HtmlCallbacks(CFXJS_Runtime* pRuntime)
20 : CFXJS_Object(pRuntime){};
21 virtual ~CFXJS_HtmlCallbacks(){};
22
23 public:
24 DECLARE_JS_CLASS(CFXJS_HtmlCallbacks);
25 JS_STATIC_METHOD(registerFunction, methodProxy);
26 JS_STATIC_METHOD(unRegisterFunction, methodProxy);
27 };
28 } // namespace javascript
29 #endif // CPDFEVENTS_H


Javascript API: cursor.h Source File

  • src
  • javascript
  • inc
cursor.h
1 #ifndef _jcursor_H_
2 #define _jcursor_H_
3
4 namespace javascript {
5 class cursor : public CFXJS_EmbedObj
6 {
7 public:
8 cursor(CFXJS_Object* pJSObject);
9 virtual ~cursor();
10
11 public:
12 FX_BOOL delay(OBJ_PROP_PARAMS);
13 FX_BOOL hidden(OBJ_PROP_PARAMS);
14 FX_BOOL visible(OBJ_PROP_PARAMS);
15 };
16
17 class CFXJS_Cursor : public CFXJS_Object
18 {
19 public:
20 CFXJS_Cursor(CFXJS_Runtime* pRuntime)
21 : CFXJS_Object(pRuntime){};
22 virtual ~CFXJS_Cursor(){};
23
24 public:
25 DECLARE_JS_CLASS(CFXJS_Cursor);
26
27 JS_STATIC_PROP(delay, cursor);
28 JS_STATIC_PROP(hidden, cursor);
29 JS_STATIC_PROP(visible, cursor);
30 };
31 } // namespace javascript
32
33 #endif //_jcursor_H_


Javascript API: data.h Source File

  • src
  • javascript
  • inc
data.h
1 #ifndef _DATA_H_
2 #define _DATA_H_
3 #include "javascript/fx_jsDocumentProvider.h"
4
6 namespace javascript {
8
17 class Data : public CFXJS_EmbedObj
18 {
19 public:
20 Data(CFXJS_Object* pJSObject);
21 virtual ~Data();
22
23 public:
24
35 FX_BOOL creationDate(OBJ_PROP_PARAMS);
36
47 FX_BOOL description(OBJ_PROP_PARAMS);
48
59 FX_BOOL MIMEType(OBJ_PROP_PARAMS);
60
71 FX_BOOL modDate(OBJ_PROP_PARAMS);
72
91 FX_BOOL name(OBJ_PROP_PARAMS);
92
103 FX_BOOL path(OBJ_PROP_PARAMS);
104
115 FX_BOOL size(OBJ_PROP_PARAMS);
116
117 public:
118 FX_BOOL AttachName(IFXJS_AppProvider* pApp,
119 CFX_ByteString csDataName,
120 JS_FAAOBJECTINFO& fileAttachment);
121
122 private:
123 IFXJS_AppProvider* m_pApp;
124 CFX_ByteString m_csDataName;
125 JS_FAAOBJECTINFO m_fileAttachment;
126 };
127
128 class CFXJS_Data : public CFXJS_Object
129 {
130 public:
131 CFXJS_Data(CFXJS_Runtime* pRuntime)
132 : CFXJS_Object(pRuntime){};
133 virtual ~CFXJS_Data(){};
134
135 public:
136 DECLARE_JS_CLASS(CFXJS_Data);
137 JS_STATIC_PROP(creationDate, Data);
138 JS_STATIC_PROP(description, Data);
139 JS_STATIC_PROP(MIMEType, Data);
140 JS_STATIC_PROP(modDate, Data);
141 JS_STATIC_PROP(name, Data);
142 JS_STATIC_PROP(path, Data);
143 JS_STATIC_PROP(size, Data);
144 static CFXJS_Data* GetData(CFX_WideString& swDataName);
145 };
146
147 } // namespace javascript
148
149 #endif //_DATA_H_
Data
The Data object is the representation of an embedded file or data stream that is stored in the docume...
Definition: data.h:17


Javascript API: database.h Source File

  • src
  • javascript
  • inc
database.h
1 #ifndef _DATABASE_H_
2 #define _DATABASE_H_
3
4 namespace javascript {
5
6 class IFXJS_ConnectionProvider;
7 class IFXJS_StatementProvider;
8 class SQL_VALUE;
9
10 typedef CFX_ArrayTemplate<SQL_VALUE*> SQL_VALUEArray;
11
12 /* ---------------------------- ADBC ---------------------------- */
13
14 class ADBC : public CFXJS_EmbedObj
15 {
16 public:
17 ADBC(CFXJS_Object* pJSObject);
18 virtual ~ADBC();
19
20 public:
21 FX_BOOL JavaScripttypes(OBJ_PROP_PARAMS);
22 FX_BOOL SQLtypes(OBJ_PROP_PARAMS);
23
24 FX_BOOL getDataSourceList(OBJ_METHOD_PARAMS);
25 FX_BOOL newConnection(OBJ_METHOD_PARAMS);
26 };
27
28 class CFXJS_ADBC : public CFXJS_Object
29 {
30 public:
31 CFXJS_ADBC(CFXJS_Runtime* pRuntime)
32 : CFXJS_Object(pRuntime){};
33 virtual ~CFXJS_ADBC(){};
34
35 DECLARE_JS_CLASS(CFXJS_ADBC);
36
37 JS_STATIC_PROP(JavaScripttypes, ADBC);
38 JS_STATIC_PROP(SQLtypes, ADBC);
39
40 JS_STATIC_METHOD(getDataSourceList, ADBC);
41 JS_STATIC_METHOD(newConnection, ADBC);
42 };
43
44 /* ---------------------------- Column ---------------------------- */
45
46 class Column : public CFXJS_EmbedObj
47 {
48 public:
49 Column(CFXJS_Object* pJSObject);
50 virtual ~Column();
51
52 public:
53 FX_BOOL columnNum(OBJ_PROP_PARAMS);
54 FX_BOOL name(OBJ_PROP_PARAMS);
55 FX_BOOL type(OBJ_PROP_PARAMS);
56 FX_BOOL typeName(OBJ_PROP_PARAMS);
57 FX_BOOL value(OBJ_PROP_PARAMS);
58
59 public:
60 void AddValue(std::unique_ptr<SQL_VALUE>&& value)
61 {
62 m_pcbaRowValues.push_back(std::move(value));
63 }
64 void SetColumnName(CFX_WideString sName)
65 {
66 m_sColumnName = sName;
67 }
68 void SetType(int iType)
69 {
70 m_iType = iType;
71 }
72 void SetTypeName(CFX_WideString sTypeName)
73 {
74 m_sTypeName = sTypeName;
75 }
76
77 private:
78 int m_iType;
79 CFX_WideString m_sTypeName;
80 CFX_WideString m_sColumnName;
81 std::vector<std::unique_ptr<SQL_VALUE>> m_pcbaRowValues;
82 };
83
84 class CFXJS_Column : public CFXJS_Object
85 {
86 public:
87 CFXJS_Column(CFXJS_Runtime* pRuntime)
88 : CFXJS_Object(pRuntime)
89 {
90 }
91 virtual ~CFXJS_Column() {}
92
93 DECLARE_JS_CLASS(CFXJS_Column);
94
95 JS_STATIC_PROP(columnNum, Column);
96 JS_STATIC_PROP(name, Column);
97 JS_STATIC_PROP(type, Column);
98 JS_STATIC_PROP(typeName, Column);
99 JS_STATIC_PROP(value, Column);
100 };
101
102 /* ---------------------------- ColumnInfo ---------------------------- */
103
104 class ColumnInfo : public CFXJS_EmbedObj
105 {
106 public:
107 ColumnInfo(CFXJS_Object* pJSObject);
108 virtual ~ColumnInfo();
109
110 public:
111 FX_BOOL description(OBJ_PROP_PARAMS);
112 FX_BOOL name(OBJ_PROP_PARAMS);
113 FX_BOOL type(OBJ_PROP_PARAMS);
114 FX_BOOL typeName(OBJ_PROP_PARAMS);
115
116 public:
117 void SetType(int iSQLType)
118 {
119 m_iType = iSQLType;
120 }
121 void SetTypeName(CFX_WideString sTypeName)
122 {
123 m_sTypeName = sTypeName;
124 }
125 void SetColName(CFX_WideString sColName)
126 {
127 m_sName = sColName;
128 }
129 void SetDescription(CFX_WideString sDecription)
130 {
131 m_sDescription = sDecription;
132 }
133
134 private:
135 CFX_WideString m_sName;
136 CFX_WideString m_sDescription;
137 CFX_WideString m_sTypeName;
138 int m_iType;
139 };
140
141 class CFXJS_ColumnInfo : public CFXJS_Object
142 {
143 public:
144 CFXJS_ColumnInfo(CFXJS_Runtime* pRuntime)
145 : CFXJS_Object(pRuntime)
146 {
147 }
148 virtual ~CFXJS_ColumnInfo(void) {}
149
150 DECLARE_JS_CLASS(CFXJS_ColumnInfo);
151
152 JS_STATIC_PROP(description, ColumnInfo);
153 JS_STATIC_PROP(name, ColumnInfo);
154 JS_STATIC_PROP(type, ColumnInfo);
155 JS_STATIC_PROP(typeName, ColumnInfo);
156 };
157
158 /* ---------------------------- Connection ---------------------------- */
159
160 class StatementObj;
161 class Connection : public CFXJS_EmbedObj
162 {
163 public:
164 Connection(CFXJS_Object* pJSObject);
165 virtual ~Connection();
166
167 public:
168 FX_BOOL close(OBJ_METHOD_PARAMS);
169 FX_BOOL getColumnList(OBJ_METHOD_PARAMS);
170 FX_BOOL getTableList(OBJ_METHOD_PARAMS);
171 FX_BOOL newStatement(OBJ_METHOD_PARAMS);
172
173 public:
174 void SetDSN(CFX_WideString sDSN)
175 {
176 m_sDSN = sDSN;
177 }
178 void SetConnection(const CFX_WideString& sDSN,
179 const CFX_WideString& sUID,
180 const CFX_WideString& sPWD);
181
182 protected:
183 void AddTableList(CFX_WideString sTableName);
184
185 private:
186 CFX_WideString m_sDSN;
187 // std::unique_ptr<CDatabase> m_pDataBase;
188 // std::unique_ptr<CRecordset> m_pConnection;
189 std::unique_ptr<IFXJS_ConnectionProvider> m_ConnectionProvider;
190 };
191
192 class CFXJS_Connection : public CFXJS_Object
193 {
194 public:
195 CFXJS_Connection(CFXJS_Runtime* pRuntime)
196 : CFXJS_Object(pRuntime){};
197 virtual ~CFXJS_Connection(void){};
198
199 DECLARE_JS_CLASS(CFXJS_Connection);
200
201 JS_STATIC_METHOD(close, Connection);
202 JS_STATIC_METHOD(getColumnList, Connection);
203 JS_STATIC_METHOD(getTableList, Connection);
204 JS_STATIC_METHOD(newStatement, Connection);
205 };
206
207 /* ---------------------------- DataSourceInfo ---------------------------- */
208
209 class DataSourceInfo : public CFXJS_EmbedObj
210 {
211 public:
212 DataSourceInfo(CFXJS_Object* pJSObject);
213 virtual ~DataSourceInfo();
214
215 public:
216 FX_BOOL description(OBJ_PROP_PARAMS);
217 FX_BOOL name(OBJ_PROP_PARAMS);
218
219 public:
220 void SetName(CFX_WideString sName)
221 {
222 m_sName = sName;
223 }
224 void SetDriver(CFX_WideString sDriver)
225 {
226 m_sDriver = sDriver;
227 }
228 void SetDescription(CFX_WideString sDescription)
229 {
230 m_sDescription = sDescription;
231 }
232
233 private:
234 CFX_WideString m_sName;
235 CFX_WideString m_sDriver;
236 CFX_WideString m_sDescription;
237 };
238
239 class CFXJS_DataSourceInfo : public CFXJS_Object
240 {
241 public:
242 CFXJS_DataSourceInfo(CFXJS_Runtime* pRuntime)
243 : CFXJS_Object(pRuntime){};
244 virtual ~CFXJS_DataSourceInfo(void){};
245
246 DECLARE_JS_CLASS(CFXJS_DataSourceInfo);
247
248 JS_STATIC_PROP(description, DataSourceInfo);
249 JS_STATIC_PROP(name, DataSourceInfo);
250 };
251
252 /* ---------------------------- Row ---------------------------- */
253
254 class Row : public CFXJS_EmbedObj
255 {
256 public:
257 Row(CFXJS_Object* pJSObject);
258 virtual ~Row();
259
260 public:
261 FX_BOOL columnArray(OBJ_PROP_PARAMS);
262 FX_BOOL columnproperties(OBJ_PROP_PARAMS);
263
264 public:
265 void AddColumn(CFX_WideString pColumns)
266 {
267 m_pcbaColumns.Add(pColumns);
268 }
269 void AddRowValues(std::unique_ptr<SQL_VALUE>&& pValue)
270 {
271 m_pcbaRowValues.push_back(std::move(pValue));
272 }
273 void SetStatement(IFXJS_StatementProvider* pStatement)
274 {
275 m_pStatementProvider = pStatement;
276 }
277 void SetRowPosition(int iPosition)
278 {
279 m_nRowPosition = iPosition;
280 }
281 void ClearRowValues()
282 {
283 m_pcbaRowValues.clear();
284 }
285 void ClearColumns()
286 {
287 m_pcbaColumns.RemoveAll();
288 }
289
290 protected:
291 FX_BOOL UpdateDatabase(FX_LPCWSTR lpPropName, FXJSE_HVALUE value);
292
293 public:
294 friend void get_row_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
295 friend void set_row_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
296
297 private:
298 IFXJS_StatementProvider* m_pStatementProvider;
299 int m_nRowPosition; // base 1
300 int m_nColumnIndex;
301 CFX_WideStringArray m_pcbaColumns;
302 std::vector<std::unique_ptr<SQL_VALUE>> m_pcbaRowValues;
303 };
304
305 class CFXJS_Row : public CFXJS_Object
306 {
307 public:
308 CFXJS_Row(CFXJS_Runtime* pRuntime)
309 : CFXJS_Object(pRuntime)
310 {
311 }
312 virtual ~CFXJS_Row() {}
313 static FX_BOOL Init(CFXJS_Runtime* pRuntime);
314 static void
315 get_columnArray_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
316 static void
317 get_columnproperties_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
318 static void set_prop_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
319
320 static void GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize);
321 };
322
323 /* ---------------------------- StatementObj ---------------------------- */
324
325 class StatementObj : public CFXJS_EmbedObj
326 {
327 public:
328 StatementObj(CFXJS_Object* pJSObject);
329 virtual ~StatementObj();
330
331 public:
332 FX_BOOL columnCount(OBJ_PROP_PARAMS);
333 FX_BOOL rowCount(OBJ_PROP_PARAMS);
334
335 FX_BOOL execute(OBJ_METHOD_PARAMS);
336 FX_BOOL getColumn(OBJ_METHOD_PARAMS);
337 FX_BOOL getColumnArray(OBJ_METHOD_PARAMS);
338 FX_BOOL getRow(OBJ_METHOD_PARAMS);
339 FX_BOOL nextRow(OBJ_METHOD_PARAMS);
340
341 public:
342 void SetStatement(std::unique_ptr<IFXJS_StatementProvider>&& pStatement)
343 {
344 m_pStatementProvider = std::move(pStatement);
345 }
346
347 private:
348 std::unique_ptr<IFXJS_StatementProvider> m_pStatementProvider;
349 FX_BOOL m_bIsConnected;
350 int m_iPositionIndex;
351 };
352
353 class CFXJS_Statement : public CFXJS_Object
354 {
355 public:
356 CFXJS_Statement(CFXJS_Runtime* pRuntime)
357 : CFXJS_Object(pRuntime)
358 {
359 }
360 virtual ~CFXJS_Statement() {}
361
362 DECLARE_JS_CLASS(CFXJS_Statement);
363
364 JS_STATIC_PROP(columnCount, StatementObj);
365 JS_STATIC_PROP(rowCount, StatementObj);
366 JS_STATIC_METHOD(execute, StatementObj);
367 JS_STATIC_METHOD(getColumn, StatementObj);
368 JS_STATIC_METHOD(getColumnArray, StatementObj);
369 JS_STATIC_METHOD(getRow, StatementObj);
370 JS_STATIC_METHOD(nextRow, StatementObj);
371 };
372
373 /* ---------------------------- TableInfo ---------------------------- */
374
375 class TableInfo : public CFXJS_EmbedObj
376 {
377 public:
378 TableInfo(CFXJS_Object* pJSObject);
379 virtual ~TableInfo();
380
381 public:
382 FX_BOOL description(OBJ_PROP_PARAMS);
383 FX_BOOL name(OBJ_PROP_PARAMS);
384
385 public:
386 void SetTableName(CFX_WideString sTableName)
387 {
388 m_sTableName = sTableName;
389 }
390 void SetTableDescription(CFX_WideString sTableDescription)
391 {
392 m_sTableDescription = sTableDescription;
393 }
394
395 private:
396 CFX_WideString m_sTableName;
397 CFX_WideString m_sTableDescription;
398 };
399
400 class CFXJS_TableInfo : public CFXJS_Object
401 {
402 public:
403 CFXJS_TableInfo(CFXJS_Runtime* pRuntime)
404 : CFXJS_Object(pRuntime){};
405 virtual ~CFXJS_TableInfo() {}
406
407 DECLARE_JS_CLASS(CFXJS_TableInfo);
408
409 JS_STATIC_PROP(description, TableInfo);
410 JS_STATIC_PROP(name, TableInfo);
411 };
412 } // namespace javascript
413
414 #endif //_DATABASE_H_


Javascript API: dialog.h Source File

  • src
  • javascript
  • inc
dialog.h
1 #ifndef _DIALOG_H_
2 #define _DIALOG_H_
3
4 namespace javascript {
5 class CFXJS_HtmlViewDialogProvider;
6 class Dialog : public CFXJS_EmbedObj
7 {
8 public:
9 Dialog(CFXJS_Object* pJSObject);
10 virtual ~Dialog();
11
12 public:
13 FX_BOOL enable(OBJ_METHOD_PARAMS);
14 FX_BOOL end(OBJ_METHOD_PARAMS);
15 FX_BOOL load(OBJ_METHOD_PARAMS);
16 FX_BOOL store(OBJ_METHOD_PARAMS);
17 FX_BOOL setForeColorRed(OBJ_METHOD_PARAMS);
18
19 public:
20 void SetMemDlg(std::unique_ptr<IFXJS_DialogProvider>&& pDlg)
21 {
22 m_phDlg = std::move(pDlg);
23 }
24 std::unique_ptr<IFXJS_DialogProvider> m_phDlg;
25 };
26
27 class CFXJS_Dialog : public CFXJS_Object
28 {
29 public:
30 CFXJS_Dialog(CFXJS_Runtime* pRuntime)
31 : CFXJS_Object(pRuntime){};
32 virtual ~CFXJS_Dialog(){};
33
34 public:
35 DECLARE_JS_CLASS(CFXJS_Dialog);
36
37 JS_STATIC_METHOD(enable, Dialog);
38 JS_STATIC_METHOD(end, Dialog);
39 JS_STATIC_METHOD(load, Dialog);
40 JS_STATIC_METHOD(store, Dialog);
41 JS_STATIC_METHOD(setForeColorRed, Dialog);
42 };
43
44 class HtmlViewDialog : public CFXJS_EmbedObj
45 {
46 public:
47 HtmlViewDialog(CFXJS_Object* pJSObject);
48 virtual ~HtmlViewDialog();
49
50 public:
51 FX_BOOL show(OBJ_METHOD_PARAMS);
52 FX_BOOL setTitle(OBJ_METHOD_PARAMS);
53 FX_BOOL setURL(OBJ_METHOD_PARAMS);
54 FX_BOOL setSize(OBJ_METHOD_PARAMS);
55 FX_BOOL close(OBJ_METHOD_PARAMS);
56
57 public:
58 void SetUrl(CFX_WideString url);
59 void SetSize(int sizeX, int sizeY);
60 CFXJS_HtmlViewDialogProvider* GetHtmlViewDialogProvider();
61
62 private:
63 IFXJS_BrowserDialogProvider* m_pBrowser;
64 std::unique_ptr<CFXJS_HtmlViewDialogProvider> m_pHtmlViewDialogProvier;
65 };
66
67 class CFXJS_HtmlViewDialog : public CFXJS_Object
68 {
69 public:
70 CFXJS_HtmlViewDialog(CFXJS_Runtime* pRuntime)
71 : CFXJS_Object(pRuntime){};
72 virtual ~CFXJS_HtmlViewDialog(){};
73
74 public:
75 DECLARE_JS_CLASS(CFXJS_HtmlViewDialog);
76
77 JS_STATIC_METHOD(show, HtmlViewDialog);
78 JS_STATIC_METHOD(setTitle, HtmlViewDialog);
79 JS_STATIC_METHOD(setURL, HtmlViewDialog);
80 JS_STATIC_METHOD(setSize, HtmlViewDialog);
81 JS_STATIC_METHOD(close, HtmlViewDialog);
82 };
83 } // namespace javascript
84
85 #endif


Javascript API: document.h File Reference

  • src
  • javascript
  • inc
Classes
document.h File Reference

JavaScript API for Doc object. More...

Go to the source code of this file.

Classes

class Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interpreter. It provides methods and properties for accessing the PDF Doc. More...


Javascript API: event.h Source File

  • src
  • javascript
  • inc
event.h
1 #ifndef _EVENT_H_
2 #define _EVENT_H_
3 namespace javascript {
6
22 class event : public CFXJS_EmbedObj
23 {
24 public:
25 event(CFXJS_Object* pJSObject);
26 virtual ~event(void) {}
27
28 public:
29
46 FX_BOOL change(OBJ_PROP_PARAMS);
47
85 FX_BOOL changeEx(OBJ_PROP_PARAMS);
86
107 FX_BOOL commitKey(OBJ_PROP_PARAMS);
108
143 FX_BOOL fieldFull(OBJ_PROP_PARAMS);
144
156 FX_BOOL keyDown(OBJ_PROP_PARAMS);
157
168 FX_BOOL modifier(OBJ_PROP_PARAMS);
169
191 FX_BOOL name(OBJ_PROP_PARAMS);
192
205 FX_BOOL rc(OBJ_PROP_PARAMS);
206
234 FX_BOOL richChange(OBJ_PROP_PARAMS);
235
268 FX_BOOL richChangeEx(OBJ_PROP_PARAMS);
269
299 FX_BOOL richValue(OBJ_PROP_PARAMS);
300
329 FX_BOOL selEnd(OBJ_PROP_PARAMS);
330
345 FX_BOOL selStart(OBJ_PROP_PARAMS);
346
365 FX_BOOL shift(OBJ_PROP_PARAMS);
366
377 FX_BOOL source(OBJ_PROP_PARAMS);
378
389 FX_BOOL target(OBJ_PROP_PARAMS);
390
409 FX_BOOL targetName(OBJ_PROP_PARAMS);
410
426 FX_BOOL type(OBJ_PROP_PARAMS);
427
450 FX_BOOL value(OBJ_PROP_PARAMS);
451
471 FX_BOOL willCommit(OBJ_PROP_PARAMS);
472 // only used by media
473 FX_BOOL stopDispatch(OBJ_PROP_PARAMS);
474 FX_BOOL stopAllDispatch(OBJ_PROP_PARAMS);
475 };
476
477 class CFXJS_Event : public CFXJS_Object
478 {
479 public:
480 CFXJS_Event(CFXJS_Runtime* pRuntime)
481 : CFXJS_Object(pRuntime){};
482 virtual ~CFXJS_Event(void){};
483
484 DECLARE_JS_CLASS(CFXJS_Event);
485
486 JS_STATIC_PROP(change, event);
487 JS_STATIC_PROP(changeEx, event);
488 JS_STATIC_PROP(commitKey, event);
489 JS_STATIC_PROP(fieldFull, event);
490 JS_STATIC_PROP(keyDown, event);
491 JS_STATIC_PROP(modifier, event);
492 JS_STATIC_PROP(name, event);
493 JS_STATIC_PROP(rc, event);
494 JS_STATIC_PROP(richChange, event);
495 JS_STATIC_PROP(richChangeEx, event);
496 JS_STATIC_PROP(richValue, event);
497 JS_STATIC_PROP(selEnd, event);
498 JS_STATIC_PROP(selStart, event);
499 JS_STATIC_PROP(shift, event);
500 JS_STATIC_PROP(source, event);
501 JS_STATIC_PROP(target, event);
502 JS_STATIC_PROP(targetName, event);
503 JS_STATIC_PROP(type, event);
504 JS_STATIC_PROP(value, event);
505 JS_STATIC_PROP(willCommit, event);
506
507 JS_STATIC_PROP(stopDispatch, event);
508 JS_STATIC_PROP(stopAllDispatch,event);
509 };
510 } // namespace javascript
511
512 #endif //_EVENT_H_
event
All JavaScript scripts are executed as the result of a particular event. For each of these events,...
Definition: event.h:22


Javascript API: events.h Source File

  • src
  • javascript
  • inc
events.h
1 #ifndef _EVENTS_H_
2 #define _EVENTS_H_
3
4 namespace javascript {
5 class Eventts : public CFXJS_EmbedObj
6 {
7 public:
8 Eventts(CFXJS_Object* pJSObject);
9 virtual ~Eventts(void);
10
11 public:
12 FX_BOOL add(OBJ_METHOD_PARAMS);
13 FX_BOOL dispatch(OBJ_METHOD_PARAMS);
14 FX_BOOL remove(OBJ_METHOD_PARAMS);
15 FX_BOOL addOrRemove(FXJSE_HVALUE hValue, bool ret);
16 FX_BOOL privCallMethods(FXJSE_HVALUE event, const char* name);
17 private:
18
19 CFX_ArrayTemplate<FXJSE_HVALUE> m_EventListeners;
20
21 };
22
23 class CFXJS_Events : public CFXJS_Object
24 {
25 public:
26 CFXJS_Events(CFXJS_Runtime* pRuntime)
27 : CFXJS_Object(pRuntime){};
28 virtual ~CFXJS_Events(void){};
29
30 DECLARE_JS_CLASS(CFXJS_Events);
31
32 JS_STATIC_METHOD(add, Eventts);
33 JS_STATIC_METHOD(dispatch, Eventts);
34 JS_STATIC_METHOD(remove, Eventts);
35 };
36 } // namespace javascript
37
38 #endif //_EVENTS_H_
event
All JavaScript scripts are executed as the result of a particular event. For each of these events,...
Definition: event.h:22


Javascript API: fdf.h Source File

  • src
  • javascript
  • inc
fdf.h
1 #ifndef _FDF_H_
2 #define _FDF_H_
3
4 namespace javascript {
5 class FDF : public CFXJS_EmbedObj
6 {
7 public:
8 FDF(CFXJS_Object* pJSObject);
9 virtual ~FDF(void);
10
11 FX_BOOL addContact(OBJ_METHOD_PARAMS);
12 FX_BOOL addRequest(OBJ_METHOD_PARAMS);
13 FX_BOOL close(OBJ_METHOD_PARAMS);
14 FX_BOOL mail(OBJ_METHOD_PARAMS);
15 FX_BOOL save(OBJ_METHOD_PARAMS);
16 };
17
18 class CFXJS_FDF : public CFXJS_Object
19 {
20 public:
21 CFXJS_FDF(CFXJS_Runtime* pRuntime)
22 : CFXJS_Object(pRuntime){};
23 virtual ~CFXJS_FDF(void){};
24
25 DECLARE_JS_CLASS(CFXJS_FDF);
26
27 JS_STATIC_METHOD(addContact, FDF);
28 JS_STATIC_METHOD(addRequest, FDF);
29 JS_STATIC_METHOD(close, FDF);
30 JS_STATIC_METHOD(mail, FDF);
31 JS_STATIC_METHOD(save, FDF);
32 };
33
34 } // namespace javascript
35
36 #endif //_FDF_H_


Javascript API: field.h File Reference

  • src
  • javascript
  • inc
Classes
field.h File Reference

JavaScript API for Field. More...

Go to the source code of this file.

Classes

class Field
This object represents an form field (that is, a field created using the form tool or the Doc addField method). In the same manner that a form author can modify an existing field’s properties, such as the border color or font, the JavaScript user can use the Field object to perform the same modifications. More...


Javascript API: fullscreen.h Source File

  • src
  • javascript
  • inc
fullscreen.h
1 #ifndef _FULLSCREEN_H_
2 #define _FULLSCREEN_H_
3 namespace javascript {
6 class CFXJS_Timer;
7
11 class FullScreen : public CFXJS_EmbedObj
12 {
13 public:
14 FullScreen(CFXJS_Object* pJSObject);
15 virtual ~FullScreen();
16 virtual void TimerProc(CFXJS_Timer* pTimer);
17
18 void SetApp(IFXJS_AppProvider* pApp);
19
20 public:
21
36 FX_BOOL backgroundColor(OBJ_PROP_PARAMS);
37
52 FX_BOOL cursor(OBJ_PROP_PARAMS);
53
70 FX_BOOL isFullScreen(OBJ_PROP_PARAMS);
71
90 FX_BOOL timeDelay(OBJ_PROP_PARAMS);
91
102 FX_BOOL useTimer(OBJ_PROP_PARAMS);
103
114 FX_BOOL usePageTiming(OBJ_PROP_PARAMS);
115
126 FX_BOOL loop(OBJ_PROP_PARAMS);
127
144 FX_BOOL transitions(OBJ_PROP_PARAMS);
145
163 FX_BOOL defaultTransition(OBJ_PROP_PARAMS);
164
165 public:
166 int m_iTimeDelay;
167 int m_iCursorStyle;
168 FX_BOOL m_fbUseTimer;
169 FX_BOOL m_fbUsePageTiming;
170 FX_BOOL m_isFullScreen;
171 FX_BOOL m_Timer;
172
173 IFXJS_AppProvider* m_pApp;
174
175 private:
176 std::unique_ptr<CFXJS_Timer> m_pTimer;
177 };
178
179 class CFXJS_FullScreen : public CFXJS_Object
180 {
181 public:
182 CFXJS_FullScreen(CFXJS_Runtime* pRuntime)
183 : CFXJS_Object(pRuntime){};
184 virtual ~CFXJS_FullScreen(){};
185
186 public:
187 DECLARE_JS_CLASS(CFXJS_FullScreen);
188
189 JS_STATIC_PROP(backgroundColor, FullScreen);
190 JS_STATIC_PROP(cursor, FullScreen);
191 JS_STATIC_PROP(isFullScreen, FullScreen);
192 JS_STATIC_PROP(timeDelay, FullScreen);
193 JS_STATIC_PROP(useTimer, FullScreen);
194 JS_STATIC_PROP(usePageTiming, FullScreen);
195 JS_STATIC_PROP(loop, FullScreen);
196 JS_STATIC_PROP(transitions, FullScreen);
197 JS_STATIC_PROP(defaultTransition, FullScreen);
198 };
199 } // namespace javascript
200
201 #endif //_FULLSCREEN_H_
FullScreen
The interface to fullscreen (presentation mode) preferences and properties. To acquire a fullScreen o...
Definition: fullscreen.h:11


Javascript API: global.h File Reference

  • src
  • javascript
  • inc
Classes
global.h File Reference

JavaScript API for global. More...

Go to the source code of this file.

Classes

class global
This is a static JavaScript object that allows you to share data between documents and to have data be persistent across sessions. Such data is called persistent global data. Global data-sharing and notification across documents is done through a subscription mechanism, which allows you to monitor global data variables and report their value changes across documents. More...


Javascript API: hostcontainer.h Source File

  • src
  • javascript
  • inc
hostcontainer.h
1 #ifndef _HOST_CONTAINER_H_
2 #define _HOST_CONTAINER_H_
3 namespace javascript {
6 struct js_host_data
7 {
8 js_host_data()
9 {
10 pData = NULL;
11 bDeleted = false;
12 }
13 FXJSE_HVALUE pData;
14 bool bDeleted;
15 };
16
17 class MessageHandler : public CFXJS_EmbedObj
18 {
19 public:
20 MessageHandler(CFXJS_Object* pJSObject);
21 virtual ~MessageHandler(void);
22 static FX_BOOL Init(CFXJS_Runtime* pJsRunTime);
23
24 static FX_INT32 TypeGetter(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FX_BOOL bQueryIn);
25 static void Getter(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
26 static void Setter(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FXJSE_HVALUE hValue);
27 static FX_BOOL Deleter(FXJSE_HOBJECT hObject, FX_BSTR szPropName);
28 static void MethodCall(FXJSE_HOBJECT hThis, FX_BSTR szFuncName, CFXJSE_Arguments& args);
29 static FX_BOOL
30 SetGlobalVariables(CFXJS_Runtime* pRuntime, FX_BSTR propname, FXJSE_HVALUE hValue);
31
32 static FXJSE_PROPERTY m_Properties[];
33 static FXJSE_FUNCTION m_Methods[];
34 static FXJSE_CLASS m_classes[];
35
36 public:
37 CFXJS_Object* m_pObject;
38 };
39
46 class HostContainer : public CFXJS_EmbedObj
47 {
48 public:
49 HostContainer(CFXJS_Object* pJSObject);
50 virtual ~HostContainer(void);
51
52 public:
53
84 FX_BOOL messageHandler(OBJ_PROP_PARAMS);
85
100 FX_BOOL postMessage(OBJ_METHOD_PARAMS);
101 };
102
103 class CFXJS_HostContainer : public CFXJS_Object
104 {
105 public:
106 CFXJS_HostContainer(CFXJS_Runtime* pRuntime)
107 : CFXJS_Object(pRuntime){};
108 virtual ~CFXJS_HostContainer(void){};
109
110 DECLARE_JS_CLASS(CFXJS_HostContainer);
111
112 JS_STATIC_PROP(messageHandler, HostContainer);
113
114 JS_STATIC_METHOD(postMessage, HostContainer);
115 };
116 } // namespace javascript
117
118 #endif
HostContainer
This object manages communication between a PDF document and a corresponding host container that the ...
Definition: hostcontainer.h:46


Javascript API: icon.h Source File

  • src
  • javascript
  • inc
icon.h
1 #ifndef _ICON_H_
2 #define _ICON_H_
3
5 namespace javascript {
7
17 class Icon : public CFXJS_EmbedObj
18 {
19 public:
20 Icon(CFXJS_Object* pJSObject);
21 virtual ~Icon();
22
23 public:
24 FX_BOOL name(OBJ_PROP_PARAMS);
25
26 public:
27 void SetStream(CPDF_Stream* pIconStream);
28 CPDF_Stream* GetStream();
29 void SetIconName(CFX_WideString name);
30 CFX_WideString GetIconName();
31 void SetBitMap(CFX_DIBitmap* pBitMap);
32 CFX_DIBitmap* GetBitMap();
33
34 private:
35 CPDF_Stream* m_pIconStream;
36 CFX_WideString m_swIconName;
37 std::unique_ptr<CFX_DIBitmap> m_pBitMap;
38 };
39
40 class CFXJS_Icon : public CFXJS_Object
41 {
42 public:
43 CFXJS_Icon(CFXJS_Runtime* pRuntime)
44 : CFXJS_Object(pRuntime){};
45 virtual ~CFXJS_Icon(){};
46
47 public:
48 DECLARE_JS_CLASS(CFXJS_Icon);
49
50 JS_STATIC_PROP(name, Icon);
51 };
52
53 class Icon_Stream : public CFXJS_EmbedObj
54 {
55 public:
56 Icon_Stream(CFXJS_Object* pJSObject);
57 virtual ~Icon_Stream();
58
59 public:
60 FX_BOOL width(OBJ_PROP_PARAMS);
61 FX_BOOL height(OBJ_PROP_PARAMS);
62
63 FX_BOOL read(OBJ_METHOD_PARAMS);
64
65 void SetBitMap(CFX_DIBitmap* pBitMap);
66 CFX_DIBitmap* GetBitMap();
67
68 private:
69 CFX_DIBitmap* m_pBitMap;
70 };
71
72 class CFXJS_Icon_Stream : public CFXJS_Object
73 {
74 public:
75 CFXJS_Icon_Stream(CFXJS_Runtime* pRuntime)
76 : CFXJS_Object(pRuntime){};
77 virtual ~CFXJS_Icon_Stream(){};
78
79 public:
80 DECLARE_JS_CLASS(CFXJS_Icon_Stream);
81
82 JS_STATIC_PROP(width, Icon_Stream);
83 JS_STATIC_PROP(height, Icon_Stream);
84
85 JS_STATIC_METHOD(read, Icon_Stream);
86 };
87 } // namespace javascript
88
89 #endif //_ICON_H_
Icon
This generic JavaScript object is an opaque representation of a Form XObject appearance stored in the...
Definition: icon.h:17


Javascript API: identity.h Source File

  • src
  • javascript
  • inc
identity.h
1 #ifndef _IDENTITY_H_
2 #define _IDENTITY_H_
3 namespace javascript {
6
10 class identity : public CFXJS_EmbedObj
11 {
12 public:
13 identity(CFXJS_Object* pJSObject);
14 ~identity();
15
16 public:
17
28 FX_BOOL corporation(OBJ_PROP_PARAMS);
29
40 FX_BOOL email(OBJ_PROP_PARAMS);
41
52 FX_BOOL loginName(OBJ_PROP_PARAMS);
53
70 FX_BOOL name(OBJ_PROP_PARAMS);
71 FX_BOOL lastName(OBJ_PROP_PARAMS);
72 FX_BOOL firstName(OBJ_PROP_PARAMS);
73 FX_BOOL department(OBJ_PROP_PARAMS);
74 FX_BOOL title(OBJ_PROP_PARAMS);
75 FX_BOOL corpAbbrev(OBJ_PROP_PARAMS);
76
77 public:
78 JS_IDENTITY_INFO GetIdentityInfo();
79 FX_INT32 QueryProperty(FX_BSTR szPropName);
80 FX_BOOL
81 DoProperty(FXJSE_HVALUE hValue, FX_BSTR szPropName, JS_ErrorString& sError, FX_BOOL IsSet);
82 FX_BOOL DelProperty(FX_BSTR szPropName, JS_ErrorString& sError);
83
84 private:
85 CFX_WideString m_sName;
86 CFX_ByteString m_sEmailAddress;
87 CFX_ByteString m_sCorporation;
88 };
89
90 class CFXJS_identity : public CFXJS_Object
91 {
92 public:
93 CFXJS_identity(CFXJS_Runtime* pRuntime)
94 : CFXJS_Object(pRuntime){};
95 virtual ~CFXJS_identity(){};
96
97 public:
98 DECLARE_JS_CLASS(CFXJS_identity);
99
100 JS_STATIC_PROP(corporation, identity);
101 JS_STATIC_PROP(email, identity);
102 JS_STATIC_PROP(loginName, identity);
103 JS_STATIC_PROP(name, identity);
104 JS_STATIC_PROP(lastName, identity);
105 JS_STATIC_PROP(firstName, identity);
106 JS_STATIC_PROP(department, identity);
107 JS_STATIC_PROP(title, identity);
108 JS_STATIC_PROP(corpAbbrev, identity);
109 };
110 } // namespace javascript
111
112 #endif //_IDENTITY_H_
identity
This is a static object that identifies the current user of the application.
Definition: identity.h:10


Javascript API: javascript.h Source File

  • src
  • javascript
  • inc
javascript.h
1 #ifndef _JAVASCRIPT_H_
2 #define _JAVASCRIPT_H_
3
4 #ifndef _JAVASCRIPT_
5 #define _JAVASCRIPT_
6 #endif
7
8 #include "pdfwindow/pwl_wnd.h"
9 #include "pdfwindow/pwl_utils.h"
10 #include "./fpdfapi/fpdf_module.h"
11 #include "./fpdfapi/fpdf_pageobj.h"
12 #include "./fpdfapi/fpdf_parser.h"
13 #include "./fpdfdoc/fpdf_doc.h"
14 #include "./fxcrt/fx_system.h"
15 #include "./fxcrt/fx_xml.h"
16 #include "./fxcrt/fx_basic.h"
17 #include "./fxcrt/fx_ext.h"
18 #include "./fxcrt/fx_process.h"
19 #include "./fdrm/fx_crypt.h"
20 #include "./fxge/fx_color.h"
21 #include "signature/fpdf_signature.h"
22
23 #include "js_define.h"
24 #include "js_interface.h"
25 #include "js_resource.h"
26
27 #include "js_wrapperTools.h"
28 #include "js_object.h"
29 #include "jjs_root.h"
30 #include "js_context.h"
31 #include "js_eventhandler.h"
32 #include "js_runtime.h"
33 #include "field.h"
34 #include "document.h"
35 #include "js_module.h"
36 #include "js_globaldata.h"
37 #include "global.h"
38 #include <string>
39 #include <vector>
40
41 namespace javascript {
42 using namespace javascript;
43 template <class TYPE>
44 #define FXLOWORD(l) ((FX_WORD)((FX_DWORD)(l)) & 0xffff)
45 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
46 {
47 public:
48 CGW_ArrayTemplate() {}
49 virtual ~CGW_ArrayTemplate() {}
50
51 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);
52
53 void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = true)
54 {
55 int nSize = this->GetSize();
56 QuickSort(0, nSize - 1, bAscent, pCompare);
57 }
58
59 private:
60 void QuickSort(FX_UINT32 nStartPos, FX_UINT32 nStopPos, FX_BOOL bAscend, LP_COMPARE pCompare)
61 {
62 if (nStartPos >= nStopPos)
63 return;
64
65 if ((nStopPos - nStartPos) == 1)
66 {
67 TYPE Value1 = this->GetAt(nStartPos);
68 TYPE Value2 = this->GetAt(nStopPos);
69
70 int iGreate = (*pCompare)(Value1, Value2);
71 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
72 {
73 this->SetAt(nStartPos, Value2);
74 this->SetAt(nStopPos, Value1);
75 }
76 return;
77 }
78
79 FX_UINT32 m = (nStartPos + nStopPos) / 2;
80 FX_UINT32 i = nStartPos;
81
82 TYPE Value = this->GetAt(m);
83
84 while (i < m)
85 {
86 TYPE temp = this->GetAt(i);
87
88 int iGreate = (*pCompare)(temp, Value);
89 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
90 {
91 this->InsertAt(m + 1, temp);
92 this->RemoveAt(i);
93 m--;
94 }
95 else
96 {
97 i++;
98 }
99 }
100
101 FX_UINT32 j = nStopPos;
102
103 while (j > m)
104 {
105 TYPE temp = this->GetAt(j);
106
107 int iGreate = (*pCompare)(temp, Value);
108 if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0))
109 {
110 this->RemoveAt(j);
111 this->InsertAt(m, temp);
112 m++;
113 }
114 else
115 {
116 j--;
117 }
118 }
119
120 if (nStartPos < m)
121 QuickSort(nStartPos, m, bAscend, pCompare);
122 if (nStopPos > m)
123 QuickSort(m, nStopPos, bAscend, pCompare);
124 }
125 };
126 } // namespace javascript
127
128 //#endif //#ifdef _JAVASCRIPT_
129
130 #endif //_JAVASCRIPT_H_
global.h
JavaScript API for global.
document.h
JavaScript API for Doc object.
field.h
JavaScript API for Field.


Javascript API: jhelper.h Source File

  • src
  • javascript
  • inc
jhelper.h
1 #ifndef JAVASCRIPT_INCLUDE_HELPER_H_
2 #define JAVASCRIPT_INCLUDE_HELPER_H_
3
4 //#include <optional>
5
6 namespace javascript {
10 bool IsNamedArguments(CFXJSE_Arguments& args);
11
12 class NamedArguments
13 {
14 public:
15 NamedArguments(const CFXJSE_Arguments& args, FXJSE_HRUNTIME hRuntime);
16 FX_INT32 GetInt32(FX_BSTR szName, bool bAllowConversion = true);
17 FX_BOOL GetBoolean(FX_BSTR szName, bool bAllowConversion = true);
18 FX_FLOAT GetFloat(FX_BSTR szName, bool bAllowConversion = true);
19 CFX_ByteString GetUtf8String(FX_BSTR szName, bool bAllowConversion = true);
20 FX_BOOL IsNull(FX_BSTR szName);
21 FX_BOOL IsUndefined(FX_BSTR szName);
22
23 virtual ~NamedArguments();
24
25 private:
26 FXJSE_HVALUE m_hValue;
27 FXJSE_HRUNTIME m_hRuntime;
28 };
29
30 // used to automatically release FXJSE_HVALUE instead of calling FXJSE_Value_Release()
31 class FXJSEValueReleaser
32 {
33 public:
34 FXJSEValueReleaser(FXJSE_HRUNTIME hRuntime);
35 ~FXJSEValueReleaser();
36 FXJSE_HVALUE GetFXJSEValue();
37
38 private:
39 FXJSE_HVALUE m_hFXJSEValue;
40 };
41
42 } // namespace javascript
43
44 #endif // JAVASCRIPT_INCLUDE_HELPER_H_


Javascript API: jjs_root.h Source File

  • src
  • javascript
  • inc
jjs_root.h
1 #ifndef _JS_ROOT_H
2 #define _JS_ROOT_H
3
4 namespace javascript {
5 using namespace engine;
6
7 CFX_WideString JSLoadStringFromID(JS_RC_STRING_ID ID);
8
9 class Root : public CFXJS_EmbedObj
10 {
11 public:
12 Root(CFXJS_Object* pJSObject);
13 virtual ~Root(){};
14
15 public:
16 FX_BOOL app(OBJ_PROP_PARAMS);
17 FX_BOOL console(OBJ_PROP_PARAMS);
18 FX_BOOL global(OBJ_PROP_PARAMS);
19 FX_BOOL color(OBJ_PROP_PARAMS);
20 FX_BOOL util(OBJ_PROP_PARAMS);
21 FX_BOOL event(OBJ_PROP_PARAMS);
22 FX_BOOL SOAP(OBJ_PROP_PARAMS);
23 FX_BOOL ReadStream(OBJ_PROP_PARAMS);
24 FX_BOOL StreamDigest(OBJ_PROP_PARAMS);
25 FX_BOOL identity(OBJ_PROP_PARAMS);
26 FX_BOOL Collab(OBJ_PROP_PARAMS);
27 FX_BOOL cursor(OBJ_PROP_PARAMS);
28 FX_BOOL ADBC(OBJ_PROP_PARAMS);
29 FX_BOOL search(OBJ_PROP_PARAMS);
30 FX_BOOL Span(OBJ_PROP_PARAMS);
31 FX_BOOL security(OBJ_PROP_PARAMS);
32
33 // cpdf 需要添加的
34 FX_BOOL FX(OBJ_PROP_PARAMS);
35
36 FX_BOOL http(OBJ_PROP_PARAMS);
37 // FX_BOOL connectedPdf(OBJ_PROP_PARAMS);
38 FX_BOOL appEvents(OBJ_PROP_PARAMS);
39 FX_BOOL methodProxy(OBJ_PROP_PARAMS);
40 FX_BOOL localStorage(OBJ_PROP_PARAMS);
41
42 //=============== const ====================
43 FX_BOOL border(OBJ_PROP_PARAMS);
44 FX_BOOL display(OBJ_PROP_PARAMS);
45 FX_BOOL font(OBJ_PROP_PARAMS);
46 FX_BOOL highlight(OBJ_PROP_PARAMS);
47 FX_BOOL position(OBJ_PROP_PARAMS);
48 FX_BOOL scaleHow(OBJ_PROP_PARAMS);
49 FX_BOOL scaleWhen(OBJ_PROP_PARAMS);
50 FX_BOOL style(OBJ_PROP_PARAMS);
51 FX_BOOL zoomtype(OBJ_PROP_PARAMS);
52
53 //=================Global Prop ===================
54 FX_BOOL IDS_GREATER_THAN(OBJ_PROP_PARAMS);
55 FX_BOOL IDS_GT_AND_LT(OBJ_PROP_PARAMS);
56 FX_BOOL IDS_LESS_THAN(OBJ_PROP_PARAMS);
57 FX_BOOL IDS_INVALID_MONTH(OBJ_PROP_PARAMS);
58 FX_BOOL IDS_INVALID_DATE(OBJ_PROP_PARAMS);
59 FX_BOOL IDS_INVALID_VALUE(OBJ_PROP_PARAMS);
60 FX_BOOL IDS_AM(OBJ_PROP_PARAMS);
61 FX_BOOL IDS_PM(OBJ_PROP_PARAMS);
62 FX_BOOL IDS_MONTH_INFO(OBJ_PROP_PARAMS);
63 FX_BOOL IDS_STARTUP_CONSOLE_MSG(OBJ_PROP_PARAMS);
64
65 FX_BOOL RE_NUMBER_ENTRY_DOT_SEP(OBJ_PROP_PARAMS);
66 FX_BOOL RE_NUMBER_COMMIT_DOT_SEP(OBJ_PROP_PARAMS);
67 FX_BOOL RE_NUMBER_ENTRY_COMMA_SEP(OBJ_PROP_PARAMS);
68 FX_BOOL RE_NUMBER_COMMIT_COMMA_SEP(OBJ_PROP_PARAMS);
69 FX_BOOL RE_ZIP_ENTRY(OBJ_PROP_PARAMS);
70 FX_BOOL RE_ZIP_COMMIT(OBJ_PROP_PARAMS);
71 FX_BOOL RE_ZIP4_ENTRY(OBJ_PROP_PARAMS);
72 FX_BOOL RE_ZIP4_COMMIT(OBJ_PROP_PARAMS);
73 FX_BOOL RE_PHONE_ENTRY(OBJ_PROP_PARAMS);
74 FX_BOOL RE_PHONE_COMMIT(OBJ_PROP_PARAMS);
75 FX_BOOL RE_SSN_ENTRY(OBJ_PROP_PARAMS);
76 FX_BOOL RE_SSN_COMMIT(OBJ_PROP_PARAMS);
77
78 //=================Global Method===================
79 FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);
80 FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);
81 FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);
82 FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);
83 FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);
84 FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);
85 FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);
86 FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);
87 FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //
88 FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);
89 FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);
90 FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);
91 FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);
92 FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);
93 FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS); //
94 FX_BOOL AFSimple(OBJ_METHOD_PARAMS);
95 FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);
96 FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);
97 FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);
98 FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS);
99 FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);
100 FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);
101
102 public:
103 FX_BOOL SetValueByName(FXJSE_HVALUE hValue, FX_LPCSTR name);
104 FX_BOOL Date_Keystroke(CFX_WideString& sFormat, CFXJS_Context* pContext);
105 FX_BOOL ParseDate(CFX_WideString& sFormat, CFXJS_Context* pContext);
106 FX_BOOL Special_KeystrokeEx(CFX_WideString& wstrMask, CFXJS_Context* pContext);
107 FX_BOOL DecimalsCounts(CFX_ByteString csNumber, int& nCount);
108 FX_BOOL ModificationValue(int nCount, int& nValue);
109 };
110
111 class CFXJS_Root : public CFXJS_Object
112 {
113 public:
114 CFXJS_Root(CFXJS_Runtime* pRuntime);
115 virtual ~CFXJS_Root();
116
117 DECLARE_ROOT_CLASS(CFXJS_Root);
118
119 JS_STATIC_PROP(app, Root);
120 JS_STATIC_PROP(console, Root);
121 JS_STATIC_PROP(global, Root);
122 JS_STATIC_PROP(util, Root);
123 JS_STATIC_PROP(color, Root);
124 JS_STATIC_PROP(event, Root);
125 JS_STATIC_PROP(SOAP, Root);
126 JS_STATIC_PROP(ReadStream, Root);
127 JS_STATIC_PROP(StreamDigest, Root);
128 JS_STATIC_PROP(identity, Root);
129 JS_STATIC_PROP(Collab, Root);
130 JS_STATIC_PROP(cursor, Root);
131 JS_STATIC_PROP(ADBC, Root);
132 JS_STATIC_PROP(search, Root);
133 JS_STATIC_PROP(Span, Root)
134 JS_STATIC_PROP(security, Root);
135
136 //=====================Const Prop =============
137 JS_STATIC_PROP(border, Root);
138 JS_STATIC_PROP(display, Root);
139 JS_STATIC_PROP(font, Root);
140 JS_STATIC_PROP(highlight, Root);
141 JS_STATIC_PROP(position, Root);
142 JS_STATIC_PROP(scaleHow, Root);
143 JS_STATIC_PROP(scaleWhen, Root);
144 JS_STATIC_PROP(style, Root);
145 JS_STATIC_PROP(zoomtype, Root);
146
147 //=====================Global Prop ============
148 JS_STATIC_PROP(IDS_GREATER_THAN, Root);
149 JS_STATIC_PROP(IDS_GT_AND_LT, Root);
150 JS_STATIC_PROP(IDS_LESS_THAN, Root);
151 JS_STATIC_PROP(IDS_INVALID_MONTH, Root);
152 JS_STATIC_PROP(IDS_INVALID_DATE, Root);
153 JS_STATIC_PROP(IDS_INVALID_VALUE, Root);
154 JS_STATIC_PROP(IDS_AM, Root);
155 JS_STATIC_PROP(IDS_PM, Root);
156 JS_STATIC_PROP(IDS_MONTH_INFO, Root);
157 JS_STATIC_PROP(IDS_STARTUP_CONSOLE_MSG, Root);
158
159 JS_STATIC_PROP(RE_NUMBER_ENTRY_DOT_SEP, Root);
160 JS_STATIC_PROP(RE_NUMBER_COMMIT_DOT_SEP, Root);
161 JS_STATIC_PROP(RE_NUMBER_ENTRY_COMMA_SEP, Root);
162 JS_STATIC_PROP(RE_NUMBER_COMMIT_COMMA_SEP, Root);
163 JS_STATIC_PROP(RE_ZIP_ENTRY, Root);
164 JS_STATIC_PROP(RE_ZIP_COMMIT, Root);
165 JS_STATIC_PROP(RE_ZIP4_ENTRY, Root);
166 JS_STATIC_PROP(RE_ZIP4_COMMIT, Root);
167 JS_STATIC_PROP(RE_PHONE_ENTRY, Root);
168 JS_STATIC_PROP(RE_PHONE_COMMIT, Root);
169 JS_STATIC_PROP(RE_SSN_ENTRY, Root);
170 JS_STATIC_PROP(RE_SSN_COMMIT, Root);
171 //=====================cpdf 需要添加;的======
172 JS_STATIC_PROP(appEvents, Root);
173 JS_STATIC_PROP(methodProxy, Root);
174 ;
175 JS_STATIC_PROP(localStorage, Root);
176 JS_STATIC_PROP(http, Root);
177 // JS_STATIC_PROP(connectedPdf, Root);
178 JS_STATIC_PROP(FX, Root);
179
180 //======================Global Method ==========
181 JS_STATIC_METHOD(AFNumber_Format, Root);
182 JS_STATIC_METHOD(AFNumber_Keystroke, Root);
183 JS_STATIC_METHOD(AFPercent_Format, Root);
184 JS_STATIC_METHOD(AFPercent_Keystroke, Root);
185 JS_STATIC_METHOD(AFDate_FormatEx, Root);
186 JS_STATIC_METHOD(AFDate_KeystrokeEx, Root);
187 JS_STATIC_METHOD(AFDate_Format, Root);
188 JS_STATIC_METHOD(AFDate_Keystroke, Root);
189 JS_STATIC_METHOD(AFTime_FormatEx, Root);
190 JS_STATIC_METHOD(AFTime_KeystrokeEx, Root);
191 JS_STATIC_METHOD(AFTime_Format, Root);
192 JS_STATIC_METHOD(AFTime_Keystroke, Root);
193 JS_STATIC_METHOD(AFSpecial_Format, Root);
194 JS_STATIC_METHOD(AFSpecial_Keystroke, Root);
195 JS_STATIC_METHOD(AFSpecial_KeystrokeEx, Root);
196 JS_STATIC_METHOD(AFSimple, Root);
197 JS_STATIC_METHOD(AFMakeNumber, Root);
198 JS_STATIC_METHOD(AFSimple_Calculate, Root);
199 JS_STATIC_METHOD(AFRange_Validate, Root);
200 JS_STATIC_METHOD(AFMergeChange, Root);
201 JS_STATIC_METHOD(AFParseDateEx, Root);
202 JS_STATIC_METHOD(AFExtractNums, Root);
203 static void isNumber_static(FXJSE_HOBJECT hThis, FX_BSTR szFuncName, CFXJSE_Arguments& args);
204
205 public:
206 static double MakeRegularDate(const CFX_WideString& value,
207 const CFX_WideString& format,
208 FX_BOOL& bWrongFormat,
209 CFXJS_Runtime* pRuntime);
210 static CFX_WideString
211 MakeFormatDate(double dDate, const CFX_WideString& format, CFXJS_Context* pContext);
212 static FX_BOOL ConvertStringToNumber(
213 FX_LPCWSTR swSource, double& dRet, FX_BOOL& bDot, FX_BOOL bSureSep, char cSeperator = '.');
214
215 static double ParseNormalDate(const CFX_WideString& value,
216 FX_BOOL& bWrongFormat,
217 CFXJS_Runtime* pRuntime,
218 FX_BOOL bHasMin);
219 static double MakeInterDate(CFX_WideString strValue, CFXJS_Runtime* pRuntime);
220
221 static FX_BOOL
222 GuessDate(int nCount, int n1, int n2, int n3, int& nYear, int& nMonth, int& nDay);
223 static FX_BOOL GuessTime(int nCount, int n1, int n2, int n3, int& nHour, int& nMin, int& nSec);
224 static double ParseDate(CFXJS_Runtime* pRuntime, CFX_ByteString& cbString);
225
226 public:
227 static CFX_WideString StrLTrim(FX_LPCWSTR pStr);
228 static CFX_WideString StrRTrim(FX_LPCWSTR pStr);
229 static CFX_WideString StrTrim(FX_LPCWSTR pStr);
230
231 static CFX_ByteString StrLTrim(FX_LPCSTR pStr);
232 static CFX_ByteString StrRTrim(FX_LPCSTR pStr);
233 static CFX_ByteString StrTrim(FX_LPCSTR pStr);
234 static FX_BOOL IsNumber(FX_LPCWSTR string);
235
236 static FX_BOOL IsAlphabetic(wchar_t ch);
237 static FX_BOOL IsAlphaNumeric(wchar_t ch);
238
239 static FX_BOOL maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
240 static FX_BOOL isReservedMaskChar(wchar_t ch);
241
242 static double AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);
243 static void deleteZerobeforeNumber(CFX_WideString& value);
244 static void SplitString(CFX_WideString& value);
245 static FX_BOOL GetSeperator(CPDF_FormField* pFormField, char& cSeperator);
246 };
247
248 // ================ cpdf =======================
250 class FX : public CFXJS_EmbedObj
251 {
252 public:
253 FX(CFXJS_Object* pJSObject);
254 virtual ~FX() {}
255
256 public:
257 FX_BOOL app(OBJ_PROP_PARAMS);
258 FX_BOOL console(OBJ_PROP_PARAMS);
259 FX_BOOL global(OBJ_PROP_PARAMS);
260 FX_BOOL color(OBJ_PROP_PARAMS);
261 FX_BOOL util(OBJ_PROP_PARAMS);
262 FX_BOOL event(OBJ_PROP_PARAMS);
263 FX_BOOL SOAP(OBJ_PROP_PARAMS);
264 FX_BOOL identity(OBJ_PROP_PARAMS);
265 FX_BOOL Collab(OBJ_PROP_PARAMS);
266 FX_BOOL cursor(OBJ_PROP_PARAMS);
267 FX_BOOL ADBC(OBJ_PROP_PARAMS);
268 FX_BOOL search(OBJ_PROP_PARAMS);
269
270 FX_BOOL http(OBJ_PROP_PARAMS);
271 // FX_BOOL connectedPdf(OBJ_PROP_PARAMS);
272 FX_BOOL appEvents(OBJ_PROP_PARAMS);
273 FX_BOOL methodProxy(OBJ_PROP_PARAMS);
274 FX_BOOL localStorage(OBJ_PROP_PARAMS);
275 FX_BOOL localFileStorage(OBJ_PROP_PARAMS);
276 // FX_BOOL user(OBJ_PROP_PARAMS);
277 FX_BOOL panelSet(OBJ_PROP_PARAMS);
278 FX_BOOL i18n(OBJ_PROP_PARAMS);
279
280 //=============== const ====================
281 FX_BOOL border(OBJ_PROP_PARAMS);
282 FX_BOOL display(OBJ_PROP_PARAMS);
283 FX_BOOL font(OBJ_PROP_PARAMS);
284 FX_BOOL highlight(OBJ_PROP_PARAMS);
285 FX_BOOL position(OBJ_PROP_PARAMS);
286 FX_BOOL scaleHow(OBJ_PROP_PARAMS);
287 FX_BOOL scaleWhen(OBJ_PROP_PARAMS);
288 FX_BOOL style(OBJ_PROP_PARAMS);
289 FX_BOOL zoomtype(OBJ_PROP_PARAMS);
290
291 //=================Global Prop ===================
292 FX_BOOL IDS_GREATER_THAN(OBJ_PROP_PARAMS);
293 FX_BOOL IDS_GT_AND_LT(OBJ_PROP_PARAMS);
294 FX_BOOL IDS_LESS_THAN(OBJ_PROP_PARAMS);
295 FX_BOOL IDS_INVALID_MONTH(OBJ_PROP_PARAMS);
296 FX_BOOL IDS_INVALID_DATE(OBJ_PROP_PARAMS);
297 FX_BOOL IDS_INVALID_VALUE(OBJ_PROP_PARAMS);
298 FX_BOOL IDS_AM(OBJ_PROP_PARAMS);
299 FX_BOOL IDS_PM(OBJ_PROP_PARAMS);
300 FX_BOOL IDS_MONTH_INFO(OBJ_PROP_PARAMS);
301 FX_BOOL IDS_STARTUP_CONSOLE_MSG(OBJ_PROP_PARAMS);
302
303 FX_BOOL RE_NUMBER_ENTRY_DOT_SEP(OBJ_PROP_PARAMS);
304 FX_BOOL RE_NUMBER_COMMIT_DOT_SEP(OBJ_PROP_PARAMS);
305 FX_BOOL RE_NUMBER_ENTRY_COMMA_SEP(OBJ_PROP_PARAMS);
306 FX_BOOL RE_NUMBER_COMMIT_COMMA_SEP(OBJ_PROP_PARAMS);
307 FX_BOOL RE_ZIP_ENTRY(OBJ_PROP_PARAMS);
308 FX_BOOL RE_ZIP_COMMIT(OBJ_PROP_PARAMS);
309 FX_BOOL RE_ZIP4_ENTRY(OBJ_PROP_PARAMS);
310 FX_BOOL RE_ZIP4_COMMIT(OBJ_PROP_PARAMS);
311 FX_BOOL RE_PHONE_ENTRY(OBJ_PROP_PARAMS);
312 FX_BOOL RE_PHONE_COMMIT(OBJ_PROP_PARAMS);
313 FX_BOOL RE_SSN_ENTRY(OBJ_PROP_PARAMS);
314 FX_BOOL RE_SSN_COMMIT(OBJ_PROP_PARAMS);
315
316 //=================Global Method===================
317 FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);
318 FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);
319 FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);
320 FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);
321 FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);
322 FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);
323 FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);
324 FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);
325 FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //
326 FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);
327 FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);
328 FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);
329 FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);
330 FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);
331 FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS); //
332 FX_BOOL AFSimple(OBJ_METHOD_PARAMS);
333 FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);
334 FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);
335 FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);
336 FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS);
337 FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);
338 FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);
339
340 public:
341 FX_BOOL SetValueByName(FXJSE_HVALUE hValue, FX_LPCSTR name);
342 FX_BOOL Date_Keystroke(CFX_WideString& sFormat, CFXJS_Context* pContext);
343 FX_BOOL ParseDate(CFX_WideString& sFormat, CFXJS_Context* pContext);
344 FX_BOOL Special_KeystrokeEx(CFX_WideString& wstrMask, CFXJS_Context* pContext);
345 FX_BOOL DecimalsCounts(CFX_ByteString csNumber, int& nCount);
346 FX_BOOL ModificationValue(int nCount, int& nValue);
347 };
348
349 class CFXJS_FX : public CFXJS_Object
350 {
351 public:
352 CFXJS_FX(CFXJS_Runtime* pRuntime);
353 virtual ~CFXJS_FX();
354
355 DECLARE_JS_CLASS(CFXJS_FX);
356
357 JS_STATIC_PROP(app, FX);
358 JS_STATIC_PROP(console, FX);
359 JS_STATIC_PROP(global, FX);
360 JS_STATIC_PROP(util, FX);
361 JS_STATIC_PROP(color, FX);
362 JS_STATIC_PROP(event, FX);
363 JS_STATIC_PROP(SOAP, FX);
364 JS_STATIC_PROP(identity, FX);
365 JS_STATIC_PROP(Collab, FX);
366 JS_STATIC_PROP(cursor, FX);
367 JS_STATIC_PROP(ADBC, FX);
368 JS_STATIC_PROP(search, FX);
369
370 //=====================Const Prop =============
371 JS_STATIC_PROP(border, FX);
372 JS_STATIC_PROP(display, FX);
373 JS_STATIC_PROP(font, FX);
374 JS_STATIC_PROP(highlight, FX);
375 JS_STATIC_PROP(position, FX);
376 JS_STATIC_PROP(scaleHow, FX);
377 JS_STATIC_PROP(scaleWhen, FX);
378 JS_STATIC_PROP(style, FX);
379 JS_STATIC_PROP(zoomtype, FX);
380
381 //=====================Global Prop ============
382 JS_STATIC_PROP(IDS_GREATER_THAN, FX);
383 JS_STATIC_PROP(IDS_GT_AND_LT, FX);
384 JS_STATIC_PROP(IDS_LESS_THAN, FX);
385 JS_STATIC_PROP(IDS_INVALID_MONTH, FX);
386 JS_STATIC_PROP(IDS_INVALID_DATE, FX);
387 JS_STATIC_PROP(IDS_INVALID_VALUE, FX);
388 JS_STATIC_PROP(IDS_AM, FX);
389 JS_STATIC_PROP(IDS_PM, FX);
390 JS_STATIC_PROP(IDS_MONTH_INFO, FX);
391 JS_STATIC_PROP(IDS_STARTUP_CONSOLE_MSG, FX);
392
393 JS_STATIC_PROP(RE_NUMBER_ENTRY_DOT_SEP, FX);
394 JS_STATIC_PROP(RE_NUMBER_COMMIT_DOT_SEP, FX)
395 JS_STATIC_PROP(RE_NUMBER_ENTRY_COMMA_SEP, FX)
396 JS_STATIC_PROP(RE_NUMBER_COMMIT_COMMA_SEP, FX)
397 JS_STATIC_PROP(RE_ZIP_ENTRY, FX)
398 JS_STATIC_PROP(RE_ZIP_COMMIT, FX)
399 JS_STATIC_PROP(RE_ZIP4_ENTRY, FX)
400 JS_STATIC_PROP(RE_ZIP4_COMMIT, FX)
401 JS_STATIC_PROP(RE_PHONE_ENTRY, FX)
402 JS_STATIC_PROP(RE_PHONE_COMMIT, FX)
403 JS_STATIC_PROP(RE_SSN_ENTRY, FX)
404 JS_STATIC_PROP(RE_SSN_COMMIT, FX)
405 //=====================cpdf 需要添加的======
406 JS_STATIC_PROP(appEvents, FX)
407 JS_STATIC_PROP(methodProxy, FX)
408 JS_STATIC_PROP(localStorage, FX)
409 JS_STATIC_PROP(localFileStorage, FX)
410 // JS_STATIC_PROP(http, FX);
411 JS_STATIC_PROP(panelSet, FX);
412 // JS_STATIC_PROP(connectedPdf, FX);
413 // JS_STATIC_PROP(user, FX);
414 JS_STATIC_PROP(i18n, FX)
415
416 //======================Global Method ==========
417 JS_STATIC_METHOD(AFNumber_Format, FX);
418 JS_STATIC_METHOD(AFNumber_Keystroke, FX);
419 JS_STATIC_METHOD(AFPercent_Format, FX);
420 JS_STATIC_METHOD(AFPercent_Keystroke, FX);
421 JS_STATIC_METHOD(AFDate_FormatEx, FX);
422 JS_STATIC_METHOD(AFDate_KeystrokeEx, FX);
423 JS_STATIC_METHOD(AFDate_Format, FX);
424 JS_STATIC_METHOD(AFDate_Keystroke, FX);
425 JS_STATIC_METHOD(AFTime_FormatEx, FX);
426 JS_STATIC_METHOD(AFTime_KeystrokeEx, FX);
427 JS_STATIC_METHOD(AFTime_Format, FX);
428 JS_STATIC_METHOD(AFTime_Keystroke, FX);
429 JS_STATIC_METHOD(AFSpecial_Format, FX);
430 JS_STATIC_METHOD(AFSpecial_Keystroke, FX);
431 JS_STATIC_METHOD(AFSpecial_KeystrokeEx, FX);
432 JS_STATIC_METHOD(AFSimple, FX);
433 JS_STATIC_METHOD(AFMakeNumber, FX);
434 JS_STATIC_METHOD(AFSimple_Calculate, FX);
435 JS_STATIC_METHOD(AFRange_Validate, FX);
436 JS_STATIC_METHOD(AFMergeChange, FX);
437 JS_STATIC_METHOD(AFParseDateEx, FX);
438 JS_STATIC_METHOD(AFExtractNums, FX);
439 static void isNumber_static(FXJSE_HOBJECT hThis, FX_BSTR szFuncName, CFXJSE_Arguments& args);
440
441 public:
442 static FX_BOOL IsDigit(char ch);
443 static FX_BOOL IsDigit(wchar_t ch);
444 static int
445 ParseStringInteger(const CFX_WideString& string, int nStart, int& nSkip, int nMaxStep);
446 static CFX_WideString ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
447 static double MakeRegularDate(const CFX_WideString& value,
448 const CFX_WideString& format,
449 FX_BOOL& bWrongFormat,
450 CFXJS_Runtime* pRuntime);
451 static CFX_WideString
452 MakeFormatDate(double dDate, const CFX_WideString& format, CFXJS_Context* pContext);
453 static FX_BOOL ConvertStringToNumber(
454 FX_LPCWSTR swSource, double& dRet, FX_BOOL& bDot, FX_BOOL bSureSep, char cSeperator = '.');
455 static double ParseStringToNumber(FX_LPCWSTR swSource);
456 static double ParseFormatDate(const CFX_WideString& value,
457 const CFX_WideString& format,
458 FX_BOOL& bWrongFormat,
459 FX_BOOL& bHasMin,
460 const CFX_WideStringArray& sMonthsArr,
461 const CFX_WideStringArray& sFullMonthsArr);
462 static double ParseNormalDate(const CFX_WideString& value,
463 FX_BOOL& bWrongFormat,
464 CFXJS_Runtime* pRuntime,
465 FX_BOOL bHasMin);
466 static double MakeInterDate(CFX_WideString strValue, CFXJS_Runtime* pRuntime);
467 static double ParseNumber(FX_LPCWSTR swSource,
468 FX_BOOL& bAllDigits,
469 FX_BOOL& bDot,
470 FX_BOOL& bSign,
471 FX_BOOL& bKXJS,
472 FX_BOOL bSureSep = false,
473 char cSeperator = ',');
474 static FX_BOOL
475 GuessDate(int nCount, int n1, int n2, int n3, int& nYear, int& nMonth, int& nDay);
476 static FX_BOOL GuessTime(int nCount, int n1, int n2, int n3, int& nHour, int& nMin, int& nSec);
477 static double ParseDate(CFXJS_Runtime* pRuntime, CFX_ByteString& cbString);
478
479 public:
480 static CFX_WideString StrLTrim(FX_LPCWSTR pStr);
481 static CFX_WideString StrRTrim(FX_LPCWSTR pStr);
482 static CFX_WideString StrTrim(FX_LPCWSTR pStr);
483
484 static CFX_ByteString StrLTrim(FX_LPCSTR pStr);
485 static CFX_ByteString StrRTrim(FX_LPCSTR pStr);
486 static CFX_ByteString StrTrim(FX_LPCSTR pStr);
487
488 static FX_BOOL IsNumber(FX_LPCSTR string);
489 static FX_BOOL IsNumber(FX_LPCWSTR string);
490
491 static FX_BOOL IsAlphabetic(wchar_t ch);
492 static FX_BOOL IsAlphaNumeric(wchar_t ch);
493
494 static FX_BOOL maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
495 static FX_BOOL isReservedMaskChar(wchar_t ch);
496
497 static double AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);
498 static void deleteZerobeforeNumber(CFX_WideString& value);
499 static void SplitString(CFX_WideString& value);
500 static FX_BOOL GetSeperator(CPDF_FormField* pFormField, char& cSeperator);
501 };
502
503 } // namespace javascript
504
505 #endif
console
The console object is a static object that enables access to the Foxit PDF Editor JavaScript Console ...
Definition: console.h:16
search
The search object is a static object that accesses the functionality provided by the Foxit PDF Editor...
Definition: search.h:115
ReadStream
A ReadStream object is an object literal that represents a stream of data. It contains a method to al...
Definition: soap.h:40
identity
This is a static object that identifies the current user of the application.
Definition: identity.h:10
event
All JavaScript scripts are executed as the result of a particular event. For each of these events,...
Definition: event.h:22
global
This is a static JavaScript object that allows you to share data between documents and to have data b...
Definition: global.h:30
security
The security object is a static JavaScript object that exposes security-related PDF functions such as...
Definition: securityhandler.h:409
app
This object is used to set and get the properties and to set the JavaScript action of a link.
Definition: app.h:169
util
A static JavaScript object that defines a number of utility methods and convenience functions for str...
Definition: util.h:15
Span
A generic object that represents a length of text and its associated properties in a rich text form f...
Definition: span.h:18
color
The color object is a convenience static object that defines the basic colors. Use this object to set...
Definition: color.h:46


Javascript API: js_context.h Source File

  • src
  • javascript
  • inc
js_context.h
1 #ifndef _JS_CONTEXT_H_
2 #define _JS_CONTEXT_H_
3
4 #include "js_interface.h"
5
6 namespace javascript {
7 class CFXJS_EventHandler;
8 class CFXJS_Runtime;
9 // class CFSCRT_JS_ActionHandler;
10
11 enum WarnType
12 {
13 NOT_SUPPORT = 0,
14 RUN_ERROR
15 };
16 struct WarnInfo
17 {
18 WarnType type;
19 CFX_WideString cwWarn;
20 };
21
22 class CFXJS_Context : public IJS_Context
23 {
24 public:
25 CFXJS_Context(CFXJS_Runtime* pRuntime, IJS_Context_Level level);
26 virtual ~CFXJS_Context();
27
28 public:
29 virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& errInfo);
30 virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& errInfo);
31 virtual FX_BOOL& GetEventRc();
32
33 public:
34 virtual void OnApp_Init();
35 // For CPDF
36 virtual void OnHtml_Callback();
37 virtual void OnDoc_Open(IFXJS_DocumentProvider* pDoc, const CFX_WideString& strTargetName);
38 virtual void OnDoc_WillPrint(IFXJS_DocumentProvider* pDoc);
39 virtual void OnDoc_DidPrint(IFXJS_DocumentProvider* pDoc);
40 virtual void OnDoc_WillSave(IFXJS_DocumentProvider* pDoc);
41 virtual void OnDoc_DidSave(IFXJS_DocumentProvider* pDoc);
42 virtual void OnDoc_WillClose(IFXJS_DocumentProvider* pDoc);
43
44 virtual void OnPage_Open(IFXJS_DocumentProvider* pTarget);
45 virtual void OnPage_Close(IFXJS_DocumentProvider* pTarget);
46 virtual void OnPage_InView(IFXJS_DocumentProvider* pTarget);
47 virtual void OnPage_OutView(IFXJS_DocumentProvider* pTarget);
48
49 virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget);
50 virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget);
51 virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget);
52 virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget);
53 virtual void OnField_Focus(FX_BOOL bModifier,
54 FX_BOOL bShift,
55 CPDF_FormField* pTarget,
56 const CFX_WideString& Value);
57 virtual void OnField_Blur(FX_BOOL bModifier,
58 FX_BOOL bShift,
59 CPDF_FormField* pTarget,
60 const CFX_WideString& Value);
61
62 virtual void OnField_Calculate(CPDF_FormField* pSource,
63 CPDF_FormField* pTarget,
64 CFX_WideString& Value,
65 FX_BOOL& bRc);
66 virtual void OnField_Format(int nCommitKey,
67 CPDF_FormField* pTarget,
68 CFX_WideString& Value,
69 FX_BOOL bWillCommit);
70 virtual void OnField_Keystroke(int nCommitKey,
71 CFX_WideString& strChange,
72 const CFX_WideString& strChangeEx,
73 FX_BOOL bKeyDown,
74 FX_BOOL bModifier,
75 int& nSelEnd,
76 int& nSelStart,
77 FX_BOOL bShift,
78 CPDF_FormField* pTarget,
79 CFX_WideString& Value,
80 FX_BOOL bWillCommit,
81 FX_BOOL bFieldFull,
82 FX_BOOL& bRc);
83 virtual void OnField_Validate(CFX_WideString& strChange,
84 const CFX_WideString& strChangeEx,
85 FX_BOOL bKeyDown,
86 FX_BOOL bModifier,
87 FX_BOOL bShift,
88 CPDF_FormField* pTarget,
89 CFX_WideString& Value,
90 FX_BOOL& bRc);
91
92 virtual void
93 OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
94 virtual void
95 OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
96 virtual void
97 OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
98 virtual void
99 OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
100 virtual void OnField_Focus(FX_BOOL bModifier,
101 FX_BOOL bShift,
102 const CFX_WideString& sTargetName,
103 const CFX_WideString& Value);
104 virtual void OnField_Blur(FX_BOOL bModifier,
105 FX_BOOL bShift,
106 const CFX_WideString& sTargetName,
107 const CFX_WideString& Value);
108
109 virtual void OnField_Calculate(const CFX_WideString& sSourceName,
110 const CFX_WideString& sTargetName,
111 CFX_WideString& Value,
112 FX_BOOL& bRc);
113 virtual void OnField_Format(int nCommitKey,
114 const CFX_WideString& sTargetName,
115 CFX_WideString& Value,
116 FX_BOOL bWillCommit);
117 virtual void OnField_Keystroke(int nCommitKey,
118 CFX_WideString& strChange,
119 const CFX_WideString& strChangeEx,
120 FX_BOOL KeyDown,
121 FX_BOOL bModifier,
122 int& nSelEnd,
123 int& nSelStart,
124 FX_BOOL bShift,
125 const CFX_WideString& sTargetName,
126 CFX_WideString& Value,
127 FX_BOOL bWillCommit,
128 FX_BOOL bFieldFull,
129 FX_BOOL& bRc);
130 virtual void OnField_Validate(CFX_WideString& strChange,
131 const CFX_WideString& strChangeEx,
132 FX_BOOL bKeyDown,
133 FX_BOOL bModifier,
134 FX_BOOL bShift,
135 const CFX_WideString& sTargetName,
136 CFX_WideString& Value,
137 FX_BOOL& bRc);
138
139 virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
140 virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
141 virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
142 virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
143 virtual void
144 OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
145 virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
146 virtual void
147 OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
148 virtual void
149 OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
150 virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
151 virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
152
153 virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
154 virtual void OnLink_MouseUp(IFXJS_DocumentProvider* pTarget);
155
156 virtual void OnMenu_Exec(IFXJS_DocumentProvider* pTarget, const CFX_WideString& strTargetName);
157 virtual void OnBatchExec(IFXJS_DocumentProvider* pTarget);
158 virtual void OnConsole_Exec();
159 virtual void OnExternal_Exec();
160
161 virtual void EnableMessageBox(FX_BOOL bEnable)
162 {
163 m_bMsgBoxEnable = bEnable;
164 }
165 FX_BOOL IsMsgBoxEnabled() const
166 {
167 return m_bMsgBoxEnable;
168 }
169
170 virtual IJS_Runtime* GetRuntime();
171 virtual void SetAttachedData(void* pData);
172 virtual void* GetAttachedData() const;
173
174 virtual IJS_Context_Level GetContextLevel()
175 {
176 return m_contextLevel;
177 }
178 FX_BOOL NeedFaithfulExecScript() const;
179
180 virtual CFX_WideString GetJSErrorMessage();
181
182 public:
183 IFXJS_AppProvider* GetReaderApp();
184 CFXJS_Runtime* GetJSRuntime()
185 {
186 return m_pRuntime;
187 }
188
189 FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& errInfo);
190 CFXJS_EventHandler* GetEventHandler()
191 {
192 return m_pEventHandler.get();
193 };
194 IFXJS_DocumentProvider* GetReaderDocument();
195
196 FX_BOOL IsBusy() const
197 {
198 return m_bBusy;
199 }
200 void AddWarning(WarnType type, FX_LPCSTR funcName);
201
202 private:
203 void GenExecWarningAndErrors(FX_INT32 nRet, FXJSE_HVALUE hRet, CFX_WideString& info);
204 void ShowExecInfos(const CFX_WideString& info);
205 CFXJS_Runtime* m_pRuntime;
206 std::unique_ptr<CFXJS_EventHandler> m_pEventHandler;
207 std::vector<WarnInfo> m_Warnings;
208 FX_BOOL m_bBusy;
209 FX_BOOL m_bMsgBoxEnable;
210 void* m_pAttachedData;
211 IJS_Context_Level m_contextLevel;
212 CFX_WideString m_cwJSErrorMessage;
213 };
214 } // namespace javascript
215
216 #endif //_JS_CONTEXT_H_


Javascript API: js_cpdfpanelview.h Source File

  • src
  • javascript
  • inc
js_cpdfpanelview.h
1 #ifndef JS_PANELVIEW_H
2 #define JS_PANELVIEW_H
3 namespace javascript {
4 // class panelSet:public CFXJS_EmbedObj
5 //{
6 // public:
7 // panelSet(CFXJS_Object* pObject);
8 //};
9
10 // class CFXJS_PanelSet:public CFXJS_Object
11 //{
12 // public:
13 // CFXJS_PanelSet(CFXJS_Runtime* pRuntime) : CFXJS_Object(pRuntime) {};
14 // virtual ~CFXJS_PanelSet(){};
15
16 // public:
17 // DECLARE_JS_CLASS(CFXJS_PanelSet);
18 //};
19
20 class panelTool : public CFXJS_EmbedObj
21 {
22 public:
23 panelTool(CFXJS_Object* pObject);
24 virtual ~panelTool();
25 FX_BOOL getPanel(OBJ_METHOD_PARAMS);
26
27 public:
28 // CFXJS_CPDFPanelItem* GetPanel(CJS_Module* pModule, CPDF_Document* pPDFDoc);
29 FXJSE_HVALUE getPanelTool() const
30 {
31 return m_hPanelTool;
32 }
33
34 void setPanelTool(const FXJSE_HVALUE& hPanelTool)
35 {
36 m_hPanelTool = hPanelTool;
37 }
38
39 CFX_ByteString getPluginName() const
40 {
41 return m_csPluginName;
42 }
43
44 void setPluginName(const CFX_ByteString& csPluginName)
45 {
46 m_csPluginName = csPluginName;
47 }
48
49 private:
50 FXJSE_HVALUE m_hPanelTool;
51 CFX_ByteString m_csPluginName;
52 };
53
54 class CFXJS_PanelItem : public CFXJS_Object
55 {
56 public:
57 CFXJS_PanelItem(CFXJS_Runtime* pRuntime)
58 : CFXJS_Object(pRuntime){};
59 virtual ~CFXJS_PanelItem(){};
60
61 public:
62 DECLARE_JS_CLASS(CFXJS_PanelItem);
63 JS_STATIC_METHOD(getPanel, panelTool);
64 };
65
66 class cpdfPanelItem : public CFXJS_EmbedObj
67 {
68 public:
69 cpdfPanelItem(CFXJS_Object* pObject);
70 virtual ~cpdfPanelItem();
71
72 FX_BOOL expand(OBJ_METHOD_PARAMS);
73 FX_BOOL setHotpoint(OBJ_METHOD_PARAMS);
74
75 public:
76 void SetIsHotPoint(FX_BOOL bSetHot)
77 {
78 m_bIsHot = bSetHot;
79 }
80 FX_BOOL IsSetHotPoint()
81 {
82 return m_bIsHot;
83 }
84 // void ReleaseHtmlView();
85
86 void* m_pPanelView;
87 void* m_pPanelInfo;
88
89 // CBrowserHtmlView* GetBrowserHtmlView();
90
91 private:
92 // HBITMAP FXDIBitmapToHbitmap (CFX_DIBitmap* pDIBitmap);
93 // BOOL PreMultiplyAlpha (HBITMAP hbmp, BOOL bAutoCheckPremlt=true);
94 // void DrawHotpoint(CFX_DIBitmap* pBitmap);
95 // FX_BOOL NavigateToUrl(CFX_ByteString csUrl);
96
97 FX_BOOL m_bIsHot;
98 // CFX_MapPtrToPtr m_DocToHtml;
99 };
100
101 class CFXJS_CPDFPanelItem : public CFXJS_Object
102 {
103 public:
104 CFXJS_CPDFPanelItem(CFXJS_Runtime* pRuntime)
105 : CFXJS_Object(pRuntime){};
106 virtual ~CFXJS_CPDFPanelItem(){};
107
108 public:
109 DECLARE_JS_CLASS(CFXJS_CPDFPanelItem);
110 JS_STATIC_METHOD(expand, cpdfPanelItem);
111 JS_STATIC_METHOD(setHotpoint, cpdfPanelItem);
112 };
113
114 } // namespace javascript
115 #endif // JS_PANELVIEW_H


Javascript API: js_cpdfuser.h Source File

  • src
  • javascript
  • inc
js_cpdfuser.h
1 #ifndef JS_CPDFUSER_H
2 #define JS_CPDFUSER_H
3 namespace javascript {
4
5 class User : public CFXJS_EmbedObj
6 {
7 public:
8 User(CFXJS_Object* pJSObject);
9 virtual ~User();
10
11 public:
12 FX_BOOL getUserToken(OBJ_METHOD_PARAMS);
13 FX_BOOL getUserEmail(OBJ_METHOD_PARAMS);
14 FX_BOOL getUserId(OBJ_METHOD_PARAMS);
15 FX_BOOL getUserAvatar(OBJ_METHOD_PARAMS);
16 FX_BOOL getUserFullName(OBJ_METHOD_PARAMS);
17 };
18
19 class CFXJS_User : public CFXJS_Object
20 {
21 public:
22 CFXJS_User(CFXJS_Runtime* pRuntime)
23 : CFXJS_Object(pRuntime){};
24 virtual ~CFXJS_User(void){};
25
26 DECLARE_JS_CLASS(CFXJS_User);
27
28 JS_STATIC_METHOD(getUserToken, User);
29 JS_STATIC_METHOD(getUserEmail, User);
30 JS_STATIC_METHOD(getUserId, User);
31 JS_STATIC_METHOD(getUserAvatar, User);
32 JS_STATIC_METHOD(getUserFullName, User);
33 };
34
35 } // namespace javascript
36 #endif // JS_CPDFUSER_H


Javascript API: js_define.h Source File

  • src
  • javascript
  • inc
js_define.h
1 #ifndef _JS_DEFINE_H_
2 #define _JS_DEFINE_H_
3 #include "../common/common.h"
4
5 #include "thirdparties/fxjse/fxjse.h"
6
7 namespace javascript {
8 typedef FXJSE_HVALUE JSFXObject;
9 typedef unsigned JSBool;
10 class CFXJS_Object;
11 struct JSConstSpec
12 {
13 const char* pName;
14 double number;
15 const char* string;
16 FX_BYTE t; // 0:double 1:str
17 };
18
19 #include <map>
20 #include <vector>
21 struct JS_ErrorString
22 {
23 CFX_ByteString name;
24 CFX_WideString message;
25 };
26 extern CFX_MapByteStringToPtr GlobalMap;
27 #define CJS_PointsArray CFX_ArrayTemplate<float>
28 #define CJS_IntArray CFX_ArrayTemplate<int>
29 extern CFX_ArrayTemplate<CFXJS_Object*> GlobalArray;
30
31 #define FXJSE_VALUE_SET_WIDESTRING(Value, Func) \
32 { \
33 auto szInputStr = (Func); \
34 FXJSE_Value_SetWideString(Value, szInputStr); \
35 }
36
37 #define JS_ParamError "ParameterError"
38 #define JS_RangeError "RangeError"
39 #define JS_TypeError "TypeError"
40 #define JS_ReferenceError "ReferenceError"
41 #define JS_MissingArgError "MissingArgError"
42 #define JS_NumberOfArgsError "NumberOfArgsError"
43 #define JS_InvalidSetError "InvalidSetError"
44 #define JS_InvalidGetError "InvalidGetError"
45 #define JS_OutOfMemoryError "OutOfMemoryError"
46 #define JS_NotAllowedError "NotAllowedError"
47 #define JS_GeneralError "GeneralError"
48 #define JS_RaiseError "RaiseError"
49 #define JS_DeadObjectError "DeadObjectError"
50 #define JS_BookmarkInsertPosError "BookmarkInsertPosError"
51 #define JS_PlayerIsAlreadyOpenError "PlayerIsAlreadyOpenError"
52 #define JS_InvalidPathError "InvalidPathError"
53 #define JS_UserCancel "UserCancel"
54 #define JS_NoSecurityHandle "NoSecurityHandle"
55 #define JSRangeError \
56 { \
57 JS_RangeError, JSLoadStringFromID(ID_JS_RANGE_ERROR) \
58 } // IDS_STRING_JS_RANGE_ERROR
59 #define JSTypeError \
60 { \
61 JS_TypeError, JSLoadStringFromID(ID_JS_TYPE_ERROR) \
62 } // IDS_STRING_JS_TYPE_ERROR
63 #define JSReferenceError \
64 { \
65 JS_ReferenceError, JSLoadStringFromID(ID_JS_REFERENCE_ERROR) \
66 } // IDS_STRING_JS_REFERENCE_ERROR
67 #define JSMissingArgError \
68 { \
69 JS_MissingArgError, JSLoadStringFromID(ID_JS_MISSING_ARG_ERROR) \
70 } // IDS_STRING_JS_MISSING_ARG_ERROR
71 #define JSNumberOfArgsError \
72 { \
73 JS_NumberOfArgsError, JSLoadStringFromID(ID_JS_NUMBER_OF_ARGS_ERROR) \
74 } // IDS_STRING_JS_NUMBER_OF_ARGS_ERROR
75 #define JSInvalidSetError \
76 { \
77 JS_InvalidSetError, JSLoadStringFromID(ID_JS_INVALID_SET_ERROR) \
78 } // IDS_STRING_JS_INVALID_SET_ERROR
79 #define JSInvalidGetError \
80 { \
81 JS_InvalidGetError, JSLoadStringFromID(ID_JS_INVALID_GET_ERROR) \
82 } // IDS_STRING_JS_INVALID_GET_ERROR
83 #define JSOutOfMemoryError \
84 { \
85 JS_OutOfMemoryError, JSLoadStringFromID(ID_JS_OUT_OF_MEMORY_ERROR) \
86 } // IDS_STRING_JS_OUT_OF_MEMORY_ERROR
87 #define JSNotAllowedError \
88 { \
89 JS_NotAllowedError, JSLoadStringFromID(ID_JS_NOT_ALLOWED_ERROR) \
90 } // IDS_STRING_JS_NOT_ALLOWED_ERROR
91 #define JSGeneralError \
92 { \
93 JS_GeneralError, JSLoadStringFromID(ID_JS_GENERAL_ERROR) \
94 } // IDS_STRING_JS_GENERAL_ERROR
95 #define JSRaiseError \
96 { \
97 JS_RaiseError, JSLoadStringFromID(ID_JS_RAISE_ERROR) \
98 } // IDS_STRING_JS_RAISE_ERROR
99 #define JSDeadObjectError \
100 { \
101 JS_DeadObjectError, JSLoadStringFromID(ID_JS_DEAD_OBJECT_ERROR) \
102 } // IDS_STRING_JS_DEAD_OBJECT_ERROR
103 #define JSBookmarkInsertPosError \
104 { \
105 JS_BookmarkInsertPosError, JSLoadStringFromID(ID_JS_BOOKMARK_INSERTPOS_ERROR) \
106 } // IDS_STRING_JS_BOOKMARK_INSERTPOS_ERROR
107 #define JSPlayerIsAlreadyOpenError \
108 { \
109 JS_PlayerIsAlreadyOpenError, JSLoadStringFromID(ID_JS_PLAYER_IS_OPEN) \
110 } //
111 #define JSInvalidPathError \
112 { \
113 JS_InvalidPathError, JSLoadStringFromID(ID_JS_PATH_INVALID) \
114 } //
115 #define JSUserCancel \
116 { \
117 JS_UserCancel, JSLoadStringFromID(ID_JS_USER_CANCEL) \
118 } //
119 #define JSNoSecurityHandle \
120 { \
121 JS_NoSecurityHandle, JSLoadStringFromID(ID_JS_NoSecurityHandle) \
122 } //
123
124
127
128 #define JS_RAISE(Error) \
129 { \
130 if (sError.name == JS_GeneralError) \
131 sError = Error; \
132 return false; \
133 }
134
136 #define JS_NotSupportWarning(main_name, sub_name) \
137 { \
138 if (!GetJSObject() || !GetJSObject()->GetJsRuntime()) \
139 return false; \
140 CFXJS_Context* pContext = GetJSObject()->GetJsRuntime()->GetJsContext(); \
141 if (!pContext) \
142 return false; \
143 pContext->AddWarning(NOT_SUPPORT, #main_name "." #sub_name); \
144 return true; \
145 }
146
147 #define JS_RunErrorWarning(main_name, sub_name) \
148 { \
149 if (!GetJSObject() || !GetJSObject()->GetJsRuntime()) \
150 return false; \
151 CFXJS_Context* pContext = GetJSObject()->GetJsRuntime()->GetJsContext(); \
152 if (!pContext) \
153 return false; \
154 pContext->AddWarning(RUN_ERROR, #main_name "." #sub_name); \
155 return true; \
156 }
157
158 /* ====================================== PUBLIC DEFINE SPEC
159 * ============================================== */
160
161 #define OBJ_PROP_PARAMS FXJSE_HVALUE hValue, JS_ErrorString &sError, FX_BOOL IsSet
162 #define OBJ_METHOD_PARAMS FXJSE_HOBJECT hThis, CFXJSE_Arguments &args, JS_ErrorString &sError
163 #define OBJ_STATIC_METHOD_PARAMS FXJSE_HOBJECT hThis, CFXJSE_Arguments &args
164 #define OBJ_PROP_ARGS hValue, sError, IsSet
165
166 #define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {
167 #define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {#const_name, pValue, "", 0},
168 #define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {#const_name, 0, #pValue, 1},
169 #define END_JS_STATIC_CONST() \
170 { \
171 0, 0, 0, 0 \
172 } \
173 } \
174 ;
175
176 #define BEGIN_JS_STATIC_PROP(js_class_name) FXJSE_PROPERTY js_class_name::JS_Class_Properties[] = {
177 #define JS_STATIC_PROP_ENTRY(prop_name) \
178 {#prop_name, get_##prop_name##_static, set_##prop_name##_static},
179 #define END_JS_STATIC_PROP() \
180 { \
181 0, 0, 0 \
182 } \
183 } \
184 ;
185
186 #define BEGIN_JS_STATIC_METHOD(js_class_name) FXJSE_FUNCTION js_class_name::JS_Class_Methods[] = {
187 #define JS_STATIC_METHOD_ENTRY(method_name) {#method_name, method_name##_static},
188 #define END_JS_STATIC_METHOD() \
189 { \
190 0, 0 \
191 } \
192 } \
193 ;
194
195 #define BEGIN_JS_STATIC_CLASS(js_class_name) \
196 FXJSE_CLASS js_class_name::m_jsclass[] = { \
197 js_class_name::m_UserName, \
198 NULL, \
199 js_class_name::JS_Class_Properties, \
200 js_class_name::JS_Class_Methods, \
201 (sizeof(js_class_name::JS_Class_Properties) / sizeof(FXJSE_PROPERTY)) - 1, \
202 (sizeof(js_class_name::JS_Class_Methods) / sizeof(FXJSE_FUNCTION)) - 1, \
203 0};
204
205 #define BEGIN_JS_DYNAMIC_CLASS(js_class_name) \
206 FXJSE_CLASS js_class_name::m_jsclass[] = { \
207 js_class_name::m_UserName, \
208 NULL, \
209 js_class_name::JS_Class_Properties, \
210 js_class_name::JS_Class_Methods, \
211 (sizeof(js_class_name::JS_Class_Properties) / sizeof(FXJSE_PROPERTY)) - 1, \
212 (sizeof(js_class_name::JS_Class_Methods) / sizeof(FXJSE_FUNCTION)) - 1, \
213 queryprop_##js_class_name##_static, \
214 getprop_##js_class_name##_static, \
215 putprop_##js_class_name##_static, \
216 delprop_##js_class_name##_static, \
217 0};
218
219 #define BEGIN_SPECIAL_JS_CLASS(js_class_name) \
220 FXJSE_CLASS js_class_name::g_hClass[] = {js_class_name::m_pClassName, \
221 NULL, \
222 NULL, \
223 JS_Class_Methods, \
224 0, \
225 (sizeof(JS_Class_Methods) / sizeof(FXJSE_FUNCTION)) - \
226 1, \
227 queryprop_##js_class_name##_static, \
228 getprop_##js_class_name##_static, \
229 putprop_##js_class_name##_static, \
230 delprop_##js_class_name##_static, \
231 NULL};
232
233 #define MEMLEAKCHECK_1() ((void)0)
234 #define MEMLEAKCHECK_2(main_name, sub_name) ((void)0)
235
236
237 /* ======================== exec javascript with control error ======================== */
238 #define JS_STATIC_EXEC_INTERNAL(class_type, main_name, sub_name, callback, true_ret, false_ret) \
239 { \
240 FX_BOOL bRet = false; \
241 bRet = class_type::callback; \
242 if (!bRet) \
243 { \
244 return false_ret; \
245 } \
246 return true_ret; \
247 } \
248 /* ======================== exec javascript with control error ======================== */
249 #define JS_EXEC_INTERNAL(class_type, main_name, sub_name, callback, true_ret, false_ret) \
250 { \
251 CFXJS_Object* pJSObj = (CFXJS_Object*)FXJSE_Value_ToObject(hObject, NULL); \
252 ASSERT(pJSObj != NULL); \
253 if (!pJSObj || !pJSObj->GetEmbedObject()) \
254 { \
255 CFX_ByteString swError; \
256 swError.Format("'%s.%s' %s", main_name, sub_name, "Is not a non-null object"); \
257 FXJSE_ThrowMessage(JS_TypeError, swError); \
258 return false_ret; \
259 } \
260 javascript::SetJSConsoleWillClear(pJSObj); \
261 class_type* pObj = dynamic_cast<class_type*>(pJSObj->GetEmbedObject()); \
262 if (!pObj) \
263 { \
264 CFX_ByteString swError; \
265 swError.Format("'%s.%s' %s", main_name, sub_name, "Wrong type of argument value."); \
266 FXJSE_ThrowMessage(JS_TypeError, swError); \
267 return false_ret; \
268 } \
269 JS_ErrorString sError = JSGeneralError; \
270 FX_BOOL bRet = false; \
271 try \
272 { \
273 if (!pObj->CheckBaseExpects()) \
274 { \
275 sError = JSDeadObjectError; \
276 } \
277 else \
278 { \
279 pJSObj->Log(main_name "." sub_name); \
280 bRet = pObj->callback; \
281 } \
282 } \
283 catch (...) \
284 { \
285 CFX_ByteString swError; \
286 swError.Format("'%s.%s' Unknown error is catched!", main_name, sub_name); \
287 FXJSE_ThrowMessage(JS_RaiseError, swError); \
288 return false_ret; \
289 } \
290 if (!bRet) \
291 { \
292 CFX_ByteString swError; \
293 swError.Format("'%s.%s' %s", main_name, sub_name, \
294 (FX_LPCSTR)sError.message.UTF8Encode()); \
295 FXJSE_ThrowMessage(sError.name, swError); \
296 return false_ret; \
297 } \
298 return true_ret; \
299 }
300
301 #define JS_NULLRET
302 #define JS_EXEC(class_type, main_name, sub_name, callback) \
303 JS_EXEC_INTERNAL(class_type, main_name, sub_name, callback, JS_NULLRET, JS_NULLRET);
304
305 #define JS_STATIC_EXEC(class_type, main_name, sub_name, callback) \
306 JS_STATIC_EXEC_INTERNAL(class_type, main_name, sub_name, callback, JS_NULLRET, JS_NULLRET);
307
308 #define JS_EXEC_BOOL(class_type, main_name, sub_name, callback) \
309 JS_EXEC_INTERNAL(class_type, main_name, sub_name, callback, true, false);
310
311 /* ======================================== PROP CALLBACK
312 * ============================================ */
313 #define JS_STATIC_PROP_GET(prop_name, class_name) \
314 static void get_##prop_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
315 FXJSE_HVALUE hValue) \
316 { \
317 JS_EXEC(class_name, #class_name, #prop_name, prop_name(hValue, sError, false)); \
318 }
319
320 #define JS_STATIC_PROP_SET(prop_name, class_name) \
321 static void set_##prop_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
322 FXJSE_HVALUE hValue) \
323 { \
324 JS_EXEC(class_name, #class_name, #prop_name, prop_name(hValue, sError, true)); \
325 }
326
327 #define JS_STATIC_PROP(prop_name, class_name) \
328 JS_STATIC_PROP_GET(prop_name, class_name); \
329 JS_STATIC_PROP_SET(prop_name, class_name)
330
331 /* ========================================= METHOD CALLBACK
332 * =========================================== */
333
334 #define JS_STATIC_METHOD(method_name, class_name) \
335 static void method_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szFuncName, \
336 CFXJSE_Arguments& args) \
337 { \
338 JS_EXEC(class_name, #class_name, #method_name, method_name(hObject, args, sError)); \
339 }
340
341 #define JS_STATIC_STATIC_METHOD(method_name, class_name) \
342 static void method_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szFuncName, \
343 CFXJSE_Arguments& args) \
344 { \
345 JS_STATIC_EXEC(class_name, #class_name, #method_name, method_name(hObject, args)); \
346 }
347
348 /* ===================================== JS CLASS =============================================== */
349
350 // template<class T>
351 // FX_BOOL query_prop(FXJSE_HOBJECT hObject, FX_BSTR szPropName, FX_BOOL bQueryIn) {
352 // javascript::CFXJS_Object* pJSObj = (javascript::CFXJS_Object*)FXJSE_Value_ToObject(hObject,
353 // NULL); T* pObj = dynamic_cast<T*>(pJSObj->GetEmbedObject()); if (!pObj) return false; FX_BOOL
354 // bRet = false; try
355 // {
356 // bRet = pObj->QueryProperty(szPropName);
357 // }
358 // catch (...)
359 // {
360 // }
361 // return bRet;
362 //}
363
364 #define DECLARE_JS_DYNAMIC_CLASS(js_class_name) \
365 static JSBool JSConstructor(FXJSE_HVALUE hTempValue, CFXJS_Runtime* pRuntime); \
366 static int Init(CFXJS_Runtime* pRuntime); \
367 static void GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize); \
368 static void GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize); \
369 static FXJSE_PROPERTY JS_Class_Properties[]; \
370 static FXJSE_FUNCTION JS_Class_Methods[]; \
371 static FX_LPCSTR m_pClassName; \
372 static FXJSE_CLASS m_jsclass[]; \
373 static FX_LPCSTR m_UserName; \
374 static FX_INT32 queryprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
375 FX_BOOL bQueryIn); \
376 static void getprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
377 FXJSE_HVALUE hValue); \
378 static void putprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
379 FXJSE_HVALUE hValue); \
380 static FX_BOOL delprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName);
381
382 #define IMPLEMENT_DYNAMIC_CLASS_RICH(js_class_name, class_alternate, class_name) \
383 FX_LPCSTR js_class_name::m_pClassName = #class_name; \
384 FX_LPCSTR js_class_name::m_UserName = #class_name; \
385 FX_INT32 js_class_name::queryprop_##js_class_name##_static( \
386 FXJSE_HOBJECT hObject, FX_BSTR szPropName, FX_BOOL bQueryIn) \
387 { \
388 javascript::CFXJS_Object* pJSObj = \
389 (javascript::CFXJS_Object*)FXJSE_Value_ToObject(hObject, NULL); \
390 class_alternate* pObj = dynamic_cast<class_alternate*>(pJSObj->GetEmbedObject()); \
391 if (!pObj) \
392 return false; \
393 FX_BOOL bRet = false; \
394 bRet = pObj->QueryProperty(szPropName); \
395 return bRet; \
396 } \
397 void js_class_name::getprop_##js_class_name##_static(FXJSE_HOBJECT hObject, \
398 FX_BSTR szPropName, FXJSE_HVALUE hValue) \
399 { \
400 JS_EXEC(class_alternate, #class_name, "GetProperty", \
401 DoProperty(hValue, szPropName, sError, false)); \
402 } \
403 void js_class_name::putprop_##js_class_name##_static(FXJSE_HOBJECT hObject, \
404 FX_BSTR szPropName, FXJSE_HVALUE hValue) \
405 { \
406 JS_EXEC(class_alternate, #class_name, "PutProperty", \
407 DoProperty(hValue, szPropName, sError, true)); \
408 } \
409 FX_BOOL js_class_name::delprop_##js_class_name##_static(FXJSE_HOBJECT hObject, \
410 FX_BSTR szPropName) \
411 { \
412 JS_EXEC_BOOL(class_alternate, #class_name, "DelProperty", \
413 DelProperty(szPropName, sError)); \
414 } \
415 JSBool js_class_name::JSConstructor(FXJSE_HVALUE hTempValue, CFXJS_Runtime* pRuntime) \
416 { \
417 std::unique_ptr<CFXJS_Object> pObj(make_unique<js_class_name>(pRuntime)); \
418 pObj->SetEmbedObject( \
419 std::unique_ptr<CFXJS_EmbedObj>(make_unique<class_alternate>(pObj.get()))); \
420 FXJSE_HCLASS hClass = \
421 FXJSE_GetClass(pRuntime->GetRootContext(), js_class_name::m_UserName); \
422 FXJSE_Value_SetObject(hTempValue, pObj.get(), hClass); \
423 pRuntime->ValueMap.SetAt(js_class_name::m_pClassName, hTempValue); \
424 pRuntime->ObjArray.push_back(std::move(pObj)); \
425 return true; \
426 } \
427 int js_class_name::Init(CFXJS_Runtime* pRuntime) \
428 { \
429 FXJSE_HVALUE htemp = FXJSE_Value_Create(pRuntime->GetHRuntime()); \
430 if (!FXJSE_DefineClass(pRuntime->GetRootContext(), m_jsclass)) \
431 return 0; \
432 JSConstructor(htemp, pRuntime); \
433 return 1; \
434 } \
435 void js_class_name::GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize) \
436 { \
437 pProperties = JS_Class_Properties; \
438 nSize = sizeof(JS_Class_Properties) / sizeof(FXJSE_PROPERTY) - 1; \
439 } \
440 void js_class_name::GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize) \
441 { \
442 pMethods = JS_Class_Methods; \
443 nSize = sizeof(JS_Class_Methods) / sizeof(FXJSE_FUNCTION) - 1; \
444 }
445 #define IMPLEMENT_DYNAMIC_CLASS(js_class_name, class_name) \
446 IMPLEMENT_DYNAMIC_CLASS_RICH(js_class_name, class_name, class_name)
447
448 /* ===================================== JS CLASS =============================================== */
449 #define DECLARE_JS_CLASS(js_class_name) \
450 static JSBool JSConstructor(FXJSE_HVALUE hTempValue, CFXJS_Runtime* pRuntime); \
451 static int Init(CFXJS_Runtime* pRuntime); \
452 static void GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize); \
453 static void GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize); \
454 static FXJSE_PROPERTY JS_Class_Properties[]; \
455 static FXJSE_FUNCTION JS_Class_Methods[]; \
456 static FX_LPCSTR m_pClassName; \
457 static FXJSE_CLASS m_jsclass[]; \
458 static FX_LPCSTR m_UserName;
459
460 #define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
461 FX_LPCSTR js_class_name::m_pClassName = #class_name; \
462 FX_LPCSTR js_class_name::m_UserName = #class_name; \
463 JSBool js_class_name::JSConstructor(FXJSE_HVALUE hTempValue, CFXJS_Runtime* pRuntime) \
464 { \
465 std::unique_ptr<CFXJS_Object> pObj(make_unique<js_class_name>(pRuntime)); \
466 pObj->SetEmbedObject( \
467 std::unique_ptr<CFXJS_EmbedObj>(make_unique<class_alternate>(pObj.get()))); \
468 FXJSE_HCLASS hClass = \
469 FXJSE_GetClass(pRuntime->GetRootContext(), js_class_name::m_UserName); \
470 FXJSE_Value_SetObject(hTempValue, pObj.get(), hClass); \
471 pRuntime->ValueMap.SetAt(js_class_name::m_pClassName, hTempValue); \
472 pRuntime->ObjArray.push_back(std::move(pObj)); \
473 return true; \
474 } \
475 int js_class_name::Init(CFXJS_Runtime* pRuntime) \
476 { \
477 FXJSE_HVALUE htemp = FXJSE_Value_Create(pRuntime->GetHRuntime()); \
478 if (!FXJSE_DefineClass(pRuntime->GetRootContext(), m_jsclass)) \
479 { \
480 FXJSE_Value_Release(htemp); \
481 return 0; \
482 } \
483 JSConstructor(htemp, pRuntime); \
484 return 1; \
485 } \
486 void js_class_name::GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize) \
487 { \
488 pProperties = JS_Class_Properties; \
489 nSize = sizeof(JS_Class_Properties) / sizeof(FXJSE_PROPERTY) - 1; \
490 } \
491 void js_class_name::GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize) \
492 { \
493 pMethods = JS_Class_Methods; \
494 nSize = sizeof(JS_Class_Methods) / sizeof(FXJSE_FUNCTION) - 1; \
495 }
496 #define IMPLEMENT_JS_CLASS(js_class_name, class_name) \
497 IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
498
499 #define DECLARE_ROOT_CLASS(js_class_name) \
500 static int Init(CFXJS_Runtime* pRuntime); \
501 static void GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize); \
502 static void GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize); \
503 static FXJSE_PROPERTY JS_Class_Properties[]; \
504 static FXJSE_FUNCTION JS_Class_Methods[]; \
505 static FX_LPCSTR m_pClassName; \
506 static FXJSE_CLASS m_jsclass[]; \
507 static FX_LPCSTR m_UserName;
508
509 #define IMPLEMENT_ROOT_CLASS_RICH(js_class_name, class_alternate, class_name) \
510 FX_LPCSTR js_class_name::m_pClassName = #class_name; \
511 FX_LPCSTR js_class_name::m_UserName = #class_name; \
512 int js_class_name::Init(CFXJS_Runtime* pRuntime) \
513 { \
514 if (!FXJSE_DefineClass(pRuntime->GetRootContext(), m_jsclass)) \
515 return 0; \
516 return 1; \
517 } \
518 void js_class_name::GetProperties(FXJSE_PROPERTY*& pProperties, int& nSize) \
519 { \
520 pProperties = JS_Class_Properties; \
521 nSize = sizeof(JS_Class_Properties) / sizeof(FXJSE_PROPERTY) - 1; \
522 } \
523 void js_class_name::GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize) \
524 { \
525 pMethods = JS_Class_Methods; \
526 nSize = sizeof(JS_Class_Methods) / sizeof(FXJSE_FUNCTION) - 1; \
527 }
528 #define IMPLEMENT_ROOT_CLASS(js_class_name, class_name) \
529 IMPLEMENT_ROOT_CLASS_RICH(js_class_name, class_name, class_name)
530
531 //============================= Const Prop ========================================================
532 #define DECLARE_JS_CLASS_CONST() \
533 static int Init(CFXJS_Runtime* pRuntime); \
534 static void GetConsts(JSConstSpec*& pConsts, int& nSize); \
535 static JSConstSpec JS_Class_Consts[]; \
536 static const FX_LPCSTR m_pClassName;
537
538 #define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
539 const FX_LPCSTR js_class_name::m_pClassName = #class_name; \
540 int js_class_name::Init(CFXJS_Runtime* pRuntime) \
541 { \
542 FXJSE_HVALUE hProp = FXJSE_Value_Create(pRuntime->GetHRuntime()); \
543 FXJSE_HVALUE hPropConst = FXJSE_Value_Create(pRuntime->GetHRuntime()); \
544 FXJSE_Value_SetObject(hProp, NULL, NULL); \
545 for (int i = 0, sz = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1; i < sz; i++) \
546 { \
547 if (JS_Class_Consts[i].t == 0) \
548 { \
549 FXJSE_Value_SetInteger(hPropConst, (int)JS_Class_Consts[i].number); \
550 FXJSE_Value_SetObjectProp(hProp, JS_Class_Consts[i].pName, hPropConst); \
551 } \
552 else \
553 { \
554 FXJSE_Value_SetUTF8String(hPropConst, JS_Class_Consts[i].string); \
555 FXJSE_Value_SetObjectProp(hProp, JS_Class_Consts[i].pName, hPropConst); \
556 } \
557 } \
558 pRuntime->ValueMap.SetAt(js_class_name::m_pClassName, hProp); \
559 FXJSE_Value_Release(hPropConst); \
560 return 1; \
561 } \
562 void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize) \
563 { \
564 pConsts = JS_Class_Consts; \
565 nSize = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1; \
566 }
567
568 /* ===================================== SPECIAL JS CLASS
569 * =============================================== */
570 #define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
571 static JSBool JSConstructor(FXJSE_HVALUE hTempValue, CFXJS_Runtime* pRuntime); \
572 static void GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize); \
573 static FXJSE_FUNCTION JS_Class_Methods[]; \
574 static FXJSE_CLASS g_hClass[]; \
575 static int Init(CFXJS_Runtime* pRuntime); \
576 static FX_LPCSTR m_pClassName; \
577 static FXJSE_HVALUE hGlobalValue; \
578 static FX_INT32 queryprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
579 FX_BOOL bQueryIn); \
580 static void getprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
581 FXJSE_HVALUE hValue); \
582 static void putprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName, \
583 FXJSE_HVALUE hValue); \
584 static FX_BOOL delprop_##js_class_name##_static(FXJSE_HOBJECT hObject, FX_BSTR szPropName);
585
586 #define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \
587 FX_LPCSTR js_class_name::m_pClassName = #class_alternate; \
588 FX_INT32 js_class_name::queryprop_##js_class_name##_static( \
589 FXJSE_HOBJECT hObject, FX_BSTR szPropName, FX_BOOL bQueryIn) \
590 { \
591 javascript::CFXJS_Object* pJSObj = \
592 (javascript::CFXJS_Object*)FXJSE_Value_ToObject(hObject, NULL); \
593 class_alternate* pObj = dynamic_cast<class_alternate*>(pJSObj->GetEmbedObject()); \
594 if (!pObj) \
595 return false; \
596 FX_BOOL bRet = false; \
597 bRet = pObj->QueryProperty(szPropName); \
598 return bRet; \
599 } \
600 void js_class_name::getprop_##js_class_name##_static(FXJSE_HOBJECT hObject, \
601 FX_BSTR szPropName, FXJSE_HVALUE hValue) \
602 { \
603 JS_EXEC(class_alternate, #class_name, "GetProperty", \
604 DoProperty(hValue, szPropName, sError, false)); \
605 } \
606 void js_class_name::putprop_##js_class_name##_static(FXJSE_HOBJECT hObject, \
607 FX_BSTR szPropName, FXJSE_HVALUE hValue) \
608 { \
609 JS_EXEC(class_alternate, #class_name, "PutProperty", \
610 DoProperty(hValue, szPropName, sError, true)); \
611 } \
612 FX_BOOL js_class_name::delprop_##js_class_name##_static(FXJSE_HOBJECT hObject, \
613 FX_BSTR szPropName) \
614 { \
615 JS_EXEC_BOOL(class_alternate, #class_name, "DelProperty", \
616 DelProperty(szPropName, sError)); \
617 } \
618 JSBool js_class_name::JSConstructor(FXJSE_HVALUE hTempValue, CFXJS_Runtime* pRuntime) \
619 { \
620 CFXJS_Object* pObj = FX_NEW js_class_name(pRuntime); \
621 pObj->SetEmbedObject(std::unique_ptr<CFXJS_EmbedObj>(make_unique<class_alternate>(pObj))); \
622 pObj->InitInstance(); \
623 FXJSE_HCLASS hClass = \
624 FXJSE_GetClass(pRuntime->GetRootContext(), js_class_name::m_pClassName); \
625 FXJSE_Value_SetObject(hTempValue, pObj, hClass); \
626 GlobalMap.SetAt(js_class_name::m_pClassName, hTempValue); \
627 GlobalArray.Add(pObj); \
628 return true; \
629 } \
630 int js_class_name::Init(CFXJS_Runtime* pRuntime) \
631 { \
632 FXJSE_HVALUE htemp = FXJSE_Value_Create(pRuntime->GetHRuntime()); \
633 if (!FXJSE_DefineClass(pRuntime->GetRootContext(), g_hClass)) \
634 return 0; \
635 JSConstructor(htemp, pRuntime); \
636 return 1; \
637 } \
638 void js_class_name::GetMethods(FXJSE_FUNCTION*& pMethods, int& nSize) \
639 { \
640 pMethods = JS_Class_Methods; \
641 nSize = sizeof(JS_Class_Methods) / sizeof(FXJSE_FUNCTION) - 1; \
642 }
643
644 /* ======================================== GLOBAL ARRAYS
645 * ============================================ */
646 #define DEFINE_GLOBAL_ARRAY(hRuntime) \
647 int size = sizeof(ArrayContent) / sizeof(FX_LPCSTR); \
648 FXJSE_HVALUE hProp = FXJSE_Value_Create(hRuntime); \
649 FXJSE_HVALUE hProp1 = FXJSE_Value_Create(hRuntime); \
650 FXJSE_Value_SetArray(hProp, NULL, NULL); \
651 for (int i = 0; i < size; i++) \
652 { \
653 FXJSE_Value_SetUTF8String(hProp1, ArrayContent[i]); \
654 FXJSE_Value_SetObjectPropByIdx(hProp, i, hProp1); \
655 } \
656 GlobalMap.SetAt(ArrayName, hProp); \
657 FXJSE_Value_Release(hProp1);
658
659 } // namespace javascript
660
661 #endif //_JS_DEFINE_H_


Javascript API: js_eventhandler.h Source File

  • src
  • javascript
  • inc
js_eventhandler.h
1 #ifndef _JS_EVENTHANDLER_H_
2 #define _JS_EVENTHANDLER_H_
3
4 namespace javascript {
5 class CFXJS_Context;
6 class Field;
7 enum JS_EVENT_T
8 {
9 JET_UNKNOWN,
10 JET_APP_INIT,
11 JET_HTML_CALLBACK,
12 JET_DOC_OPEN,
13 JET_DOC_WILLPRINT,
14 JET_DOC_DIDPRINT,
15 JET_DOC_WILLSAVE,
16 JET_DOC_DIDSAVE,
17 JET_DOC_WILLCLOSE,
18 JET_PAGE_OPEN,
19 JET_PAGE_CLOSE,
20 JET_PAGE_INVIEW,
21 JET_PAGE_OUTVIEW,
22 JET_FIELD_MOUSEDOWN,
23 JET_FIELD_MOUSEUP,
24 JET_FIELD_MOUSEENTER,
25 JET_FIELD_MOUSEEXIT,
26 JET_FIELD_FOCUS,
27 JET_FIELD_BLUR,
28 JET_FIELD_KEYSTROKE,
29 JET_FIELD_VALIDATE,
30 JET_FIELD_CALCULATE,
31 JET_FIELD_FORMAT,
32 JET_SCREEN_FOCUS,
33 JET_SCREEN_BLUR,
34 JET_SCREEN_OPEN,
35 JET_SCREEN_CLOSE,
36 JET_SCREEN_MOUSEDOWN,
37 JET_SCREEN_MOUSEUP,
38 JET_SCREEN_MOUSEENTER,
39 JET_SCREEN_MOUSEEXIT,
40 JET_SCREEN_INVIEW,
41 JET_SCREEN_OUTVIEW,
42 JET_BATCH_EXEC,
43 JET_MENU_EXEC,
44 JET_CONSOLE_EXEC,
45 JET_EXTERNAL_EXEC,
46 JET_BOOKMARK_MOUSEUP,
47 JET_LINK_MOUSEUP,
48 // media
49 // JET_MEDIA_MEDIAPLAY
50 JET_MEDIA_BLUR,
51 JET_MEDIA_CLOSE,
52 JET_MEDIA_DONE,
53 JET_MEDIA_PLAY,
54 JET_MEDIA_READY,
55 JET_MEDIA_SEEK,
56 JET_MEDIA_STOP,
57 };
58
59 class CFXJS_EventHandler
60 {
61 public:
62 CFXJS_EventHandler(CFXJS_Context* pContext);
63 virtual ~CFXJS_EventHandler();
64
65 void OnApp_Init();
66 void OnHtml_Callback();
67
68 void OnDoc_Open(IFXJS_DocumentProvider* pDoc, const CFX_WideString& strTargetName);
69 void OnDoc_WillPrint(IFXJS_DocumentProvider* pDoc);
70 void OnDoc_DidPrint(IFXJS_DocumentProvider* pDoc);
71 void OnDoc_WillSave(IFXJS_DocumentProvider* pDoc);
72 void OnDoc_DidSave(IFXJS_DocumentProvider* pDoc);
73 void OnDoc_WillClose(IFXJS_DocumentProvider* pDoc);
74
75 void OnPage_Open(IFXJS_DocumentProvider* pDoc);
76 void OnPage_Close(IFXJS_DocumentProvider* pDoc);
77 void OnPage_InView(IFXJS_DocumentProvider* pTarget);
78 void OnPage_OutView(IFXJS_DocumentProvider* pTarget);
79
80 void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
81 void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
82 void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
83 void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, const CFX_WideString& sTargetName);
84 void OnField_Focus(FX_BOOL bModifier,
85 FX_BOOL bShift,
86 const CFX_WideString& sTargetName,
87 const CFX_WideString& Value);
88 void OnField_Blur(FX_BOOL bModifier,
89 FX_BOOL bShift,
90 const CFX_WideString& sTargetName,
91 const CFX_WideString& Value);
92
93 void OnField_Calculate(const CFX_WideString& sSourceName,
94 const CFX_WideString& sTargetName,
95 CFX_WideString& Value,
96 FX_BOOL& bRc);
97 void OnField_Format(int nCommitKey,
98 const CFX_WideString& sTargetName,
99 CFX_WideString& Value,
100 FX_BOOL bWillCommit);
101 void OnField_Keystroke(int nCommitKey,
102 CFX_WideString& strChange,
103 const CFX_WideString& strChangeEx,
104 FX_BOOL KeyDown,
105 FX_BOOL bModifier,
106 int& nSelEnd,
107 int& nSelStart,
108 FX_BOOL bShift,
109 const CFX_WideString& sTargetName,
110 CFX_WideString& Value,
111 FX_BOOL bWillCommit,
112 FX_BOOL bFieldFull,
113 FX_BOOL& bRc);
114 void OnField_Validate(CFX_WideString& strChange,
115 const CFX_WideString& strChangeEx,
116 FX_BOOL bKeyDown,
117 FX_BOOL bModifier,
118 FX_BOOL bShift,
119 const CFX_WideString& sTargetName,
120 CFX_WideString& Value,
121 FX_BOOL& bRc);
122
123 void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
124 void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
125 void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
126 void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
127 void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
128 void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
129 void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
130 void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
131 void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
132 void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, IFXJS_AnnotProvider* pScreen);
133
134 void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
135 void OnLink_MouseUp(IFXJS_DocumentProvider* pTarget);
136
137 void OnMenu_Exec(IFXJS_DocumentProvider* pTarget, const CFX_WideString& strTargetName);
138 void OnBatchExec(IFXJS_DocumentProvider* pTarget);
139 void OnConsole_Exec();
140 void OnExternal_Exec();
141
142 void OnMediaEvent(JSMediaEventInfo& type);
143
144
145
146
147 public:
148 void Initial(JS_EVENT_T type);
149
150 CFX_WideString& Change();
151 CFX_WideString ChangeEx();
152 int CommitKey();
153 FX_BOOL FieldFull();
154 FX_BOOL KeyDown();
155 FX_BOOL Modifier();
156 FX_LPCWSTR Name();
157 FX_LPCWSTR Type();
158 FX_BOOL& Rc();
159 int& SelEnd();
160 int& SelStart();
161 FX_BOOL Shift();
162 FX_BOOL StopDispatch();
163 FX_BOOL StopAllDispatch();
164
165 void GetSource(FXJSE_HVALUE hValue);
166 void GetTarget(FXJSE_HVALUE hValue);
167 Field* GetTargetField(FXJSE_HVALUE hValue);
168 CFXJS_Object* FindFieldObject(CFX_WideString cwName);
169 CFX_WideString& Value();
170 FX_BOOL WillCommit();
171 CFX_WideString TargetName();
172
173 JS_EVENT_T EventType()
174 {
175 return m_eEventType;
176 }
177
178 JSMediaEventInfo MediaEvent();
179
180 private:
181 CFXJS_Context* m_pJSContext;
182 JS_EVENT_T m_eEventType;
183
184 CFX_WideString m_strTargetName;
185 CFX_WideString m_strSourceName;
186 CFX_WideString* m_pWideStrChange;
187 CFX_WideString m_WideStrChangeDu;
188 CFX_WideString m_WideStrChangeEx;
189 int m_nCommitKey;
190 FX_BOOL m_bKeyDown;
191 FX_BOOL m_bModifier;
192 FX_BOOL m_bShift;
193 int* m_pISelEnd;
194 int m_nSelEndDu;
195 int* m_pISelStart;
196 int m_nSelStartDu;
197 FX_BOOL m_bWillCommit;
198 CFX_WideString* m_pValue;
199 CFX_WideString m_ValueDu;
200 FX_BOOL m_bFieldFull;
201 FX_BOOL* m_pbRc;
202 FX_BOOL m_bRcDu;
203 FX_BOOL m_stopDispatch;
204 FX_BOOL m_stopAllDispatch;
205 IFXJS_DocumentProvider* m_pSourceDoc;
206 CPDF_Bookmark* m_pTargetBookMark;
207 IFXJS_DocumentProvider* m_pTargetDoc;
208 IFXJS_AnnotProvider* m_pTargetAnnot;
209 std::vector<std::unique_ptr<CFXJS_Object>> m_newObjects;
210 CFX_PtrArray m_newDocObjects;
211 FX_BOOL m_bCalculateField;
212 };
213 } // namespace javascript
214
215 #endif //_JS_EVENTHANDLER_H_
Field
This object represents an form field (that is, a field created using the form tool or the Doc addFiel...
Definition: field.h:212


Javascript API: js_globaldata.h Source File

  • src
  • javascript
  • inc
js_globaldata.h
1 #ifndef _JS_GLOBALDATA_H_
2 #define _JS_GLOBALDATA_H_
3
4 namespace javascript {
5 #define JS_GLOBALDATA_TYPE_NUMBER 0
6 #define JS_GLOBALDATA_TYPE_BOOLEAN 1
7 #define JS_GLOBALDATA_TYPE_STRING 2
8 #define JS_GLOBALDATA_TYPE_OBJECT 3
9 #define JS_GLOBALDATA_TYPE_NULL 4
10
11 class CJS_KeyValue;
12 class CFXJS_GlobalVariableArray;
13 class CJS_GlobalData_Element;
14
15 class CFXJS_GlobalVariableArray
16 {
17 public:
18 CFXJS_GlobalVariableArray();
19 virtual ~CFXJS_GlobalVariableArray();
20
21 void Add(CJS_KeyValue* p);
22 int Count() const;
23 CJS_KeyValue* GetAt(int index) const;
24 void Copy(const CFXJS_GlobalVariableArray& array);
25
26 void Empty();
27
28 private:
29 CFX_ArrayTemplate<CJS_KeyValue*> array;
30 };
31
32 class CJS_KeyValue
33 {
34 public:
35 CJS_KeyValue() {}
36 virtual ~CJS_KeyValue() {}
37
38 CFX_ByteString sKey;
39 int nType; // 0:int 1:FX_BOOL 2:string 3:obj
40 double dData;
41 FX_BOOL bData;
42 CFX_ByteString sData;
43 CFXJS_GlobalVariableArray objData;
44 };
45
46 class CJS_GlobalData_Element
47 {
48 public:
49 CJS_GlobalData_Element() {}
50 virtual ~CJS_GlobalData_Element() {}
51
52 CFX_ByteString sKey;
53 FXJSE_HVALUE data;
54 FX_BOOL bPersistent;
55 };
56
57 class CFXJS_GlobalData
58 {
59 public:
60 CFXJS_GlobalData(IFXJS_AppProvider* pApp, CFXJS_Runtime* pRuntime);
61 virtual ~CFXJS_GlobalData();
62
63 public:
64 void SetGlobalVariable(FX_LPCSTR propname, FXJSE_HVALUE hValue);
65
66 FX_BOOL SetGlobalVariablePersistent(FX_LPCSTR propname, FX_BOOL bPersistent);
67 FX_BOOL DeleteGlobalVariable(FX_LPCSTR propname);
68
69 FX_INT32 GetSize() const;
70 CJS_GlobalData_Element* GetAt(int index) const;
71
72 private:
73 void LoadGlobalPersistentVariables();
74 void SaveGlobalPersisitentVariables();
75
76 CJS_GlobalData_Element* GetGlobalVariable(FX_LPCSTR propname);
77 int FindGlobalVariable(FX_LPCSTR propname);
78
79 void LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength);
80 void WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength);
81 void MakeByteString(const CFX_ByteString& name, FXJSE_HVALUE hValue, CFX_BinaryBuf& sData);
82
83 private:
84 CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData;
85 CFX_WideString m_sFilePath;
86 IFXJS_AppProvider* m_pApp;
87 CFXJS_Runtime* m_pRuntime;
88 };
89 } // namespace javascript
90
91 #endif //_JS_GLOBALDATA_H_


Javascript API: js_htmlview.h Source File

  • src
  • javascript
  • inc
js_htmlview.h
1 #ifndef JS_HTMLVIEW_H
2 #define JS_HTMLVIEW_H
3 namespace javascript {
4 class CFXJS_CPDFHtmlViewProvider;
5 class htmlView : public CFXJS_EmbedObj
6 {
7 public:
8 htmlView(CFXJS_Object* pJSObject);
9 virtual ~htmlView();
10
11 FX_BOOL callJScript(OBJ_METHOD_PARAMS);
12 FX_BOOL registerHtmlProxyFunc(OBJ_METHOD_PARAMS);
13 FX_BOOL setParams(OBJ_METHOD_PARAMS);
14 FX_BOOL getParams(OBJ_METHOD_PARAMS);
15
16 public:
17 // void AttachHTMLView(std::unique_ptr<CBrowserHtmlView>&& pHtmlView);
18 // CBrowserHtmlView* GetAttachedHtmlView(){return m_pHTMLView.get();}
19 void AttachHTMLView(void* pHtmlView);
20 void* GetAttachedHtmlView()
21 {
22 return m_pBrowserHtmlView;
23 }
24
25 private:
26 // std::unique_ptr<CBrowserHtmlView> m_pHTMLView;
27 void* m_pBrowserHtmlView; // CBrowserHtmlView
28 CFX_MapByteStringToPtr m_pParams;
29 };
30
31 class CFXJS_HTMLView : public CFXJS_Object
32 {
33 public:
34 CFXJS_HTMLView(CFXJS_Runtime* pRuntime)
35 : CFXJS_Object(pRuntime)
36 {
37 m_hHtmlValue = NULL;
38 }
39 virtual ~CFXJS_HTMLView()
40 {
41 if (m_hHtmlValue)
42 {
43 FXJSE_Value_Release(m_hHtmlValue);
44 m_hHtmlValue = NULL;
45 }
46 }
47
48 public:
49 DECLARE_JS_CLASS(CFXJS_HTMLView);
50 JS_STATIC_METHOD(callJScript, htmlView);
51 JS_STATIC_METHOD(registerHtmlProxyFunc, htmlView);
52 JS_STATIC_METHOD(setParams, htmlView);
53 JS_STATIC_METHOD(getParams, htmlView);
54
55 FXJSE_HVALUE m_hHtmlValue;
56 };
57 } // namespace javascript
58 #endif // JS_HTMLVIEW_H


Javascript API: js_http.h Source File

  • src
  • javascript
  • inc
js_http.h
1 #ifndef _JS_HTTP_H_
2 #define _JS_HTTP_H_
3
4 namespace javascript {
5
6 // class CFXJS_HttpThread;
7 class http : public CFXJS_EmbedObj
8 {
9 public:
10 http(CFXJS_Object* pJSObject);
11 virtual ~http();
12
13 public:
14 FX_BOOL request(OBJ_METHOD_PARAMS);
15 };
16
17 class CFXJS_Http : public CFXJS_Object
18 {
19 public:
20 CFXJS_Http(CFXJS_Runtime* pRuntime)
21 : CFXJS_Object(pRuntime){};
22 virtual ~CFXJS_Http(void){};
23
24 DECLARE_JS_CLASS(CFXJS_Http);
25
26 JS_STATIC_METHOD(request, http);
27 };
28 } // namespace javascript
29 #endif


Javascript API: js_i18n.h Source File

  • src
  • javascript
  • inc
js_i18n.h
1 #ifndef _JS_I18N_H_
2 #define _JS_I18N_H_
3
4 namespace javascript {
5 class ji18n : public CFXJS_EmbedObj
6 {
7 public:
8 ji18n(CFXJS_Object* pJSObject);
9 virtual ~ji18n();
10
11 public:
12 FX_BOOL getMessage(OBJ_METHOD_PARAMS);
13 FX_BOOL getCurLanguage(OBJ_METHOD_PARAMS);
14
15 private:
16 void JSMessageFormat(CFX_WideString& wsMessage, CFX_WideStringArray* pSubstitutions);
17 };
18
19 class CFXJS_I18N : public CFXJS_Object
20 {
21 public:
22 CFXJS_I18N(CFXJS_Runtime* pRuntime)
23 : CFXJS_Object(pRuntime){};
24 virtual ~CFXJS_I18N(void){};
25
26 DECLARE_JS_CLASS(CFXJS_I18N);
27
28 JS_STATIC_METHOD(getMessage, ji18n);
29 JS_STATIC_METHOD(getCurLanguage, ji18n);
30 };
31 } // namespace javascript
32
33 #endif


Javascript API: js_interface.h Source File

  • src
  • javascript
  • inc
js_interface.h
1 #ifndef _IJAVASCRIPT_H_
2 #define _IJAVASCRIPT_H_
3 #include "javascript/fx_javascript.h"
4 namespace javascript {
5 class IJS_Context;
6 class IJS_Runtime;
7 class IFXJS_AppProvider;
8 class IFXJS_DocumentProvider;
9
10 class IJS_RuntimeNotify
11 {
12 protected:
13 ~IJS_RuntimeNotify() {}
14
15 public:
16 virtual void OnInitial() = 0;
17 };
18
19 class IJS_RuntimeFactory : public CFX_Object
20 {
21 public:
22 virtual ~IJS_RuntimeFactory() {}
23
24 public:
25 virtual IJS_Runtime* NewJSRuntime(IFXJS_AppProvider* pApp,
26 FX_BOOL bXFA,
27 IJS_RuntimeNotify* pNotify = NULL,
28 IFXJS_DocumentProvider* pDoc = NULL) = 0;
29 virtual void DeleteJSRuntime(IJS_Runtime* pRunTime) = 0;
30 virtual IJS_Runtime* FindDocRuntime(IFXJS_DocumentProvider* pDoc) = 0;
31 };
32
33 } // namespace javascript
34
35 #endif //_IJAVASCRIPT_H_


Javascript API: js_module.h Source File

  • src
  • javascript
  • inc
js_module.h
1 #ifndef _JS_MODULE_H_
2 #define _JS_MODULE_H_
3 #include "./js_interface.h"
4 #include "javascript/fx_javascript.h"
5
6 namespace javascript {
7 class IJS_Runtime;
8 class IJS_RuntimeNotify;
9 class CFXJS_GlobalData;
10 class CFXJS_Runtime;
11 class CFXJS_Root;
12 class CFXJS_Module;
13 class IFXJS_ExternalScriptProvider;
14 class CFXJS_HTMLView;
15 enum FR_JS_Folder_Type
16 {
17 // FR_JS_Folder_Api,
18 FR_JS_Folder_App,
19 FR_JS_Folder_User
20 };
21
22 struct CurExec
23 {
24 IJS_Context* pContext;
25 CFX_ByteString func;
26 };
27
28 //#define APPJSAPIFOLDER L"\\JavaScripts\\jsapi"
29 #define APPJSFOLDER L"\\JavaScripts"
30 #define USERJSFOLDER L"Privileged\\%s\\JavaScripts"
31
32 class CFXJS_RuntimeFactory : public IJS_RuntimeFactory
33 {
34 public:
35 CFXJS_RuntimeFactory() {}
36
37 virtual ~CFXJS_RuntimeFactory()
38 {
39 m_RuntimesArr.clear();
40 }
41
42 virtual IJS_Runtime* NewJSRuntime(IFXJS_AppProvider* pApp,
43 FX_BOOL bXFA,
44 IJS_RuntimeNotify* pNotify,
45 IFXJS_DocumentProvider* pDoc);
46 virtual void DeleteJSRuntime(IJS_Runtime* pRunTime);
47
48 IJS_Runtime* FindDocRuntime(IFXJS_DocumentProvider* pDoc);
49
50 private:
51 std::vector<std::unique_ptr<IJS_Runtime>> m_RuntimesArr;
52 };
53 class CFXJS_Module : public IFX_JSEngine
54 {
55 public:
56 CFXJS_Module(IFXJS_AppProvider* pApp);
57 virtual ~CFXJS_Module();
58
59 void ReleaseDocRuntime(IFXJS_DocumentProvider* pDocument);
60
61 FX_BOOL RunJavaScript(CFX_WideString script, CFX_WideString& errInfo, FX_BOOL* pbRC = nullptr);
62
63 FX_BOOL RunNonConsoleJavaScript(CFX_WideString script,
64 CFX_WideString& errInfo,
65 FX_BOOL* pbRC = nullptr) override;
66
67 static void V8OOMErrorCallback(FX_BSTR szLocation, FX_BOOL bHeadOOM);
68 static void V8FatalErrorCallback(FX_BSTR szLocation, FX_BSTR szMessage);
69 static void EncounterFatalError(const CFX_WideString& title, const CFX_WideString& info);
70
71 FXJSE_HRUNTIME GetHRuntime() const
72 {
73 return m_gRuntime;
74 }
75
76 JSActionReturn RunDocJavaScript(IFXJS_DocumentProvider* pDocument,
77 CPDF_AAction::AActionType type,
78 const CFX_WideString& sScriptName,
79 const CFX_WideString& script,
80 CFX_WideString& errInfo);
81
82 JSActionReturn RunFieldJavaScript(IFXJS_DocumentProvider* pDocument,
83 CPDF_FormField* pFormField,
84 CPDF_AAction::AActionType type,
85 javascript::JS_FieldAction& data,
86 const CFX_WideString& script);
87 JSActionReturn RunBookmarkJavaScript(IFXJS_DocumentProvider* pDocument,
88 CPDF_Bookmark* pBookmark,
89 const CFX_WideString& script);
90
91 JSActionReturn RunFieldCalculate(IFXJS_DocumentProvider* pDocument,
92 CFX_WideString sourceName,
93 CFX_WideString targetName,
94 CFX_WideString& value,
95 CFX_WideString script,
96 FX_BOOL& rc);
97
98 JSActionReturn RunFieldFormat(IFXJS_DocumentProvider* pDocument,
99 FX_INT32 commitKey,
100 CFX_WideString targetName,
101 CFX_WideString& value,
102 CFX_WideString script,
103 FX_BOOL willCommit);
104
105 JSActionReturn RunOutsideEnv(IFXJS_DocumentProvider* pDocument,
106 JSEnv env,
107 CFX_WideString script,
108 CFX_WideString& errInfo);
109
110 JSActionReturn RunScreenJavaScript(IFXJS_DocumentProvider* pDocument,
111 CPDF_AAction::AActionType type,
112 CFX_WideString script,
113 FX_BOOL modifier,
114 FX_BOOL shift,
115 IFXJS_AnnotProvider* screenAnnot);
116
117 JSActionReturn RunFieldFormatChange(IFXJS_DocumentProvider* pReaderDoc,
118 CPDF_FormField* pSourceField,
119 CFX_WideString& csValue,
120 const CFX_WideString& script,
121 FX_BOOL& bRetCode,
122 FX_BOOL bEnableMsgBox);
123 JSActionReturn RunLinkJavaScript(IFXJS_DocumentProvider* pDocument, CFX_WideString script);
124
125 FX_BOOL RunProcJavaScript(IFXJS_DocumentProvider* pDocument,
126 CFX_WideString script,
127 JSProcType procType);
128 void DispatchMultimediaEvent(IFXJS_DocumentProvider* pDocument, FXJSE_HVALUE hEvents, JSMediaEventInfo& type);
129
130 void BeginAppBlock() override;
131
132 void EndAppBlock() override;
133
134 FX_BOOL IsBlockAppRuntime() override;
135
136 void BeginDocBlock(IFXJS_DocumentProvider* pDocument, FX_BOOL bXFA) override;
137
138 void EndDocBlock(IFXJS_DocumentProvider* pDocument, FX_BOOL bXFA) override;
139
140 FX_BOOL IsBlockDocRuntime(IFXJS_DocumentProvider* pDocument, FX_BOOL bXFA);
141
142 FX_BOOL IsRunningAppRuntime();
143
144 FX_BOOL IsRunningDocRuntime(IFXJS_DocumentProvider* pDocument, FX_BOOL bXFA);
145
146 void SetCloseDocDelay(IFXJS_DocumentProvider* pDocument, FX_BOOL bDelay, FX_BOOL bXFA);
147
148 void DoDelayCloseDoc(IFXJS_DocumentProvider* pDocument, FX_BOOL bXFA);
149
150 FX_BOOL CreateXFADocContext(IFXJS_DocumentProvider* pDocument);
151 void ReleaseXFADocContext(IFXJS_DocumentProvider* pDocument);
152 FX_BOOL GetHValueByName(IFXJS_DocumentProvider* pDocument,
153 FX_BOOL bXFA,
154 FX_BSTR utf8Name,
155 FXJSE_HVALUE hVaule);
156
157 virtual FX_BOOL GetHighPrivilege();
158 virtual void SetHighPrivilege(FX_BOOL bHighPrivilege);
159
160 void GetObjectNames(CFX_WideStringArray& array) override;
161 void GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array) override;
162 void GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array) override;
163 void GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array) override;
164
165 void AddNotSupportedWarning();
166
167 IJS_Runtime*
168 GetDocJSRuntime(IFXJS_DocumentProvider* pDocument, FX_BOOL bForJSPlugins, FX_BOOL bJustGet);
169 void SetJSRuntime(IJS_Runtime* pRuntime);
170 IJS_Runtime* GetAppJSRuntime(FX_BOOL bForJSPlugins, FX_BOOL bJustGet, FX_BOOL bXFA);
171
172 public:
173 FX_BOOL InitJavaScriptModule(IFXJS_AppProvider* pApp);
174
175 FX_BOOL InitGlobalContext(CFXJS_Runtime* runtime);
176 std::unique_ptr<IJS_Runtime>
177 NewJSRuntime(FX_BOOL bXFA, IJS_RuntimeNotify* pNotify, IFXJS_DocumentProvider* pDoc);
178 CFXJS_GlobalData* NewGlobalData(CFXJS_Runtime* pRuntime);
179 void ReleaseGlobalData();
180
181 FXJSE_HCONTEXT GetHContext() const
182 {
183 return m_gContext;
184 }
185 IJS_RuntimeFactory* GetJsRuntimeFactory()
186 {
187 return m_pJSRuntimeFactory;
188 }
189 void RemoveDocumentObject(IFXJS_DocumentProvider* pReaderDoc);
190 bool IsShowMsgBox(IFXJS_DocumentProvider* pReaderDoc);
191 void EraseRDocFormMap(IFXJS_DocumentProvider* pReaderDoc);
192 void InsertRDocToMap(IFXJS_DocumentProvider* pReaderDoc, bool bShow);
193 IJS_Runtime* GetDocJsRuntime(IFXJS_DocumentProvider* pReaderDoc, FX_BOOL bJustGet = false);
194 void clearInterval(IFXJS_DocumentProvider* pDoc, FX_BOOL bclearAll) override;
195 void
196 clearInterval(IFXJS_DocumentProvider* pDoc, CFXJS_Timer* pTimer, FX_BOOL bclearAll = false);
197 CFXJS_Timer* appSetInterval(IFXJS_DocumentProvider* pDoc, CFXJS_EmbedObj* object);
198 void SetBeginTrusted(FX_BOOL bBeginTrusted)
199 {
200 m_bBeginTrusted = bBeginTrusted;
201 }
202 FX_BOOL IsBeginTrusted()
203 {
204 return m_bBeginTrusted;
205 }
206 FX_INT32 GetStatusCode(CFXJS_Runtime* pRuntime, CPDF_Dictionary* pFieldDict, JS_ErrorString &sError, FX_BOOL &bRet);
207 void SetJSConsoleWillClear(bool bClear)
208 {
209 m_bJSWillClear = bClear;
210 }
211 bool JSConsoleWillClear() const
212 {
213 return m_bJSWillClear;
214 }
215 void ClearConsole()
216 {
217 m_pApp->ClearConsole();
218 SetJSConsoleWillClear(true);
219 }
220 void ExecLog(IJS_Context* pContext, CFX_ByteString func);
221 IFXJS_AppProvider* GetAppProvider() const
222 {
223 return m_pApp;
224 }
225 IFXJS_ConnectedPDFProvider* GetCPDFProvider() const
226 {
227 if (m_pApp)
228 return m_pApp->GetConnectedPDFProvider();
229 return NULL;
230 }
231
232 void AddCPDFHtmlView(std::unique_ptr<CFXJS_HTMLView>&& pHtmlView);
233 void DeleteCPDFHtmlView(CFXJS_HTMLView* pHtmlView);
234
235 public:
236 std::map<IFXJS_DocumentProvider*, std::unique_ptr<CFXJS_Document>> m_Doc2ObjectsMap;
237 std::map<IFXJS_DocumentProvider*, std::vector<std::unique_ptr<CFXJS_Timer>>> m_aTimer;
238 std::unique_ptr<CFXJS_Root> m_JSRoot;
239 std::map<CFX_WideString, bool> m_mapRDocTobShowMsgBox;
240 CFX_MapPtrToPtr m_PDFDocToJSDoc;
241 FX_BOOL m_bNoDocRuntime;
242 FX_BOOL m_bInitFXJSE;
243 FX_BOOL m_bJSWillClear;
244 IJS_Runtime* m_pAppJSRuntime;
245 CurExec* m_CurExecFunc;
246 std::vector<std::unique_ptr<CFXJS_HTMLView>> m_arrHtmlViews;
247
248 private:
249 FXJSE_HRUNTIME m_gRuntime;
250 FXJSE_HCONTEXT m_gContext;
251
252 CFXJS_GlobalData* m_pGlobalData;
253 FX_INT32 m_nGlobalDataCount;
254 IFXJS_AppProvider* m_pApp;
255
256 IJS_RuntimeFactory* m_pJSRuntimeFactory;
257
258 FX_BOOL m_bBeginTrusted;
259 };
260
262 // cpdf EventInfo
263 // extern FX_DWORD g_DlgShowTime;//alert
264 // class BasicEventInfo
265 // {
266 // public:
267 // BasicEventInfo()
268 // {
269 // m_pApp = NULL;
270 // hFunc = NULL;
271 // }
272 // BasicEventInfo(IFXJS_AppProvider* pApp, FXJSE_HVALUE hEventFunc, CFX_ByteString
273 // csEventPluginName)
274 // {
275 // m_pApp = pApp;
276 // hFunc = hEventFunc;
277 // csPluginName = csEventPluginName;
278 // }
279 // virtual ~BasicEventInfo() {}
280
281 // FX_BOOL CallEventCallbakcFunction(FXJSE_HVALUE hThis, FXJSE_HVALUE hRetValue, FX_UINT32
282 // nArgCount, FXJSE_HVALUE* lpArgs)
283 // {
284 // CFXJS_Module* pModule =
285 // dynamic_cast<CFXJS_Module*>(IFX_JSEngine::GetJSEngine(m_pApp));
286 // //pModule->m_pJSPluginMgr->SetCurJSPlugin(csPluginName);
288 // //FX_DWORD dwStart = GetTickCount();
289 // FX_BOOL bSuccess = FXJSE_Value_CallFunction(hFunc, hThis, hRetValue, nArgCount,
290 // lpArgs);
297 // //assert(bSuccess);
299 // return bSuccess;
300 // }
301
302 // public:
303 // IFXJS_AppProvider* m_pApp;
304 // FXJSE_HVALUE hFunc;
305 // CFX_ByteString csPluginName;
306 // };
307
308 // class EventInfo : public BasicEventInfo
309 // {
310 // public:
311 // EventInfo(IFXJS_AppProvider* pApp, FXJSE_HVALUE hEventFunc, CFX_ByteString
312 // csEventPluginName, CFX_ByteString eventType, CFXJS_Runtime* runtime = nullptr) :
313 // BasicEventInfo(pApp, hEventFunc, csEventPluginName)
314 // {
315 // csType = eventType;
316 // pJS_Runtime = runtime;
317 // }
318 // virtual ~EventInfo() {}
319 // public:
320 // CFX_ByteString csType;
321 // CFXJS_Runtime* pJS_Runtime;
322 // };
323
324 // class DRMEventInfo : public BasicEventInfo
325 // {
326 // public:
327 // DRMEventInfo(IFXJS_AppProvider* pApp, FXJSE_HVALUE hEventFunc, CFX_ByteString
328 // csEventPluginName) : BasicEventInfo(pApp, hEventFunc, csEventPluginName)
329 // {
330 // m_hDRMAuthVallue = NULL;
331 // pJS_Runtime = nullptr;
332 // }
333 // virtual ~DRMEventInfo()
334 // {
335 // if (m_hDRMAuthVallue)
336 // {
337 // FXJSE_Value_Release(m_hDRMAuthVallue);
338 // m_hDRMAuthVallue = NULL;
339 // }
340 // }
341
342 // public:
343 // CFXJS_Runtime* pJS_Runtime;
344 // //std::unique_ptr<IReader_DRMHandler> pDRMHandler;
345 // FXJSE_HVALUE m_hDRMAuthVallue;
346 // };
347 } // namespace javascript
348
349 #endif //_JS_MODULE_H_


Javascript API: js_object.h Source File

  • src
  • javascript
  • inc
js_object.h
1 #ifndef _JS_OBJECT_H_
2 #define _JS_OBJECT_H_
3
4 #include <vector>
5 #include <functional>
6
7 namespace javascript {
8 class CFXJS_Object;
9 class CFXJS_Timer;
10 class CFXJS_Context;
11 class CFXJS_Runtime;
12 class IFXJS_PageViewProvider;
13 class IFXJS_PageViewProvider;
14
15 CFX_WideString JSLoadStringFromID(JS_RC_STRING_ID ID);
16
17 namespace engine {
18 FX_BOOL FXJSE_Value_ToBool(FXJSE_HVALUE hValue, FX_BOOL& ret);
19 FX_BOOL FXJSE_Value_ToWideString(FXJSE_HVALUE hValue, CFX_WideString& szStrOutput);
20 FX_BOOL FXJSE_Value_SetWideString(FXJSE_HVALUE hValue, CFX_WideString& szStrInput);
21 FX_BOOL FXJSE_Value_ToWideStringArray(FXJSE_HVALUE hValue, std::vector<CFX_WideString>& strArray);
22 FX_BOOL FXJSE_Value_ToDWordArray(FXJSE_HVALUE hValue, CFX_DWordArray& array);
23
24 FX_INT32 FXJSE_GetInt32(CFXJSE_Arguments& args, int nIndex);
25
26 FX_FLOAT FXJSE_ToFloat(FXJSE_HVALUE hValue, float fDefValue = 0.0);
27 FXJSE_DOUBLE FXJSE_ToDouble(FXJSE_HVALUE hValue);
28 FX_INT32 FXJSE_ToInteger(FXJSE_HVALUE hValue);
29
30 CFX_WideString GetStringInfo(FXJSE_HVALUE hValue, FX_BSTR szPropName, FXJSE_HVALUE hPropValue);
31
32 void SetJSConsoleWillClear(CFXJS_Object* pJSObj);
33 } // namespace engine
34
35 // rely on C++11
36 template <typename F, typename... Args>
37 struct is_invocable
38 : std::is_constructible<std::function<void(Args...)>,
39 std::reference_wrapper<typename std::remove_reference<F>::type>>
40 {
41 };
42
43 template <typename R, typename F, typename... Args>
44 struct is_invocable_r
45 : std::is_constructible<std::function<R(Args...)>,
46 std::reference_wrapper<typename std::remove_reference<F>::type>>
47 {
48 };
49
50 template <bool B, class T = void>
51 using enable_if_t = typename std::enable_if<B, T>::type;
52
53 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_ANDROID_
54 constexpr FX_BOOL is_cacl_v = true;
55 constexpr FX_BOOL is_set_v = true;
56 constexpr FX_BOOL is_get_v = true;
57 #else
58 template <class Args, class F>
59 constexpr FX_BOOL is_cacl_v = is_invocable_r<FX_BOOL, F, FXJSE_HVALUE, Args&>::value;
60
61 template <class Args, class F>
62 constexpr FX_BOOL is_set_v = is_invocable_r<FX_BOOL, F, const Args&, JS_ErrorString&>::value;
63
64 template <class F>
65 constexpr FX_BOOL is_get_v = is_invocable_r<FX_BOOL, F, FXJSE_HVALUE, JS_ErrorString&>::value;
66 #endif
67
68 class CFXJS_EmbedObj : public CFX_Object
69 {
70 public:
71 CFXJS_EmbedObj(CFXJS_Object* pJSObject);
72 virtual ~CFXJS_EmbedObj();
73 virtual bool CheckBaseExpects()
74 {
75 return true;
76 }
77 virtual void TimerProc(CFXJS_Timer* pTimer) {}
78
79 CFXJS_Object* GetJSObject() const
80 {
81 return m_pJSObject;
82 }
83 operator CFXJS_Object*() const
84 {
85 return m_pJSObject;
86 }
87
88 IFXJS_PageViewProvider* JSGetPageView(CFXJS_Context* cc);
89 void Alert(CFXJS_Context* pContext, FX_LPCWSTR swMsg);
90 FX_BOOL IsSafeMode();
91 FX_BOOL CanRunJS(CFX_ByteString csFunctionName, IFXJS_DocumentProvider* pReaderDoc);
92
93 FX_BOOL CheckContextLevel() const;
94 FX_BOOL NeedFaithfulExecScript() const;
95 FX_BOOL IsCurDocInvalid();
96
97 FX_BOOL IsCanSet() const
98 {
99 return m_bCanSet;
100 }
101 FX_BOOL IsDelaySet() const
102 {
103 return m_bDelay;
104 }
105
106 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_ANDROID_
107 template <class Args,
108 class CF,
109 class SF,
110 class GF,
111 enable_if_t<is_cacl_v && is_set_v && is_get_v, int> = 0>
112 #else
113 template <class Args,
114 class CF,
115 class SF,
116 class GF,
117 enable_if_t<is_cacl_v<Args, CF> && is_set_v<Args, SF> && is_get_v<GF>, int> = 0>
118 #endif
119 FX_BOOL process(const CF& cacl_args_func,
120 const SF& set_func,
121 const GF& get_func,
122 OBJ_PROP_PARAMS,
123 FX_BOOL bCanRun = true)
124 {
125 // 1. 判断基本的前置条件是否满足，暂时只检测所对应的的对象是否已经不合法
126 // 基本前置条件在进入整个调用前执行，放在了JS_EXEC_INTERNAL的实现中
127 // if (!obj.CheckBaseExpects())
128 // JS_RAISE(JSDeadObjectError);
129 // 2. 判断额外的執行条件是否得到满足
130 if (!bCanRun)
131 JS_RAISE(JSNotAllowedError);
132 // 3. 执行属性操作
133 if (IsSet)
134 {
135 // 3.1 检测是否绑定了设置方法
136 // 3.2. 获取属性需要设置的值
137 Args value = {};
138 if (!cacl_args_func(hValue, value))
139 JS_RAISE(JSTypeError);
140 // 3.3. 检测基本的条件是否被破坏
141 if (!CheckBaseExpects())
142 JS_RAISE(JSDeadObjectError);
143 // 3.4. 执行设置
144 return set_func(value, sError);
145 }
146 else
147 {
148 return get_func(hValue, sError);
149 }
150 return true;
151 }
152
153 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_ANDROID_
154 template <class Args, class CF, class SF, enable_if_t<is_cacl_v && is_set_v, int> = 0>
155 #else
156 template <class Args,
157 class CF,
158 class SF,
159 enable_if_t<is_cacl_v<Args, CF> && is_set_v<Args, SF>, int> = 0>
160 #endif
161 FX_BOOL process(const CF& cacl_args_func,
162 const SF& set_func,
163 OBJ_PROP_PARAMS,
164 FX_BOOL bCanRun = true)
165 {
166 // 1. 判断基本的前置条件是否满足，暂时只检测所对应的的对象是否已经不合法
167 // 基本前置条件在进入整个调用前执行，放在了JS_EXEC_INTERNAL的实现中
168 // if (!obj.CheckBaseExpects())
169 // JS_RAISE(JSDeadObjectError);
170 // 2. 判断额外的執行条件是否得到满足
171 if (!bCanRun)
172 JS_RAISE(JSNotAllowedError);
173 // 3. 执行属性操作
174 if (IsSet)
175 {
176 // 3.1 检测是否绑定了设置方法
177 // 3.2. 获取属性需要设置的值
178 Args value = {};
179 if (!cacl_args_func(hValue, value))
180 JS_RAISE(JSTypeError);
181 // 3.3. 检测基本的条件是否被破坏
182 if (!CheckBaseExpects())
183 JS_RAISE(JSDeadObjectError);
184 // 3.4. 执行设置
185 return set_func(value, sError);
186 }
187 else
188 {
189 JS_RAISE(JSInvalidGetError);
190 }
191 return true;
192 }
193 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_ANDROID_
194 template <class Args, class GF, enable_if_t<is_get_v, int> = 0>
195 #else
196 template <class Args, class GF, enable_if_t<is_get_v<GF>, int> = 0>
197 #endif
198 FX_BOOL process(const GF& get_func, OBJ_PROP_PARAMS, FX_BOOL bCanRun = true)
199 {
200 // 1. 判断基本的前置条件是否满足，暂时只检测所对应的的对象是否已经不合法
201 // 基本前置条件在进入整个调用前执行，放在了JS_EXEC_INTERNAL的实现中
202 // if (!obj.CheckBaseExpects())
203 // JS_RAISE(JSDeadObjectError);
204 // 2. 判断额外的執行条件是否得到满足
205 if (!bCanRun)
206 JS_RAISE(JSNotAllowedError);
207 // 3. 执行属性操作
208 if (IsSet)
209 {
210 JS_RAISE(JSInvalidSetError);
211 }
212 else
213 {
214 return get_func(hValue, sError);
215 }
216 return true;
217 }
218
219 public:
220 std::vector<std::unique_ptr<CFXJS_Object>> m_NewObject;
221 CFXJS_Object* m_pJSObject;
222
223 protected:
224 FX_BOOL m_bCanSet = true;
225 FX_BOOL m_bDelay = false;
226 };
227
228 #define USERJSFOLDER L"Privileged\\%s\\JavaScripts"
229 #define SILENTINSTALLJSFOLDER L"SilentInstall\\JavaScripts"
230
231 class CFXJS_Object : public CFX_Object
232 {
233 public:
234 CFXJS_Object(CFXJS_Runtime* pRuntime);
235 virtual ~CFXJS_Object();
236
237 virtual FX_BOOL InitInstance()
238 {
239 return true;
240 };
241 CFX_WideString GetObjGuid();
242 operator CFXJS_EmbedObj*()
243 {
244 return m_pEmbedObj.get();
245 };
246
247 void SetEmbedObject(std::unique_ptr<CFXJS_EmbedObj>&& pObj)
248 {
249 m_pEmbedObj = std::move(pObj);
250 };
251 CFXJS_EmbedObj* GetEmbedObject()
252 {
253 return m_pEmbedObj.get();
254 };
255
256 static IFXJS_PageViewProvider* JSGetPageView(CFXJS_Context* cc);
257 static void Alert(CFXJS_Context* pContext, FX_LPCWSTR swMsg);
258
259 FX_BOOL IsSafeMode();
260 CFXJS_Runtime* GetJsRuntime()
261 {
262 return m_pRuntime;
263 };
264 void SetJsRuntime(CFXJS_Runtime* pRuntime)
265 {
266 m_pRuntime = pRuntime;
267 };
268 void Log(CFX_ByteString func);
269 // public:
270 // std::map<FX_LPCSTR, FXJSE_HVALUE> RootMap;
271
272 protected:
273 std::unique_ptr<CFXJS_EmbedObj> m_pEmbedObj;
274 CFXJS_Runtime* m_pRuntime;
275
276 private:
277 CFX_WideString m_wsObjGUID;
278 };
279
280 struct JS_TIMER_MAP
281 {
282 FX_UINT32 nID;
283 CFXJS_Timer* pTimer;
284 };
285
286 typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray;
287
288 struct JS_TIMER_MAPARRAY
289 {
290 public:
291 JS_TIMER_MAPARRAY() {}
292
293 ~JS_TIMER_MAPARRAY()
294 {
295 for (int i = 0, sz = m_Array.GetSize(); i < sz; i++)
296 delete m_Array.GetAt(i);
297
298 m_Array.RemoveAll();
299 }
300
301 void SetAt(FX_UINT32 nIndex, CFXJS_Timer* pTimer)
302 {
303 int i = Find(nIndex);
304
305 if (i >= 0)
306 {
307 if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
308 pMap->pTimer = pTimer;
309 }
310 else
311 {
312 if (JS_TIMER_MAP* pMap = new JS_TIMER_MAP)
313 {
314 pMap->nID = nIndex;
315 pMap->pTimer = pTimer;
316 m_Array.Add(pMap);
317 }
318 }
319 }
320
321 CFXJS_Timer* GetAt(FX_UINT32 nIndex)
322 {
323 int i = Find(nIndex);
324
325 if (i >= 0)
326 {
327 if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
328 return pMap->pTimer;
329 }
330 return NULL;
331 }
332
333 void RemoveAt(FX_UINT32 nIndex)
334 {
335 int i = Find(nIndex);
336
337 if (i >= 0)
338 {
339 delete m_Array.GetAt(i);
340 m_Array.RemoveAt(i);
341 }
342 }
343
344 int Find(FX_UINT32 nIndex)
345 {
346 for (int i = 0, sz = m_Array.GetSize(); i < sz; i++)
347 {
348 if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
349 {
350 if (pMap->nID == nIndex)
351 return i;
352 }
353 }
354
355 return -1;
356 }
357
358 CTimerMapArray m_Array;
359 };
360
361 static JS_TIMER_MAPARRAY m_sTimeMap;
362
363 class CFXJS_Runtime;
364
365 class JSTimerFunc
366 {
367 public:
368 JSTimerFunc(FXJSE_HVALUE Func, CFX_ByteString sPluginName)
369 {
370 m_hFunc = Func;
371 m_sPluginName = sPluginName;
372 }
373 virtual ~JSTimerFunc() {}
374
375 FXJSE_HVALUE m_hFunc;
376 CFX_ByteString m_sPluginName;
377 };
378 class CFXJS_Timer
379 {
380 public:
381 CFXJS_Timer(CFXJS_EmbedObj* pObj)
382 : m_pEmbedObj(pObj)
383 , m_nTimerID(0)
384 , m_bProcessing(false)
385 , m_dwStartTime(0)
386 , m_dwTimeOut(0)
387 , m_dwElapse(0)
388 , m_pRuntime(NULL)
389 , m_nType(0)
390 {
391 }
392
393 virtual ~CFXJS_Timer()
394 {
395 KillJSTimer();
396 }
397
398 public:
399 FX_UINT32 SetJSTimer(FX_UINT32 nElapse);
400
401 void KillJSTimer();
402
403 void SetType(int nType)
404 {
405 m_nType = nType;
406 }
407
408 int GetType() const
409 {
410 return m_nType;
411 }
412
413 void SetStartTime(FX_DWORD dwStartTime)
414 {
415 m_dwStartTime = dwStartTime;
416 }
417
418 FX_DWORD GetStartTime() const
419 {
420 return m_dwStartTime;
421 }
422
423 void SetTimeOut(FX_DWORD dwTimeOut)
424 {
425 m_dwTimeOut = dwTimeOut;
426 }
427
428 FX_DWORD GetTimeOut() const
429 {
430 return m_dwTimeOut;
431 }
432
433 void SetRuntime(CFXJS_Runtime* pRuntime)
434 {
435 m_pRuntime = pRuntime;
436 }
437
438 CFXJS_Runtime* GetRuntime() const
439 {
440 return m_pRuntime;
441 }
442
443 void SetJScript(const CFX_WideString& script)
444 {
445 m_swJScript = script;
446 }
447
448 CFX_WideString GetJScript() const
449 {
450 return m_swJScript;
451 }
452
453 void SetJSFunction(FXJSE_HVALUE hFunc);
454 JSTimerFunc* GetJSFunction() const; // cpdf
455
456 IFXJS_AppProvider* GetApp();
457 FX_UINT32 m_nTimerID;
458 CFXJS_EmbedObj* m_pEmbedObj;
459 FX_BOOL m_bProcessing;
460
461 private:
462 // data
463 FX_DWORD m_dwStartTime;
464 FX_DWORD m_dwTimeOut;
465 FX_DWORD m_dwElapse;
466 CFXJS_Runtime* m_pRuntime;
467 CFX_WideString m_swJScript;
468 int m_nType; // 0:Interval; 1:TimeOut
469 // std::unique_ptr<BasicEventInfo> m_hFunction; // cpdf
470 std::unique_ptr<JSTimerFunc> m_hFunction;
471 };
472 } // namespace javascript
473
474 #endif //_JS_OBJECT_H_


Javascript API: js_resource.h Source File

  • src
  • javascript
  • inc
js_resource.h
1 #ifndef _FJS_RESOURCE_H_
2 #define _FJS_RESOURCE_H_
3
4 #include "js_context.h"
5
6 namespace javascript {
7 #define IDD_JS_MSGBOX 25600
8 #define IDD_RESPONSE 25601
9 #define IDC_JS_MSG_TEXT 25602
10 #define ID_JS_MSG_OK 25603
11 #define ID_JS_MSG_CANCEL 25604
12 #define IDC_JS_MSG_ICON 25605
13 #define ID_JS_MSG_YES 25606
14 #define ID_JS_MSG_NO 25607
15 #define IDC_JS_QUESTION 25608
16 #define ID_JS_OK 25609
17 #define ID_JS_CANCEL 25610
18 #define IDC_JS_ANSWER 25611
19 #define IDC_JS_EDIT 25612
20 #define IDS_STRING_JSALERT 25613
21 #define IDS_STRING_JSPARAMERROR 25614
22 #define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615
23 #define IDS_STRING_JSPARAM_TOOLONG 25617
24 #define IDS_STRING_JSPARSEDATE 25618
25 #define IDS_STRING_JSRANGE1 25619
26 #define IDS_STRING_JSRANGE2 25620
27 #define IDS_STRING_JSRANGE3 25621
28 #define IDS_STRING_JSATTENTION 25624
29 #define IDS_STRING_JSSUBMITS 25625
30 #define IDS_STRING_JSSUBMITF 25626
31 #define IDS_STRING_NOTSUPPORT 25627
32 #define IDS_STRING_JSBUSY 25628
33 #define IDS_STRING_JSEVENT 25629
34 #define IDS_STRING_RUN 25630
35 #define IDS_STRING_UNHANDLED 25631
36 #define IDS_STRING_JSPRINT1 25632
37 #define IDS_STRING_JSPRINT2 25633
38 #define IDS_STRING_LAUNCHURL 25634
39 #define IDS_JSPARAM_INCORRECT 25635
40 #define IDD_JS_CONSOLE 25636
41 #define IDS_STRING_SAFEMODEL 25636
42 #define IDC_EDTSCRIPT 25637
43 #define IDC_BTNCLEAR 25638
44 #define IDC_EDTOUTPUT 25639
45 #define IDC_CHECK_TIPS 25640
46 #define IDC_BTNRUN 25641
47
48 static CFX_WideString JSGetStringFromID(CFXJS_Context* pContext, FX_DWORD ID)
49 {
50 auto pAppProvider = pContext->GetReaderApp();
51 if (!pAppProvider)
52 return L"";
53 switch (ID)
54 {
55 case IDS_STRING_JSALERT:
56 return pAppProvider->JSLoadString(ID_JS_ALERT);
57 case IDS_STRING_JSPARAMERROR:
58 return pAppProvider->JSLoadString(ID_JS_PARAMERROR);
59 case IDS_STRING_JSAFNUMBER_KEYSTROKE:
60 return pAppProvider->JSLoadString(ID_JS_AFNUMBER_KEYSTROKE);
61 case IDS_STRING_JSPARAM_TOOLONG:
62 return pAppProvider->JSLoadString(ID_JS_PARAM_TOOLONG);
63 case IDS_STRING_JSPARSEDATE:
64 return pAppProvider->JSLoadString(ID_JS_PARSEDATE);
65 case IDS_STRING_JSRANGE1:
66 return pAppProvider->JSLoadString(ID_JS_JSRANGE1);
67 case IDS_STRING_JSRANGE2:
68 return pAppProvider->JSLoadString(ID_JS_JSRANGE2);
69 case IDS_STRING_JSRANGE3:
70 return pAppProvider->JSLoadString(ID_JS_JSRANGE3);
71 case IDS_STRING_JSATTENTION:
72 return pAppProvider->JSLoadString(ID_JS_ATTENTION);
73 case IDS_STRING_JSSUBMITS:
74 return pAppProvider->JSLoadString(ID_JS_SUBMITS);
75 case IDS_STRING_JSSUBMITF:
76 return pAppProvider->JSLoadString(ID_JS_SUBMITF);
77 case IDS_STRING_NOTSUPPORT:
78 return pAppProvider->JSLoadString(ID_JS_NOTSUPPORT);
79 case IDS_STRING_JSBUSY:
80 return pAppProvider->JSLoadString(ID_JS_STR_JSBUSY);
81 case IDS_STRING_JSEVENT:
82 return pAppProvider->JSLoadString(ID_JS_EVENT);
83 case IDS_STRING_RUN:
84 return pAppProvider->JSLoadString(ID_JS_STR_RUN);
85 case IDS_STRING_UNHANDLED:
86 return pAppProvider->JSLoadString(ID_JS_UNHANDLED);
87 case IDS_STRING_JSPRINT1:
88 return pAppProvider->JSLoadString(ID_JS_PRINT1);
89 case IDS_STRING_JSPRINT2:
90 return pAppProvider->JSLoadString(ID_JS_PRINT2);
91 case IDS_STRING_LAUNCHURL:
92 return pAppProvider->JSLoadString(ID_JS_LAUNCHURL);
93 case IDS_JSPARAM_INCORRECT:
94 return pAppProvider->JSLoadString(ID_JS_PARAM_INCORRECT);
95 case IDS_STRING_SAFEMODEL:
96 return pAppProvider->JSLoadString(ID_JS_SAFEMODEL);
97 default:
98 return L"";
99 }
100 }
101
102 //#if (_FX_OS_ == _FX_ANDROID_) || (_FX_OS_ == _FX_IOS_) || (WINAPI_PARTITION_APP ||
103 // WINAPI_PARTITION_PC_APP)
104 static CFX_ByteString JSGetByteStringFromID(CFXJS_Context* pContext, FX_DWORD ID)
105 {
106 CFX_WideString cwMsg = JSGetStringFromID(pContext, ID);
107 return cwMsg.UTF8Encode();
108 }
109
110 } // namespace javascript
111
112 //#endif
113 #endif //_FJS_RESOURCE_H_


Javascript API: js_runtime.h Source File

  • src
  • javascript
  • inc
js_runtime.h
1 #ifndef _JS_RUNTIME_H_
2 #define _JS_RUNTIME_H_
3
4 namespace javascript {
6 class IFXJS_AppProvider;
7 class IFXJS_DocumentProvider;
8 class IJS_RuntimeNotify;
9 class CFXJS_Module;
10 class MessageHandler;
11 class CJS_FieldEvent
12 {
13 public:
14 CFX_WideString sTargetName;
15 JS_EVENT_T eEventType;
16 CJS_FieldEvent* pNext;
17 };
18
19 class CFXJS_Runtime : public IJS_Runtime
20 {
21 public:
22 CFXJS_Runtime(IFXJS_AppProvider* pApp,
23 IFXJS_DocumentProvider* pDoc = NULL,
24 FX_BOOL bXFA = false,
25 IJS_RuntimeNotify* pNotify = NULL);
26 virtual ~CFXJS_Runtime();
27
28 virtual void* GetGlobalData();
29 virtual bool IsThisAsGlobal();
30
31 virtual IJS_Context* NewContext(IJS_Context_Level level = IJS_Document_Level);
32 virtual void ReleaseContext();
33 virtual IJS_Context* GetCurrentContext();
34
35 virtual FX_BOOL IsRunning() const;
36
37 virtual void SetReaderDocument(IFXJS_DocumentProvider* pReaderDoc);
38 virtual IFXJS_DocumentProvider* GetReaderDocument()
39 {
40 return m_pDocument;
41 }
42 virtual void ClearReaderDocument();
43
44 virtual void GetObjectNames(CFX_WideStringArray& array);
45 virtual void GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array);
46 virtual void GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array);
47 virtual void GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array);
48
49 virtual FX_BOOL GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue);
50 virtual FXJSE_HRUNTIME GetHRuntime();
51
52 IFXJS_AppProvider* GetReaderApp()
53 {
54 return m_pApp;
55 }
56
57 FX_BOOL InitJSObjects(FX_BOOL bXFA);
58 FX_BOOL AllowedRemoveField(const CFX_WideString& sTargetName);
59 FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
60 void RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
61
62 void BeginBlock()
63 {
64 m_bBlocking = true;
65 }
66 void EndBlock()
67 {
68 m_bBlocking = false;
69 }
70 FX_BOOL IsBlocking()
71 {
72 return m_bBlocking;
73 }
74
75 // void OutputAll();
76
77 void SetGlobalData(void* pData);
78 FX_BOOL IsXFA() const
79 {
80 return m_bXFA;
81 }
82
83 IFXJS_AppProvider* GetAppProvider();
84 // ****
85 CFXJS_Context* GetJsContext();
86
87 FXJSE_HCONTEXT GetHContext() override;
88 FXJSE_HCONTEXT GetRootContext();
89 // void ReleaseHContext(FXJSE_HCONTEXT hContxt);
90 // for closeDoc Action 之后执行其他操作导致的Crash
91 FX_BOOL IsCurDocInvalid();
92
93 FX_BOOL IsSafeFunction(CFX_ByteString csFunctionName); // 判断是否是带S的函数
94 void SetHighPrivilege(FX_BOOL bHighPrivilege)
95 {
96 m_bHighPrivilege = bHighPrivilege;
97 } // 控制台等需要提高权限的地方设置。默认为false 不执行
98 bool GetHighPrivilege()
99 {
100 return m_bHighPrivilege;
101 } // 获取是否有更高的权利，目前只表示从控制台执行的
102
103 // SECURITY-228 XFA file closeDoc
104 virtual FX_BOOL SetCloseDocDelay(FX_BOOL bDelay);
105 virtual FX_BOOL DoDelayCloseDoc();
106
107 FX_BOOL IsCloseDocDelay();
108 void SetCloseDocAttribute(IFXJS_DocumentProvider* pRDDoc, FX_BOOL bNoSave);
109
110 FX_BOOL GetIsFirstGetInfo() override
111 {
112 return m_bFirstGetInfo;
113 }
114
115 std::vector<std::unique_ptr<CFXJS_Object>> ObjArray;
116 CFX_MapByteStringToPtr ValueMap;
117
118 CFXJS_Module* m_pJsModule;
119 IFXJS_AppProvider* m_pApp;
120 std::unique_ptr<MessageHandler> m_pMessageHandler;
121 bool m_bFirstGetInfo;
122
123 protected:
124 // IFXJS_DocumentProvider::Observer m_pDocument;
125 IFXJS_DocumentProvider* m_pDocument;
126 FX_BOOL m_bBlocking;
127 std::vector<CJS_FieldEvent> m_vecFieldEvent;
128
129 FX_BOOL m_bXFA;
130 FXJSE_HCONTEXT m_pDocContext;
131 CFXJS_Context* m_pCurContext;
132 // 为了标记ReleaseContext的时候和当前的Context对应不上的问题
133 // 为了可以循环访问m_stkContext 不使用std::stack 而是用vector来模拟栈行为
134 // std::vector的front作为栈顶
135 std::vector<std::unique_ptr<CFXJS_Context>> m_stkContext;
136 FX_BOOL m_bCurDocDestroyted;
137 FX_BOOL m_bHighPrivilege;
138 CFX_ByteStringArray m_SafeFunctionArray;
139 CFX_MapPtrTemplate<IFXJS_DocumentProvider*, FX_INT32> m_DestroyDocMap;
140 FX_BOOL m_bDealyCloseDoc;
141 CFX_MapPtrTemplate<IFXJS_DocumentProvider*, bool> m_CloseDocAttMap;
142 };
143 } // namespace javascript
144
145 #endif //_JS_RUNTIME_H_


Javascript API: js_value.h Source File

  • src
  • javascript
  • inc
js_value.h
1 #ifndef _JS_VALUE_H_
2 #define _JS_VALUE_H_
3
4 namespace javascript {
5 class CFXJS_Array;
6 class CFXJS_Date;
7
8 class CFXJS_Value
9 {
10 public:
11 CFXJS_Value();
12 CFXJS_Value(JSValue* pValue, VALUETYPE t);
13 CFXJS_Value(const int& iValue);
14 CFXJS_Value(const double& dValue);
15 CFXJS_Value(const float& fValue);
16 CFXJS_Value(const bool& bValue);
17 CFXJS_Value(JSFXObject*);
18 CFXJS_Value(JSObject*);
19 CFXJS_Value(CFXJS_Object*);
20 CFXJS_Value(FX_LPCSTR pStr);
21 CFXJS_Value(FX_LPCWSTR pWstr);
22 CFXJS_Value(CFXJS_Array& array);
23
24 ~CFXJS_Value();
25
26 void SetNull();
27 void Attach(JSValue* pValue, VALUETYPE t);
28 void Attach(CFXJS_Value* pValue);
29 void Detach();
30
31 operator int() const;
32 operator bool() const;
33 operator double() const;
34 operator float() const;
35 operator CFXJS_Object*() const;
36 operator JSFXObject*() const;
37 operator JSObject*() const;
38 operator Darray*() const;
39 operator FX_LPCWSTR() const;
40 operator FX_WCHAR*() const;
41 operator CFX_ByteString() const;
42 JSValue* ToJSValue();
43
44 void operator=(int iValue);
45 void operator=(bool bValue);
46 void operator=(double);
47 void operator=(float);
48 void operator=(CFXJS_Object*);
49 void operator=(JSFXObject*);
50 void operator=(JSObject*);
51 void operator=(CFXJS_Array&);
52 void operator=(CFXJS_Date&);
53 void operator=(FX_LPCWSTR pWstr);
54 void operator=(FX_LPCSTR pStr);
55 void operator=(CFXJS_Value value);
56
57 FX_BOOL IsArrayObject() const;
58 FX_BOOL IsDateObject() const;
59 VALUETYPE GetType() const;
60
61 FX_BOOL ConvertToArray(CFXJS_Array&) const;
62 FX_BOOL ConvertToDate(CFXJS_Date&) const;
63
64 protected:
65 JSValue* m_pValue;
66 VALUETYPE m_eType;
67 };
68
69 template <class TYPE>
70 class CJS_ParametersTmpl : public CFX_ArrayTemplate<TYPE>
71 {
72 public:
73 void push_back(TYPE newElement)
74 {
75 CFX_ArrayTemplate<TYPE>::Add(newElement);
76 }
77 int size() const
78 {
79 return CFX_ArrayTemplate<TYPE>::GetSize();
80 }
81 };
82 typedef CJS_ParametersTmpl<CFXJS_Value> CJS_Parameters;
83
84 class CFXJS_PropValue : public CFXJS_Value
85 {
86 public:
87 CFXJS_PropValue(const CFXJS_Value&);
88 CFXJS_PropValue();
89 ~CFXJS_PropValue();
90
91 public:
92 FX_BOOL IsSetting();
93 FX_BOOL IsGetting();
94 void operator<<(int);
95 void operator>>(int&);
96 void operator<<(bool);
97 void operator>>(bool&);
98 void operator<<(double);
99 void operator>>(double&);
100 void operator<<(CFXJS_Object* pObj);
101 void operator>>(CFXJS_Object*& ppObj);
102 void operator<<(CFX_ByteString);
103 void operator>>(CFX_ByteString&);
104 void operator<<(CFX_WideString);
105 void operator>>(CFX_WideString&);
106 void operator<<(FX_LPCWSTR c_string);
107
108 void operator<<(JSFXObject*);
109 void operator>>(JSFXObject*&);
110
111 void operator<<(JSObject*);
112 void operator>>(JSObject*&);
113
114 void operator>>(CFXJS_Array& array);
115 void operator<<(CFXJS_Array& array);
116
117 void operator<<(CFXJS_Date& date);
118 void operator>>(CFXJS_Date& date);
119 void StartSetting();
120 void StartGetting();
121
122 private:
123 FX_BOOL m_bIsSetting;
124 };
125
126 class CFXJS_Array
127 {
128 public:
129 CFXJS_Array();
130 virtual ~CFXJS_Array();
131
132 void Attach(Darray* pArray);
133 void GetElement(unsigned index, CFXJS_Value& value);
134 void SetElement(unsigned index, CFXJS_Value value);
135 int GetLength();
136 FX_BOOL IsAttached();
137 operator Darray*();
138
139 private:
140 Darray* m_pArray;
141 };
142
143 class CFXJS_Date
144 {
145 friend class CFXJS_Value;
146
147 public:
148 CFXJS_Date();
149 CFXJS_Date(double dMsec_time);
150 CFXJS_Date(int year, int mon, int day, int hour, int min, int sec);
151 virtual ~CFXJS_Date();
152 void Attach(Value* pDate);
153
154 int GetYear();
155 void SetYear(int iYear);
156
157 int GetMonth();
158 void SetMonth(int iMonth);
159
160 int GetDay();
161 void SetDay(int iDay);
162
163 int GetHours();
164 void SetHours(int iHours);
165
166 int GetMinutes();
167 void SetMinutes(int minutes);
168
169 int GetSeconds();
170 void SetSeconds(int seconds);
171
172 operator JSValue*();
173 operator double() const;
174
175 CFX_WideString ToString() const;
176
177 static double MakeDate(int year, int mon, int mday, int hour, int min, int sec, int ms);
178
179 FX_BOOL IsValidDate();
180
181 protected:
182 Value* m_pDate;
183 };
184
185 static CFXJS_Value PARAM_TO_JSVALUE(Value* p)
186 {
187 assert(p != NULL);
188
189 CFXJS_Value ret;
190
191 VALUETYPE type = GET_VALUE_TYPE(p);
192 switch (type)
193 {
194 case VT_string:
195 ret.Attach(p, VT_string);
196 break;
197 case VT_number:
198 ret.Attach(p, VT_number);
199 break;
200 case VT_boolean:
201 ret.Attach(p, VT_boolean);
202 break;
203 case VT_date:
204 ret.Attach(p, VT_date);
205 break;
206 case VT_object:
207 {
208 Dobject* pObj = DS_ToObject(p);
209 if (pObj && FXSYS_wcscmp(DS_GetClassname(pObj), CLASSNAME_STRING) == 0)
210 {
211 ret.Attach(DS_GetObjectValue(pObj), VT_string);
212 }
213 else
214 ret.Attach(p, VT_object);
215 }
216 break;
217 case VT_fxobject:
218 ret.Attach(p, VT_fxobject);
219 break;
220 case VT_null:
221 ret.Attach(p, VT_null);
222 break;
223 case VT_undefined:
224 ret.Attach(p, VT_undefined);
225 break;
226 }
227
228 return ret;
229 }
230 } // namespace javascript
231 #endif //_JS_VALUE_H_


Javascript API: js_wrapperTools.h Source File

  • src
  • javascript
  • inc
js_wrapperTools.h
1 #ifndef __JSE_WRAPPER_H__
2 #define __JSE_WRAPPER_H__
3
4 class JSEValue
5 {
6 public:
7 static JSEValue Create(FXJSE_HRUNTIME hRuntime)
8 {
9 return JSEValue(FXJSE_Value_Create(hRuntime));
10 }
11
12 static JSEValue Create(const CFXJSE_Arguments& args, FX_INT32 index)
13 {
14 return JSEValue(args.GetValue(index));
15 }
16
17 ~JSEValue()
18 {
19 Destory();
20 }
21 JSEValue(const JSEValue&) = delete;
22 JSEValue& operator=(const JSEValue&) = delete;
23 JSEValue(JSEValue&& other)
24 {
25 m_hValue = other.m_hValue;
26 other.m_hValue = nullptr;
27 }
28
29 JSEValue& operator=(JSEValue&& other)
30 {
31 if (this != &other)
32 {
33 Destory();
34 m_hValue = other.m_hValue;
35 other.m_hValue = nullptr;
36 }
37 return *this;
38 }
39
40 void reset(FXJSE_HVALUE hValue = nullptr)
41 {
42 Destory();
43 m_hValue = hValue;
44 }
45
46 FXJSE_HVALUE release()
47 {
48 FXJSE_HVALUE temp = m_hValue;
49 m_hValue = nullptr;
50 return temp;
51 }
52
53 operator bool() const
54 {
55 return m_hValue != nullptr;
56 }
57
58 operator FXJSE_HVALUE() const
59 {
60 return m_hValue;
61 }
62
63 private:
64 explicit JSEValue(FXJSE_HVALUE hValue = nullptr) noexcept
65 : m_hValue(hValue)
66 {
67 }
68 void Destory()
69 {
70 if (m_hValue)
71 FXJSE_Value_Release(m_hValue);
72 m_hValue = nullptr;
73 }
74 FXJSE_HVALUE m_hValue = nullptr;
75 };
76
77 // todo
78 // template<class T, std::enable_if_t<std::is_base_of_v<CFX_PrivateData,T>,int> = 0>
79 // class Observer {
80 // static void DeleteSubject(FX_LPVOID data) {
81 // if (data) {
82 // reinterpret_cast<Subject*>(data)->data_ = nullptr;
83 // }
84 // }
85 // struct Subject {
86 // std::atomic_int observer_count_ = 0;
87 // T* data_ = nullptr;
88 // explicit Subject(T* data) noexcept : data_(data) {}
89 // Subject(const Subject&) = delete;
90 // Subject& operator = (const Subject&) = delete;
91 // Subject(Subject&&) = delete;
92 // Subject& operator = (Subject&&) = delete;
93 //
94 // ~Subject() noexcept {
95 // if (data_) {
96 // data_->RemovePrivateData(data_);
97 // }
98 // data_ = nullptr;
99 // }
100 //
101 // void _AddObserver(Observer* observer) {
102 // if (observer && !observer->subject_) {
103 // observer->subject_ = this;
104 // observer_count_++;
105 // }
106 // }
107 //
108 // void _RemoveObserver(Observer* observer) {
109 // if (observer && observer->subject_ == this) {
110 // observer->subject_ = nullptr;
111 // if (!(--observer_count_))
112 // delete this;
113 // }
114 // }
115 // };
116 //
117 // void StartObserve(Subject* subject) {
118 // if (subject == subject_)
119 // return;
120 // StopObserve();
121 // if (subject)
122 // subject->_AddObserver(this);
123 // }
124 //
125 // public:
126 // explicit Observer(T* pData = nullptr) noexcept {
127 // StartObserve(pData);
128 // };
129 //
130 // Observer(const Observer& other) {
131 // StartObserve(other.subject_);
132 // }
133 //
134 // Observer& operator= (const Observer& other) {
135 // if (this != &other) StartObserve(other.subject_);
136 // return *this;
137 // }
138 //
139 // Observer(Observer&& other) {
140 // subject_ = other.subject_;
141 // other.subject_ = nullptr;
142 // }
143 //
144 // Observer& operator= (Observer&& other) {
145 // if (this != &other) {
146 // subject_ = other.subject_;
147 // other.subject_ = nullptr; StartObserve(other.subject_);
148 // }
149 // return *this;
150 // }
151 //
152 // ~Observer() {
153 // StopObserve();
154 // }
155 //
156 // T* Get() const {
157 // return subject_ ? subject_->data_ : nullptr;
158 // }
159 //
160 // T* operator->() {
161 // return subject_ ? subject_->data_ : nullptr;
162 // }
163 //
164 // operator bool() {
165 // return (subject_ && subject_->data_);
166 // }
167 //
168 // void StartObserve(T* pData) {
169 // if (!pData) {
170 // StopObserve();
171 // } else {
172 // auto subject = pData->GetPrivateData(pData);
173 // if (subject_ && subject == subject_) return;
174 // if (!subject) {
175 // subject = new Subject(pData);
176 // pData->SetPrivateData(pData, subject, DeleteSubject);
177 // }
178 // StartObserve(reinterpret_cast<Subject*>(subject));
179 // }
180 // }
181 //
182 // void StopObserve() {
183 // if (subject_) {
184 // subject_->_RemoveObserver(this);
185 // }
186 // }
187 //
188 //
189 //
190 // private:
191 // Subject* subject_ = nullptr;
192 //};
193
194 #endif


Javascript API: link.h File Reference

  • src
  • javascript
  • inc
Classes
link.h File Reference

JavaScript API for Link. More...

Go to the source code of this file.

Classes

class Link
This object is used to set and get the properties and to set the JavaScript action of a link. More...


Javascript API: media.h Source File

  • src
  • javascript
  • inc
media.h
1 #ifndef _MEDIA_H_
2 #define _MEDIA_H_
3
4 #include "fpdfannot/fpdf_annot.h"
5 #include "../../../include/javascript/fx_jsPlayerProvider.h"
6
8 namespace javascript {
10 class IFXJS_MediaPlayerProvider;
11 /* ------------------------------- MediaData ------------------------------- */
12 class MediaData : public CFXJS_EmbedObj
13 {
14 public:
15 MediaData(CFXJS_Object* pJSObject);
16 virtual ~MediaData();
17
18 public:
19
30 FX_BOOL isOpen(OBJ_PROP_PARAMS);
31
32 public:
33 void SetURL(CFX_WideString wsURL);
34 void SetMIMEType(CFX_WideString wsMIMEType);
35
36 private:
37 CFX_WideString m_wsURL;
38 CFX_WideString m_wsMIMEType;
39 };
40
41 class CFXJS_MediaData : public CFXJS_Object
42 {
43 public:
44 CFXJS_MediaData(CFXJS_Runtime* pRuntime)
45 : CFXJS_Object(pRuntime){};
46 virtual ~CFXJS_MediaData(){};
47
48 public:
49 DECLARE_JS_CLASS(CFXJS_MediaData);
50
51 JS_STATIC_PROP(isOpen, MediaData);
52 };
53
54 /*-------------------------------- PlayerInfo ------------------------------------*/
55 class PlayerInfo : public CFXJS_EmbedObj
56 {
57 public:
58 PlayerInfo(CFXJS_Object* pJSObject);
59 virtual ~PlayerInfo() {}
60 };
61 class CFXJS_PlayerInfo : public CFXJS_Object
62 {
63 public:
64 CFXJS_PlayerInfo(CFXJS_Runtime* pRuntime)
65 : CFXJS_Object(pRuntime){};
66 virtual ~CFXJS_PlayerInfo() {}
67 };
68 /* ------------------------------- PlayerInfoList ------------------------------- */
69
70 class PlayerInfoList : public CFXJS_EmbedObj
71 {
72 public:
73 PlayerInfoList(CFXJS_Object* pJSObject);
74 virtual ~PlayerInfoList();
75
76 public:
77
88 FX_BOOL isOpen(OBJ_PROP_PARAMS);
89
90 public:
91 void SetMIMEType(CFX_WideString wsMIMEType);
92
93 private:
94 CFX_WideString m_wsMIMEType;
95 };
96
97 class CFXJS_PlayerInfoList : public CFXJS_Object
98 {
99 public:
100 CFXJS_PlayerInfoList(CFXJS_Runtime* pRuntime)
101 : CFXJS_Object(pRuntime){};
102 virtual ~CFXJS_PlayerInfoList(){};
103
104 public:
105 DECLARE_JS_CLASS(CFXJS_PlayerInfoList);
106 };
107
108 /* ------------------------------- MediaSettings ------------------------------- */
109
110 typedef struct _FLOATING_INFO_TAG
111 {
112 _FLOATING_INFO_TAG()
113 {
114 align = 4;
115 over = 0;
116 canResize = 0;
117 hasClose = true;
118 hasTitle = true;
119 title = L"";
120 ifOffScreen = 0;
121 rect = FX_RECT();
122 width = 0;
123 height = 0;
124 }
125 int align;
126 int over;
127 int canResize;
128 FX_BOOL hasClose;
129 FX_BOOL hasTitle;
130 CFX_WideString title;
131 int ifOffScreen;
132 FX_RECT rect;
133 int width;
134 int height;
135
136 } FLOATING_INFO, *LPFLOATING_INFO;
137
138 class MediaSettings : public CFXJS_EmbedObj
139 {
140 public:
141 MediaSettings(CFXJS_Object* pJSObject);
142 virtual ~MediaSettings();
143
144 public:
145 FX_BOOL name(OBJ_PROP_PARAMS);
146
147 public:
148 void SetName(CFX_WideString wsName);
149 void SetWindowType(int iType);
150 void SetFloatingInfo(LPFLOATING_INFO pFloating);
151 void SetPlayerInfoList(PlayerInfoList* pPlayerInfo);
152 void SetMediaData(MediaData* pData);
153 void SetAutoPlay(FX_BOOL bIsAutoPlay);
154 void SetBaseURL(CFX_WideString wsURL);
155 void SetBGColor(FX_COLORREF bgcolor);
156 void SetBGOpacity(float fOpacity);
157 void SetDuration(int iDuration);
158 void SetLayout(int iLayout);
159 void SetMonitorType(int iMonitorType);
160 void SetPage(int iPage);
161 void SetPalindrome(FX_BOOL bPalindrome);
162 void SetRepeat(int iRepeat);
163 void SetIsShowUI(FX_BOOL bIsShowUI);
164 void SetIsVisible(FX_BOOL bIsVisible);
165 void SetVolume(int iVolume);
166
167 CFX_WideString GetName() const;
168 int GetWindowType() const;
169 LPFLOATING_INFO GetFloatingInfo() const;
170 PlayerInfoList* GetPlayerInfoList() const;
171 MediaData* GetMediaData() const;
172 FX_BOOL IsAutoPlay() const;
173 CFX_WideString GetBaseURL() const;
174 FX_COLORREF GetBGColor() const;
175 float GetBGOpacity() const;
176 int GetDuration() const;
177 int GetMonitorType() const;
178 int GetPage() const;
179 FX_BOOL GetPalindrome() const;
180 int GetRepeat() const;
181 FX_BOOL IsShowUI() const;
182 FX_BOOL IsVisible() const;
183 int GetVolume() const;
184 int GetLayout() const;
185
186 private:
187 CFX_WideString m_wsName;
188 int m_iWindowType;
189 std::unique_ptr<FLOATING_INFO> m_pFloatingInfo;
190 PlayerInfoList* m_pPlayerInfoList;
191 MediaData* m_pMediaData;
192 FX_BOOL m_bAutoPlay;
193 CFX_WideString m_wsBaseURL;
194 FX_COLORREF m_cBGColor;
195 float m_fBGOpacity;
196 int m_iDuration;
197 int m_iLayout;
198 int m_iMonitorType;
199 int m_iPage;
200 FX_BOOL m_bPalindrome;
201 int m_iRate;
202 int m_iRepeat;
203 FX_BOOL m_bShowUI;
204 FX_BOOL m_bVisible;
205 int m_iVolume;
206 };
207
208 class CFXJS_MediaSettings : public CFXJS_Object
209 {
210 public:
211 CFXJS_MediaSettings(CFXJS_Runtime* pRuntime)
212 : CFXJS_Object(pRuntime){};
213 virtual ~CFXJS_MediaSettings(){};
214
215 public:
216 DECLARE_JS_CLASS(CFXJS_MediaSettings);
217
218 JS_STATIC_PROP(name, MediaSettings);
219 };
220
221 /* ------------------------------- Rendition ------------------------------- */
227 class Rendition : public CFXJS_EmbedObj
228 {
229 public:
230 Rendition(CFXJS_Object* pJSObject);
231 virtual ~Rendition();
232
233 public:
234
252 FX_BOOL uiName(OBJ_PROP_PARAMS);
253
287 FX_BOOL altText(OBJ_PROP_PARAMS);
288
289 public:
290 void SetRendition(CPDF_Dictionary* pRenditionDict);
291 CFX_ByteString GetMediaContentType() const;
292 FX_COLORREF GetBGColor() const;
293 CPDF_FileSpec GetMediaClipFile() const;
294 CFX_ByteString GetMediaClipContentType() const;
295 CPDF_Dictionary* GetRendition() const;
296
297 private:
298 CPDF_Dictionary* m_pRenditionDict;
299 };
300
301 class CFXJS_Rendition : public CFXJS_Object
302 {
303 public:
304 CFXJS_Rendition(CFXJS_Runtime* pRuntime)
305 : CFXJS_Object(pRuntime){};
306 virtual ~CFXJS_Rendition(){};
307
308 public:
309 DECLARE_JS_CLASS(CFXJS_Rendition);
310
311 JS_STATIC_PROP(altText, Rendition);
312 JS_STATIC_PROP(uiName, Rendition);
313 };
314
315 /* ------------------------------- ScreenAnnot ------------------------------- */
321 class ScreenAnnot : public CFXJS_EmbedObj
322 {
323 public:
324 ScreenAnnot(CFXJS_Object* pJSObject);
325 virtual ~ScreenAnnot();
326
327 public:
328
339 FX_BOOL page(OBJ_PROP_PARAMS);
340
360 FX_BOOL rect(OBJ_PROP_PARAMS);
361
362 public:
363 void SetAnnot(IFXJS_AnnotProvider* pAnnot);
364 IFXJS_AnnotProvider* GetAnnot() const
365 {
366 return m_pScreenAnnot;
367 }
368
369 private:
370 void Rect(CPDF_Document* pReaderDoc, IFXJS_AnnotProvider* pAnnot, CPDF_Rect rectArray);
371 void UpdateAnnot(IFXJS_AnnotProvider* pAnnot, FX_BOOL bResetApp, FX_BOOL bRefresh);
372 IFXJS_AnnotProvider* m_pScreenAnnot;
373 };
374
375 class CFXJS_ScreenAnnot : public CFXJS_Object
376 {
377 public:
378 CFXJS_ScreenAnnot(CFXJS_Runtime* pRuntime)
379 : CFXJS_Object(pRuntime){};
380 virtual ~CFXJS_ScreenAnnot(){};
381
382 public:
383 DECLARE_JS_CLASS(CFXJS_ScreenAnnot);
384
385 JS_STATIC_PROP(page, ScreenAnnot);
386 JS_STATIC_PROP(rect, ScreenAnnot);
387 };
388
389 /* ------------------------------- MediaPlayer ------------------------------- */
395 class MediaPlayer : public CFXJS_EmbedObj
396 {
397 public:
398 MediaPlayer(CFXJS_Object* pJSObject);
399 virtual ~MediaPlayer();
400
401 public:
402
413 FX_BOOL isOpen(OBJ_PROP_PARAMS);
414
426 FX_BOOL settings(OBJ_PROP_PARAMS);
427
446 FX_BOOL visible(OBJ_PROP_PARAMS);
447
448
523 FX_BOOL open(OBJ_METHOD_PARAMS);
524
535 FX_BOOL close(OBJ_METHOD_PARAMS);
536
542 FX_BOOL stop(OBJ_METHOD_PARAMS);
543
608 FX_BOOL seek(OBJ_METHOD_PARAMS);
609
618 FX_BOOL play(OBJ_METHOD_PARAMS);
619
620 public:
621 void SetPlayer(IFXJS_MediaPlayerProvider* pPlayer);
622 void SetPlayerParam(FXJS_PLAYER_ARGS& PlayerParams, IFXJS_AppMediaProvider* pAppMediaProvider);
623 CFX_WideString GetPlayerName() const;
624 FX_BOOL IsOpen() const;
625 FX_BOOL IsVisible() const;
626
627 private:
628 IFXJS_MediaPlayerProvider* m_pMediaPlayer;
629 IFXJS_AppMediaProvider* m_pAppMediaProvider;
630 FXJS_PLAYER_ARGS m_PlayerParams;
631 };
632
633 class CFXJS_MediaPlayer : public CFXJS_Object
634 {
635 public:
636 CFXJS_MediaPlayer(CFXJS_Runtime* pRuntime)
637 : CFXJS_Object(pRuntime){};
638 virtual ~CFXJS_MediaPlayer(){};
639
640 public:
641 DECLARE_JS_CLASS(CFXJS_MediaPlayer);
642
643 JS_STATIC_PROP(isOpen, MediaPlayer);
644 JS_STATIC_PROP(settings, MediaPlayer);
645 JS_STATIC_PROP(visible, MediaPlayer);
646
647 JS_STATIC_METHOD(close, MediaPlayer);
648 JS_STATIC_METHOD(open, MediaPlayer);
649 JS_STATIC_METHOD(stop, MediaPlayer);
650 JS_STATIC_METHOD(seek, MediaPlayer);
651 JS_STATIC_METHOD(play, MediaPlayer);
652 };
653
654 /* ------------------------------- MediaPlayer ------------------------------- */
658 class doc_media : public CFXJS_EmbedObj
659 {
660 public:
661 doc_media(CFXJS_Object* pJSObject);
662 virtual ~doc_media();
663
664 public:
665
690 FX_BOOL getAnnot(OBJ_METHOD_PARAMS);
691
722 FX_BOOL getOpenPlayers(OBJ_METHOD_PARAMS);
723
742 FX_BOOL getRendition(OBJ_METHOD_PARAMS);
743
744 public:
745 void SetDocument(IFXJS_DocumentProvider* pDoc);
746 // CPDF_Rendition GetRenditionByName(CFX_WideString wsName);
747 void ParseParams(JSFXObject pObj,
748 int& iPage,
749 CFX_WideString& wsAnnotName,
750 CFX_WideString& wsAnnotTitle);
751 void GetAnnot(CFXJS_ScreenAnnot* pScreen,
752 int iPage,
753 CFX_WideString wsAnnotName,
754 CFX_WideString wsAnnotTitle) const;
755
756 private:
757 IFXJS_DocumentProvider* m_pDocument;
758 IFXJS_MediaPlayerArray m_aOpenPlayers;
759 std::unique_ptr<IFXJS_AppMediaProvider> m_pAppMedia;
760 };
761
762 class CFXJS_doc_media : public CFXJS_Object
763 {
764 public:
765 CFXJS_doc_media(CFXJS_Runtime* pRuntime)
766 : CFXJS_Object(pRuntime){};
767 virtual ~CFXJS_doc_media();
768
769 DECLARE_JS_CLASS(CFXJS_doc_media);
770
771 JS_STATIC_METHOD(getAnnot, doc_media);
772 JS_STATIC_METHOD(getOpenPlayers, doc_media);
773 JS_STATIC_METHOD(getRendition, doc_media);
774 };
775
776 /* ------------------------------- app_media ------------------------------- */
777
778 // class Document;
779
780 struct PARAMS_OF_PLAYER
781 {
782 PARAMS_OF_PLAYER()
783 {
784 m_pRendition = NULL;
785 m_pAnnot = NULL;
786 m_pSettings = new MediaSettings(NULL);
787 wsURL = L"";
788 wsMIMETYPE = L"";
789 m_pDocument = NULL;
790 m_hEvents = NULL;
791 }
792
793 virtual ~PARAMS_OF_PLAYER()
794 {
795 if (m_pSettings)
796 {
797 delete m_pSettings;
798 m_pSettings = NULL;
799 }
800 }
801
802 Rendition* m_pRendition;
803 ScreenAnnot* m_pAnnot;
804 MediaSettings* m_pSettings;
805 CFX_WideString wsURL;
806 CFX_WideString wsMIMETYPE;
807 Doc* m_pDocument;
808 FXJSE_HVALUE m_hEvents;
809 };
810
820 class app_media : public CFXJS_EmbedObj
821 {
822 public:
823 app_media(CFXJS_Object* pJSObject);
824 virtual ~app_media();
825
826 public:
827
839 FX_BOOL align(OBJ_PROP_PARAMS);
840
853 FX_BOOL closeReason(OBJ_PROP_PARAMS);
854
871 FX_BOOL windowType(OBJ_PROP_PARAMS);
872
884 FX_BOOL canResize(OBJ_PROP_PARAMS);
885
897 FX_BOOL ifOffScreen(OBJ_PROP_PARAMS);
898
909 FX_BOOL over(OBJ_PROP_PARAMS);
910
911
933 FX_BOOL getPlayers(OBJ_METHOD_PARAMS);
934
963 FX_BOOL getURLData(OBJ_METHOD_PARAMS);
964
986 FX_BOOL openPlayer(OBJ_METHOD_PARAMS);
987
1053 FX_BOOL createPlayer(OBJ_METHOD_PARAMS);
1054 FX_BOOL Events(OBJ_METHOD_PARAMS);
1055 static FX_BOOL Events(OBJ_STATIC_METHOD_PARAMS);
1056
1057 private:
1058 void ParsePlayerArg(JSFXObject pObj, PARAMS_OF_PLAYER& player_params);
1059 void SetPlayerArgs(FXJS_LPPLAYER_ARGS pPlayerArgs, const PARAMS_OF_PLAYER& player_params);
1060
1061 public:
1062 void SetDocument(CPDF_Document* pDoc);
1063
1064 private:
1065 CPDF_Document* m_pDocument;
1066 std::unique_ptr<IFXJS_AppMediaProvider> m_pAppMedia;
1067 IFXJS_MediaPlayerProvider* m_pAppMediaPlayer;
1068 bool m_bCreatePlayer;
1069 };
1070
1071 class CFXJS_app_media : public CFXJS_Object
1072 {
1073 public:
1074 CFXJS_app_media(CFXJS_Runtime* pRuntime)
1075 : CFXJS_Object(pRuntime)
1076 {
1077 }
1078 virtual ~CFXJS_app_media(){};
1079
1080 DECLARE_JS_CLASS(CFXJS_app_media);
1081
1082 JS_STATIC_PROP(align, app_media);
1083 JS_STATIC_PROP(closeReason, app_media);
1084 JS_STATIC_PROP(canResize, app_media);
1085 JS_STATIC_PROP(ifOffScreen, app_media);
1086 JS_STATIC_PROP(over, app_media);
1087 JS_STATIC_PROP(windowType, app_media);
1088
1089 JS_STATIC_METHOD(getPlayers, app_media);
1090 JS_STATIC_METHOD(getURLData, app_media);
1091 JS_STATIC_METHOD(openPlayer, app_media);
1092 JS_STATIC_METHOD(createPlayer, app_media);
1093 // JS_STATIC_METHOD(Events, app_media);
1094 JS_STATIC_STATIC_METHOD(Events, app_media);
1095 };
1096 } // namespace javascript
1097
1098 #endif //_MEDIA_H_
app_media
This object defines properties and functions useful in multimedia JavaScript code.
Definition: media.h:820
Rendition
A Rendition contains information needed to play a media clip, including embedded media data (or a URL...
Definition: media.h:227
ScreenAnnot
A ScreenAnnot object represents a screen annotation, which is a rectangular area within a PDF documen...
Definition: media.h:321
doc_media
The media property of each document specifies an object that contains multimedia properties and metho...
Definition: media.h:658
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205
MediaPlayer
A MediaPlayer object represents an instance of a multimedia player such as QuickTime,...
Definition: media.h:395


Javascript API: ocg.h File Reference

  • src
  • javascript
  • inc
Classes
ocg.h File Reference

JavaScript API for OCG. More...

Go to the source code of this file.

Classes

class OCG
An OCG object represents an optional content group in a PDF file. Content in the file can belong to one or more optional content groups. Content belonging to one or more OCGs is referred to as optional content and its visibility is determined by the states (ON or OFF) of the OCGs to which it belongs. In the simplest case, optional content belongs to a single OCG, with the content being visible when the OCG is on and hidden when the OCG is off. More advanced visibility behavior can be achieved by using multiple OCGs and different visibility mappings. Use the Doc getOCGs method to get an array of OCG objects for a PDF document. The Doc methods addWatermarkFromFile and addWatermarkFromText add watermarks in an OCG. See the PDF Reference for additional details on optional content groups. More...


Javascript API: printparams.h Source File

  • src
  • javascript
  • inc
printparams.h
1 #ifndef _PRINTPARAMS_H_
2 #define _PRINTPARAMS_H_
3
5 namespace javascript {
7 enum js_print_interaction_level
8 {
9 INTERACTION_LEVEL_FULL = 0,
10 INTERACTION_LEVEL_AUTOMATIC = 1,
11 INTERACTION_LEVEL_SILENT = 2
12 };
13
14 enum js_print_page_subset
15 {
16 PAGE_SUBSET_ALL = -3,
17 PAGE_SUBSET_EVEN = -5,
18 PAGE_SUBSET_ODD = -4
19 };
20
21 enum js_print_page_handling
22 {
23 PAGE_HANDLING_NONE = 1,
24 PAGE_HANDLING_FIT = 2,
25 PAGE_HANDLING_SHRINK = 3,
26 PAGE_HANDLING_TILE_ALL = 4, //不做支持
27 PAGE_HANDLING_TILE_LARGE = 5,
28 PAGE_HANDLING_NUP = 6,
29 PAGE_HANDLING_BOOKLET = 7
30 };
31
32 enum js_print_page_orders
33 {
34 PAGE_ORDERS_HORIZONTAL = 0,
35 PAGE_ORDERS_HORIZONTALREVERSED = 1,
36 PAGE_ORDERS_VERTICAL = 2,
37 PAGE_ORDERS_VERTICALREVERSED = 3
38 };
39
40 enum js_print_page_content
41 {
42 PAGE_CONTENT_DOC = 0,
43 PAGE_CONTENT_DOC_AND_COMMENTS = 1,
44 PAGE_CONTENT_DOC_AND_STAMPS = 2,
45 PAGE_CONTENT_FORMFIELDSONLY = 3
46 };
47
48 enum js_print_bookletBindings
49 {
50 BOOKLET_BINDINGS_LEFT = 0,
51 BOOKLET_BINDINGS_RIGHT = 1,
52 BOOKLET_BINDINGS_LEFT_TALL = 2,
53 BOOKLET_BINDINGS_RIGHT_TALL = 3
54 };
55
56 enum js_print_bookletDuplexMode
57 {
58 BOOKLET_DUPLEX_BOTH_SIDES = 0,
59 BOOKLET_DUPLEX_FRONT_SIDE_ONLY = 1,
60 BOOKLET_DUPLEX_BACK_SIDE_ONLY = 2
61 };
62
63 enum js_print_tileMark
64 {
65 TILEMARK_NONE = 0,
66 TILEMARK_WEST = 1,
67 TILEMARK_EAST = 2
68 };
69
70 enum js_print_DuplexType
71 {
72 DUPLEXTYPE_SIMPLEX = 0,
73 DUPLEXTYPE_FLIP_LONG_EDGE = 1,
74 DUPLEXTYPE_FLIP_SHORT_EDGE = 2
75 };
76
77 struct print_Range
78 {
79 int nStart;
80 int nEnd;
81
82 print_Range()
83 {
84 nStart = -1;
85 nEnd = -1;
86 }
87 };
88
94 class PrintParams : public CFXJS_EmbedObj
95 {
96 public:
97 PrintParams(CFXJS_Object* pJSObject);
98 virtual ~PrintParams(void);
99 //
100
111 FX_BOOL binaryOK(OBJ_PROP_PARAMS);
112
123 FX_BOOL bitmapDPI(OBJ_PROP_PARAMS);
124
195 FX_BOOL booklet(OBJ_PROP_PARAMS);
196 // FX_BOOL colorOverride (OBJ_PROP_PARAMS){return true;}
197
223 FX_BOOL constants(OBJ_PROP_PARAMS);
224
252 FX_BOOL DuplexType(OBJ_PROP_PARAMS);
253
281 FX_BOOL fileName(OBJ_PROP_PARAMS);
282
301 FX_BOOL firstPage(OBJ_PROP_PARAMS);
302
360 FX_BOOL flags(OBJ_PROP_PARAMS);
361
391 FX_BOOL interactive(OBJ_PROP_PARAMS);
392
404 FX_BOOL lastPage(OBJ_PROP_PARAMS);
405
417 FX_BOOL nUpAutoRotate(OBJ_PROP_PARAMS);
418
442 FX_BOOL nUpNumPagesH(OBJ_PROP_PARAMS);
443
456 FX_BOOL nUpNumPagesV(OBJ_PROP_PARAMS);
457
470 FX_BOOL nUpPageBorder(OBJ_PROP_PARAMS);
471
500 FX_BOOL nUpPageOrders(OBJ_PROP_PARAMS);
501
520 FX_BOOL NumCopies(OBJ_PROP_PARAMS);
521
566 FX_BOOL pageHandling(OBJ_PROP_PARAMS);
567
590 FX_BOOL pageSubset(OBJ_PROP_PARAMS);
591
602 FX_BOOL printAsImage(OBJ_PROP_PARAMS);
603
628 FX_BOOL printContent(OBJ_PROP_PARAMS);
629
652 FX_BOOL printRange(OBJ_PROP_PARAMS);
653
681 FX_BOOL printerName(OBJ_PROP_PARAMS);
682
693 FX_BOOL reversePages(OBJ_PROP_PARAMS);
694
705 FX_BOOL tileLabel(OBJ_PROP_PARAMS);
706
723 FX_BOOL tileMark(OBJ_PROP_PARAMS);
724
735 FX_BOOL tileOverlap(OBJ_PROP_PARAMS);
736
747 FX_BOOL tileScale(OBJ_PROP_PARAMS);
748
749 public:
750 FX_BOOL m_binaryOK;
751 FX_INT32 m_bitmapDPI;
752 FXJSE_HVALUE m_hBookletValue;
753 js_print_DuplexType m_nDuplexType;
754 CFX_ByteString m_bsFileName;
755 FX_INT32 m_nFirstPage;
756 FX_DWORD m_dwFlags;
757 js_print_interaction_level m_interactive;
758 FX_INT32 m_nLastPage;
759 FX_BOOL m_bUpAutoRotate;
760 FX_INT32 m_nUpNumPagesH;
761 FX_INT32 m_nUpNumPagesV;
762 FX_BOOL m_bUpPageBorder;
763 js_print_page_orders m_nUpPageOrders;
764 FX_INT32 m_nNumCopies;
765 js_print_page_handling m_nPageHandling;
766 js_print_page_subset m_nPageSubset;
767 FX_BOOL m_bPrintAsImage;
768 js_print_page_content m_nPrintContent;
769 std::vector<print_Range> m_printRangeVec;
770 CFX_ByteString m_bsPrinterName;
771 FX_BOOL m_bReversePages;
772 FX_BOOL m_bTileLabel;
773 js_print_tileMark m_nTileMark;
774 FX_INT32 m_nTileOverlap;
775 FX_FLOAT m_fTileScale;
776
777 private:
778 FX_BOOL setPropId(FXJSE_HVALUE hValue,
779 const char* pArrPropName[],
780 FX_INT32 arrValue[],
781 unsigned iNum,
782 CFXJS_Context* pContext);
783 };
784
785 class CFXJS_PrintParams : public CFXJS_Object
786 {
787 public:
788 CFXJS_PrintParams(CFXJS_Runtime* pRuntime)
789 : CFXJS_Object(pRuntime){};
790 virtual ~CFXJS_PrintParams(void){};
791
792 DECLARE_JS_CLASS(CFXJS_PrintParams);
793 //
794 JS_STATIC_PROP(binaryOK, PrintParams);
795 JS_STATIC_PROP(bitmapDPI, PrintParams);
796 JS_STATIC_PROP(booklet, PrintParams);
797 // JS_STATIC_PROP(colorOverride , PrintParams);
798 // JS_STATIC_PROP(colorProfile , PrintParams);
799 JS_STATIC_PROP(constants, PrintParams);
800 // JS_STATIC_PROP(downloadFarEastFonts , PrintParams);
801 JS_STATIC_PROP(DuplexType, PrintParams);
802 JS_STATIC_PROP(fileName, PrintParams);
803 JS_STATIC_PROP(firstPage, PrintParams);
804 JS_STATIC_PROP(flags, PrintParams);
805 // JS_STATIC_PROP(fontPolicy , PrintParams);
806 // JS_STATIC_PROP(gradientDPI , PrintParams);
807 JS_STATIC_PROP(interactive, PrintParams);
808 JS_STATIC_PROP(lastPage, PrintParams);
809 JS_STATIC_PROP(nUpAutoRotate, PrintParams);
810 JS_STATIC_PROP(nUpNumPagesH, PrintParams);
811 JS_STATIC_PROP(nUpNumPagesV, PrintParams);
812 JS_STATIC_PROP(nUpPageBorder, PrintParams);
813 JS_STATIC_PROP(nUpPageOrders, PrintParams);
814 JS_STATIC_PROP(NumCopies, PrintParams);
815 JS_STATIC_PROP(pageHandling, PrintParams);
816 JS_STATIC_PROP(pageSubset, PrintParams);
817 JS_STATIC_PROP(printAsImage, PrintParams);
818 JS_STATIC_PROP(printContent, PrintParams);
819 JS_STATIC_PROP(printRange, PrintParams);
820 JS_STATIC_PROP(printerName, PrintParams);
821 // JS_STATIC_PROP(psLevel , PrintParams);
822 // JS_STATIC_PROP(rasterFlags , PrintParams);
823 JS_STATIC_PROP(reversePages, PrintParams);
824 JS_STATIC_PROP(tileLabel, PrintParams);
825 JS_STATIC_PROP(tileMark, PrintParams);
826 JS_STATIC_PROP(tileOverlap, PrintParams);
827 JS_STATIC_PROP(tileScale, PrintParams);
828 // JS_STATIC_PROP(transparencyLevel , PrintParams);
829 // JS_STATIC_PROP(usePrinterCRD , PrintParams);
830 // JS_STATIC_PROP(useT1Conversion , PrintParams);
831 };
832
833 class Booklet : public CFXJS_EmbedObj
834 {
835 public:
836 Booklet(CFXJS_Object* pJSObject);
837 virtual ~Booklet(void);
838
839 FX_BOOL binding(OBJ_PROP_PARAMS);
840 FX_BOOL duplexMode(OBJ_PROP_PARAMS);
841
842 public:
843 js_print_bookletBindings m_nBookletBindings;
844 js_print_bookletDuplexMode m_nBookletDuplexMode;
845 ;
846 };
847
848 class CFXJS_Booklet : public CFXJS_Object
849 {
850 public:
851 CFXJS_Booklet(CFXJS_Runtime* pRuntime)
852 : CFXJS_Object(pRuntime)
853 {
854 }
855 virtual ~CFXJS_Booklet(){};
856
857 DECLARE_JS_CLASS(CFXJS_Booklet);
858
859 JS_STATIC_PROP(binding, Booklet);
860 JS_STATIC_PROP(duplexMode, Booklet);
861 };
862 } // namespace javascript
863
864 #endif //_PRINTPARAMS_H_
PrintParams
This is a generic object that controls printing parameters that affect any document printed using Jav...
Definition: printparams.h:94


Javascript API: publicmethods.h Source File

  • src
  • javascript
  • inc
publicmethods.h
1 #ifndef _PUBLICMETHODS_H_
2 #define _PUBLICMETHODS_H_
3
4 namespace javascript {
5 class CFXJS_PublicMethods : public CFXJS_Object
6 {
7 public:
8 CFXJS_PublicMethods(JSFXObject* pObject)
9 : CFXJS_Object(pObject){};
10 virtual ~CFXJS_PublicMethods(void){};
11
12 public:
13 static FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);
14 static FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);
15 static FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);
16 static FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);
17 static FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);
18 static FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);
19 static FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);
20 static FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);
21 static FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //
22 static FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);
23 static FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);
24 static FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);
25 static FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);
26 static FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);
27 static FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS); //
28 static FX_BOOL AFSimple(OBJ_METHOD_PARAMS);
29 static FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);
30 static FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);
31 static FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);
32 static FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS);
33 static FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);
34 static FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);
35
36 public:
37 JS_STATIC_GLOBAL_FUN(AFNumber_Format);
38 JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
39 JS_STATIC_GLOBAL_FUN(AFPercent_Format);
40 JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
41 JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
42 JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
43 JS_STATIC_GLOBAL_FUN(AFDate_Format);
44 JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
45 JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
46 JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
47 JS_STATIC_GLOBAL_FUN(AFTime_Format);
48 JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
49 JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
50 JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
51 JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
52 JS_STATIC_GLOBAL_FUN(AFSimple);
53 JS_STATIC_GLOBAL_FUN(AFMakeNumber);
54 JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
55 JS_STATIC_GLOBAL_FUN(AFRange_Validate);
56 JS_STATIC_GLOBAL_FUN(AFMergeChange);
57 JS_STATIC_GLOBAL_FUN(AFParseDateEx);
58 JS_STATIC_GLOBAL_FUN(AFExtractNums);
59
60 JS_STATIC_DECLARE_GLOBAL_FUN();
61
62 public:
63 static int
64 ParseStringInteger(const CFX_WideString& string, int nStart, int& nSkip, int nMaxStep);
65 static CFX_WideString ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
66 static double MakeRegularDate(const CFX_WideString& value,
67 const CFX_WideString& format,
68 FX_BOOL& bWrongFormat);
69 static CFX_WideString MakeFormatDate(double dDate, const CFX_WideString& format);
70 static FX_BOOL ConvertStringToNumber(FX_LPCWSTR swSource, double& dRet, FX_BOOL& bDot);
71 static double ParseStringToNumber(FX_LPCWSTR swSource);
72 static double ParseNormalDate(const CFX_WideString& value, FX_BOOL& bWrongFormat);
73 static FX_BOOL IsPM(const CFX_WideString& value, FX_BOOL bDouble, int nStart, int& nSkip);
74
75 static double MakeInterDate(CFX_WideString strValue);
76 static double ParseNumber(
77 FX_LPCWSTR swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);
78
79 public:
80 static CFX_WideString StrLTrim(FX_LPCWSTR pStr);
81 static CFX_WideString StrRTrim(FX_LPCWSTR pStr);
82 static CFX_WideString StrTrim(FX_LPCWSTR pStr);
83
84 static CFX_ByteString StrLTrim(FX_LPCSTR pStr);
85 static CFX_ByteString StrRTrim(FX_LPCSTR pStr);
86 static CFX_ByteString StrTrim(FX_LPCSTR pStr);
87
88 static FX_BOOL IsNumber(FX_LPCSTR string);
89 static FX_BOOL IsNumber(FX_LPCWSTR string);
90
91 static FX_BOOL IsDigit(char ch);
92 static FX_BOOL IsDigit(wchar_t ch);
93 static FX_BOOL IsAlphabetic(wchar_t ch);
94 static FX_BOOL IsAlphaNumeric(wchar_t ch);
95
96 static FX_BOOL maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
97 static FX_BOOL isReservedMaskChar(wchar_t ch);
98
99 static double AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);
100 static CFXJS_Array AF_MakeArrayFromList(CFXJS_Value val);
101 };
102 } // namespace javascript
103 #endif //_PUBLICMETHODS_H_


Javascript API: report.h Source File

  • src
  • javascript
  • inc
report.h
1 #ifndef _REPORT_H_
2 #define _REPORT_H_
3
4 namespace javascript {
5 class Report : public CFXJS_EmbedObj
6 {
7 public:
8 Report(CFXJS_Object* pJSObject);
9 virtual ~Report();
10
11 public:
12 FX_BOOL save(OBJ_METHOD_PARAMS);
13 FX_BOOL writeText(OBJ_METHOD_PARAMS);
14 };
15
16 class CFXJS_Report : public CFXJS_Object
17 {
18 public:
19 CFXJS_Report(CFXJS_Runtime* pRuntime)
20 : CFXJS_Object(pRuntime){};
21 virtual ~CFXJS_Report(){};
22
23 public:
24 DECLARE_JS_CLASS(CFXJS_Report);
25
26 JS_STATIC_METHOD(save, Report)
27 JS_STATIC_METHOD(writeText, Report);
28 };
29 } // namespace javascript
30
31 #endif //_REPORT_H_


Javascript API: scope_guard.h Source File

  • src
  • javascript
  • inc
scope_guard.h
1 #ifndef FR_SCOPE_GUARD_H_
2 #define FR_SCOPE_GUARD_H_
3
4 #define __SCOPEGUARD_CONCATENATE_IMPL(s1, s2) s1##s2
5 #define __SCOPEGUARD_CONCATENATE(s1, s2) __SCOPEGUARD_CONCATENATE_IMPL(s1, s2)
6
7 #include <type_traits>
8
9 namespace javascript {
10 template <typename Fun>
11 class ScopeGuard
12 {
13 public:
14 ScopeGuard(Fun&& f)
15 : _fun(std::forward<Fun>(f))
16 , _active(true)
17 {
18 }
19
20 ~ScopeGuard()
21 {
22 if (_active)
23 {
24 _fun();
25 }
26 }
27 ScopeGuard(const ScopeGuard&) = delete;
28 ScopeGuard& operator=(const ScopeGuard&) = delete;
29
30 void Dismiss()
31 {
32 _active = false;
33 }
34
35 ScopeGuard(ScopeGuard&& rhs)
36 : _fun(std::move(rhs._fun))
37 , _active(rhs._active)
38 {
39 rhs.Dismiss();
40 }
41
42 private:
43 ScopeGuard();
44 Fun _fun;
45 bool _active;
46 };
47
48 enum ScopeGuardOnExit
49 {
50 };
51
52 template <typename Fun>
53 inline ScopeGuard<Fun> operator+(ScopeGuardOnExit, Fun&& fn)
54 {
55 return ScopeGuard<Fun>(std::forward<Fun>(fn));
56 }
57
58 } // namespace javascript
59 // Helper macro
60 #define SCOPE_DEFER(Name) \
61 auto __SCOPEGUARD_CONCATENATE(_SDK_Scope_Guard_, Name) = ScopeGuardOnExit() +
62
63 #define SCOPE_DISMISS(Name) __SCOPEGUARD_CONCATENATE(_SDK_Scope_Guard_, Name).Dismiss()
64
65 #define ON_SCOPE_EXIT(Callback) \
66 SCOPE_DEFER(__SCOPEGUARD_CONCATENATE(_ext_exitBlock_, __LINE__)) Callback
67
68 // Sample 1
69 // char* buffer = new char[10]();
70 // ON_SCOPE_EXIT([&buffer] {delete[] buffer; });
71
72 // Sample 2
73 // char* buffer = new char[10]();
74 // SCOPE_DEFER(buffer)[&buffer] {delete[] buffer; };
75 // SCOPE_DISMISS(buffer);
76
77 #endif // FR_SCOPE_GUARD_H_


Javascript API: search.h File Reference

  • src
  • javascript
  • inc
Classes
search.h File Reference

JavaScript API for Index. More...

Go to the source code of this file.

Classes

class | Index
An object that represents a Catalog-generated index. It is non-creatable and returned by various methods of the search object and catalog object. You use this object to perform various indexing operations using Catalog. You can find the status of the index with a search. More...
class | search
The search object is a static object that accesses the functionality provided by the Foxit PDF Editor Search plug-in. This plug-in must be installed to interface with the search object (see available). See also the Index object, which is returned by some of the methods of the search object. The results for query calls are displayed in the Find dialog box of Foxit PDF Editor. More...

Detailed Description

JavaScript API for search.


Javascript API: securityhandler.h Source File

  • src
  • javascript
  • inc
securityhandler.h
1 #ifndef _SECURITYHANDLER_H_
2 #define _SECURITYHANDLER_H_
3
4
6 namespace javascript {
8
13 typedef enum _KeyName
14 {
16 KeyNameSigner = 0,
18 KeyNameLocation = 1,
20 KeyNameReason = 2,
22 KeyNameContactInfo = 3,
24 KeyNameDN = 4,
26 KeyNameText = 5
27 } KeyName;
28
29 // Conform to file:JavaScript for Foxit PDF Editor API Reference.pdf
30 enum SignatureInfoStatusCode
31 {
32 STATUS_NOT_SIGNAATURE_FIELD = -1,
33 STATUS_BLANK_OR_UNSIGNED,
34 STATUS_UNKNOWN,
35 STATUS_INVALID,
36 STATUS_VALID_BUT_SIGNER_CANNOT_VERIFIED,
37 STATUS_VALID_AND_SIGNER_VALID
38 };
39
41
47 class SecurityHandler : public CFXJS_EmbedObj
48 {
49 public:
50 SecurityHandler(CFXJS_Object* pJSObject);
51 virtual ~SecurityHandler(void);
52
53
66 FX_BOOL appearances(OBJ_PROP_PARAMS);
67
96 FX_BOOL digitalIDs(OBJ_PROP_PARAMS);
97
98
118 FX_BOOL isLoggedIn(OBJ_PROP_PARAMS);
119
130 FX_BOOL loginName(OBJ_PROP_PARAMS);
131
142 FX_BOOL loginPath(OBJ_PROP_PARAMS);
143
154 FX_BOOL name(OBJ_PROP_PARAMS);
155
166 FX_BOOL uiName(OBJ_PROP_PARAMS);
167
168
179 FX_BOOL signAuthor(OBJ_PROP_PARAMS);
180
191 FX_BOOL signInvisible(OBJ_PROP_PARAMS);
192
203 FX_BOOL signValidate(OBJ_PROP_PARAMS);
204
215 FX_BOOL signVisible(OBJ_PROP_PARAMS);
216
217
294 FX_BOOL login(OBJ_METHOD_PARAMS);
295
302 FX_BOOL logout(OBJ_METHOD_PARAMS);
303
357 FX_BOOL newUser(OBJ_METHOD_PARAMS);
358
359 public:
360 FX_BOOL GetCertificateAndPassowrd(void*& pCertificate, CFX_WideString& cwPassword);
361 CFX_WideString GetCertificatePath()
362 {
363 return m_cwCertPath;
364 };
365
366 private:
367 FX_BOOL m_bLoggedIn;
368
369 IFXJS_CertificateProvider* m_pCertMgr;
370 CFX_WideString m_cwCertPath;
371 void* m_pCertContext;
372 CFX_WideString m_cwPassword;
373 };
374
375 class CFXJS_SecurityHandler : public CFXJS_Object
376 {
377 public:
378 CFXJS_SecurityHandler(CFXJS_Runtime* pRuntime)
379 : CFXJS_Object(pRuntime){};
380 virtual ~CFXJS_SecurityHandler(void){};
381
382 DECLARE_JS_DYNAMIC_CLASS(CFXJS_SecurityHandler);
383
384 JS_STATIC_PROP(appearances, SecurityHandler);
385 JS_STATIC_PROP(digitalIDs, SecurityHandler);
386
387 JS_STATIC_PROP(isLoggedIn, SecurityHandler);
388 JS_STATIC_PROP(loginName, SecurityHandler);
389 JS_STATIC_PROP(loginPath, SecurityHandler);
390 JS_STATIC_PROP(name, SecurityHandler);
391 JS_STATIC_PROP(uiName, SecurityHandler);
392
393 JS_STATIC_PROP(signAuthor, SecurityHandler);
394 JS_STATIC_PROP(signInvisible, SecurityHandler);
395 JS_STATIC_PROP(signValidate, SecurityHandler);
396 JS_STATIC_PROP(signVisible, SecurityHandler);
397
398 JS_STATIC_METHOD(login, SecurityHandler);
399 JS_STATIC_METHOD(logout, SecurityHandler);
400 JS_STATIC_METHOD(newUser, SecurityHandler);
401 };
402
404
409 class security : public CFXJS_EmbedObj
410 {
411 public:
412 security(CFXJS_Object* pJSObject);
413 virtual ~security(void);
414
415
439 FX_BOOL handlers(OBJ_PROP_PARAMS);
440 FX_BOOL StandardHandler(OBJ_PROP_PARAMS);
441 FX_BOOL PPKLiteHandler(OBJ_PROP_PARAMS);
442 FX_BOOL APSHandler(OBJ_PROP_PARAMS);
443
444
476 FX_BOOL getHandler(OBJ_METHOD_PARAMS);
477
496 FX_BOOL importFromFile(OBJ_METHOD_PARAMS);
497 };
498
499 class CFXJS_security : public CFXJS_Object
500 {
501 public:
502 CFXJS_security(CFXJS_Runtime* pRuntime)
503 : CFXJS_Object(pRuntime){};
504 virtual ~CFXJS_security(void){};
505
506 DECLARE_JS_CLASS(CFXJS_security);
507
508 JS_STATIC_PROP(handlers, security);
509 JS_STATIC_PROP(StandardHandler, security);
510 JS_STATIC_PROP(PPKLiteHandler, security);
511 JS_STATIC_PROP(APSHandler, security);
512
513 JS_STATIC_METHOD(getHandler, security);
514 JS_STATIC_METHOD(importFromFile, security);
515 };
516
519
561 class SignatureInfo : public CFXJS_EmbedObj
562 {
563 public:
564 SignatureInfo(CFXJS_Object* pJSObject);
565 virtual ~SignatureInfo();
566 FX_BOOL CheckBaseExpects() override;
567
568 FX_BOOL date(OBJ_PROP_PARAMS);
569 FX_BOOL dateTrusted(OBJ_PROP_PARAMS);
570 FX_BOOL digestMethod(OBJ_PROP_PARAMS);
571
572 FX_BOOL handlerName(OBJ_PROP_PARAMS);
573 FX_BOOL handlerUserName(OBJ_PROP_PARAMS);
574 FX_BOOL handlerUIName(OBJ_PROP_PARAMS);
575
576 FX_BOOL location(OBJ_PROP_PARAMS);
577 FX_BOOL mdp(OBJ_PROP_PARAMS);
578 FX_BOOL name(OBJ_PROP_PARAMS);
579 FX_BOOL reason(OBJ_PROP_PARAMS);
580
581 FX_BOOL sigValue(OBJ_PROP_PARAMS);
582 FX_BOOL status(OBJ_PROP_PARAMS);
583 FX_BOOL statusText(OBJ_PROP_PARAMS);
584
585 FX_BOOL subFilter(OBJ_PROP_PARAMS);
586 FX_BOOL timeStamp(OBJ_PROP_PARAMS);
587
588 FX_BOOL verifyDate(OBJ_PROP_PARAMS);
589 FX_BOOL verifyHandlerName(OBJ_PROP_PARAMS);
590 FX_BOOL verifyHandlerUIName(OBJ_PROP_PARAMS);
591
592 FX_BOOL appearance(OBJ_PROP_PARAMS);
593 FX_BOOL certificates(OBJ_PROP_PARAMS);
594 FX_BOOL byteRange(OBJ_PROP_PARAMS);
595
596 FX_BOOL docValidity(OBJ_PROP_PARAMS);
597 FX_BOOL idPrivValidity(OBJ_PROP_PARAMS);
598 FX_BOOL idValidity(OBJ_PROP_PARAMS);
599 FX_BOOL objValidity(OBJ_PROP_PARAMS);
600
601 FX_BOOL password(OBJ_PROP_PARAMS);
602
603 public:
604 void SetFormField(CPDF_InterForm* pDocument, CPDF_FormField* pFormField);
605
606 private:
607 CPDF_Dictionary* GetSignVDict();
608 CFX_WideString GetHandleName(CPDF_Dictionary* pSignV);
609 CFX_WideString GetSignValue(CPDF_Dictionary* pSignV);
610 FX_BOOL GetByteRangeArr(CPDF_Dictionary* pSignV, CFX_Int32Array& byteRangeArr);
611 CPDF_Document* GetReaderDocument(CFXJS_Runtime* pRuntime);
612
613 CFX_WideString GetDate(CFXJS_Runtime* pRuntime);
614 CFX_WideString GetDocValidity(CFXJS_Runtime* pRuntime);
615 CFX_WideString GetSubFilter(CPDF_Dictionary* pSignV);
616 void GetInfo(FX_BSTR szKey, CFX_WideString& strInfo);
617 CFX_WideString GetidPrivValidity(CFXJS_Runtime* pRuntime);
618
619 private:
620 CPDF_FormField* m_pFormField;
621 CPDF_InterForm* m_pInterForm;
622 };
623
624 class CFXJS_SignatureInfo : public CFXJS_Object
625 {
626 public:
627 CFXJS_SignatureInfo(CFXJS_Runtime* pRuntime)
628 : CFXJS_Object(pRuntime){};
629 virtual ~CFXJS_SignatureInfo(void){};
630
631 DECLARE_JS_CLASS(CFXJS_SignatureInfo);
632
633 JS_STATIC_PROP(date, SignatureInfo);
634 JS_STATIC_PROP(dateTrusted, SignatureInfo);
635 JS_STATIC_PROP(digestMethod, SignatureInfo);
636
637 JS_STATIC_PROP(handlerName, SignatureInfo);
638 JS_STATIC_PROP(handlerUserName, SignatureInfo)
639 JS_STATIC_PROP(handlerUIName, SignatureInfo)
640
641 JS_STATIC_PROP(location, SignatureInfo);
642 JS_STATIC_PROP(mdp, SignatureInfo);
643 JS_STATIC_PROP(name, SignatureInfo);
644 JS_STATIC_PROP(reason, SignatureInfo);
645
646 JS_STATIC_PROP(sigValue, SignatureInfo);
647 JS_STATIC_PROP(status, SignatureInfo);
648 JS_STATIC_PROP(statusText, SignatureInfo);
649
650 JS_STATIC_PROP(subFilter, SignatureInfo);
651 JS_STATIC_PROP(timeStamp, SignatureInfo);
652
653 JS_STATIC_PROP(verifyDate, SignatureInfo);
654 JS_STATIC_PROP(verifyHandlerName, SignatureInfo);
655 JS_STATIC_PROP(verifyHandlerUIName, SignatureInfo);
656
657 JS_STATIC_PROP(appearance, SignatureInfo);
658 JS_STATIC_PROP(certificates, SignatureInfo);
659 JS_STATIC_PROP(byteRange, SignatureInfo);
660
661 JS_STATIC_PROP(docValidity, SignatureInfo);
662 JS_STATIC_PROP(idPrivValidity, SignatureInfo);
663 JS_STATIC_PROP(idValidity, SignatureInfo);
664 JS_STATIC_PROP(objValidity, SignatureInfo);
665
666 JS_STATIC_PROP(password, SignatureInfo);
667 };
668
670 class SeedValue : public CFXJS_EmbedObj
671 {
672 public:
673 SeedValue(CFXJS_Object* pJSObject);
674 virtual ~SeedValue(void);
675 FX_BOOL CheckBaseExpects() override;
676 FX_BOOL certspec(OBJ_PROP_PARAMS);
677 FX_BOOL digestMethod(OBJ_PROP_PARAMS);
678
679 FX_BOOL filter(OBJ_PROP_PARAMS);
680 FX_BOOL flags(OBJ_PROP_PARAMS);
681 FX_BOOL legalAttestations(OBJ_PROP_PARAMS);
682
683 FX_BOOL mdp(OBJ_PROP_PARAMS);
684 FX_BOOL reasons(OBJ_PROP_PARAMS);
685
686 FX_BOOL shouldAddRevInfo(OBJ_PROP_PARAMS);
687 FX_BOOL subFilter(OBJ_PROP_PARAMS);
688
689 FX_BOOL timeStampspec(OBJ_PROP_PARAMS);
690 FX_BOOL version(OBJ_PROP_PARAMS);
691
692 public:
693 void SetFormField(CPDF_InterForm* pInterForm, CPDF_FormField* pFormField);
694
695 FX_BOOL GetSeedValueInfo(JS_SG_SEEDVALUE_INFO*& pInfo);
696 void SetSeedValueInfo(JS_SG_SEEDVALUE_INFO*& pInfo);
697
698 FX_BOOL ParseSeedValue(CFXJS_Runtime* pRuntime,
699 FXJSE_HVALUE hValue,
700 JS_SG_SEEDVALUE_INFO*& pSeedInfo);
701
702 private:
703 FX_BOOL GetWideStringArr(FXJSE_HVALUE hValue,
704 FX_BSTR szPropName,
705 CFX_WideStringArray& widestringArr);
706 FX_BOOL GetByteStringArr(FXJSE_HVALUE hValue,
707 FX_BSTR szPropName,
708 CFX_ByteStringArray& bytestringArr);
709 FX_BOOL GetIntergerArr(FXJSE_HVALUE hValue, FX_BSTR szPropName, CFX_Int32Array& intergerArr);
710
711 FX_BOOL GetInterger(FXJSE_HVALUE hValue, FX_BSTR szPropName, FX_INT32& nValue);
712 FX_BOOL GetWideString(FXJSE_HVALUE hValue, FX_BSTR szPropName, CFX_WideString& cwString);
713
714 FX_BOOL GetSeedValueCert(FXJSE_HVALUE hValue, JS_SG_SEEDVALUE_INFO*& pSeedInfo);
715 FX_BOOL GetSeedValueTm(FXJSE_HVALUE hValue, JS_SG_SEEDVALUE_INFO*& pSeedInfo);
716
717 FX_BOOL ParseRDNValue(FXJSE_HVALUE hValue, JS_SG_SEEDVALUE_INFO*& pSeedInfo);
718
719 private:
720 CPDF_InterForm* m_pInterForm;
721 CPDF_FormField* m_pFormField;
722 CFXJS_Runtime* m_pRuntime;
723 FXJSE_HVALUE m_hValue;
724 JS_SG_SEEDVALUE_INFO* m_pSeedInfo;
725 std::vector<std::unique_ptr<JS_SG_SEEDVALUE_INFO>> m_SeedValueArray;
726 };
727
728 class CFXJS_SeedValue : public CFXJS_Object
729 {
730 public:
731 CFXJS_SeedValue(CFXJS_Runtime* pRuntime)
732 : CFXJS_Object(pRuntime){};
733 virtual ~CFXJS_SeedValue(void){};
734
735 DECLARE_JS_CLASS(CFXJS_SeedValue);
736
737 JS_STATIC_PROP(certspec, SeedValue);
738 JS_STATIC_PROP(digestMethod, SeedValue);
739 JS_STATIC_PROP(filter, SeedValue);
740 JS_STATIC_PROP(flags, SeedValue);
741 JS_STATIC_PROP(legalAttestations, SeedValue);
742 JS_STATIC_PROP(mdp, SeedValue);
743 JS_STATIC_PROP(reasons, SeedValue);
744 JS_STATIC_PROP(shouldAddRevInfo, SeedValue);
745 JS_STATIC_PROP(subFilter, SeedValue);
746 JS_STATIC_PROP(timeStampspec, SeedValue);
747 JS_STATIC_PROP(version, SeedValue);
748 };
749
751
752 class CertificateSpecifier : public CFXJS_EmbedObj
753 {
754 public:
755 CertificateSpecifier(CFXJS_Object* pJSObject);
756 virtual ~CertificateSpecifier(void);
757
758 FX_BOOL flags(OBJ_PROP_PARAMS);
759 FX_BOOL issuer(OBJ_PROP_PARAMS);
760
761 FX_BOOL keyUsage(OBJ_PROP_PARAMS);
762 FX_BOOL oid(OBJ_PROP_PARAMS);
763 FX_BOOL subject(OBJ_PROP_PARAMS);
764
765 FX_BOOL subjectDN(OBJ_PROP_PARAMS);
766 FX_BOOL url(OBJ_PROP_PARAMS);
767 FX_BOOL urlType(OBJ_PROP_PARAMS);
768
769 public:
770 FX_BOOL SetSeedValueCert(JS_SG_SEEDVALUE_INFO*& pSeedInfo)
771 {
772 m_pSeedInfo = pSeedInfo;
773 return true;
774 }
775 void GetCertificateObject(CFXJS_Runtime* pRuntime,
776 FXJSE_HVALUE hValue,
777 FX_BOOL bSubject = false);
778
779 private:
780 JS_SG_SEEDVALUE_INFO* m_pSeedInfo;
781 };
782
783 class CFXJS_CertificateSpecifier : public CFXJS_Object
784 {
785 public:
786 CFXJS_CertificateSpecifier(CFXJS_Runtime* pRuntime)
787 : CFXJS_Object(pRuntime){};
788 virtual ~CFXJS_CertificateSpecifier(void){};
789
790 DECLARE_JS_CLASS(CFXJS_CertificateSpecifier);
791
792 JS_STATIC_PROP(flags, CertificateSpecifier);
793 JS_STATIC_PROP(issuer, CertificateSpecifier);
794 JS_STATIC_PROP(keyUsage, CertificateSpecifier);
795 JS_STATIC_PROP(oid, CertificateSpecifier);
796 JS_STATIC_PROP(subject, CertificateSpecifier);
797
798 JS_STATIC_PROP(subjectDN, CertificateSpecifier);
799 JS_STATIC_PROP(url, CertificateSpecifier);
800 JS_STATIC_PROP(urlType, CertificateSpecifier);
801 };
802
804 class TimeStampSpecifier : public CFXJS_EmbedObj
805 {
806 public:
807 TimeStampSpecifier(CFXJS_Object* pJSObject);
808 virtual ~TimeStampSpecifier(void);
809
810 FX_BOOL flags(OBJ_PROP_PARAMS);
811 FX_BOOL url(OBJ_PROP_PARAMS);
812
813 public:
814 FX_BOOL SetSeedValue(JS_SG_SEEDVALUE_INFO*& pSeedInfo)
815 {
816 m_pSeedInfo = pSeedInfo;
817 return true;
818 }
819
820 private:
821 JS_SG_SEEDVALUE_INFO* m_pSeedInfo;
822 };
823
824 class CFXJS_TimeStampSpecifier : public CFXJS_Object
825 {
826 public:
827 CFXJS_TimeStampSpecifier(CFXJS_Runtime* pRuntime)
828 : CFXJS_Object(pRuntime){};
829 virtual ~CFXJS_TimeStampSpecifier(void){};
830
831 DECLARE_JS_CLASS(CFXJS_TimeStampSpecifier);
832
833 JS_STATIC_PROP(flags, TimeStampSpecifier);
834 JS_STATIC_PROP(url, TimeStampSpecifier);
835 };
836 } // namespace javascript
837 #endif
security
The security object is a static JavaScript object that exposes security-related PDF functions such as...
Definition: securityhandler.h:409
SignatureInfo
A generic JavaScript object that contains the properties of a digital signature. Some properties are ...
Definition: securityhandler.h:561
SecurityHandler
SecurityHandler objects are used to access security handler capabilities such as signatures,...
Definition: securityhandler.h:47


Javascript API: soap.h Source File

  • src
  • javascript
  • inc
soap.h
1 #ifndef _SOAP_H
2 #define _SOAP_H
3
5 namespace javascript {
7
8 class StreamDigest : public CFXJS_EmbedObj
9 {
10 public:
11 StreamDigest(CFXJS_Object* pJSObject);
12 virtual ~StreamDigest(){};
13 FX_BOOL MD5(OBJ_PROP_PARAMS);
14 FX_BOOL SHA1(OBJ_PROP_PARAMS);
15 };
16 class CFXJS_StreamDigest : public CFXJS_Object
17 {
18 public:
19 CFXJS_StreamDigest(CFXJS_Runtime* pRuntime)
20 : CFXJS_Object(pRuntime){};
21 virtual ~CFXJS_StreamDigest(){};
22
23 public:
24 DECLARE_JS_CLASS(CFXJS_StreamDigest)
25 JS_STATIC_PROP(MD5, StreamDigest)
26 JS_STATIC_PROP(SHA1, StreamDigest)
27 };
28
40 class ReadStream : public CFXJS_EmbedObj
41 {
42 public:
43 ReadStream(CFXJS_Object* pJSObject);
44 virtual ~ReadStream(){};
45
46 FX_BOOL read(OBJ_PROP_PARAMS);
47 FX_BOOL write(OBJ_PROP_PARAMS);
48
49 void SetString(CFX_ByteString csString);
50 CFX_ByteString GetString();
51
52 private:
53 CFX_ByteString m_csContents;
54 };
55 class CFXJS_ReadStream : public CFXJS_Object
56 {
57 public:
58 CFXJS_ReadStream(CFXJS_Runtime* pRuntime)
59 : CFXJS_Object(pRuntime){};
60 virtual ~CFXJS_ReadStream(){};
61
62 public:
63 DECLARE_JS_CLASS(CFXJS_ReadStream)
64 JS_STATIC_PROP(read, ReadStream)
65 JS_STATIC_PROP(write, ReadStream)
66 };
67
68 class SOAP : public CFXJS_EmbedObj
69 {
70 public:
71 SOAP(CFXJS_Object* pJSObject);
72 virtual ~SOAP();
73
74 public:
75 FX_BOOL wireDump(OBJ_PROP_PARAMS);
76
77 FX_BOOL connect(OBJ_METHOD_PARAMS);
78
79 FX_BOOL queryServices(OBJ_METHOD_PARAMS);
80 FX_BOOL resolveService(OBJ_METHOD_PARAMS);
81 FX_BOOL request(OBJ_METHOD_PARAMS);
82 FX_BOOL response(OBJ_METHOD_PARAMS);
83 FX_BOOL streamDecode(OBJ_METHOD_PARAMS);
84 FX_BOOL streamDigest(OBJ_METHOD_PARAMS);
85 FX_BOOL streamEncode(OBJ_METHOD_PARAMS);
86 FX_BOOL streamFromString(OBJ_METHOD_PARAMS);
87 FX_BOOL stringFromStream(OBJ_METHOD_PARAMS);
88 // static FX_BOOL HttpDataPost(FX_LPCWSTR csData,FX_LPCWSTR csAppName,CFX_WideString
89 // csObject,FX_LPCWSTR csServer, FX_LPCWSTR csUserName,FX_LPCWSTR csPassword,INTERNET_PORT nPort
90 // ,BOOL IsHTTPS,FX_LPCWSTR csContentType,FX_LPCWSTR csAddHeader,CFX_WideString &wsResponse);
91 // static FX_BOOL NeedAuth(CHttpFile *pHttpFile);
92 // FX_BOOL PostRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsContentType,
93 // FX_WSTR wsEncode, FX_WSTR wsHeader, CFX_WideString &wsResponse);
94 };
95
96 class CFXJS_SOAP : public CFXJS_Object
97 {
98 public:
99 CFXJS_SOAP(CFXJS_Runtime* pRuntime)
100 : CFXJS_Object(pRuntime){};
101 virtual ~CFXJS_SOAP(){};
102
103 public:
104 DECLARE_JS_CLASS(CFXJS_SOAP);
105 JS_STATIC_PROP(wireDump, SOAP);
106
107 JS_STATIC_METHOD(connect, SOAP);
108 JS_STATIC_METHOD(queryServices, SOAP);
109 JS_STATIC_METHOD(resolveService, SOAP);
110 JS_STATIC_METHOD(request, SOAP);
111 JS_STATIC_METHOD(response, SOAP);
112 JS_STATIC_METHOD(streamDecode, SOAP);
113 JS_STATIC_METHOD(streamDigest, SOAP);
114 JS_STATIC_METHOD(streamEncode, SOAP);
115 JS_STATIC_METHOD(streamFromString, SOAP);
116 JS_STATIC_METHOD(stringFromStream, SOAP);
117 };
118
119 } // namespace javascript
120 #endif
ReadStream
A ReadStream object is an object literal that represents a stream of data. It contains a method to al...
Definition: soap.h:40


Javascript API: span.h File Reference

  • src
  • javascript
  • inc
Classes
span.h File Reference

JavaScript API for Span. More...

Go to the source code of this file.

Classes

class Span
A generic object that represents a length of text and its associated properties in a rich text form field or annotation. A rich text value consists of an array of span objects representing the text and formatting. More...


Javascript API: template.h File Reference

  • src
  • javascript
  • inc
Classes
template.h File Reference

JavaScript API for Template. More...

Go to the source code of this file.

Classes

class Template
Template objects are named pages within the document. These pages may be hidden or visible and can be copied or spawned. They are typically used to dynamically create content (for example, to add pages to an invoice on overflow). More...


Javascript API: tools.h Source File

  • src
  • javascript
  • inc
tools.h
1 #ifndef _TOOLS_H
2 #define _TOOLS_H
3
4 namespace javascript {
5 class localStorage : public CFXJS_EmbedObj
6 {
7 public:
8 localStorage(CFXJS_Object* pJSObject);
9 ~localStorage() {}
10
11 public:
12 FX_BOOL write(OBJ_METHOD_PARAMS);
13 FX_BOOL read(OBJ_METHOD_PARAMS);
14 };
15
16 class CFXJS_Cache : public CFXJS_Object
17 {
18 public:
19 CFXJS_Cache(CFXJS_Runtime* pRuntime)
20 : CFXJS_Object(pRuntime)
21 {
22 }
23 virtual ~CFXJS_Cache() {}
24
25 DECLARE_JS_CLASS(CFXJS_Cache)
26
27 JS_STATIC_METHOD(write, localStorage)
28 JS_STATIC_METHOD(read, localStorage)
29 };
30
31 class persistentData : public CFXJS_EmbedObj
32 {
33 public:
34 persistentData(CFXJS_Object* pJSObject);
35 virtual ~persistentData(){};
36
37 public:
38 FX_BOOL writeData(OBJ_METHOD_PARAMS);
39 FX_BOOL getData(OBJ_METHOD_PARAMS);
40 FX_BOOL deleteData(OBJ_METHOD_PARAMS);
41 };
42
43 class CFXJS_PersistentData : public CFXJS_Object
44 {
45 public:
46 CFXJS_PersistentData(CFXJS_Runtime* pRuntime)
47 : CFXJS_Object(pRuntime)
48 {
49 }
50 virtual ~CFXJS_PersistentData() {}
51
52 DECLARE_JS_CLASS(CFXJS_PersistentData)
53
54 JS_STATIC_METHOD(writeData, persistentData)
55 JS_STATIC_METHOD(getData, persistentData)
56 JS_STATIC_METHOD(deleteData, persistentData)
57 };
58
59 class bitmap : public CFXJS_EmbedObj
60 {
61 public:
62 bitmap(CFXJS_Object* pJSObject);
63 virtual ~bitmap() {}
64
65 public:
66 FX_BOOL width(OBJ_PROP_PARAMS);
67 FX_BOOL heigth(OBJ_PROP_PARAMS);
68 };
69 class CFXJS_BitMap : public CFXJS_Object
70 {
71 public:
72 CFXJS_BitMap(CFXJS_Runtime* pRuntime)
73 : CFXJS_Object(pRuntime)
74 {
75 }
76 virtual ~CFXJS_BitMap() {}
77
78 DECLARE_JS_CLASS(CFXJS_BitMap)
79
80 JS_STATIC_PROP(width, bitmap);
81 JS_STATIC_PROP(heigth, bitmap);
82 };
83
84 #define JS_LOCAL_FILE_STORAGE L"JSLocalFileStorage\\"
85 class localFileStorage : public CFXJS_EmbedObj
86 {
87 public:
88 localFileStorage(CFXJS_Object* pJSObject);
89 ~localFileStorage() {}
90
91 private:
92 FX_BOOL CreateMultipleDirectory(const CFX_ByteString& szPath);
93
94 public:
95 FX_BOOL write(OBJ_METHOD_PARAMS);
96 FX_BOOL write2(OBJ_METHOD_PARAMS);
97 FX_BOOL read(OBJ_METHOD_PARAMS);
98 FX_BOOL remove(OBJ_METHOD_PARAMS);
99 };
100
101 class CFXJS_LocalFileStorage : public CFXJS_Object
102 {
103 public:
104 CFXJS_LocalFileStorage(CFXJS_Runtime* pRuntime)
105 : CFXJS_Object(pRuntime)
106 {
107 }
108 virtual ~CFXJS_LocalFileStorage() {}
109
110 DECLARE_JS_CLASS(CFXJS_LocalFileStorage)
111
112 JS_STATIC_METHOD(write, localFileStorage)
113 JS_STATIC_METHOD(write2, localFileStorage)
114 JS_STATIC_METHOD(read, localFileStorage)
115 JS_STATIC_METHOD(remove, localFileStorage)
116 };
117 } // namespace javascript
118 #endif


Javascript API: util.h File Reference

  • src
  • javascript
  • inc
Classes
util.h File Reference

JavaScript API for util. More...

Go to the source code of this file.

Classes

class util
A static JavaScript object that defines a number of utility methods and convenience functions for string and date formatting and parsing. More...


Javascript API: src Directory Reference

  • src
src Directory Reference


Javascript API: inc Directory Reference

  • src
  • javascript
  • inc
inc Directory Reference

Files

file | 3d.h [code]
JavaScript API for Bookmark.
file | annotation.h [code]
JavaScript API for attachment.
file | app.h [code]
JavaScript API for app.
file | bookmark.h [code]
JavaScript API for Bookmark.
file | certificate.h [code]
JavaScript API for Certificate.
file | color.h [code]
JavaScript API for Color.
file | console.h [code]
JavaScript API for console.
file | document.h [code]
JavaScript API for Doc object.
file | field.h [code]
JavaScript API for Field.
file | global.h [code]
JavaScript API for global.
file | link.h [code]
JavaScript API for Link.
file | ocg.h [code]
JavaScript API for OCG.
file | search.h [code]
JavaScript API for Index.
file | span.h [code]
JavaScript API for Span.
file | template.h [code]
JavaScript API for Template.
file | util.h [code]
JavaScript API for util.


Javascript API: javascript Directory Reference

  • src
  • javascript
javascript Directory Reference

Directories

Generated by doxygen 1.8.15


Javascript API: Main Page

Javascript API Documentation


Javascript API: Member List

Data Member List

This is the complete list of members for Data, including all inherited members.

creationDate(OBJ_PROP_PARAMS) | Data
description(OBJ_PROP_PARAMS) | Data
MIMEType(OBJ_PROP_PARAMS) | Data
modDate(OBJ_PROP_PARAMS) | Data
name(OBJ_PROP_PARAMS) | Data
path(OBJ_PROP_PARAMS) | Data
size(OBJ_PROP_PARAMS) | Data


Javascript API: certificate.h Source File

  • src
  • javascript
  • inc
certificate.h
Go to the documentation of this file.
1 #ifndef CERTIFICATE_H_
2 #define CERTIFICATE_H_
3
5 namespace javascript {
6 /*enum CERT_IDENTITY_TYPE
7 {
8 CERT_ISSUER = 0,
9 CERT_USER
10 };*/
12
28 class RDN : public CFXJS_EmbedObj
29 {
30 public:
31 RDN(CFXJS_Object* pJSObject);
32 virtual ~RDN(void);
33
34 FX_BOOL c(OBJ_PROP_PARAMS);
35 FX_BOOL cn(OBJ_PROP_PARAMS);
36 FX_BOOL e(OBJ_PROP_PARAMS);
37 FX_BOOL l(OBJ_PROP_PARAMS);
38
39 FX_BOOL o(OBJ_PROP_PARAMS);
40 FX_BOOL ou(OBJ_PROP_PARAMS);
41 FX_BOOL st(OBJ_PROP_PARAMS);
42
43 public:
44 void SetCertMgr(IFXJS_CertificateProvider* pCertMgr)
45 {
46 m_pCertMgr = pCertMgr;
47 }
48 void SetCertIndentify(const JS_CERT_IDENTITY_TYPE& certIdentityType)
49 {
50 m_certIdentityType = certIdentityType;
51 }
52
53 private:
54 IFXJS_CertificateProvider* m_pCertMgr;
55 JS_CERT_IDENTITY_TYPE m_certIdentityType;
56 };
57
58 class CFXJS_RDN : public CFXJS_Object
59 {
60 public:
61 CFXJS_RDN(CFXJS_Runtime* pRuntime)
62 : CFXJS_Object(pRuntime){};
63 virtual ~CFXJS_RDN(void){};
64
65 DECLARE_JS_DYNAMIC_CLASS(CFXJS_RDN);
66
67 JS_STATIC_PROP(c, RDN);
68 JS_STATIC_PROP(cn, RDN);
69 JS_STATIC_PROP(e, RDN);
70 JS_STATIC_PROP(l, RDN);
71
72 JS_STATIC_PROP(o, RDN);
73 JS_STATIC_PROP(ou, RDN);
74 JS_STATIC_PROP(st, RDN);
75 };
76
86 class Certificate : public CFXJS_EmbedObj
87 {
88 public:
89 Certificate(CFXJS_Object* pJSObject);
90 virtual ~Certificate(void);
101 FX_BOOL binary(OBJ_PROP_PARAMS);
112 FX_BOOL issuerDN(OBJ_PROP_PARAMS);
126 FX_BOOL keyUsage(OBJ_PROP_PARAMS);
138 FX_BOOL MD5Hash(OBJ_PROP_PARAMS);
153 FX_BOOL privateKeyValidityEnd(OBJ_PROP_PARAMS);
168 FX_BOOL privateKeyValidityStart(OBJ_PROP_PARAMS);
180 FX_BOOL SHA1Hash(OBJ_PROP_PARAMS);
191 FX_BOOL serialNumber(OBJ_PROP_PARAMS);
202 FX_BOOL subjectCN(OBJ_PROP_PARAMS);
213 FX_BOOL subjectDN(OBJ_PROP_PARAMS);
214
215 FX_BOOL usage(OBJ_PROP_PARAMS);
227 FX_BOOL validityEnd(OBJ_PROP_PARAMS);
239 FX_BOOL validityStart(OBJ_PROP_PARAMS);
240
241 public:
242 FX_BOOL SetCertPath(CFX_WideString cwCertPath);
243 FX_BOOL SetCertData(FX_BYTE* pbData, FX_DWORD cbData);
244
245 CFX_ByteString GetCertData();
246 IFXJS_CertificateProvider* GetCertMgr();
247
248 private:
249 void CreateRdnObjectAndSet(FXJSE_HVALUE hValue, JS_CERT_IDENTITY_TYPE type);
250 IFXJS_CertificateProvider* m_pCertMgr;
251 };
252
253 class CFXJS_Certificate : public CFXJS_Object
254 {
255 public:
256 CFXJS_Certificate(CFXJS_Runtime* pRuntime)
257 : CFXJS_Object(pRuntime){};
258 virtual ~CFXJS_Certificate(void){};
259
260 DECLARE_JS_DYNAMIC_CLASS(CFXJS_Certificate);
261
262 JS_STATIC_PROP(binary, Certificate);
263 JS_STATIC_PROP(issuerDN, Certificate);
264 JS_STATIC_PROP(keyUsage, Certificate);
265 JS_STATIC_PROP(MD5Hash, Certificate);
266
267 JS_STATIC_PROP(privateKeyValidityEnd, Certificate);
268 JS_STATIC_PROP(privateKeyValidityStart, Certificate);
269
270 JS_STATIC_PROP(SHA1Hash, Certificate);
271 JS_STATIC_PROP(serialNumber, Certificate);
272 JS_STATIC_PROP(subjectCN, Certificate);
273 JS_STATIC_PROP(subjectDN, Certificate);
274 JS_STATIC_PROP(usage, Certificate);
275
276 JS_STATIC_PROP(validityEnd, Certificate);
277 JS_STATIC_PROP(validityStart, Certificate);
278 };
279
280 #endif // CERTIFICATE_H_
281 }
RDN
This generic object represents a Relative Distinguished Name. It is used by securityHandler....
Definition: certificate.h:28
Certificate
The Certificate object provides read-only access to the properties of an X.509 public key certificate...
Definition: certificate.h:86


Javascript API: console.h Source File

  • src
  • javascript
  • inc
console.h
Go to the documentation of this file.
1 #ifndef _CONSOLE_H_
2 #define _CONSOLE_H_
3
5 namespace javascript {
7
16 class console : public CFXJS_EmbedObj
17 {
18 public:
19 console(CFXJS_Object* pJSObject);
20 virtual ~console(void);
21
22 public:
26 FX_BOOL clear(OBJ_METHOD_PARAMS);
27
31 FX_BOOL hide(OBJ_METHOD_PARAMS);
32
67 FX_BOOL println(OBJ_METHOD_PARAMS);
68
78 FX_BOOL show(OBJ_METHOD_PARAMS);
79 };
80
81 class CFXJS_Console : public CFXJS_Object
82 {
83 public:
84 CFXJS_Console(CFXJS_Runtime* pRuntime)
85 : CFXJS_Object(pRuntime){};
86 virtual ~CFXJS_Console(void){};
87
88 DECLARE_JS_CLASS(CFXJS_Console);
89
90 JS_STATIC_METHOD(clear, console);
91 JS_STATIC_METHOD(hide, console);
92 JS_STATIC_METHOD(println, console);
93 JS_STATIC_METHOD(show, console);
94 };
95 } // namespace javascript
96
97 #endif //_CONSOLE_H_
console
The console object is a static object that enables access to the Foxit PDF Editor JavaScript Console ...
Definition: console.h:16


Javascript API: Member List

global Member List

This is the complete list of members for global, including all inherited members.

setPersistent(OBJ_METHOD_PARAMS) global


Javascript API: Member List

security Member List

This is the complete list of members for security, including all inherited members.

getHandler(OBJ_METHOD_PARAMS) | security
handlers(OBJ_PROP_PARAMS) | security
importFromFile(OBJ_METHOD_PARAMS) | security


Javascript API: Member List

app_media Member List

This is the complete list of members for app_media, including all inherited members.

align(OBJ_PROP_PARAMS) | app_media
canResize(OBJ_PROP_PARAMS) | app_media
closeReason(OBJ_PROP_PARAMS) | app_media
createPlayer(OBJ_METHOD_PARAMS) | app_media
getPlayers(OBJ_METHOD_PARAMS) | app_media
getURLData(OBJ_METHOD_PARAMS) | app_media
ifOffScreen(OBJ_PROP_PARAMS) | app_media
openPlayer(OBJ_METHOD_PARAMS) | app_media
over(OBJ_PROP_PARAMS) | app_media
windowType(OBJ_PROP_PARAMS) | app_media


Javascript API: Member List

Field Member List

This is the complete list of members for Field, including all inherited members.

alignment(OBJ_PROP_PARAMS) | Field
borderStyle(OBJ_PROP_PARAMS) | Field
browseForFileToSubmit(OBJ_METHOD_PARAMS) | Field
buttonFitBounds(OBJ_PROP_PARAMS) | Field
buttonGetCaption(OBJ_METHOD_PARAMS) | Field
buttonGetIcon(OBJ_METHOD_PARAMS) | Field
buttonPosition(OBJ_PROP_PARAMS) | Field
buttonScaleHow(OBJ_PROP_PARAMS) | Field
buttonScaleWhen(OBJ_PROP_PARAMS) | Field
buttonSetCaption(OBJ_METHOD_PARAMS) | Field
buttonSetIcon(OBJ_METHOD_PARAMS) | Field
calcOrderIndex(OBJ_PROP_PARAMS) | Field
charLimit(OBJ_PROP_PARAMS) | Field
checkThisBox(OBJ_METHOD_PARAMS) | Field
clearItems(OBJ_METHOD_PARAMS) | Field
comb(OBJ_PROP_PARAMS) | Field
commitOnSelChange(OBJ_PROP_PARAMS) | Field
currentValueIndices(OBJ_PROP_PARAMS) | Field
defaultIsChecked(OBJ_METHOD_PARAMS) | Field
defaultStyle(OBJ_PROP_PARAMS) | Field
defaultValue(OBJ_PROP_PARAMS) | Field
delay(OBJ_PROP_PARAMS) | Field
deleteItemAt(OBJ_METHOD_PARAMS) | Field
display(OBJ_PROP_PARAMS) | Field
doc(OBJ_PROP_PARAMS) | Field
doNotScroll(OBJ_PROP_PARAMS) | Field
doNotSpellCheck(OBJ_PROP_PARAMS) | Field
editable(OBJ_PROP_PARAMS) | Field
exportValues(OBJ_PROP_PARAMS) | Field
fileSelect(OBJ_PROP_PARAMS) | Field
fillColor(OBJ_PROP_PARAMS) | Field
getArray(OBJ_METHOD_PARAMS) | Field
getItemAt(OBJ_METHOD_PARAMS) | Field
getLock(OBJ_METHOD_PARAMS) | Field
hidden(OBJ_PROP_PARAMS) | Field
highlight(OBJ_PROP_PARAMS) | Field
insertItemAt(OBJ_METHOD_PARAMS) | Field
isBoxChecked(OBJ_METHOD_PARAMS) | Field
isDefaultChecked(OBJ_METHOD_PARAMS) | Field
lineWidth(OBJ_PROP_PARAMS) | Field
multiline(OBJ_PROP_PARAMS) | Field
multipleSelection(OBJ_PROP_PARAMS) | Field
name(OBJ_PROP_PARAMS) | Field
numItems(OBJ_PROP_PARAMS) | Field
page(OBJ_PROP_PARAMS) | Field
password(OBJ_PROP_PARAMS) | Field
print(OBJ_PROP_PARAMS) | Field
radiosInUnison(OBJ_PROP_PARAMS) | Field
readonly(OBJ_PROP_PARAMS) | Field
rect(OBJ_PROP_PARAMS) | Field
required(OBJ_PROP_PARAMS) | Field
richText(OBJ_PROP_PARAMS) | Field
richValue(OBJ_PROP_PARAMS) | Field
rotation(OBJ_PROP_PARAMS) | Field
setAction(OBJ_METHOD_PARAMS) | Field
setFocus(OBJ_METHOD_PARAMS) | Field
setItems(OBJ_METHOD_PARAMS) | Field
setLock(OBJ_METHOD_PARAMS) | Field
signatureGetModifications(OBJ_METHOD_PARAMS) | Field
signatureGetSeedValue(OBJ_METHOD_PARAMS) | Field
signatureInfo(OBJ_METHOD_PARAMS) | Field
signatureSetSeedValue(OBJ_METHOD_PARAMS) | Field
signatureSign(OBJ_METHOD_PARAMS) | Field
signatureValidate(OBJ_METHOD_PARAMS) | Field
strokeColor(OBJ_PROP_PARAMS) | Field
style(OBJ_PROP_PARAMS) | Field
submitName(OBJ_PROP_PARAMS) | Field
textColor(OBJ_PROP_PARAMS) | Field
textFont(OBJ_PROP_PARAMS) | Field
textSize(OBJ_PROP_PARAMS) | Field
type(OBJ_PROP_PARAMS) | Field
userName(OBJ_PROP_PARAMS) | Field
value(OBJ_PROP_PARAMS) | Field
valueAsString(OBJ_PROP_PARAMS) | Field


Javascript API: app.h Source File

  • src
  • javascript
  • inc
app.h
Go to the documentation of this file.
1 #ifndef _APP_H_
2 #define _APP_H_
3
4 #include "js_interface.h"
5 #include "js_object.h"
6
8 namespace javascript {
9 class CFXJS_Runtime;
10 class CFXJS_Timer;
11
12 #define JS_STR_VIEWERTYPE_READER L"Reader"
13 #define JS_STR_VIEWERTYPE_STANDARD L"Exchange"
14 #define JS_STR_VIEWERVARIATION L"Full"
15 #define JS_STR_APPVERSION L"Foxit"
16 #define JS_STR_VIEWERVERSION 11.007
17 #define JS_NUM_FORMSVERSION 11
18
19 #if _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_ || _FX_OS_ == _FX_WIN32_DESKTOP_
20 #define JS_STR_PLATFORM L"WIN"
21 #elif _FX_OS_ == _FX_SOLARIS_ || _FX_OS_ == _FX_LINUX_EMBEDDED_ || _FX_OS_ == _FX_LINUX_DESKTOP_
22 #define JS_STR_PLATFORM L"LINUX"
23 #elif _FX_OS_ == _FX_IOS_
24 #define JS_STR_PLATFORM L"IOS"
25 #elif _FX_OS_ == _FX_MACOSX_
26 #define JS_STR_PLATFORM L"MAC"
27 #elif _FX_OS_ == _FX_ANDROID_
28 #define JS_STR_PLATFORM L"ANDROID"
29 #else
30 #define JS_STR_PLATFORM L"UNKNOWN"
31 #endif
32
33 class Thermometer : public CFXJS_EmbedObj
34 {
35 public:
36 Thermometer(CFXJS_Object* pJSObject)
37 : CFXJS_EmbedObj(pJSObject)
38 {
39 }
40 virtual ~Thermometer() {}
41
42 public:
43 FX_BOOL cancelled(OBJ_PROP_PARAMS);
44 FX_BOOL duration(OBJ_PROP_PARAMS);
45 FX_BOOL text(OBJ_PROP_PARAMS);
46 FX_BOOL value(OBJ_PROP_PARAMS);
47
48 FX_BOOL begin(OBJ_METHOD_PARAMS);
49 FX_BOOL end(OBJ_METHOD_PARAMS);
50 };
51
52 class CFXJS_Thermometer : public CFXJS_Object
53 {
54 public:
55 CFXJS_Thermometer(CFXJS_Runtime* pRuntime)
56 : CFXJS_Object(pRuntime)
57 {
58 }
59 virtual ~CFXJS_Thermometer() {}
60
61 DECLARE_JS_CLASS(CFXJS_Thermometer)
62
63 JS_STATIC_PROP(cancelled, Thermometer)
64 JS_STATIC_PROP(duration, Thermometer)
65 JS_STATIC_PROP(text, Thermometer)
66 JS_STATIC_PROP(value, Thermometer)
67
68 JS_STATIC_METHOD(begin, Thermometer)
69 JS_STATIC_METHOD(end, Thermometer)
70 };
71
72 /******************************************************************************/
73 /* timer object */
74 /******************************************************************************/
75
76 class TimerObj : public CFXJS_EmbedObj
77 {
78 public:
79 TimerObj(CFXJS_Object* pJSObject);
80 virtual ~TimerObj();
81
82 public:
83 void SetTimer(CFXJS_Timer* pTimer);
84 CFXJS_Timer* GetTimer() const;
85
86 private:
87 CFXJS_Timer* m_pTimer;
88 };
89
90 class CFXJS_TimerObj : public CFXJS_Object
91 {
92 public:
93 CFXJS_TimerObj(CFXJS_Runtime* pRuntime)
94 : CFXJS_Object(pRuntime)
95 {
96 }
97 virtual ~CFXJS_TimerObj() {}
98
99 DECLARE_JS_CLASS(CFXJS_TimerObj);
100 };
101
102 class TreeItem : public CFXJS_EmbedObj
103 {
104 public:
105 TreeItem(CFXJS_Object* pJSObject)
106 : CFXJS_EmbedObj(pJSObject)
107 {
108 }
109 virtual ~TreeItem() {}
110
111 public:
112 FX_BOOL cName(OBJ_PROP_PARAMS);
113 FX_BOOL oChildren(OBJ_PROP_PARAMS);
114
115 void SetEleName(const CFX_ByteString& csEleName)
116 {
117 m_csEleName = csEleName;
118 }
119 void SetCateName(const CFX_ByteString& csCateName)
120 {
121 m_csCateName = csCateName;
122 }
123 void SetPanelName(const CFX_ByteString& csPanelName)
124 {
125 m_csPanelName = csPanelName;
126 }
127
128 static void CreateTreeItem(FXJSE_HVALUE hProp,
129 const CFX_ByteString& csCategory,
130 const CFX_ByteString& csPanel,
131 const CFX_ByteString& csEle,
132 CFXJS_Runtime* pRuntime,
133 std::vector<std::unique_ptr<CFXJS_Object>>& Objects);
134
135 private:
136 CFX_ByteString m_csEleName = "";
137 CFX_ByteString m_csCateName = "";
138 CFX_ByteString m_csPanelName = "";
139 };
140
141 class CFXJS_TreeItem : public CFXJS_Object
142 {
143 public:
144 CFXJS_TreeItem(CFXJS_Runtime* pRuntime)
145 : CFXJS_Object(pRuntime)
146 {
147 }
148 virtual ~CFXJS_TreeItem() {}
149
150 DECLARE_JS_CLASS(CFXJS_TreeItem);
151
152 JS_STATIC_PROP(cName, TreeItem);
153 JS_STATIC_PROP(oChildren, TreeItem);
154 };
155
156 //*****************************************************************************
157 //* app
158 //*****************************************************************************
160
169 class app : public CFXJS_EmbedObj
170 {
171 public:
172 app(CFXJS_Object* pJSObject);
173 virtual ~app();
174
175 public:
198 FX_BOOL activeDocs(OBJ_PROP_PARAMS);
210 FX_BOOL calculate(OBJ_PROP_PARAMS);
211
231 FX_BOOL formsVersion(OBJ_PROP_PARAMS);
247 FX_BOOL fs(OBJ_PROP_PARAMS);
263 FX_BOOL fullscreen(OBJ_PROP_PARAMS);
295 FX_BOOL language(OBJ_PROP_PARAMS);
296
297 FX_BOOL plugIns(OBJ_PROP_PARAMS);
317 FX_BOOL printerNames(OBJ_PROP_PARAMS);
329 FX_BOOL media(OBJ_PROP_PARAMS);
347 FX_BOOL platform(OBJ_PROP_PARAMS);
367 FX_BOOL runtimeHighlight(OBJ_PROP_PARAMS);
383 FX_BOOL runtimeHighlightColor(OBJ_PROP_PARAMS);
399 FX_BOOL viewerType(OBJ_PROP_PARAMS);
415 FX_BOOL viewerVariation(OBJ_PROP_PARAMS);
430 FX_BOOL viewerVersion(OBJ_PROP_PARAMS);
431 FX_BOOL appVersion(OBJ_PROP_PARAMS);
432 FX_BOOL isFoxit(OBJ_PROP_PARAMS);
433 FX_BOOL appFoxitVersion(OBJ_PROP_PARAMS);
434 FX_BOOL persistentData(OBJ_PROP_PARAMS);
435 FX_BOOL user(OBJ_PROP_PARAMS);
436
452 FX_BOOL constants(OBJ_PROP_PARAMS);
453
468 FX_BOOL thermometer(OBJ_PROP_PARAMS);
496 FX_BOOL alert(OBJ_METHOD_PARAMS);
506 FX_BOOL beep(OBJ_METHOD_PARAMS);
543 FX_BOOL browseForDoc(OBJ_METHOD_PARAMS);
557 FX_BOOL clearInterval(OBJ_METHOD_PARAMS);
571 FX_BOOL clearTimeOut(OBJ_METHOD_PARAMS);
1084 FX_BOOL execDialog(OBJ_METHOD_PARAMS);
1120 FX_BOOL execMenuItem(OBJ_METHOD_PARAMS);
1121 FX_BOOL findComponent(OBJ_METHOD_PARAMS);
1122 FX_BOOL goBack(OBJ_METHOD_PARAMS);
1123 FX_BOOL goForward(OBJ_METHOD_PARAMS);
1137 FX_BOOL launchURL(OBJ_METHOD_PARAMS);
1171 FX_BOOL mailMsg(OBJ_METHOD_PARAMS);
1172
1185 FX_BOOL newFDF(OBJ_METHOD_PARAMS);
1201 FX_BOOL newDoc(OBJ_METHOD_PARAMS);
1220 FX_BOOL openDoc(OBJ_METHOD_PARAMS);
1221 FX_BOOL openFDF(OBJ_METHOD_PARAMS);
1263 FX_BOOL popUpMenuEx(OBJ_METHOD_PARAMS);
1284 FX_BOOL popUpMenu(OBJ_METHOD_PARAMS);
1315 FX_BOOL response(OBJ_METHOD_PARAMS);
1348 FX_BOOL setInterval(OBJ_METHOD_PARAMS);
1392 FX_BOOL setTimeOut(OBJ_METHOD_PARAMS);
1393 FX_BOOL execProgress(OBJ_METHOD_PARAMS);
1394 FX_BOOL addListeners(OBJ_METHOD_PARAMS);
1395 FX_BOOL deleteListeners(OBJ_METHOD_PARAMS);
1396 FX_BOOL onInitView(OBJ_METHOD_PARAMS);
1397 FX_BOOL getObject(OBJ_METHOD_PARAMS);
1398 FX_BOOL addListener(OBJ_METHOD_PARAMS);
1399 FX_BOOL getCurDoc(OBJ_METHOD_PARAMS);
1400 FX_BOOL sendEmail(OBJ_METHOD_PARAMS);
1401 FX_BOOL execHtmlDialog(OBJ_METHOD_PARAMS);
1402 FX_BOOL httpRequest(OBJ_METHOD_PARAMS);
1403 FX_BOOL getInfo(OBJ_METHOD_PARAMS);
1404 FX_BOOL loginWithUI(OBJ_METHOD_PARAMS);
1405 FX_BOOL signOut(OBJ_METHOD_PARAMS);
1406 FX_BOOL getDigestId(OBJ_METHOD_PARAMS);
1407 FX_BOOL log(OBJ_METHOD_PARAMS);
1408 FX_BOOL initPlugin(OBJ_METHOD_PARAMS);
1409 FX_BOOL registerDRMHandler(OBJ_METHOD_PARAMS);
1410 FX_BOOL enableToolButton(OBJ_METHOD_PARAMS);
1411 ;
1412 FX_BOOL activateCategory(OBJ_METHOD_PARAMS);
1413 FX_BOOL encryptDocument(OBJ_METHOD_PARAMS);
1414 FX_BOOL removeEncryption(OBJ_METHOD_PARAMS);
1415 FX_BOOL loadHtmlView(OBJ_METHOD_PARAMS);
1416 FX_BOOL closeDoc(OBJ_METHOD_PARAMS);
1417 FX_BOOL expandPanel(OBJ_METHOD_PARAMS);
1418 FX_BOOL setHotPoint(OBJ_METHOD_PARAMS);
1419 FX_BOOL isPanelActivate(OBJ_METHOD_PARAMS);
1420 FX_BOOL opencPDFWebPage(OBJ_METHOD_PARAMS);
1421 FX_BOOL addFocusedDoc(OBJ_METHOD_PARAMS);
1422 FX_BOOL doOpenMessage(OBJ_METHOD_PARAMS);
1423 FX_BOOL showAllPinNote(OBJ_METHOD_PARAMS);
1424 FX_BOOL isShowAllPinNote(OBJ_METHOD_PARAMS);
1425
1466 FX_BOOL addMenuItem(OBJ_METHOD_PARAMS);
1467 FX_BOOL addSubMenu(OBJ_METHOD_PARAMS);
1468 FX_BOOL addToolButton(OBJ_METHOD_PARAMS);
1469 FX_BOOL removeToolButton(OBJ_METHOD_PARAMS);
1505 FX_BOOL listMenuItems(OBJ_METHOD_PARAMS);
1506 FX_BOOL trustedFunction(OBJ_METHOD_PARAMS);
1507 FX_BOOL beginPriv(OBJ_METHOD_PARAMS);
1508 FX_BOOL endPriv(OBJ_METHOD_PARAMS);
1509
1510 private :
1511
1512 void TimerProc(CFXJS_Timer* pTimer);
1513 void RunJsScript(CFXJS_Runtime* pRuntime, const CFX_WideString& wsScript);
1514 void ParsePopupMenuObj(FX_MenuItemEx* pMenuItem, FXJSE_HVALUE pObj);
1515 void DeleteMenuItems(FX_MenuItemExArray* pMenuItems);
1516 void ParserMenuItem(FX_Menu* pHead, CFX_ArrayTemplate<FXJSE_HVALUE>& args);
1517 void DestroyMenuItems(FX_Menu* pHead);
1518
1519 public:
1520 CFX_WideString GetAppInfo(AppInfoType type, CFXJS_Context* cc);
1521 static FX_BOOL CallbackExecHtmlDialogMessasge(CFX_Object* JsApp, FXJSE_HVALUE param);
1522 void OnExecHtmlDialog(FXJSE_HVALUE hDlgParam);
1523
1524 private:
1525 FX_BOOL m_bCalculate;
1526 CFXJS_Runtime* m_pRuntime;
1527 FX_BOOL m_bRuntimeHighLight;
1528 CFX_ArrayTemplate<CFXJS_Timer*> m_aTimer;
1529 };
1530
1531 class CFXJS_App : public CFXJS_Object
1532 {
1533 public:
1534 CFXJS_App(CFXJS_Runtime* pRuntime)
1535 : CFXJS_Object(pRuntime){};
1536 virtual ~CFXJS_App(void){};
1537
1538 DECLARE_JS_CLASS(CFXJS_App);
1539
1540 JS_STATIC_PROP(activeDocs, app);
1541 JS_STATIC_PROP(calculate, app);
1542 JS_STATIC_PROP(formsVersion, app);
1543 JS_STATIC_PROP(fs, app);
1544 JS_STATIC_PROP(fullscreen, app);
1545 JS_STATIC_PROP(language, app);
1546 JS_STATIC_PROP(media, app);
1547 JS_STATIC_PROP(platform, app);
1548 JS_STATIC_PROP(runtimeHighlight, app);
1549 JS_STATIC_PROP(runtimeHighlightColor, app);
1550 JS_STATIC_PROP(viewerType, app);
1551 JS_STATIC_PROP(viewerVariation, app);
1552 JS_STATIC_PROP(viewerVersion, app);
1553 JS_STATIC_PROP(isFoxit, app);
1554 JS_STATIC_PROP(plugIns, app);
1555 JS_STATIC_PROP(printerNames, app);
1556 JS_STATIC_PROP(appVersion, app);
1557 JS_STATIC_PROP(appFoxitVersion, app);
1558 JS_STATIC_PROP(persistentData, app);
1559 JS_STATIC_PROP(user, app);
1560 JS_STATIC_PROP(constants, app);
1561 JS_STATIC_PROP(thermometer, app);
1562
1563 JS_STATIC_METHOD(alert, app);
1564 JS_STATIC_METHOD(beep, app);
1565 JS_STATIC_METHOD(browseForDoc, app);
1566 JS_STATIC_METHOD(clearInterval, app);
1567 JS_STATIC_METHOD(clearTimeOut, app);
1568 JS_STATIC_METHOD(execDialog, app);
1569 JS_STATIC_METHOD(execMenuItem, app);
1570 JS_STATIC_METHOD(findComponent, app);
1571 JS_STATIC_METHOD(goBack, app);
1572 JS_STATIC_METHOD(goForward, app);
1573 JS_STATIC_METHOD(launchURL, app);
1574 JS_STATIC_METHOD(mailMsg, app);
1575 JS_STATIC_METHOD(newFDF, app);
1576 JS_STATIC_METHOD(newDoc, app);
1577 JS_STATIC_METHOD(openDoc, app);
1578 JS_STATIC_METHOD(openFDF, app);
1579 JS_STATIC_METHOD(popUpMenuEx, app);
1580 JS_STATIC_METHOD(popUpMenu, app);
1581 JS_STATIC_METHOD(response, app);
1582 JS_STATIC_METHOD(setInterval, app);
1583 JS_STATIC_METHOD(setTimeOut, app);
1584 JS_STATIC_METHOD(execProgress, app);
1585 JS_STATIC_METHOD(addListeners, app);
1586 JS_STATIC_METHOD(deleteListeners, app);
1587 JS_STATIC_METHOD(onInitView, app);
1588 JS_STATIC_METHOD(getObject, app);
1589 JS_STATIC_METHOD(addListener, app);
1590 JS_STATIC_METHOD(getCurDoc, app);
1591 JS_STATIC_METHOD(sendEmail, app);
1592 JS_STATIC_METHOD(execHtmlDialog, app);
1593 JS_STATIC_METHOD(httpRequest, app);
1594 JS_STATIC_METHOD(getInfo, app);
1595 JS_STATIC_METHOD(loginWithUI, app);
1596 JS_STATIC_METHOD(signOut, app);
1597 JS_STATIC_METHOD(getDigestId, app);
1598 JS_STATIC_METHOD(log, app);
1599 JS_STATIC_METHOD(initPlugin, app);
1600 JS_STATIC_METHOD(registerDRMHandler, app);
1601 JS_STATIC_METHOD(enableToolButton, app);
1602 JS_STATIC_METHOD(activateCategory, app);
1603 JS_STATIC_METHOD(encryptDocument, app);
1604 JS_STATIC_METHOD(removeEncryption, app);
1605 JS_STATIC_METHOD(loadHtmlView, app);
1606 JS_STATIC_METHOD(closeDoc, app);
1607 JS_STATIC_METHOD(expandPanel, app);
1608 JS_STATIC_METHOD(setHotPoint, app);
1609 JS_STATIC_METHOD(isPanelActivate, app);
1610 JS_STATIC_METHOD(opencPDFWebPage, app);
1611 JS_STATIC_METHOD(addFocusedDoc, app);
1612 JS_STATIC_METHOD(doOpenMessage, app);
1613 JS_STATIC_METHOD(showAllPinNote, app);
1614 JS_STATIC_METHOD(isShowAllPinNote, app);
1615 JS_STATIC_METHOD(addMenuItem, app)
1616 JS_STATIC_METHOD(listMenuItems, app)
1617 JS_STATIC_METHOD(addSubMenu, app)
1618 JS_STATIC_METHOD(addToolButton, app)
1619 JS_STATIC_METHOD(removeToolButton, app)
1620 JS_STATIC_METHOD(trustedFunction, app)
1621 JS_STATIC_METHOD(beginPriv, app)
1622 JS_STATIC_METHOD(endPriv, app)
1623 };
1624
1625 class privilegeController : public CFXJS_EmbedObj
1626 {
1627 public:
1628 privilegeController(CFXJS_Object* pJSObject);
1629 virtual ~privilegeController();
1630
1631 public:
1632 FX_BOOL beginTrusted(OBJ_METHOD_PARAMS);
1633 FX_BOOL endTrusted(OBJ_METHOD_PARAMS);
1634 };
1635
1636 class CFXJS_PrivilegeController : public CFXJS_Object
1637 {
1638 public:
1639 CFXJS_PrivilegeController(CFXJS_Runtime* pRuntime)
1640 : CFXJS_Object(pRuntime)
1641 {
1642 }
1643 virtual ~CFXJS_PrivilegeController(){};
1644
1645 DECLARE_JS_CLASS(CFXJS_PrivilegeController);
1646
1647 JS_STATIC_METHOD(beginTrusted, privilegeController);
1648 JS_STATIC_METHOD(endTrusted, privilegeController);
1649 };
1650
1652 class appInfo : public CFXJS_EmbedObj
1653 {
1654 public:
1655 appInfo(CFXJS_Object* pJSObject);
1656 virtual ~appInfo() {}
1657
1658 FX_BOOL apiVersion(OBJ_PROP_PARAMS);
1659 FX_BOOL capabilities(OBJ_PROP_PARAMS);
1660 FX_BOOL language(OBJ_PROP_PARAMS);
1661 FX_BOOL appVersion(OBJ_PROP_PARAMS);
1662 FX_BOOL appName(OBJ_PROP_PARAMS);
1663 FX_BOOL baseUrl(OBJ_PROP_PARAMS);
1664 FX_BOOL shareUsageData(OBJ_PROP_PARAMS);
1665 FX_BOOL appId(OBJ_PROP_PARAMS);
1666 FX_BOOL isFipsMode(OBJ_PROP_PARAMS);
1667 };
1668
1669 class CFXJS_appInfo : public CFXJS_Object
1670 {
1671 public:
1672 CFXJS_appInfo(CFXJS_Runtime* pRuntime)
1673 : CFXJS_Object(pRuntime)
1674 {
1675 }
1676 virtual ~CFXJS_appInfo() {}
1677
1678 DECLARE_JS_CLASS(CFXJS_appInfo);
1679
1680 JS_STATIC_PROP(apiVersion, appInfo);
1681 JS_STATIC_PROP(capabilities, appInfo);
1682 JS_STATIC_PROP(language, appInfo);
1683 JS_STATIC_PROP(appVersion, appInfo);
1684 JS_STATIC_PROP(appName, appInfo);
1685 JS_STATIC_PROP(baseUrl, appInfo);
1686 JS_STATIC_PROP(shareUsageData, appInfo);
1687 JS_STATIC_PROP(appId, appInfo);
1688 JS_STATIC_PROP(isFipsMode, appInfo);
1689 };
1690
1691 class CFXJS_ProgressObj;
1692
1693 class ProgressObj : public CFXJS_EmbedObj
1694 {
1695 public:
1696 ProgressObj(CFXJS_Object* pJSObject);
1697 virtual ~ProgressObj();
1698
1699 void SetProgressObj(IFXJS_UIProgressProvider* pUIPro);
1700 IFXJS_UIProgressProvider* GetProgressObj();
1701
1702 FX_BOOL getCurrentValue(OBJ_METHOD_PARAMS);
1703 FX_BOOL setCurrentValue(OBJ_METHOD_PARAMS);
1704 FX_BOOL doCancel(OBJ_METHOD_PARAMS);
1705 FX_BOOL doDestroy(OBJ_METHOD_PARAMS);
1706
1707 private:
1708 IFXJS_UIProgressProvider* m_pProgress;
1709 };
1710
1711 class CFXJS_ProgressObj : public CFXJS_Object
1712 {
1713 public:
1714 CFXJS_ProgressObj(CFXJS_Runtime* pRuntime)
1715 : CFXJS_Object(pRuntime)
1716 {
1717 }
1718 virtual ~CFXJS_ProgressObj() {}
1719
1720 DECLARE_JS_CLASS(CFXJS_ProgressObj);
1721
1722 JS_STATIC_METHOD(getCurrentValue, ProgressObj);
1723 JS_STATIC_METHOD(setCurrentValue, ProgressObj);
1724 JS_STATIC_METHOD(doCancel, ProgressObj);
1725 JS_STATIC_METHOD(doDestroy, ProgressObj);
1726 };
1727
1728 class app_constants : public CFXJS_EmbedObj
1729 {
1730 public:
1731 app_constants(CFXJS_Object* pJSObject)
1732 : CFXJS_EmbedObj(pJSObject)
1733 {
1734 }
1735 virtual ~app_constants() {}
1736
1737 public:
1738 FX_BOOL align(OBJ_PROP_PARAMS);
1739 };
1740
1741 class CFXJS_app_constants : public CFXJS_Object
1742 {
1743 public:
1744 CFXJS_app_constants(CFXJS_Runtime* pRuntime)
1745 : CFXJS_Object(pRuntime)
1746 {
1747 }
1748 virtual ~CFXJS_app_constants() {}
1749
1750 DECLARE_JS_CLASS(CFXJS_app_constants);
1751
1752 JS_STATIC_PROP(align, app_constants);
1753 };
1754 } // namespace javascript
1755
1756 #endif //_APP_H_
app
This object is used to set and get the properties and to set the JavaScript action of a link.
Definition: app.h:169


Javascript API: global.h Source File

  • src
  • javascript
  • inc
global.h
Go to the documentation of this file.
1 #ifndef _GLOBAL_H_
2 #define _GLOBAL_H_
3 namespace javascript {
5 class IFXJS_AppProvider;
6 struct js_global_data
7 {
8 js_global_data()
9 {
10 pData = NULL;
11 bPersistent = false;
12 bDeleted = false;
13 }
14 FXJSE_HVALUE pData;
15 bool bPersistent;
16 bool bDeleted;
17 };
19
30 class global : public CFXJS_EmbedObj
31 {
32 public:
33 global(CFXJS_Object* pJSObject);
34 virtual ~global();
35
36 public:
37
57 FX_BOOL setPersistent(OBJ_METHOD_PARAMS);
58
59 public:
60 FX_INT32 QueryProperty(FX_BSTR szPropName);
61 FX_BOOL
62 DoProperty(FXJSE_HVALUE hValue, FX_BSTR szPropName, JS_ErrorString& sError, FX_BOOL IsSet);
63 FX_BOOL DelProperty(FX_BSTR szPropName, JS_ErrorString& sError);
64
65 void Initial(IFXJS_AppProvider* pApp);
66
67 private:
68 void DestroyGlobalPersisitentVariables();
69 FX_BOOL SetGlobalVariables(FX_BSTR propname, FXJSE_HVALUE hValue, FX_BOOL bDefaultPersistent);
70
71 private:
72 std::map<CFX_ByteString, std::unique_ptr<js_global_data>> m_mapGlobal;
73 CFX_WideString m_sFilePath;
74 IFXJS_AppProvider* m_pApp;
75 };
76
77 class CFXJS_Global : public CFXJS_Object
78 {
79 public:
80 CFXJS_Global(CFXJS_Runtime* pRuntime)
81 : CFXJS_Object(pRuntime){};
82 virtual ~CFXJS_Global(void){};
83
84 virtual FX_BOOL InitInstance();
85
86 DECLARE_SPECIAL_JS_CLASS(CFXJS_Global);
87
88 JS_STATIC_METHOD(setPersistent, global);
89 };
90 } // namespace javascript
91
92 #endif //_GLOBAL_H_
global
This is a static JavaScript object that allows you to share data between documents and to have data b...
Definition: global.h:30


Javascript API: ocg.h Source File

  • src
  • javascript
  • inc
ocg.h
Go to the documentation of this file.
1 #ifndef _OCG_H_
2 #define _OCG_H_
3
4 #include "fpdfdoc/fpdf_doc.h"
6 namespace javascript {
7 class CFXJS_OCGNotify;
8 class CFXJS_Runtime;
9 class IFXJS_DocumentProvider;
10 class IFXJS_DocViewProvider;
11
12 class states : public CFXJS_EmbedObj
13 {
14 public:
15 states(CFXJS_Object* pJSObject);
16 virtual ~states();
17
18 public:
19 FX_BOOL on(OBJ_PROP_PARAMS);
20 FX_BOOL off(OBJ_PROP_PARAMS);
21 };
22
23 class CFXJS_States : public CFXJS_Object
24 {
25 public:
26 CFXJS_States(CFXJS_Runtime* pRuntime);
27 virtual ~CFXJS_States(){};
28
29 public:
30 DECLARE_JS_CLASS(CFXJS_States);
31 JS_STATIC_PROP(on, states);
32 JS_STATIC_PROP(off, states);
33 };
34
35 class intents : public CFXJS_EmbedObj
36 {
37 public:
38 intents(CFXJS_Object* pJSObject);
39 virtual ~intents();
40
41 public:
42 FX_BOOL view(OBJ_PROP_PARAMS);
43 FX_BOOL design(OBJ_PROP_PARAMS);
44 };
45
46 class CFXJS_Intents : public CFXJS_Object
47 {
48 public:
49 CFXJS_Intents(CFXJS_Runtime* pRuntime)
50 : CFXJS_Object(pRuntime){};
51 virtual ~CFXJS_Intents(){};
52
53 public:
54 DECLARE_JS_CLASS(CFXJS_Intents);
55 JS_STATIC_PROP(view, intents);
56 JS_STATIC_PROP(design, intents);
57 };
58
59 class constants : public CFXJS_EmbedObj
60 {
61 public:
62 constants(CFXJS_Object* pJSObject);
63 virtual ~constants();
64
65 public:
66 FX_BOOL intents(OBJ_PROP_PARAMS);
67 FX_BOOL states(OBJ_PROP_PARAMS);
68 };
69
70 class CFXJS_Constants : public CFXJS_Object
71 {
72 public:
73 CFXJS_Constants(CFXJS_Runtime* pRuntime);
74 virtual ~CFXJS_Constants(){};
75
76 public:
77 DECLARE_JS_CLASS(CFXJS_Constants);
78 JS_STATIC_PROP(intents, constants);
79 JS_STATIC_PROP(states, constants);
80 };
81
83
99 class OCG : public CFXJS_EmbedObj
100 {
101 public:
102 OCG(CFXJS_Object* pJSObject);
103 virtual ~OCG();
104
105 public:
106 FX_BOOL constants(OBJ_PROP_PARAMS);
107
132 FX_BOOL name(OBJ_PROP_PARAMS);
133
156 FX_BOOL state(OBJ_PROP_PARAMS);
157
175 FX_BOOL initState(OBJ_PROP_PARAMS);
176
188 FX_BOOL locked(OBJ_PROP_PARAMS);
189
190 FX_BOOL getIntent(OBJ_METHOD_PARAMS);
191 FX_BOOL setIntent(OBJ_METHOD_PARAMS);
192
218 FX_BOOL setAction(OBJ_METHOD_PARAMS);
219 FX_BOOL toString(OBJ_METHOD_PARAMS);
220
221 public:
222 void SetOCGInfo(IFXJS_DocumentProvider* pDocument,
223 IFXJS_DocViewProvider* pDocView,
224 CPDF_Dictionary* pDict);
225 static void RunJavaScript(CFXJS_Runtime* pRuntime, CFX_WideString swJavaScript);
226 CFXJS_Runtime* GetJSRuntime()
227 {
228 return m_pRuntime;
229 }
230 CFX_WideString GetJSScript()
231 {
232 return m_swJavaScript;
233 }
234 CPDF_Dictionary* GetDictionary()
235 {
236 return m_pOCGDict;
237 }
238 void SetOrderName(CFX_ByteString csName)
239 {
240 m_OrderName = csName;
241 }
242 CFX_ByteString GetOrderName()
243 {
244 return m_OrderName;
245 }
246
247 private:
248 IFXJS_DocumentProvider* m_pDocument;
249 IFXJS_DocViewProvider* m_pDocView;
250 CPDF_Dictionary* m_pOCGDict;
251 CFX_WideString m_swJavaScript;
252 CFXJS_Runtime* m_pRuntime;
253 CFX_ByteString m_OrderName;
254 std::unique_ptr<IPDF_OCNotify> s_pNotify;
255 };
256
257 class CFXJS_OCG : public CFXJS_Object
258 {
259 public:
260 CFXJS_OCG(CFXJS_Runtime* pRuntime)
261 : CFXJS_Object(pRuntime){};
262 virtual ~CFXJS_OCG(){};
263
264 public:
265 DECLARE_JS_CLASS(CFXJS_OCG);
266 JS_STATIC_PROP(constants, OCG);
267 JS_STATIC_PROP(name, OCG);
268 JS_STATIC_PROP(state, OCG);
269 JS_STATIC_PROP(initState, OCG);
270 JS_STATIC_PROP(locked, OCG);
271
272 JS_STATIC_METHOD(getIntent, OCG);
273 JS_STATIC_METHOD(setIntent, OCG);
274 JS_STATIC_METHOD(setAction, OCG);
275 JS_STATIC_METHOD(toString, OCG);
276 };
277
278 class CFXJS_OCGNotify : public IPDF_OCNotify
279 {
280 public:
281 CFXJS_OCGNotify(OCG* pOcg)
282 {
283 if (pOcg)
284 m_pOcg = pOcg;
285 }
286 ~CFXJS_OCGNotify() {}
287
288 virtual void OnOCGStateChanged(CPDF_Document* pDoc, CPDF_OCGroup ocg, FX_BOOL bVisible);
289
290 private:
291 OCG* m_pOcg;
292 };
293 } // namespace javascript
294
295 #endif //_OCG_H_
OCG
An OCG object represents an optional content group in a PDF file. Content in the file can belong to o...
Definition: ocg.h:99


Javascript API: Member List

Bookmark Member List

This is the complete list of members for Bookmark, including all inherited members.

children(OBJ_PROP_PARAMS) | Bookmark
createChild(OBJ_METHOD_PARAMS) | Bookmark
doc(OBJ_PROP_PARAMS) | Bookmark
insertChild(OBJ_METHOD_PARAMS) | Bookmark
name(OBJ_PROP_PARAMS) | Bookmark
open(OBJ_PROP_PARAMS) | Bookmark
parent(OBJ_PROP_PARAMS) | Bookmark
remove(OBJ_METHOD_PARAMS) | Bookmark
setAction(OBJ_METHOD_PARAMS) | Bookmark


Javascript API: Member List

console Member List

This is the complete list of members for console, including all inherited members.

clear(OBJ_METHOD_PARAMS) | console
hide(OBJ_METHOD_PARAMS) | console
println(OBJ_METHOD_PARAMS) | console
show(OBJ_METHOD_PARAMS) | console


Javascript API: link.h Source File

  • src
  • javascript
  • inc
link.h
Go to the documentation of this file.
1 #ifndef _LINK_H_
2 #define _LINK_H_
3
5 namespace javascript {
6 class IFXJS_AnnotProvider;
8
17 class Link : public CFXJS_EmbedObj
18 {
19 public:
20 Link(CFXJS_Object* pJSObject);
21 virtual ~Link();
22 bool CheckBaseExpects() override
23 {
24 return (bool)m_pLink;
25 }
26
27 public:
39 FX_BOOL borderColor(OBJ_PROP_PARAMS);
50 FX_BOOL borderWidth(OBJ_PROP_PARAMS);
63 FX_BOOL highlightMode(OBJ_PROP_PARAMS);
76 FX_BOOL rect(OBJ_PROP_PARAMS);
86 FX_BOOL setAction(OBJ_METHOD_PARAMS);
87
88 public:
89 void SetAnnot(IFXJS_AnnotProvider* pLink);
90 CFX_ByteString GetHighLightMode(CFX_ByteString cbValue);
91 CFX_ByteString GetModeFromUser(CFX_ByteString cbUser);
92
93 private:
94 FX_BOOL Validate(FX_BOOL IsSet);
95 IFXJS_AnnotProvider* m_pLink;
96 };
97
98 class CFXJS_Link : public CFXJS_Object
99 {
100 public:
101 CFXJS_Link(CFXJS_Runtime* pRuntime)
102 : CFXJS_Object(pRuntime){};
103 virtual ~CFXJS_Link(){};
104
105 public:
106 DECLARE_JS_CLASS(CFXJS_Link);
107 JS_STATIC_PROP(borderColor, Link);
108 JS_STATIC_PROP(borderWidth, Link);
109 JS_STATIC_PROP(highlightMode, Link);
110 JS_STATIC_PROP(rect, Link);
111
112 JS_STATIC_METHOD(setAction, Link);
113 };
114
115 } // namespace javascript
116
117 #endif //_LINK_H_
Link
This object is used to set and get the properties and to set the JavaScript action of a link.
Definition: link.h:17


Javascript API: span.h Source File

  • src
  • javascript
  • inc
span.h
Go to the documentation of this file.
1 #ifndef _JS_SPAN_H_
2 #define _JS_SPAN_H_
3
5 namespace javascript {
6 class Doc;
8
18 class Span : public CFXJS_EmbedObj
19 {
20 public:
21 Span(CFXJS_Object* pJSObject);
22 virtual ~Span(void);
23
40 FX_BOOL alignment(OBJ_PROP_PARAMS);
41
66 FX_BOOL fontFamily(OBJ_PROP_PARAMS);
67
81 FX_BOOL fontStretch(OBJ_PROP_PARAMS);
82
96 FX_BOOL fontWeight(OBJ_PROP_PARAMS);
97
111 FX_BOOL fontStyle(OBJ_PROP_PARAMS);
112
123 FX_BOOL strikethrough(OBJ_PROP_PARAMS);
124
136 FX_BOOL subscript(OBJ_PROP_PARAMS);
137
178 FX_BOOL superscript(OBJ_PROP_PARAMS);
179
194 FX_BOOL text(OBJ_PROP_PARAMS);
195
211 FX_BOOL textColor(OBJ_PROP_PARAMS);
212
229 FX_BOOL textSize(OBJ_PROP_PARAMS);
230
245 FX_BOOL underline(OBJ_PROP_PARAMS);
246
247 private:
248 FX_BOOL FindNativeFont(CFX_WideString csName);
249
250 public:
251 CFX_ByteString m_alignment;
252 CFX_WideStringArray m_fontFamily;
253 CFX_ByteString m_fontStretch;
254 CFX_ByteString m_fontStyle;
255 CFX_ByteString m_csfont;
256 int m_fontWeight;
257 bool m_bStrikethrough;
258 bool m_bSubscript;
259 bool m_bSuperscript;
260 CFX_ByteString m_text;
261 CFX_ColorF m_color;
262 int m_textsize;
263 bool m_bUnderline;
264 };
265
266 class CFXJS_Span : public CFXJS_Object
267
268 {
269 public:
270 CFXJS_Span(CFXJS_Runtime* pRuntime)
271 : CFXJS_Object(pRuntime){};
272 virtual ~CFXJS_Span(void){};
273
274 DECLARE_JS_CLASS(CFXJS_Span);
275
276 JS_STATIC_PROP(alignment, Span)
277 JS_STATIC_PROP(fontFamily, Span)
278 JS_STATIC_PROP(fontStretch, Span)
279 JS_STATIC_PROP(fontWeight, Span)
280 JS_STATIC_PROP(fontStyle, Span)
281 JS_STATIC_PROP(strikethrough, Span)
282 JS_STATIC_PROP(subscript, Span)
283 JS_STATIC_PROP(superscript, Span)
284 JS_STATIC_PROP(text, Span)
285 JS_STATIC_PROP(textColor, Span)
286 JS_STATIC_PROP(textSize, Span)
287 JS_STATIC_PROP(underline, Span)
288 };
289 } // namespace javascript
290
291 #endif
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205
Span
A generic object that represents a length of text and its associated properties in a rich text form f...
Definition: span.h:18


Javascript API: Member List

FullScreen Member List

This is the complete list of members for FullScreen, including all inherited members.

backgroundColor(OBJ_PROP_PARAMS) | FullScreen
cursor(OBJ_PROP_PARAMS) | FullScreen
defaultTransition(OBJ_PROP_PARAMS) | FullScreen
isFullScreen(OBJ_PROP_PARAMS) | FullScreen
loop(OBJ_PROP_PARAMS) | FullScreen
timeDelay(OBJ_PROP_PARAMS) | FullScreen
transitions(OBJ_PROP_PARAMS) | FullScreen
usePageTiming(OBJ_PROP_PARAMS) | FullScreen
useTimer(OBJ_PROP_PARAMS) | FullScreen


Javascript API: Member List

HostContainer Member List

This is the complete list of members for HostContainer, including all inherited members.

messageHandler(OBJ_PROP_PARAMS) | HostContainer
postMessage(OBJ_METHOD_PARAMS) | HostContainer


Javascript API: Member List

Doc Member List

This is the complete list of members for Doc, including all inherited members.

addAnnot(OBJ_METHOD_PARAMS) | Doc |
addField(OBJ_METHOD_PARAMS) | Doc |
addIcon(OBJ_METHOD_PARAMS) | Doc |
addLink(OBJ_METHOD_PARAMS) | Doc |
addWatermarkFromFile(OBJ_METHOD_PARAMS) | Doc |
addWatermarkFromText(OBJ_METHOD_PARAMS) | Doc |
addWeblinks(OBJ_METHOD_PARAMS) | Doc |
AnnotCanBeFetched(IFXJS_AnnotProvider *pAnnot) | Doc | static
author(OBJ_PROP_PARAMS) | Doc |
baseURL(OBJ_PROP_PARAMS) | Doc |
bookmarkRoot(OBJ_PROP_PARAMS) | Doc |
calculate(OBJ_PROP_PARAMS) | Doc |
calculateNow(OBJ_METHOD_PARAMS) | Doc |
closeDoc(OBJ_METHOD_PARAMS) | Doc |
createTemplate(OBJ_METHOD_PARAMS) | Doc |
creationDate(OBJ_PROP_PARAMS) | Doc |
creator(OBJ_PROP_PARAMS) | Doc |
dataObjects(OBJ_PROP_PARAMS) | Doc |
delay(OBJ_PROP_PARAMS) | Doc |
deletePages(OBJ_METHOD_PARAMS) | Doc |
dirty(OBJ_PROP_PARAMS) | Doc |
documentFileName(OBJ_PROP_PARAMS) | Doc |
dynamicXFAForm(OBJ_PROP_PARAMS) | Doc |
exportAsFDF(OBJ_METHOD_PARAMS) | Doc |
exportAsText(OBJ_METHOD_PARAMS) | Doc |
exportAsXFDF(OBJ_METHOD_PARAMS) | Doc |
exportAsXFDFStr(OBJ_METHOD_PARAMS) | Doc |
exportDataObject(OBJ_METHOD_PARAMS) | Doc |
external(OBJ_PROP_PARAMS) | Doc |
extractPages(OBJ_METHOD_PARAMS) | Doc |
filesize(OBJ_PROP_PARAMS) | Doc |
flattenPages(OBJ_METHOD_PARAMS) | Doc |
getAnnot(OBJ_METHOD_PARAMS) | Doc |
getAnnots(OBJ_METHOD_PARAMS) | Doc |
getDataObject(OBJ_METHOD_PARAMS) | Doc |
getField(OBJ_METHOD_PARAMS) | Doc |
getIcon(OBJ_METHOD_PARAMS) | Doc |
getLinks(OBJ_METHOD_PARAMS) | Doc |
getNthFieldName(OBJ_METHOD_PARAMS) | Doc |
getOCGOrder(OBJ_METHOD_PARAMS) | Doc |
getOCGs(OBJ_METHOD_PARAMS) | Doc |
getPageBox(OBJ_METHOD_PARAMS) | Doc |
getPageNthWord(OBJ_METHOD_PARAMS) | Doc |
getPageNthWordQuads(OBJ_METHOD_PARAMS) | Doc |
getPageNumWords(OBJ_METHOD_PARAMS) | Doc |
getPageRotation(OBJ_METHOD_PARAMS) | Doc |
getPageTransition(OBJ_METHOD_PARAMS) | Doc |
getPrintParams(OBJ_METHOD_PARAMS) | Doc |
getTemplate(OBJ_METHOD_PARAMS) | Doc |
getURL(OBJ_METHOD_PARAMS) | Doc |
gotoNamedDest(OBJ_METHOD_PARAMS) | Doc |
hostContainer(OBJ_PROP_PARAMS) | Doc |
icons(OBJ_PROP_PARAMS) | Doc |
importAnFDF(OBJ_METHOD_PARAMS) | Doc |
importAnXFDF(OBJ_METHOD_PARAMS) | Doc |
importDataObject(OBJ_METHOD_PARAMS) | Doc |
importTextData(OBJ_METHOD_PARAMS) | Doc |
info(OBJ_PROP_PARAMS) | Doc |
insertPages(OBJ_METHOD_PARAMS) | Doc |
keywords(OBJ_PROP_PARAMS) | Doc |
layout(OBJ_PROP_PARAMS) | Doc |
mailDoc(OBJ_METHOD_PARAMS) | Doc |
mailForm(OBJ_METHOD_PARAMS) | Doc |
media(OBJ_PROP_PARAMS) | Doc |
modDate(OBJ_PROP_PARAMS) | Doc |
mouseX(OBJ_PROP_PARAMS) | Doc |
mouseY(OBJ_PROP_PARAMS) | Doc |
movePage(OBJ_METHOD_PARAMS) | Doc |
newPage(OBJ_METHOD_PARAMS) | Doc |
numFields(OBJ_PROP_PARAMS) | Doc |
numPages(OBJ_PROP_PARAMS) | Doc |
page(OBJ_PROP_PARAMS) | Doc |
pageNum(OBJ_PROP_PARAMS) | Doc |
pageWindowRect(OBJ_PROP_PARAMS) | Doc |
path(OBJ_PROP_PARAMS) | Doc |
print(OBJ_METHOD_PARAMS) | Doc |
producer(OBJ_PROP_PARAMS) | Doc |
removeDataObject(OBJ_METHOD_PARAMS) | Doc |
removeField(OBJ_METHOD_PARAMS) | Doc |
removeIcon(OBJ_METHOD_PARAMS) | Doc |
removeLinks(OBJ_METHOD_PARAMS) | Doc |
removeTemplate(OBJ_METHOD_PARAMS) | Doc |
removeWeblinks(OBJ_METHOD_PARAMS) | Doc |
replacePages(OBJ_METHOD_PARAMS) | Doc |
resetForm(OBJ_METHOD_PARAMS) | Doc |
scroll(OBJ_METHOD_PARAMS) | Doc |
securityHandler(OBJ_PROP_PARAMS) | Doc |
setOCGOrder(OBJ_METHOD_PARAMS) | Doc |
setPageBoxes(OBJ_METHOD_PARAMS) | Doc |
setPageRotations(OBJ_METHOD_PARAMS) | Doc |
setPageTabOrder(OBJ_METHOD_PARAMS) | Doc |
setPageTransitions(OBJ_METHOD_PARAMS) | Doc |
spawnPageFromTemplate(OBJ_METHOD_PARAMS) | Doc |
subject(OBJ_PROP_PARAMS) | Doc |
submitForm(OBJ_METHOD_PARAMS) | Doc |
syncAnnotScan(OBJ_METHOD_PARAMS) | Doc |
templates(OBJ_PROP_PARAMS) | Doc |
title(OBJ_PROP_PARAMS) | Doc |
URL(OBJ_PROP_PARAMS) | Doc |
xfa(OBJ_PROP_PARAMS) | Doc |
zoom(OBJ_PROP_PARAMS) | Doc |
zoomType(OBJ_PROP_PARAMS) | Doc |


Javascript API: 3d.h Source File

  • src
  • javascript
  • inc
3d.h
Go to the documentation of this file.
1 #ifndef _ANNOT3D_H_
2 #define _ANNOT3D_H_
3 #include "../../../include/javascript/fx_js3DProvider.h"
5
6 namespace javascript {
7 class Doc;
9
14 struct CFXJS_Annot3DObj
15 {
16 CFXJS_Annot3DObj()
17 {
18 context3D = nullptr;
19 activated = false;
20 page = 0;
21 }
22
23 FX_BOOL activated;
24 FXJSE_HCONTEXT context3D;
25 CPDF_Rect innerRect;
26 CFX_WideString name;
27 FX_INT32 page;
28 CPDF_Rect rect;
29 };
30
36 class Annot3D : public CFXJS_EmbedObj
37 {
38 public:
39 Annot3D(CFXJS_Object* pJSObject);
40 virtual ~Annot3D();
41
42 public:
55 FX_BOOL activated(OBJ_PROP_PARAMS);
56 FX_BOOL context3D(OBJ_PROP_PARAMS);
57
68 FX_BOOL innerRect(OBJ_PROP_PARAMS);
69
80 FX_BOOL name(OBJ_PROP_PARAMS);
81
93 FX_BOOL page(OBJ_PROP_PARAMS);
94 FX_BOOL rect(OBJ_PROP_PARAMS);
95
96 public:
97 void SetDoc(Doc* pDoc)
98 {
99 m_pJSDoc = pDoc;
100 }
101 void Initial(Doc* pDocument, IFXJS_Annot3DProvider* pAnnot, CFXJS_Annot3DObj& Annot3DobjProp);
102
103 protected:
104 std::unique_ptr<CFXJS_Object>
105 CreateObjectAndSet(FXJSE_HVALUE value, CPDF_Dictionary* dict, CFXJS_Runtime* pRuntime);
106
107 private:
108 void SetChangeNotity();
109
110 static void Name(IFXJS_Annot3DProvider* pAnnot3D, CFX_WideString& cwName);
111 static void Rect(IFXJS_Annot3DProvider* pAnnot3D, CPDF_Rect& rectArray);
112
113 static void UpdateAnnot(IFXJS_Annot3DProvider* pAnnot3D, FX_BOOL bRefresh);
114
115 Doc* m_pJSDoc;
116 CPDF_Dictionary* m_Annot3D;
117 bool m_bRoot;
118 IFXJS_Annot3DProvider* m_pAnnot3DProvider;
119 CFXJS_Annot3DObj m_Annot3DobjProp;
120 };
121
122 class CFXJS_Annot3D : public CFXJS_Object
123 {
124 public:
125 CFXJS_Annot3D(CFXJS_Runtime* pRuntime)
126 : CFXJS_Object(pRuntime){};
127 virtual ~CFXJS_Annot3D(){};
128
129 public:
130 DECLARE_JS_CLASS(CFXJS_Annot3D);
131
132 JS_STATIC_PROP(activated, Annot3D);
133 JS_STATIC_PROP(context3D, Annot3D);
134 JS_STATIC_PROP(innerRect, Annot3D);
135 JS_STATIC_PROP(name, Annot3D);
136 JS_STATIC_PROP(page, Annot3D);
137 JS_STATIC_PROP(rect, Annot3D);
138 };
139 } // namespace javascript
140
141 #endif //_BOOKMARK_H_
Annot3D
A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational p...
Definition: 3d.h:36
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205


Javascript API: field.h Source File

  • src
  • javascript
  • inc
field.h
Go to the documentation of this file.
1 #ifndef _FIELD_H_
2 #define _FIELD_H_
3
4 #include "fxge/fx_color.h"
5 #include "javascript/fx_jsAppProvider.h"
7 namespace javascript {
8 class Doc;
9 class IFXJS_WidgetProvider;
10
11 struct LOCKELEMENT
12 {
13 LOCKELEMENT()
14 {
15 cwLock = L"undefined";
16 Fields.RemoveAll();
17 }
18 CFX_WideString cwLock;
19 CFX_WideStringArray Fields;
20 };
21 class Document;
22
23 using CPDF_FormFieldArray = CFX_ArrayTemplate<CPDF_FormField*>;
24
25
26 class CFieldFunctions
27 {
28 public:
29 CFieldFunctions() {}
30 ~CFieldFunctions() {}
31 static CPDF_FormFieldArray GetFormFields(CPDF_InterForm* pInterForm,
32 const CFX_WideString& csFieldName);
33
34 static FX_BOOL IsSignatureField(CPDF_FormField* pFormField);
35
36 static FX_BOOL CreateSignInfoObj(CFXJS_Runtime* pRuntime,
37 FXJSE_HVALUE hReturnValue,
38 CPDF_InterForm* pInterForm,
39 const CFX_WideString& csFieldName,
40 std::vector<std::unique_ptr<CFXJS_Object>>& newObjects);
41 };
42
43 /* ------------------------------------- XFAField ------------------------------------- */
44
45 class XFAField : public CFXJS_EmbedObj
46 {
47 public:
48 XFAField(CFXJS_Object* pJSObject);
49 virtual ~XFAField(void);
50
51 FX_BOOL rect(OBJ_PROP_PARAMS);
52
53 FX_BOOL setFocus(OBJ_METHOD_PARAMS);
54 FX_BOOL setLock(OBJ_METHOD_PARAMS);
55 FX_BOOL signatureGetModifications(OBJ_METHOD_PARAMS);
56 FX_BOOL signatureGetSeedValue(OBJ_METHOD_PARAMS);
57 FX_BOOL signatureInfo(OBJ_METHOD_PARAMS);
58 FX_BOOL signatureSetSeedValue(OBJ_METHOD_PARAMS);
59 FX_BOOL signatureSign(OBJ_METHOD_PARAMS);
60 FX_BOOL signatureValidate(OBJ_METHOD_PARAMS);
61
62 public:
63 FX_INT32 QueryProperty(FX_BSTR szPropName);
64 FX_BOOL
65 DoProperty(FXJSE_HVALUE hValue, FX_BSTR szPropName, JS_ErrorString& sError, FX_BOOL IsSet);
66 FX_BOOL DelProperty(FX_BSTR szPropName, JS_ErrorString& sError);
67
68 FX_BOOL AttachField(Doc* pDocument, const CFX_WideString& csFieldName);
69
70
71 public:
72 Doc* m_pJSDoc;
73 IFXJS_DocumentProvider* m_pDocument;
74 CFX_WideString m_FieldName;
75 CPDF_InterForm* m_pInterForm = nullptr;
76 FX_BOOL m_bCreate = false;
77 };
78
79 class CFXJS_XFAField : public CFXJS_Object
80 {
81 public:
82 CFXJS_XFAField(CFXJS_Runtime* pRuntime);
83 virtual ~CFXJS_XFAField(void);
84
85 DECLARE_JS_CLASS(CFXJS_XFAField);
86
87 JS_STATIC_PROP(rect, XFAField);
88
89 JS_STATIC_METHOD(setFocus, XFAField);
90 JS_STATIC_METHOD(setLock, XFAField);
91 JS_STATIC_METHOD(signatureGetModifications, XFAField);
92 JS_STATIC_METHOD(signatureGetSeedValue, XFAField);
93 JS_STATIC_METHOD(signatureInfo, XFAField);
94 JS_STATIC_METHOD(signatureSetSeedValue, XFAField);
95 JS_STATIC_METHOD(signatureSign, XFAField);
96 JS_STATIC_METHOD(signatureValidate, XFAField);
97 };
98
99 /* ------------------------------------- Field ------------------------------------- */
100
101 enum FIELD_PROP
102 {
103 FP_ALIGNMENT,
104 FP_BORDERSTYLE,
105 FP_BUTTONALIGNX,
106 FP_BUTTONALIGNY,
107 FP_BUTTONFITBOUNDS,
108 FP_BUTTONPOSITION,
109 FP_BUTTONSCALEHOW,
110 FP_BUTTONSCALEWHEN,
111 FP_CALCORDERINDEX,
112 FP_CHARLIMIT,
113 FP_COMB,
114 FP_COMMITONSELCHANGE,
115 FP_CURRENTVALUEINDICES,
116 FP_DEFAULTVALUE,
117 FP_DONOTSCROLL,
118 FP_DISPLAY,
119 FP_FILLCOLOR,
120 FP_HIDDEN,
121 FP_HIGHLIGHT,
122 FP_LINEWIDTH,
123 FP_MULTILINE,
124 FP_MULTIPLESELECTION,
125 FP_PASSWORD,
126 FP_RECT,
127 FP_RICHTEXT,
128 FP_RICHVALUE,
129 FP_ROTATION,
130 FP_STROKECOLOR,
131 FP_STYLE,
132 FP_TEXTCOLOR,
133 FP_TEXTFONT,
134 FP_TEXTSIZE,
135 FP_USERNAME,
136 FP_VALUE
137 };
138 struct CFXJS_DelayData
139 {
140 CFX_WideString sFieldName;
141 int nControlIndex = 0;
142 enum FIELD_PROP eProp = FP_ALIGNMENT;
143 FX_INT32 num = 0;
144 FX_BOOL b = false;
145 CFX_ByteString string;
146 CFX_WideString widestring;
147 CPDF_Rect rect;
148 CFX_ColorF color;
149 CFX_DWordArray wordarray;
150 std::vector<CFX_WideString> widestringarray;
151 };
152 struct js_field_Dynamic_data
153 {
154 js_field_Dynamic_data()
155 {
156 pData = NULL;
157 bDeleted = false;
158 }
159 FXJSE_HVALUE pData;
160 bool bDeleted;
161 };
162
163 struct js_RichText_data
164 {
165 CFX_ByteString alignment;
166 CFX_WideStringArray fontFamily;
167 CFX_ByteString fontStretch;
168 CFX_ByteString fontStyle;
169 int fontWeight;
170 bool strikethrough;
171 bool subscript;
172 bool superscript;
173 CFX_ByteString text;
174 CFX_ColorF color;
175 int textsize;
176 bool underline;
177
178 CFX_ByteString csfont;
179 js_RichText_data()
180 {
181 alignment = "left";
182 fontStretch = "normal";
183 fontStyle = "normal";
184 fontWeight = 400;
185 strikethrough = false;
186 subscript = false;
187 superscript = false;
188 textsize = 12;
189 underline = false;
190 }
191 };
192
193 void SplitStyle(CFX_WideString sStyle, js_RichText_data* pBlock);
194 CFX_WideString GetStyleString(js_RichText_data* data);
195 void ParseXML2Span(CXML_Element* pXML, std::vector<std::unique_ptr<js_RichText_data>>& pSpanBlocks);
196
197 #define FIELD_PROP_PARAMS \
198 IFXJS_DocumentProvider *pDocument, const CPDF_FormFieldArray &FieldArray, int nControlIndex, \
199 JS_ErrorString &sError
200
212 class Field : public CFXJS_EmbedObj
213 {
214 public:
215 Field(CFXJS_Object* pJSObject);
216 virtual ~Field(void);
217 bool CheckBaseExpects() override;
218
239 FX_BOOL alignment(OBJ_PROP_PARAMS);
240
274 FX_BOOL borderStyle(OBJ_PROP_PARAMS);
275 FX_BOOL buttonAlignX(OBJ_PROP_PARAMS);
276 FX_BOOL buttonAlignY(OBJ_PROP_PARAMS);
277
300 FX_BOOL buttonFitBounds(OBJ_PROP_PARAMS);
301
328 FX_BOOL buttonPosition(OBJ_PROP_PARAMS);
329
352 FX_BOOL buttonScaleHow(OBJ_PROP_PARAMS);
353
377 FX_BOOL buttonScaleWhen(OBJ_PROP_PARAMS);
378
403 FX_BOOL calcOrderIndex(OBJ_PROP_PARAMS);
404
424 FX_BOOL charLimit(OBJ_PROP_PARAMS);
425
459 FX_BOOL comb(OBJ_PROP_PARAMS);
460
480 FX_BOOL commitOnSelChange(OBJ_PROP_PARAMS);
481
529 FX_BOOL currentValueIndices(OBJ_PROP_PARAMS);
530
568 FX_BOOL defaultStyle(OBJ_PROP_PARAMS);
569
591 FX_BOOL defaultValue(OBJ_PROP_PARAMS);
592
614 FX_BOOL doNotScroll(OBJ_PROP_PARAMS);
615
637 FX_BOOL doNotSpellCheck(OBJ_PROP_PARAMS);
638
669 FX_BOOL delay(OBJ_PROP_PARAMS);
670
693 FX_BOOL display(OBJ_PROP_PARAMS);
694
718 FX_BOOL doc(OBJ_PROP_PARAMS);
719
740 FX_BOOL editable(OBJ_PROP_PARAMS);
741
773 FX_BOOL exportValues(OBJ_PROP_PARAMS);
774
796 FX_BOOL fileSelect(OBJ_PROP_PARAMS);
797
820 FX_BOOL fillColor(OBJ_PROP_PARAMS);
821
851 FX_BOOL hidden(OBJ_PROP_PARAMS);
852
881 FX_BOOL highlight(OBJ_PROP_PARAMS);
882
908 FX_BOOL lineWidth(OBJ_PROP_PARAMS);
909
939 FX_BOOL multiline(OBJ_PROP_PARAMS);
940
969 FX_BOOL multipleSelection(OBJ_PROP_PARAMS);
970
992 FX_BOOL name(OBJ_PROP_PARAMS);
993
1014 FX_BOOL numItems(OBJ_PROP_PARAMS);
1015
1045 FX_BOOL page(OBJ_PROP_PARAMS);
1046
1076 FX_BOOL password(OBJ_PROP_PARAMS);
1077
1108 FX_BOOL print(OBJ_PROP_PARAMS);
1109
1130 FX_BOOL radiosInUnison(OBJ_PROP_PARAMS);
1131
1152 FX_BOOL readonly(OBJ_PROP_PARAMS);
1153
1189 FX_BOOL rect(OBJ_PROP_PARAMS);
1190
1211 FX_BOOL required(OBJ_PROP_PARAMS);
1212
1247 FX_BOOL richText(OBJ_PROP_PARAMS);
1248
1311 FX_BOOL richValue(OBJ_PROP_PARAMS);
1312
1335 FX_BOOL rotation(OBJ_PROP_PARAMS);
1336
1363 FX_BOOL strokeColor(OBJ_PROP_PARAMS);
1364
1393 FX_BOOL style(OBJ_PROP_PARAMS);
1394
1412 FX_BOOL submitName(OBJ_PROP_PARAMS);
1413
1438 FX_BOOL textColor(OBJ_PROP_PARAMS);
1439
1477 FX_BOOL textFont(OBJ_PROP_PARAMS);
1478
1499 FX_BOOL textSize(OBJ_PROP_PARAMS);
1500
1529 FX_BOOL type(OBJ_PROP_PARAMS);
1530
1551 FX_BOOL userName(OBJ_PROP_PARAMS);
1573 FX_BOOL value(OBJ_PROP_PARAMS);
1589 FX_BOOL valueAsString(OBJ_PROP_PARAMS);
1590 FX_BOOL source(OBJ_PROP_PARAMS);
1591 FX_BOOL forReal(OBJ_PROP_PARAMS);
1592 FX_BOOL stampName(OBJ_PROP_PARAMS);
1593
1606 FX_BOOL browseForFileToSubmit(OBJ_METHOD_PARAMS);
1607
1627 FX_BOOL buttonGetCaption(OBJ_METHOD_PARAMS);
1628
1649 FX_BOOL buttonGetIcon(OBJ_METHOD_PARAMS);
1650 FX_BOOL buttonImportIcon(OBJ_METHOD_PARAMS);
1651
1669 FX_BOOL buttonSetCaption(OBJ_METHOD_PARAMS);
1670
1699 FX_BOOL buttonSetIcon(OBJ_METHOD_PARAMS);
1700
1721 FX_BOOL checkThisBox(OBJ_METHOD_PARAMS);
1722
1733 FX_BOOL clearItems(OBJ_METHOD_PARAMS);
1734
1754 FX_BOOL defaultIsChecked(OBJ_METHOD_PARAMS);
1755
1776 FX_BOOL deleteItemAt(OBJ_METHOD_PARAMS);
1777
1794 FX_BOOL getArray(OBJ_METHOD_PARAMS);
1795
1826 FX_BOOL getItemAt(OBJ_METHOD_PARAMS);
1827
1834 FX_BOOL getLock(OBJ_METHOD_PARAMS);
1835
1853 FX_BOOL insertItemAt(OBJ_METHOD_PARAMS);
1854
1875 FX_BOOL isBoxChecked(OBJ_METHOD_PARAMS);
1876
1897 FX_BOOL isDefaultChecked(OBJ_METHOD_PARAMS);
1898
1925 FX_BOOL setAction(OBJ_METHOD_PARAMS);
1926
1946 FX_BOOL setFocus(OBJ_METHOD_PARAMS);
1947
1970 FX_BOOL setItems(OBJ_METHOD_PARAMS);
1971
1994 FX_BOOL setLock(OBJ_METHOD_PARAMS);
1995
2035 FX_BOOL signatureGetModifications(OBJ_METHOD_PARAMS);
2036
2056 FX_BOOL signatureGetSeedValue(OBJ_METHOD_PARAMS);
2057
2090 FX_BOOL signatureInfo(OBJ_METHOD_PARAMS);
2091
2149 FX_BOOL signatureSetSeedValue(OBJ_METHOD_PARAMS);
2150
2201 FX_BOOL signatureSign(OBJ_METHOD_PARAMS);
2202
2245 FX_BOOL signatureValidate(OBJ_METHOD_PARAMS);
2246
2247 public:
2248 FX_INT32 QueryProperty(FX_BSTR szPropName);
2249 FX_BOOL
2250 DoProperty(FXJSE_HVALUE hValue, FX_BSTR szPropName, JS_ErrorString& sError, FX_BOOL IsSet);
2251 FX_BOOL DelProperty(FX_BSTR szPropName, JS_ErrorString& sError);
2252 FX_BOOL SetGlobalVariables(CFXJS_Runtime* pRuntime, FX_BSTR propname, FXJSE_HVALUE hValue);
2253
2254 public:
2255 static bool SetAlignment(FIELD_PROP_PARAMS, const CFX_ByteString& string);
2256 static bool SetBorderStyle(FIELD_PROP_PARAMS, const CFX_ByteString& string);
2257 static bool SetButtonAlignX(FIELD_PROP_PARAMS, int number);
2258 static bool SetButtonAlignY(FIELD_PROP_PARAMS, int number);
2259 static bool SetButtonFitBounds(FIELD_PROP_PARAMS, FX_BOOL b);
2260 static bool SetButtonPosition(FIELD_PROP_PARAMS, int number);
2261 static bool SetButtonScaleHow(FIELD_PROP_PARAMS, int number);
2262 static bool SetButtonScaleWhen(FIELD_PROP_PARAMS, int number);
2263 static bool SetCalcOrderIndex(FIELD_PROP_PARAMS, int number);
2264 static bool SetCharLimit(FIELD_PROP_PARAMS, int number);
2265 static bool SetComb(FIELD_PROP_PARAMS, FX_BOOL b);
2266 static bool SetCommitOnSelChange(FIELD_PROP_PARAMS, FX_BOOL b);
2267 static bool SetCurrentValueIndices(FIELD_PROP_PARAMS, const CFX_DWordArray& array);
2268 static bool SetDefaultStyle(FIELD_PROP_PARAMS, const js_RichText_data* pData);
2269 static bool SetDefaultValue(FIELD_PROP_PARAMS, const CFX_WideString& string);
2270 static bool SetDoNotScroll(FIELD_PROP_PARAMS, FX_BOOL b);
2271 static bool SetDisplay(FIELD_PROP_PARAMS, int number);
2272 static bool SetFillColor(FIELD_PROP_PARAMS, const CFX_ColorF& color);
2273 static bool SetHidden(FIELD_PROP_PARAMS, FX_BOOL b);
2274 static bool SetHighlight(FIELD_PROP_PARAMS, const CFX_ByteString& string);
2275 static bool SetLineWidth(FIELD_PROP_PARAMS, int number);
2276 static bool SetMultiline(FIELD_PROP_PARAMS, FX_BOOL b);
2277 static bool SetMultipleSelection(FIELD_PROP_PARAMS, FX_BOOL b);
2278 static bool SetPassword(FIELD_PROP_PARAMS, FX_BOOL b);
2279 static bool SetRect(FIELD_PROP_PARAMS, const CPDF_Rect& rect);
2280 static bool SetRichText(FIELD_PROP_PARAMS, FX_BOOL b);
2281 static bool
2282 SetRichValue(FIELD_PROP_PARAMS, CFX_ByteString csRVXML, const CFX_WideString& string);
2283 static bool GetRichValue(FIELD_PROP_PARAMS,
2284 const CFX_ByteString csName,
2285 CFX_WideStringArray& csArrRVXML);
2286 static bool SetRotation(FIELD_PROP_PARAMS, int number);
2287 static bool SetStrokeColor(FIELD_PROP_PARAMS, const CFX_ColorF& color);
2288 static bool SetStyle(FIELD_PROP_PARAMS, const CFX_ByteString& string);
2289 static bool SetTextColor(FIELD_PROP_PARAMS, const CFX_ColorF& color);
2290 static bool SetTextFont(FIELD_PROP_PARAMS, const CFX_ByteString& string);
2291 static bool SetTextSize(FIELD_PROP_PARAMS, int number);
2292 static bool SetUserName(FIELD_PROP_PARAMS, const CFX_WideString& string);
2293 static bool SetValue(FIELD_PROP_PARAMS, const std::vector<CFX_WideString>& strArray);
2294 static bool SetTMName(FIELD_PROP_PARAMS, const CFX_ByteString& string);
2295
2296 void ClearSpanBlocks();
2297 bool IsXFADocument();
2298
2299 public:
2300 static bool AddField(IFXJS_DocumentProvider* pDocument,
2301 int nPageIndex,
2302 int nFieldType,
2303 const CFX_WideString& sName,
2304 const CPDF_Rect& rcCoords);
2305 CFX_WideString GetFieldName()
2306 {
2307 return m_FieldName;
2308 }
2309
2310 public:
2311 static void UpdateFormField(IFXJS_DocumentProvider* pDocument,
2312 CPDF_FormField* pFormField,
2313 FX_BOOL bResetAP = true,
2314 FX_BOOL bValueChanged = false,
2315 FX_BOOL bResetRV = true);
2316 static void UpdateFormControl(IFXJS_DocumentProvider* pDocument,
2317 CPDF_FormControl* pFormControl,
2318 FX_BOOL bChangeMark,
2319 FX_BOOL bResetAP,
2320 FX_BOOL bRefresh);
2321
2322 static IFXJS_WidgetProvider* GetWidget(IFXJS_DocumentProvider* pDocument,
2323 CPDF_FormControl* pFormControl);
2324 static void
2325 DoDelay(IFXJS_DocumentProvider* pDocument, JS_ErrorString& sError, CFXJS_DelayData* pData);
2326
2327 public:
2328 FX_BOOL AttachField(Doc* pDocument, const CFX_WideString& csFieldName);
2329 void SetDelay(FX_BOOL bDelay);
2330 static void ParseFieldName(const std::wstring& strFieldNameParsed,
2331 std::wstring& strFieldName,
2332 int& iControlNo);
2333
2334 protected:
2335 CPDF_FormFieldArray GetFormFields();
2336 CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
2337 FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
2338
2339 void AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n);
2340 void AddDelay_Bool(enum FIELD_PROP prop, FX_BOOL b);
2341 void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
2342 void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
2343 void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
2344 void AddDelay_Color(enum FIELD_PROP prop, const CFX_ColorF& color);
2345 void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
2346 void AddDelay_WideStringArray(enum FIELD_PROP prop, const std::vector<CFX_WideString>& array);
2347
2348 CFX_ByteString GetRVXML();
2349
2350 private:
2351 FX_BOOL Validate(FX_BOOL IsSet)
2352 {
2353 return !(IsSet && !IsCanSet());
2354 }
2355
2356 void AnalysisSignModifyDetect(FXJSE_HVALUE hReturnValue, CPDF_FormField* pFormField);
2357
2358 void AnalysisFormModifyDetect(FXJSE_HVALUE hReturnValue, CPDF_FormField* pFormField);
2359 void AnalysisAnnotModifyDetect(FXJSE_HVALUE hReturnValue, CPDF_FormField* pFormField);
2360 void AnalysisPageModifyDetect(FXJSE_HVALUE hReturnValue, CPDF_FormField* pFormField);
2361
2362 Doc* GetJSDocument();
2363 void SetModifyFieldProp(FXJSE_HVALUE hProp, FX_INT32 nIndex, const JS_MODIFYDATA& data);
2364 void SetModifyAnnotProp(FXJSE_HVALUE hProp, FX_INT32 nIndex, const JS_MODIFYDATA& data);
2365
2366 CFX_ByteString GetFieldTypeBuffer(CPDF_Dictionary* pFormDict);
2367 CFXJS_Object* FindJSDocument(IFXJS_DocumentProvider* pDoc);
2368
2369 public:
2370 Doc* m_pJSDoc;
2371 IFXJS_DocumentProvider* m_pDocument;
2372 CFX_WideString m_FieldName;
2373 int m_nFormControlIndex;
2374 std::vector<std::unique_ptr<js_RichText_data>> m_arrDefValue;
2375 CFX_WideString m_cwValue;
2376 std::vector<std::unique_ptr<js_RichText_data>> m_SpanBlocks;
2377 };
2378
2379 class CFXJS_Field : public CFXJS_Object
2380 {
2381 public:
2382 CFXJS_Field(CFXJS_Runtime* pRuntime)
2383 : CFXJS_Object(pRuntime){};
2384 virtual ~CFXJS_Field(void){};
2385
2386 DECLARE_JS_DYNAMIC_CLASS(CFXJS_Field);
2387
2388 JS_STATIC_PROP(alignment, Field);
2389 JS_STATIC_PROP(borderStyle, Field);
2390 JS_STATIC_PROP(buttonAlignX, Field);
2391 JS_STATIC_PROP(buttonAlignY, Field);
2392 JS_STATIC_PROP(buttonFitBounds, Field);
2393 JS_STATIC_PROP(buttonPosition, Field);
2394 JS_STATIC_PROP(buttonScaleHow, Field);
2395 JS_STATIC_PROP(buttonScaleWhen, Field);
2396 JS_STATIC_PROP(calcOrderIndex, Field);
2397 JS_STATIC_PROP(charLimit, Field);
2398 JS_STATIC_PROP(comb, Field);
2399 JS_STATIC_PROP(commitOnSelChange, Field);
2400 JS_STATIC_PROP(currentValueIndices, Field);
2401 JS_STATIC_PROP(defaultStyle, Field);
2402 JS_STATIC_PROP(defaultValue, Field);
2403 JS_STATIC_PROP(doNotScroll, Field);
2404 JS_STATIC_PROP(doNotSpellCheck, Field);
2405 JS_STATIC_PROP(delay, Field);
2406 JS_STATIC_PROP(display, Field);
2407 JS_STATIC_PROP(doc, Field);
2408 JS_STATIC_PROP(editable, Field);
2409 JS_STATIC_PROP(exportValues, Field);
2410 JS_STATIC_PROP(fileSelect, Field);
2411 JS_STATIC_PROP(fillColor, Field);
2412 JS_STATIC_PROP(hidden, Field);
2413 JS_STATIC_PROP(highlight, Field);
2414 JS_STATIC_PROP(lineWidth, Field);
2415 JS_STATIC_PROP(multiline, Field);
2416 JS_STATIC_PROP(multipleSelection, Field);
2417 JS_STATIC_PROP(name, Field);
2418 JS_STATIC_PROP(numItems, Field);
2419 JS_STATIC_PROP(page, Field);
2420 JS_STATIC_PROP(password, Field);
2421 JS_STATIC_PROP(print, Field);
2422 JS_STATIC_PROP(radiosInUnison, Field);
2423 JS_STATIC_PROP(readonly, Field);
2424 JS_STATIC_PROP(rect, Field);
2425 JS_STATIC_PROP(required, Field);
2426 JS_STATIC_PROP(richText, Field);
2427 JS_STATIC_PROP(richValue, Field);
2428 JS_STATIC_PROP(rotation, Field);
2429 JS_STATIC_PROP(strokeColor, Field);
2430 JS_STATIC_PROP(style, Field);
2431 JS_STATIC_PROP(submitName, Field);
2432 JS_STATIC_PROP(textColor, Field);
2433 JS_STATIC_PROP(textFont, Field);
2434 JS_STATIC_PROP(textSize, Field);
2435 JS_STATIC_PROP(type, Field);
2436 JS_STATIC_PROP(userName, Field);
2437 JS_STATIC_PROP(value, Field);
2438 JS_STATIC_PROP(valueAsString, Field);
2439 JS_STATIC_PROP(source, Field);
2440 JS_STATIC_PROP(forReal, Field);
2441 JS_STATIC_PROP(stampName, Field);
2442
2443 JS_STATIC_METHOD(browseForFileToSubmit, Field);
2444 JS_STATIC_METHOD(buttonGetCaption, Field);
2445 JS_STATIC_METHOD(buttonGetIcon, Field);
2446 JS_STATIC_METHOD(buttonImportIcon, Field);
2447 JS_STATIC_METHOD(buttonSetCaption, Field);
2448 JS_STATIC_METHOD(buttonSetIcon, Field);
2449 JS_STATIC_METHOD(checkThisBox, Field);
2450 JS_STATIC_METHOD(clearItems, Field);
2451 JS_STATIC_METHOD(defaultIsChecked, Field);
2452 JS_STATIC_METHOD(deleteItemAt, Field);
2453 JS_STATIC_METHOD(getArray, Field);
2454 JS_STATIC_METHOD(getItemAt, Field);
2455 JS_STATIC_METHOD(getLock, Field);
2456 JS_STATIC_METHOD(insertItemAt, Field);
2457 JS_STATIC_METHOD(isBoxChecked, Field);
2458 JS_STATIC_METHOD(isDefaultChecked, Field);
2459 JS_STATIC_METHOD(setAction, Field);
2460 JS_STATIC_METHOD(setFocus, Field);
2461 JS_STATIC_METHOD(setItems, Field);
2462 JS_STATIC_METHOD(setLock, Field);
2463 JS_STATIC_METHOD(signatureGetModifications, Field);
2464 JS_STATIC_METHOD(signatureGetSeedValue, Field);
2465 JS_STATIC_METHOD(signatureInfo, Field);
2466 JS_STATIC_METHOD(signatureSetSeedValue, Field);
2467 JS_STATIC_METHOD(signatureSign, Field);
2468 JS_STATIC_METHOD(signatureValidate, Field);
2469 };
2470
2471 //---------------------------------------------------Lock -----------------------------------------
2472 class Lock : public CFXJS_EmbedObj
2473 {
2474 public:
2475 Lock(CFXJS_Object* pJSObject);
2476 virtual ~Lock(void);
2477
2478 FX_BOOL action(OBJ_PROP_PARAMS);
2479 FX_BOOL fields(OBJ_PROP_PARAMS);
2480
2481 public:
2482 void SetField(CPDF_FormField* pFormField)
2483 {
2484 m_pFormField = pFormField;
2485 }
2486 void GetLockElement(LOCKELEMENT& lockEle);
2487
2488 FX_BOOL SetLock(const LOCKELEMENT& lockEle);
2489
2490 private:
2491 private:
2492 void GetLockEleFromDict();
2493
2494 CPDF_FormField* m_pFormField;
2495 LOCKELEMENT m_LockElement;
2496 };
2497
2498 class CFXJS_Lock : public CFXJS_Object
2499 {
2500 public:
2501 CFXJS_Lock(CFXJS_Runtime* pRuntime)
2502 : CFXJS_Object(pRuntime){};
2503 virtual ~CFXJS_Lock(void){};
2504
2505 DECLARE_JS_CLASS(CJS_Lock);
2506
2507 JS_STATIC_PROP(action, Lock);
2508 JS_STATIC_PROP(fields, Lock);
2509 };
2510 } // namespace javascript
2511
2512 #endif //_FIELD_H_
Field
This object represents an form field (that is, a field created using the form tool or the Doc addFiel...
Definition: field.h:212
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205
color
The color object is a convenience static object that defines the basic colors. Use this object to set...
Definition: color.h:46


Javascript API: Member List

ScreenAnnot Member List

This is the complete list of members for ScreenAnnot, including all inherited members.

page(OBJ_PROP_PARAMS) | ScreenAnnot
rect(OBJ_PROP_PARAMS) | ScreenAnnot


Javascript API: Member List

app Member List

This is the complete list of members for app, including all inherited members.

activeDocs(OBJ_PROP_PARAMS) | app
addMenuItem(OBJ_METHOD_PARAMS) | app
alert(OBJ_METHOD_PARAMS) | app
beep(OBJ_METHOD_PARAMS) | app
browseForDoc(OBJ_METHOD_PARAMS) | app
calculate(OBJ_PROP_PARAMS) | app
clearInterval(OBJ_METHOD_PARAMS) | app
clearTimeOut(OBJ_METHOD_PARAMS) | app
constants(OBJ_PROP_PARAMS) | app
execDialog(OBJ_METHOD_PARAMS) | app
execMenuItem(OBJ_METHOD_PARAMS) | app
formsVersion(OBJ_PROP_PARAMS) | app
fs(OBJ_PROP_PARAMS) | app
fullscreen(OBJ_PROP_PARAMS) | app
language(OBJ_PROP_PARAMS) | app
launchURL(OBJ_METHOD_PARAMS) | app
listMenuItems(OBJ_METHOD_PARAMS) | app
mailMsg(OBJ_METHOD_PARAMS) | app
media(OBJ_PROP_PARAMS) | app
newDoc(OBJ_METHOD_PARAMS) | app
newFDF(OBJ_METHOD_PARAMS) | app
openDoc(OBJ_METHOD_PARAMS) | app
platform(OBJ_PROP_PARAMS) | app
popUpMenu(OBJ_METHOD_PARAMS) | app
popUpMenuEx(OBJ_METHOD_PARAMS) | app
printerNames(OBJ_PROP_PARAMS) | app
response(OBJ_METHOD_PARAMS) | app
runtimeHighlight(OBJ_PROP_PARAMS) | app
runtimeHighlightColor(OBJ_PROP_PARAMS) | app
setInterval(OBJ_METHOD_PARAMS) | app
setTimeOut(OBJ_METHOD_PARAMS) | app
thermometer(OBJ_PROP_PARAMS) | app
viewerType(OBJ_PROP_PARAMS) | app
viewerVariation(OBJ_PROP_PARAMS) | app
viewerVersion(OBJ_PROP_PARAMS) | app


Javascript API: Member List

Icon Member List

This is the complete list of members for Icon, including all inherited members.


Javascript API: Member List

Index Member List

This is the complete list of members for Index, including all inherited members.

available(OBJ_PROP_PARAMS) | Index
name(OBJ_PROP_PARAMS) | Index
path(OBJ_PROP_PARAMS) | Index
selected(OBJ_PROP_PARAMS) | Index


Javascript API: Member List

PrintParams Member List

This is the complete list of members for PrintParams, including all inherited members.

binaryOK(OBJ_PROP_PARAMS) | PrintParams
bitmapDPI(OBJ_PROP_PARAMS) | PrintParams
booklet(OBJ_PROP_PARAMS) | PrintParams
constants(OBJ_PROP_PARAMS) | PrintParams
DuplexType(OBJ_PROP_PARAMS) | PrintParams
fileName(OBJ_PROP_PARAMS) | PrintParams
firstPage(OBJ_PROP_PARAMS) | PrintParams
flags(OBJ_PROP_PARAMS) | PrintParams
interactive(OBJ_PROP_PARAMS) | PrintParams
lastPage(OBJ_PROP_PARAMS) | PrintParams
NumCopies(OBJ_PROP_PARAMS) | PrintParams
nUpAutoRotate(OBJ_PROP_PARAMS) | PrintParams
nUpNumPagesH(OBJ_PROP_PARAMS) | PrintParams
nUpNumPagesV(OBJ_PROP_PARAMS) | PrintParams
nUpPageBorder(OBJ_PROP_PARAMS) | PrintParams
nUpPageOrders(OBJ_PROP_PARAMS) | PrintParams
pageHandling(OBJ_PROP_PARAMS) | PrintParams
pageSubset(OBJ_PROP_PARAMS) | PrintParams
printAsImage(OBJ_PROP_PARAMS) | PrintParams
printContent(OBJ_PROP_PARAMS) | PrintParams
printerName(OBJ_PROP_PARAMS) | PrintParams
printRange(OBJ_PROP_PARAMS) | PrintParams
reversePages(OBJ_PROP_PARAMS) | PrintParams
tileLabel(OBJ_PROP_PARAMS) | PrintParams
tileMark(OBJ_PROP_PARAMS) | PrintParams
tileOverlap(OBJ_PROP_PARAMS) | PrintParams
tileScale(OBJ_PROP_PARAMS) | PrintParams


Javascript API: Member List

SecurityHandler Member List

This is the complete list of members for SecurityHandler, including all inherited members.

appearances(OBJ_PROP_PARAMS) | SecurityHandler
digitalIDs(OBJ_PROP_PARAMS) | SecurityHandler
isLoggedIn(OBJ_PROP_PARAMS) | SecurityHandler
login(OBJ_METHOD_PARAMS) | SecurityHandler
loginName(OBJ_PROP_PARAMS) | SecurityHandler
loginPath(OBJ_PROP_PARAMS) | SecurityHandler
logout(OBJ_METHOD_PARAMS) | SecurityHandler
name(OBJ_PROP_PARAMS) | SecurityHandler
newUser(OBJ_METHOD_PARAMS) | SecurityHandler
signAuthor(OBJ_PROP_PARAMS) | SecurityHandler
signInvisible(OBJ_PROP_PARAMS) | SecurityHandler
signValidate(OBJ_PROP_PARAMS) | SecurityHandler
signVisible(OBJ_PROP_PARAMS) | SecurityHandler
uiName(OBJ_PROP_PARAMS) | SecurityHandler


Javascript API: Member List

search Member List

This is the complete list of members for search, including all inherited members.

addIndex(OBJ_METHOD_PARAMS) | search
attachments(OBJ_PROP_PARAMS) | search
bookmarks(OBJ_PROP_PARAMS) | search
docText(OBJ_PROP_PARAMS) | search
ignoreAccents(OBJ_PROP_PARAMS) | search
ignoreAsianCharacterWidth(OBJ_PROP_PARAMS) | search
markup(OBJ_PROP_PARAMS) | search
matchCase(OBJ_PROP_PARAMS) | search
matchWholeWord(OBJ_PROP_PARAMS) | search
maxDocs(OBJ_PROP_PARAMS) | search
proximity(OBJ_PROP_PARAMS) | search
query(OBJ_METHOD_PARAMS) | search
removeIndex(OBJ_METHOD_PARAMS) | search
stem(OBJ_PROP_PARAMS) | search
wordMatching(OBJ_PROP_PARAMS) | search


Javascript API: Member List

doc_media Member List

This is the complete list of members for doc_media, including all inherited members.

getAnnot(OBJ_METHOD_PARAMS) | doc_media
getOpenPlayers(OBJ_METHOD_PARAMS) | doc_media
getRendition(OBJ_METHOD_PARAMS) | doc_media


Javascript API: util.h Source File

  • src
  • javascript
  • inc
util.h
Go to the documentation of this file.
1 #ifndef _UTIL_H_
2 #define _UTIL_H_
3
5 namespace javascript {
7
15 class util : public CFXJS_EmbedObj
16 {
17 public:
18 util(CFXJS_Object* pJSObject);
19 virtual ~util(void);
20
21 public:
22
89 FX_BOOL printd(OBJ_METHOD_PARAMS);
90
123 FX_BOOL printf(OBJ_METHOD_PARAMS);
124
143 FX_BOOL printx(OBJ_METHOD_PARAMS);
144
181 FX_BOOL scand(OBJ_METHOD_PARAMS);
182 FX_BOOL fixOldString(OBJ_METHOD_PARAMS);
183
208 FX_BOOL iconStreamFromIcon(OBJ_METHOD_PARAMS);
209
210 public:
211 // static void printd(const std::wstring &cFormat,CJS_Date Date,bool bXFAPicture,
212 // std::wstring &cPurpose);
213 static void
214 printx(const std::string& cFormat, const std::string& cSource, std::string& cPurpose);
215 static int ParstDataType(FX_LPCWSTR sFormat);
216 static void getTimeOffset(CFXJS_Runtime* pRuntime, FXJSE_HVALUE hValue, double& nOffset);
217
218 private:
219 // CFX_WideString GetJapaneseEras(int nYear, int nMonth, int nDay);
220 };
221
222 class CFXJS_Util : public CFXJS_Object
223 {
224 public:
225 CFXJS_Util(CFXJS_Runtime* pRuntime)
226 : CFXJS_Object(pRuntime){};
227 virtual ~CFXJS_Util(void){};
228
229 DECLARE_JS_CLASS(CFXJS_Util);
230
231 JS_STATIC_METHOD(printd, util);
232 JS_STATIC_METHOD(printf, util);
233 JS_STATIC_METHOD(printx, util);
234 JS_STATIC_METHOD(scand, util);
235 JS_STATIC_METHOD(fixOldString, util);
236 JS_STATIC_METHOD(iconStreamFromIcon, util);
237 };
238 } // namespace javascript
239 #endif //_UTIL_H_
util
A static JavaScript object that defines a number of utility methods and convenience functions for str...
Definition: util.h:15


Javascript API: Member List

OCG Member List

This is the complete list of members for OCG, including all inherited members.

initState(OBJ_PROP_PARAMS) | OCG
locked(OBJ_PROP_PARAMS) | OCG
name(OBJ_PROP_PARAMS) | OCG
setAction(OBJ_METHOD_PARAMS) | OCG
state(OBJ_PROP_PARAMS) | OCG


Javascript API: Member List

Annotation Member List

This is the complete list of members for Annotation, including all inherited members.

alignment(OBJ_PROP_PARAMS) | Annotation
AP(OBJ_PROP_PARAMS) | Annotation
arrowBegin(OBJ_PROP_PARAMS) | Annotation
arrowEnd(OBJ_PROP_PARAMS) | Annotation
attachIcon(OBJ_PROP_PARAMS) | Annotation
author(OBJ_PROP_PARAMS) | Annotation
borderEffectIntensity(OBJ_PROP_PARAMS) | Annotation
borderEffectStyle(OBJ_PROP_PARAMS) | Annotation
callout(OBJ_PROP_PARAMS) | Annotation
caretSymbol(OBJ_PROP_PARAMS) | Annotation
contents(OBJ_PROP_PARAMS) | Annotation
creationDate(OBJ_PROP_PARAMS) | Annotation
dash(OBJ_PROP_PARAMS) | Annotation
delay(OBJ_PROP_PARAMS) | Annotation
destroy(OBJ_METHOD_PARAMS) | Annotation
doc(OBJ_PROP_PARAMS) | Annotation
doCaption(OBJ_PROP_PARAMS) | Annotation
fillColor(OBJ_PROP_PARAMS) | Annotation
gestures(OBJ_PROP_PARAMS) | Annotation
hidden(OBJ_PROP_PARAMS) | Annotation
inReplyTo(OBJ_PROP_PARAMS) | Annotation
intent(OBJ_PROP_PARAMS) | Annotation
leaderExtend(OBJ_PROP_PARAMS) | Annotation
leaderLength(OBJ_PROP_PARAMS) | Annotation
lineEnding(OBJ_PROP_PARAMS) | Annotation
lock(OBJ_PROP_PARAMS) | Annotation
modDate(OBJ_PROP_PARAMS) | Annotation
name(OBJ_PROP_PARAMS) | Annotation
noteIcon(OBJ_PROP_PARAMS) | Annotation
noView(OBJ_PROP_PARAMS) | Annotation
opacity(OBJ_PROP_PARAMS) | Annotation
page(OBJ_PROP_PARAMS) | Annotation
point(OBJ_PROP_PARAMS) | Annotation
points(OBJ_PROP_PARAMS) | Annotation
popupOpen(OBJ_PROP_PARAMS) | Annotation
popupRect(OBJ_PROP_PARAMS) | Annotation
print(OBJ_PROP_PARAMS) | Annotation
quads(OBJ_PROP_PARAMS) | Annotation
readOnly(OBJ_PROP_PARAMS) | Annotation
rect(OBJ_PROP_PARAMS) | Annotation
refType(OBJ_PROP_PARAMS) | Annotation
soundIcon(OBJ_PROP_PARAMS) | Annotation
strokeColor(OBJ_PROP_PARAMS) | Annotation
style(OBJ_PROP_PARAMS) | Annotation
subject(OBJ_PROP_PARAMS) | Annotation
textFont(OBJ_PROP_PARAMS) | Annotation
textSize(OBJ_PROP_PARAMS) | Annotation
toggleNoView(OBJ_PROP_PARAMS) | Annotation
type(OBJ_PROP_PARAMS) | Annotation
vertices(OBJ_PROP_PARAMS) | Annotation
width(OBJ_PROP_PARAMS) | Annotation


Javascript API: search.h Source File

  • src
  • javascript
  • inc
search.h
Go to the documentation of this file.
1 #ifndef SEARCH_H_
2 #define SEARCH_H_
3
5 namespace javascript {
7
17 class Index : public CFXJS_EmbedObj
18 {
19 public:
20 Index(CFXJS_Object* pJSObject);
21 virtual ~Index(void);
34 FX_BOOL available(OBJ_PROP_PARAMS);
54 FX_BOOL name(OBJ_PROP_PARAMS);
66 FX_BOOL path(OBJ_PROP_PARAMS);
79 FX_BOOL selected(OBJ_PROP_PARAMS);
80
81 public:
82 bool m_bAvailable;
83 bool m_bSelected;
84 CFX_WideString m_csName;
85 CFX_WideString m_csPath;
86 };
87
88 class CFXJS_Index : public CFXJS_Object
89 {
90 public:
91 CFXJS_Index(CFXJS_Runtime* pRuntime)
92 : CFXJS_Object(pRuntime){};
93 virtual ~CFXJS_Index(void){};
94
95 DECLARE_JS_CLASS(CFXJS_Index)
96
97 JS_STATIC_PROP(available, Index)
98 JS_STATIC_PROP(name, Index)
99 JS_STATIC_PROP(path, Index)
100 JS_STATIC_PROP(selected, Index)
101 };
102
104
115 class search : public CFXJS_EmbedObj
116 {
117 public:
118 search(CFXJS_Object* pJSObject);
119 virtual ~search(void);
132 FX_BOOL matchWholeWord(OBJ_PROP_PARAMS);
145 FX_BOOL attachments(OBJ_PROP_PARAMS);
155 FX_BOOL bookmarks(OBJ_PROP_PARAMS);
165 FX_BOOL docText(OBJ_PROP_PARAMS);
176 FX_BOOL ignoreAccents(OBJ_PROP_PARAMS);
187 FX_BOOL markup(OBJ_PROP_PARAMS);
197 FX_BOOL matchCase(OBJ_PROP_PARAMS);
208 FX_BOOL maxDocs(OBJ_PROP_PARAMS);
221 FX_BOOL proximity(OBJ_PROP_PARAMS);
222 FX_BOOL refine(OBJ_PROP_PARAMS);
235 FX_BOOL stem(OBJ_PROP_PARAMS);
248 FX_BOOL wordMatching(OBJ_PROP_PARAMS);
259 FX_BOOL ignoreAsianCharacterWidth(OBJ_PROP_PARAMS);
279 FX_BOOL query(OBJ_METHOD_PARAMS);
297 FX_BOOL addIndex(OBJ_METHOD_PARAMS);
305 FX_BOOL removeIndex(OBJ_METHOD_PARAMS);
306
307 private:
308 FX_SearchOption m_searchOpt;
309 };
310
311 class CFXJS_Search : public CFXJS_Object
312 {
313 public:
314 CFXJS_Search(CFXJS_Runtime* pRuntime)
315 : CFXJS_Object(pRuntime){};
316 virtual ~CFXJS_Search(void){};
317
318 DECLARE_JS_CLASS(CFXJS_Search);
319 JS_STATIC_PROP(matchWholeWord, search);
320 JS_STATIC_PROP(attachments, search);
321 JS_STATIC_PROP(bookmarks, search);
322 JS_STATIC_PROP(docText, search);
323 JS_STATIC_PROP(ignoreAccents, search);
324 JS_STATIC_PROP(markup, search);
325 JS_STATIC_PROP(matchCase, search);
326 JS_STATIC_PROP(maxDocs, search);
327 JS_STATIC_PROP(proximity, search);
328 JS_STATIC_PROP(refine, search);
329 JS_STATIC_PROP(stem, search);
330 JS_STATIC_PROP(wordMatching, search);
331 JS_STATIC_PROP(ignoreAsianCharacterWidth, search)
332
333 JS_STATIC_METHOD(query, search);
334 JS_STATIC_METHOD(addIndex, search);
335 JS_STATIC_METHOD(removeIndex, search);
336 };
337 } // namespace javascript
338
339 #endif // SEARCH_H_
search
The search object is a static object that accesses the functionality provided by the Foxit PDF Editor...
Definition: search.h:115
Index
An object that represents a Catalog-generated index. It is non-creatable and returned by various meth...
Definition: search.h:17


Javascript API: Member List

MediaPlayer Member List

This is the complete list of members for MediaPlayer, including all inherited members.

close(OBJ_METHOD_PARAMS) | MediaPlayer
isOpen(OBJ_PROP_PARAMS) | MediaPlayer
open(OBJ_METHOD_PARAMS) | MediaPlayer
play(OBJ_METHOD_PARAMS) | MediaPlayer
seek(OBJ_METHOD_PARAMS) | MediaPlayer
settings(OBJ_PROP_PARAMS) | MediaPlayer
stop(OBJ_METHOD_PARAMS) | MediaPlayer
visible(OBJ_PROP_PARAMS) | MediaPlayer


Javascript API: Member List

event Member List

This is the complete list of members for event, including all inherited members.

change(OBJ_PROP_PARAMS) | event
changeEx(OBJ_PROP_PARAMS) | event
commitKey(OBJ_PROP_PARAMS) | event
fieldFull(OBJ_PROP_PARAMS) | event
keyDown(OBJ_PROP_PARAMS) | event
modifier(OBJ_PROP_PARAMS) | event
name(OBJ_PROP_PARAMS) | event
rc(OBJ_PROP_PARAMS) | event
richChange(OBJ_PROP_PARAMS) | event
richChangeEx(OBJ_PROP_PARAMS) | event
richValue(OBJ_PROP_PARAMS) | event
selEnd(OBJ_PROP_PARAMS) | event
selStart(OBJ_PROP_PARAMS) | event
shift(OBJ_PROP_PARAMS) | event
source(OBJ_PROP_PARAMS) | event
target(OBJ_PROP_PARAMS) | event
targetName(OBJ_PROP_PARAMS) | event
type(OBJ_PROP_PARAMS) | event
value(OBJ_PROP_PARAMS) | event
willCommit(OBJ_PROP_PARAMS) | event


Javascript API: color.h Source File

  • src
  • javascript
  • inc
color.h
Go to the documentation of this file.
1 #ifndef _COLOR_H_
2 #define _COLOR_H_
3 #include "fxge/fx_color.h"
4
6 namespace javascript {
8
46 class color : public CFXJS_EmbedObj
47 {
48 public:
49 color(CFXJS_Object* pJSObject);
50 virtual ~color(void);
51
52 FX_BOOL black(OBJ_PROP_PARAMS);
53 FX_BOOL blue(OBJ_PROP_PARAMS);
54 FX_BOOL cyan(OBJ_PROP_PARAMS);
55 FX_BOOL dkGray(OBJ_PROP_PARAMS);
56 FX_BOOL gray(OBJ_PROP_PARAMS);
57 FX_BOOL green(OBJ_PROP_PARAMS);
58 FX_BOOL ltGray(OBJ_PROP_PARAMS);
59 FX_BOOL magenta(OBJ_PROP_PARAMS);
60 FX_BOOL red(OBJ_PROP_PARAMS);
61 FX_BOOL transparent(OBJ_PROP_PARAMS);
62 FX_BOOL white(OBJ_PROP_PARAMS);
63 FX_BOOL yellow(OBJ_PROP_PARAMS);
64
65
82 FX_BOOL convert(OBJ_METHOD_PARAMS);
83
101 FX_BOOL equal(OBJ_METHOD_PARAMS);
102
103 public:
104 static void ConvertPWLColorToArray(const CFX_ColorF& color, FXJSE_HVALUE hValue);
105 static bool ConvertArrayToPWLColor(FXJSE_HVALUE hValue, CFX_ColorF& color);
106
107 private:
108 CFX_ColorF m_crTransparent;
109 CFX_ColorF m_crBlack;
110 CFX_ColorF m_crWhite;
111 CFX_ColorF m_crRed;
112 CFX_ColorF m_crGreen;
113 CFX_ColorF m_crBlue;
114 CFX_ColorF m_crCyan;
115 CFX_ColorF m_crMagenta;
116 CFX_ColorF m_crYellow;
117 CFX_ColorF m_crDKGray;
118 CFX_ColorF m_crGray;
119 CFX_ColorF m_crLTGray;
120 };
121
122 class CFXJS_Color : public CFXJS_Object
123 {
124 public:
125 CFXJS_Color(CFXJS_Runtime* pRuntime)
126 : CFXJS_Object(pRuntime){};
127 virtual ~CFXJS_Color(void){};
128
129 DECLARE_JS_CLASS(CFXJS_Color);
130
131 JS_STATIC_PROP(black, color);
132 JS_STATIC_PROP(blue, color);
133 JS_STATIC_PROP(cyan, color);
134 JS_STATIC_PROP(dkGray, color);
135 JS_STATIC_PROP(gray, color);
136 JS_STATIC_PROP(green, color);
137 JS_STATIC_PROP(ltGray, color);
138 JS_STATIC_PROP(magenta, color);
139 JS_STATIC_PROP(red, color);
140 JS_STATIC_PROP(transparent, color);
141 JS_STATIC_PROP(white, color);
142 JS_STATIC_PROP(yellow, color);
143
144 JS_STATIC_METHOD(convert, color);
145 JS_STATIC_METHOD(equal, color);
146 };
147
148 // inline FX_BOOL operator == (const CFX_ColorF &c1, const CFX_ColorF &c2)
149 // {
150 // return c1.nColorType == c2.nColorType &&
151 // c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 &&
152 // c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0.0001 &&
153 // c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0.0001 &&
154 // c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
155 // }
156 } // namespace javascript
157
158 #endif //_COLOR_H_
color
The color object is a convenience static object that defines the basic colors. Use this object to set...
Definition: color.h:46


Javascript API: Member List

ReadStream Member List

This is the complete list of members for ReadStream, including all inherited members.


Javascript API: Member List

color Member List

This is the complete list of members for color, including all inherited members.

convert(OBJ_METHOD_PARAMS) | color
equal(OBJ_METHOD_PARAMS) | color


Javascript API: Member List

Link Member List

This is the complete list of members for Link, including all inherited members.

borderColor(OBJ_PROP_PARAMS) | Link
borderWidth(OBJ_PROP_PARAMS) | Link
highlightMode(OBJ_PROP_PARAMS) | Link
rect(OBJ_PROP_PARAMS) | Link
setAction(OBJ_METHOD_PARAMS) | Link


Javascript API: Member List

Template Member List

This is the complete list of members for Template, including all inherited members.

hidden(OBJ_PROP_PARAMS) | Template
name(OBJ_PROP_PARAMS) | Template
spawn(OBJ_METHOD_PARAMS) | Template


Javascript API: document.h Source File

  • src
  • javascript
  • inc
document.h
Go to the documentation of this file.
1 #ifndef _DOCUMENT_H_
2 #define _DOCUMENT_H_
3
4 #include "annotation.h"
5 // class CFX_Annot;
6 class CPDF_Page;
7 class CPDF_Document;
9
10 namespace javascript {
11 class Doc;
12 class CFXJS_Icon;
13 struct CFXJS_AnnotObj;
14 // class BasicEventInfo;
15 class JField;
16 struct print_Range;
17 //#ifdef BUILD_PHANTOM
18 struct JS_WatemarkElementInfo;
19 //#endif
20 struct CFXJS_DelayData;
21
22 struct TemplateElement
23 {
24 TemplateElement()
25 : csName("")
26 , hValue(NULL)
27 {
28 }
29 ~TemplateElement()
30 {
31 if (hValue)
32 FXJSE_Value_Release(hValue);
33 }
34 CFX_ByteString csName;
35 FXJSE_HVALUE hValue;
36 };
37 struct IconElement
38 {
39 IconElement()
40 : IconName(L"")
41 , IconStream(NULL)
42 , NextIcon(NULL)
43 {
44 }
45 virtual ~IconElement() {}
46 CFX_WideString IconName;
47 IconElement* NextIcon;
48 CFXJS_Icon* IconStream;
49 };
50
51 class JIconTree
52 {
53 public:
54 JIconTree()
55 : m_pHead(NULL)
56 , m_pEnd(NULL)
57 , m_iLength(0)
58 {
59 }
60
61 virtual ~JIconTree() {}
62
63 public:
64 void InsertIconElement(IconElement* pNewIcon);
65 void DeleteIconElement(CFX_WideString swIconName);
66 void DeleteIconTree();
67 int GetLength();
68 IconElement* operator[](int iIndex);
69
70 private:
71 IconElement* m_pHead;
72 IconElement* m_pEnd;
73 int m_iLength;
74 };
75
76 typedef struct _JS_BulbMessageInfo
77 {
78 CFX_ByteString name;
79 CFX_WideString message;
80 CFX_WideString title;
81 void* pPriData;
82 int opBtnCount;
83 CFX_ArrayTemplate<CFX_ByteString> arOpBtnName;
84 CFX_ArrayTemplate<CFX_WideString> arOpBtnTitle;
85 // FXJSE_HVALUE hCallbackFunc;
86 // std::vector<std::unique_ptr<BasicEventInfo> > arCallbackFunc;
87 CFXJS_Runtime* pRuntime;
88 Doc* pJSDoc;
89 _JS_BulbMessageInfo()
90 {
91 name = "";
92 message = L"";
93 title = L"";
94 pPriData = NULL;
95 opBtnCount = 0;
96 pRuntime = NULL;
97 pJSDoc = NULL;
98 }
99 } JS_BULBMESSAGEINFO, *JS_PBULBMESSAGEINFO;
100
101 class Info : public CFXJS_EmbedObj
102 {
103 public:
104 Info(CFXJS_Object* pJSObject);
105 virtual ~Info();
106 FX_BOOL Title(OBJ_PROP_PARAMS);
107 FX_BOOL Author(OBJ_PROP_PARAMS);
108 FX_BOOL Subject(OBJ_PROP_PARAMS);
109 FX_BOOL Keywords(OBJ_PROP_PARAMS);
110 FX_BOOL Creator(OBJ_PROP_PARAMS);
111 FX_BOOL Producer(OBJ_PROP_PARAMS);
112 FX_BOOL CreationDate(OBJ_PROP_PARAMS);
113 FX_BOOL ModDate(OBJ_PROP_PARAMS);
114 FX_BOOL Trapped(OBJ_PROP_PARAMS);
115 void AttachDoc(IFXJS_DocumentProvider* pDocument);
116
117 private:
118 FX_BOOL DealWithInfoObject(FXJSE_HVALUE hValue, FX_BOOL IsSet, FX_BSTR csName);
119
120 IFXJS_DocumentProvider* m_pDocument;
121 };
122 class CFXJS_DocInfoList : public CFXJS_Object
123 {
124 public:
125 CFXJS_DocInfoList(CFXJS_Runtime* pRuntime)
126 : CFXJS_Object(pRuntime){};
127 virtual ~CFXJS_DocInfoList(){};
128
129 public:
130 DECLARE_JS_CLASS(CFXJS_DocInfoList);
131 JS_STATIC_PROP(Title, Info);
132 JS_STATIC_PROP(Author, Info);
133 JS_STATIC_PROP(Subject, Info);
134 JS_STATIC_PROP(Keywords, Info);
135 JS_STATIC_PROP(Creator, Info);
136 JS_STATIC_PROP(Producer, Info);
137 JS_STATIC_PROP(CreationDate, Info);
138 JS_STATIC_PROP(ModDate, Info);
139 JS_STATIC_PROP(Trapped, Info);
140 };
141 // struct CJS_DelayData;
142 // struct CJS_DelayAnnot;
143 // struct CJS_AnnotObj;
144
145 struct CJS_FIELD
146 {
147 enum EXPORT_TYPE
148 {
149 FDF = 0,
150 TXT,
151 XFDF,
152 XFDFSTR
153 };
154
155 FX_BOOL bAllField = false;
156 FX_BOOL bNoPassWord = true;
157 CFX_PtrArray aFields;
158 FX_BOOL bFlags = false;
159
160 CFX_WideString cPath = L"";
161 FX_BOOL bAnnotations = false;
162 EXPORT_TYPE type;
163
164 CFX_WideString cHRef = L"";
165 CFX_ByteString csXFDFStr = "";
166 };
167 struct InfoWord
168 {
169 InfoWord()
170 {
171 wsWord = L"";
172 nStart = 0;
173 nEnd = 0;
174 nCount = 0;
175 }
176 int nStart;
177 int nEnd;
178 int nCount;
179 CFX_WideString wsWord;
180 };
181 #define DURATION_INIT -10
182 struct TransDict
183 {
184 CFX_ByteString csM = "I"; // Split, Box and Fly transition styles only
185 CFX_ByteString csDm = ""; // Split and Blinds transition styles only
186 int nDi = 0; // Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only
187 int nDuration = DURATION_INIT;
188 CFX_ByteString csTransition = "";
189 int nTransDuration = -1;
190 };
192
198 class IFXJS_DialogProvider;
199 class IFXJS_FileAttachmentProvider;
200 class IFXJS_PrintMgrProvider;
205 class Doc : public Root
206 {
207 public:
208 Doc(CFXJS_Object* pJSObject);
209 virtual ~Doc();
210
211 public:
212 FX_BOOL ADBE(OBJ_PROP_PARAMS);
231 FX_BOOL author(OBJ_PROP_PARAMS);
251 FX_BOOL baseURL(OBJ_PROP_PARAMS);
252
279 FX_BOOL bookmarkRoot(OBJ_PROP_PARAMS);
280
301 FX_BOOL calculate(OBJ_PROP_PARAMS);
302
303 FX_BOOL Collab(OBJ_PROP_PARAMS);
304
319 FX_BOOL creationDate(OBJ_PROP_PARAMS);
320
339 FX_BOOL creator(OBJ_PROP_PARAMS);
340
363 FX_BOOL delay(OBJ_PROP_PARAMS);
364
393 FX_BOOL dirty(OBJ_PROP_PARAMS);
394
413 FX_BOOL documentFileName(OBJ_PROP_PARAMS);
414
438 FX_BOOL external(OBJ_PROP_PARAMS);
439
454 FX_BOOL filesize(OBJ_PROP_PARAMS);
455
487 FX_BOOL icons(OBJ_PROP_PARAMS);
488
521 FX_BOOL info(OBJ_PROP_PARAMS);
522
541 FX_BOOL keywords(OBJ_PROP_PARAMS);
542
564 FX_BOOL layout(OBJ_PROP_PARAMS);
565
584 FX_BOOL media(OBJ_PROP_PARAMS);
585
600 FX_BOOL modDate(OBJ_PROP_PARAMS);
601
621 FX_BOOL mouseX(OBJ_PROP_PARAMS);
622
634 FX_BOOL mouseY(OBJ_PROP_PARAMS);
635
650 FX_BOOL numFields(OBJ_PROP_PARAMS);
651
672 FX_BOOL numPages(OBJ_PROP_PARAMS);
673
692 FX_BOOL pageNum(OBJ_PROP_PARAMS);
693
709 FX_BOOL pageWindowRect(OBJ_PROP_PARAMS);
710
726 FX_BOOL path(OBJ_PROP_PARAMS);
727
746 FX_BOOL producer(OBJ_PROP_PARAMS);
747
767 FX_BOOL securityHandler(OBJ_PROP_PARAMS);
768
788 FX_BOOL subject(OBJ_PROP_PARAMS);
789
808 FX_BOOL title(OBJ_PROP_PARAMS);
809
828 FX_BOOL zoom(OBJ_PROP_PARAMS);
829
857 FX_BOOL zoomType(OBJ_PROP_PARAMS);
858
876 FX_BOOL dynamicXFAForm(OBJ_PROP_PARAMS);
877
889 FX_BOOL URL(OBJ_PROP_PARAMS);
890
910 FX_BOOL dataObjects(OBJ_PROP_PARAMS);
911
923 FX_BOOL hostContainer(OBJ_PROP_PARAMS);
924
960 FX_BOOL xfa(OBJ_PROP_PARAMS);
961
984 FX_BOOL templates(OBJ_PROP_PARAMS);
985
986
1004 FX_BOOL page(OBJ_PROP_PARAMS);
1005 FX_BOOL guid(OBJ_PROP_PARAMS);
1006 FX_BOOL isInProtectedViewMode(OBJ_PROP_PARAMS);
1007 FX_BOOL ANSB_None(OBJ_PROP_PARAMS);
1008 FX_BOOL ANSB_Page(OBJ_PROP_PARAMS);
1009 FX_BOOL ANSB_Seq(OBJ_PROP_PARAMS);
1010 FX_BOOL ANSB_Author(OBJ_PROP_PARAMS);
1011 FX_BOOL ANSB_ModDate(OBJ_PROP_PARAMS);
1012 FX_BOOL ANSB_Type(OBJ_PROP_PARAMS);
1013 FX_BOOL ANSB_Subject(OBJ_PROP_PARAMS);
1014 FX_BOOL ANFB_ShouldNone(OBJ_PROP_PARAMS);
1015 FX_BOOL ANFB_ShouldPrint(OBJ_PROP_PARAMS);
1016 FX_BOOL ANFB_ShouldView(OBJ_PROP_PARAMS);
1017 FX_BOOL ANFB_ShouldEdit(OBJ_PROP_PARAMS);
1018 FX_BOOL ANFB_ShouldAppearInPanel(OBJ_PROP_PARAMS);
1019 FX_BOOL ANFB_ShouldSummarize(OBJ_PROP_PARAMS);
1020 FX_BOOL ANFB_ShouldExport(OBJ_PROP_PARAMS);
1021 FX_BOOL ANFB_ShouldCollaborate(OBJ_PROP_PARAMS);
1022
1063 FX_BOOL addAnnot(OBJ_METHOD_PARAMS);
1100 FX_BOOL addField(OBJ_METHOD_PARAMS);
1135 FX_BOOL addLink(OBJ_METHOD_PARAMS);
1152 FX_BOOL addIcon(OBJ_METHOD_PARAMS);
1165 FX_BOOL calculateNow(OBJ_METHOD_PARAMS);
1184 FX_BOOL closeDoc(OBJ_METHOD_PARAMS);
1185 FX_BOOL createDataObject(OBJ_METHOD_PARAMS);
1186 FX_BOOL createIcon(OBJ_METHOD_PARAMS);
1208 FX_BOOL createTemplate(OBJ_METHOD_PARAMS);
1226 FX_BOOL deletePages(OBJ_METHOD_PARAMS);
1248 FX_BOOL exportAsText(OBJ_METHOD_PARAMS);
1271 FX_BOOL exportAsFDF(OBJ_METHOD_PARAMS);
1289 FX_BOOL exportAsXFDF(OBJ_METHOD_PARAMS);
1309 FX_BOOL exportAsXFDFStr(OBJ_METHOD_PARAMS);
1310
1311 FX_BOOL exportXFAData(OBJ_METHOD_PARAMS);
1332 FX_BOOL extractPages(OBJ_METHOD_PARAMS);
1353 FX_BOOL exportDataObject(OBJ_METHOD_PARAMS);
1373 FX_BOOL getAnnot(OBJ_METHOD_PARAMS);
1400 FX_BOOL getAnnots(OBJ_METHOD_PARAMS);
1401 FX_BOOL getAnnot3D(OBJ_METHOD_PARAMS);
1402 FX_BOOL getAnnots3D(OBJ_METHOD_PARAMS);
1441 FX_BOOL getField(OBJ_METHOD_PARAMS);
1442
1463 FX_BOOL getIcon(OBJ_METHOD_PARAMS);
1464
1491 FX_BOOL getLinks(OBJ_METHOD_PARAMS);
1509 FX_BOOL getNthFieldName(OBJ_METHOD_PARAMS);
1527 FX_BOOL getOCGs(OBJ_METHOD_PARAMS);
1546 FX_BOOL getPageBox(OBJ_METHOD_PARAMS);
1565 FX_BOOL getPageNthWord(OBJ_METHOD_PARAMS);
1566
1591 FX_BOOL getPageNthWordQuads(OBJ_METHOD_PARAMS);
1592
1609 FX_BOOL getPageNumWords(OBJ_METHOD_PARAMS);
1627 FX_BOOL getPageRotation(OBJ_METHOD_PARAMS);
1640 FX_BOOL getPrintParams(OBJ_METHOD_PARAMS);
1654 FX_BOOL getURL(OBJ_METHOD_PARAMS);
1672 FX_BOOL getDataObject(OBJ_METHOD_PARAMS);
1691 FX_BOOL getTemplate(OBJ_METHOD_PARAMS);
1712 FX_BOOL gotoNamedDest(OBJ_METHOD_PARAMS);
1727 FX_BOOL importAnFDF(OBJ_METHOD_PARAMS);
1742 FX_BOOL importAnXFDF(OBJ_METHOD_PARAMS);
1762 FX_BOOL importDataObject(OBJ_METHOD_PARAMS);
1797 FX_BOOL importTextData(OBJ_METHOD_PARAMS);
1798
1799 FX_BOOL importXFAData(OBJ_METHOD_PARAMS);
1825 FX_BOOL insertPages(OBJ_METHOD_PARAMS);
1854 FX_BOOL mailForm(OBJ_METHOD_PARAMS);
1888 FX_BOOL print(OBJ_METHOD_PARAMS);
1906 FX_BOOL removeField(OBJ_METHOD_PARAMS);
1928 FX_BOOL removeDataObject(OBJ_METHOD_PARAMS);
1929 FX_BOOL embedDocAsDataObject(OBJ_METHOD_PARAMS);
1943 FX_BOOL removeTemplate(OBJ_METHOD_PARAMS);
1962 FX_BOOL replacePages(OBJ_METHOD_PARAMS);
1993 FX_BOOL resetForm(OBJ_METHOD_PARAMS);
1994
1995 FX_BOOL saveAs(OBJ_METHOD_PARAMS);
2037 FX_BOOL submitForm(OBJ_METHOD_PARAMS);
2071 FX_BOOL mailDoc(OBJ_METHOD_PARAMS);
2072
2089 FX_BOOL removeIcon(OBJ_METHOD_PARAMS);
2090
2125 FX_BOOL spawnPageFromTemplate(OBJ_METHOD_PARAMS);
2144 FX_BOOL scroll(OBJ_METHOD_PARAMS);
2167 FX_BOOL syncAnnotScan(OBJ_METHOD_PARAMS);
2168
2169 // FX_BOOL createBulbmessage(OBJ_METHOD_PARAMS);
2170 // FX_BOOL showBulbmessage(OBJ_METHOD_PARAMS);
2171 FX_BOOL addPageOpenJSMessage(OBJ_METHOD_PARAMS);
2172 FX_BOOL showBalloon(OBJ_METHOD_PARAMS);
2173 FX_BOOL hideBalloon(OBJ_METHOD_PARAMS);
2174 FX_BOOL getDocId(OBJ_METHOD_PARAMS);
2175 FX_BOOL getVersionID(OBJ_METHOD_PARAMS);
2176 FX_BOOL isCpdf(OBJ_METHOD_PARAMS);
2177 FX_BOOL getPageCount(OBJ_METHOD_PARAMS);
2178 FX_BOOL getCurPageIndex(OBJ_METHOD_PARAMS);
2179 FX_BOOL convertTocPDF(OBJ_METHOD_PARAMS);
2180 FX_BOOL saveAsNewcPDF(OBJ_METHOD_PARAMS);
2181 // FX_BOOL getDigestId(OBJ_METHOD_PARAMS);
2182 FX_BOOL getSize(OBJ_METHOD_PARAMS);
2183 FX_BOOL readBuf(OBJ_METHOD_PARAMS);
2184 FX_BOOL importAnnotFromXFDF(OBJ_METHOD_PARAMS);
2185 FX_BOOL exportAnonymousAnnot(OBJ_METHOD_PARAMS);
2186 FX_BOOL exportAllAnnots(OBJ_METHOD_PARAMS);
2187 FX_BOOL deleteAnnot(OBJ_METHOD_PARAMS);
2188 FX_BOOL goToAnnot(OBJ_METHOD_PARAMS);
2189 FX_BOOL saveOfflineCopy(OBJ_METHOD_PARAMS);
2190 FX_BOOL getEncryptionMethod(OBJ_METHOD_PARAMS);
2191 FX_BOOL getURI(OBJ_METHOD_PARAMS);
2192 FX_BOOL getPageObjNum(OBJ_METHOD_PARAMS);
2193 FX_BOOL getPageIndexByPageObjNum(OBJ_METHOD_PARAMS);
2194 FX_BOOL isForm(OBJ_METHOD_PARAMS);
2195 FX_BOOL setReviewType(OBJ_METHOD_PARAMS);
2196
2197 FX_BOOL activePin(OBJ_METHOD_PARAMS);
2198 FX_BOOL deletePin(OBJ_METHOD_PARAMS);
2199 FX_BOOL createPin(OBJ_METHOD_PARAMS);
2200 FX_BOOL hoverPin(OBJ_METHOD_PARAMS);
2201
2202 FX_BOOL updateACL(OBJ_METHOD_PARAMS);
2203 FX_BOOL addAdLayer(OBJ_METHOD_PARAMS);
2204 FX_BOOL gotoPage(OBJ_METHOD_PARAMS);
2225 FX_BOOL setPageTabOrder(OBJ_METHOD_PARAMS);
2226
2227 //#ifdef BUILD_PHANTOM
2228
2276 FX_BOOL addWatermarkFromText(OBJ_METHOD_PARAMS);
2326 FX_BOOL addWatermarkFromFile(OBJ_METHOD_PARAMS);
2327 //#endif
2349 FX_BOOL flattenPages(OBJ_METHOD_PARAMS);
2370 FX_BOOL setPageTransitions(OBJ_METHOD_PARAMS);
2389 FX_BOOL getPageTransition(OBJ_METHOD_PARAMS);
2390
2391 FX_BOOL selectPageNthWord(OBJ_METHOD_PARAMS);
2392
2393 FX_BOOL importIcon(OBJ_METHOD_PARAMS);
2410 FX_BOOL movePage(OBJ_METHOD_PARAMS);
2411
2431 FX_BOOL newPage(OBJ_METHOD_PARAMS);
2432
2450 FX_BOOL setPageRotations(OBJ_METHOD_PARAMS);
2471 FX_BOOL setPageBoxes(OBJ_METHOD_PARAMS);
2488
2493 FX_BOOL addWeblinks(OBJ_METHOD_PARAMS);
2494
2515 FX_BOOL removeWeblinks(OBJ_METHOD_PARAMS);
2516
2540 FX_BOOL removeLinks(OBJ_METHOD_PARAMS);
2541
2557 FX_BOOL getOCGOrder(OBJ_METHOD_PARAMS);
2578 FX_BOOL setOCGOrder(OBJ_METHOD_PARAMS);
2579
2580 FX_BOOL setPageLabels(OBJ_METHOD_PARAMS);
2581 FX_BOOL getPageLabel(OBJ_METHOD_PARAMS);
2582 FXJSE_HRUNTIME GetHRunTime();
2583
2584 public:
2585 void AttachDoc(IFXJS_DocumentProvider* pDoc);
2586 IFXJS_DocumentProvider* GetReaderDoc();
2587 void AttachDialog(IFXJS_DialogProvider* pDialog);
2588 void AttachFileAttachment(IFXJS_FileAttachmentProvider* pFileAttachment);
2589
2590 static FX_BOOL ExtractFileName(IFXJS_DocumentProvider* pDoc, CFX_ByteString& strFileName);
2591 static FX_BOOL ExtractFolderName(IFXJS_DocumentProvider* pDoc, CFX_ByteString& strFolderName);
2592
2593 public:
2594 CFXJS_DelayData* AddDelayData(CFX_WideString field_name, int control_index, FIELD_PROP prop);
2595 void DoFieldDelay(const CFX_WideString& sFieldName, JS_ErrorString& sError, int nControlIndex);
2596
2597 CFXJS_AnnotObj*
2598 AddDelayAnnotData(IFXJS_AnnotProvider* annot, ANNOT_TYPE annot_type, CFX_WideString name);
2599 void DoAnnotDelay(CFX_WideString cwNM);
2600
2601 CPDF_Document* GetDocument();
2602 FXJSE_HRUNTIME m_hRuntime;
2603 // annot
2604 FXJSE_HVALUE GetAnnotHValueByGUID(CFX_ByteString bsGUID);
2605 FXJSE_HVALUE GetAnnotHValue(IFXJS_AnnotProvider* pAnnot);
2606 void DeleteAnnotHValue(FX_INT32 nPageIndex, CFX_WideString wsAnnotName);
2607 Annotation* GetJSAnnotByReaderAnnot(IFXJS_AnnotProvider* pAnnot);
2608 CFX_RectArray& GetRcWordquads()
2609 {
2610 return m_rcWordquads;
2611 }
2612 void OnConvertToCPDF();
2613 void OnSaveAsNewCPDF(const CFX_WideString& wsNewName);
2614 void OnExportAnnots(FX_BOOL bAnnoymous);
2615 static FX_BOOL CallbackExportAnnots(CFX_Object* JsDoc, FX_BOOL bAnnoy);
2616 static FX_BOOL CallbackConvertToCPDFMessasge(CFX_Object* JsDoc);
2617 static FX_BOOL CallbackSaveAsNewCPDFMessasge(CFX_Object* JsDoc, CFX_WideString NewName);
2618
2619 public: // print
2620 FX_BOOL IsShowPrintWaring();
2621 FX_BOOL PrintByJSPrintParams(CFXJSE_Arguments& args);
2622 FX_BOOL PrintByJSPrintParams(CFXJS_EmbedObj* pEmbedObj,
2623 FXJSE_HVALUE hFristValue,
2624 FXJSE_HVALUE hProp);
2625 FX_BOOL PrintByJSPrintParams(FXJSE_HVALUE hFristValue);
2626
2627 void SetJSPrintMode(IFXJS_PrintMgrProvider* pPrintMgr,
2628 FXJSE_HVALUE hFristValue,
2629 FXJSE_HVALUE hProp,
2630 FX_INT32 interactive);
2631 void SetJSPrintRange(IFXJS_PrintMgrProvider* pPrintMgr,
2632 FXJSE_HVALUE hFristValue,
2633 FXJSE_HVALUE hProp);
2634 void SetJSPrinterGroup(IFXJS_PrintMgrProvider* pPrintMgr,
2635 FXJSE_HVALUE hFristValue,
2636 FXJSE_HVALUE hProp);
2637 void SetJSPrintHandling(IFXJS_PrintMgrProvider* pPrintMgr,
2638 FXJSE_HVALUE hFristValue,
2639 FXJSE_HVALUE hProp);
2640
2641 void SetJSPrintScale(IFXJS_PrintMgrProvider* pPrintMgr,
2642 FXJSE_HVALUE hFristValue,
2643 FXJSE_HVALUE hProp,
2644 int nPageHandling);
2645 void SetJSPrintMultiple(IFXJS_PrintMgrProvider* pPrintMgr,
2646 FXJSE_HVALUE hFristValue,
2647 FXJSE_HVALUE hProp);
2648 void SetJSPrintTileLarge(IFXJS_PrintMgrProvider* pPrintMgr,
2649 FXJSE_HVALUE hFristValue,
2650 FXJSE_HVALUE hProp);
2651 void SetJSPrintBooklet(IFXJS_PrintMgrProvider* pPrintMgr,
2652 FXJSE_HVALUE hFristValue,
2653 FXJSE_HVALUE hProp);
2654
2655 FX_BOOL GetPrintRangeArry(FXJSE_HVALUE hProp, CFX_WordArray& wPrintPagesArry);
2656 FX_BOOL GetPrintRangeArry(FXJSE_HVALUE hProp, std::vector<print_Range>& printRangeVec);
2657
2659 static FX_BOOL AnnotCanBeFetched(IFXJS_AnnotProvider* pAnnot);
2660
2661 private:
2662 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
2663 int CountWords(CPDF_TextObject* pTextObj);
2664 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
2665
2666 FX_BOOL ParserParams(JSFXObject pObj, CFXJS_AnnotObj& annotobj);
2667 FX_BOOL EnumNamedItems(CFX_ByteString csNameItem, CFX_WideStringArray& items);
2668 FX_BOOL EnumNamedItems(CPDF_Dictionary* pNode, CFX_WideStringArray& items);
2669
2670 FX_BOOL IsShareViewDoc();
2671 FX_BOOL GetByteStringArrFormHValue(FXJSE_HVALUE hValue, CFX_ByteStringArray& array);
2672 std::unique_ptr<TemplateElement> FindTemplates(CFX_ByteString csName,
2673 CPDF_Dictionary* pTemplates);
2674 FX_BOOL RemoveTemplate(CPDF_Dictionary* pTemplates, CFX_ByteString csName);
2675
2676 // FX_BOOL AddMessage(std::unique_ptr<JS_BULBMESSAGEINFO>&& msgInfo);
2677 // static void BulbMsgCenterBtn1ExecuteProc(void* clientData);
2678 // static void BulbMsgCenterBtn2ExecuteProc(void* clientData);
2679 // static void BulbMsgCenterBtn3ExecuteProc(void* clientData);
2680
2681
2682 //#ifdef BUILD_PHANTOM
2683 void ParseWatermarkParam(JS_WatemarkElementInfo& wInfo,
2684 int nStartIndex,
2685 const CFXJSE_Arguments& args);
2686 FX_BOOL AddWatermark(const JS_WatemarkElementInfo& wInfo);
2687 FX_BOOL IsValidFileType(const CFX_WideString wsFilePath);
2688 void CheckPageRange(JS_WatemarkElementInfo& wInfo);
2689 //#endif
2690 FX_BOOL ParseFieldParams(CFXJSE_Arguments& args,
2691 std::map<int, CFX_ByteString>& argMap,
2692 CJS_FIELD& fieldInfo,
2693 JS_ErrorString& sError);
2694
2695 private:
2696 int GetWordSearch(std::wstring wsPageText, CFX_WideString wsRegExpression, int nWord);
2697 FX_BOOL GetFields(CFX_PtrArray& aFields,
2698 CFXJS_Runtime* pRunTime,
2699 FXJSE_HVALUE hValue,
2700 CPDF_InterForm* pPDFForm);
2701 CFXJS_Object* FindFieldObject(CFX_WideString cwName);
2702 FXJSE_HCLASS GetFieldObjectHClass(CFXJS_Runtime* pRuntime);
2703
2704 bool GetTrans(FXJSE_HVALUE hProp, TransDict& nTransDict);
2705 CFX_WideString GetTransNameByDict(CPDF_Dictionary* pDicTrans);
2706 void GetOCGs(CPDF_Array* pOCGOrderArray, FXJSE_HVALUE hRgValue);
2707 bool SetOCGs(CPDF_Array* pOCGOrderArray, FXJSE_HVALUE hParam);
2708
2709 private:
2710 CFX_RectArray m_rcWordquads;
2711 std::vector<InfoWord> m_InfoWord;
2712 std::unique_ptr<JIconTree> m_pIconTree;
2713 IFXJS_DocumentProvider* m_pDocument;
2714 CFX_WideString m_cwBaseURL;
2715
2716 FX_BOOL m_bDelay;
2717 std::vector<std::unique_ptr<CFXJS_DelayData>> m_DelayData;
2718 std::vector<std::unique_ptr<CFXJS_AnnotObj>> m_DelayAnnotData;
2719
2720 CFX_MapByteStringToPtr m_DataMap;
2721 CFX_MapPtrTemplate<IFXJS_DocumentProvider*, FX_BOOL>
2722 m_DocsMap; // the Doc has been showPrintWaring, Not need show again
2723 std::vector<std::unique_ptr<JS_BULBMESSAGEINFO>> m_arBulbMsgInfo;
2724 FXJSE_HCLASS m_hFieldClass;
2725 std::map<IFXJS_AnnotProvider::Observer, void*> m_AnnotToJSAnnot;
2726
2727 // CFX_MapPtrToPtr m_AnnotToJSAnnot;
2728
2729 /* std::unique_ptr<BasicEventInfo> m_hValueConvertToCPDFFunc;
2730 std::unique_ptr<BasicEventInfo> m_hExportAnnotSuccessFunc;
2731 std::unique_ptr<BasicEventInfo> m_hValueSaveAsNewCPDFFunc;*/
2732
2733 // getAnnots param nSortBy values.
2734 const int m_ANSB_None_Value = 0;
2735 const int m_ANSB_Page_Value = 1;
2736 const int m_ANSB_Seq_Value = 2;
2737 const int m_ANSB_Author_Value = 3;
2738 const int m_ANSB_ModDate_Value = 4;
2739 const int m_ANSB_Type_Value = 5;
2740 const int m_ANSB_Subject_Value = 6;
2741
2742 // getAnnots param nFilterBy values. Values not listed in js api reference are commented out.
2743 const int m_ANFB_ShouldNone_Value = 7;
2744 const int m_ANFB_ShouldPrint_Value = 0;
2745 const int m_ANFB_ShouldView_Value = 1;
2746 const int m_ANFB_ShouldEdit_Value = 2;
2747 const int m_ANFB_ShouldAppearInPanel_Value = 3;
2748 const int m_ANFB_ShouldSummarize_Value = 4;
2749 const int m_ANFB_ShouldExport_Value = 5;
2750 const int m_ANFB_ShouldCollaborate_Value = 6;
2751 };
2753 class CFXJS_Document : public CFXJS_Root
2754 {
2755 public:
2756 CFXJS_Document(CFXJS_Runtime* pRuntime);
2757 virtual ~CFXJS_Document(){};
2758
2759 DECLARE_ROOT_CLASS(CFXJS_Document);
2760 #if (_FX_OS_ == _FX_IOS_) // PHRD-2628
2761 JS_STATIC_PROP(app, Doc);
2762 JS_STATIC_PROP(console, Doc);
2763 JS_STATIC_PROP(global, Doc);
2764 JS_STATIC_PROP(util, Doc);
2765 JS_STATIC_PROP(color, Doc);
2766 JS_STATIC_PROP(event, Doc);
2767 JS_STATIC_PROP(SOAP, Doc);
2768 JS_STATIC_PROP(ReadStream, Doc);
2769 JS_STATIC_PROP(StreamDigest, Doc);
2770 JS_STATIC_PROP(identity, Doc);
2771 JS_STATIC_PROP(cursor, Doc);
2772 JS_STATIC_PROP(ADBC, Doc);
2773 JS_STATIC_PROP(search, Doc);
2774 JS_STATIC_PROP(Span, Doc)
2775 JS_STATIC_PROP(security, Doc);
2776
2777 //=====================Const Prop =============
2778 JS_STATIC_PROP(border, Doc);
2779 JS_STATIC_PROP(display, Doc);
2780 JS_STATIC_PROP(font, Doc);
2781 JS_STATIC_PROP(highlight, Doc);
2782 JS_STATIC_PROP(position, Doc);
2783 JS_STATIC_PROP(scaleHow, Doc);
2784 JS_STATIC_PROP(scaleWhen, Doc);
2785 JS_STATIC_PROP(style, Doc);
2786 JS_STATIC_PROP(zoomtype, Doc);
2787
2788 //=====================Global Prop ============
2789 JS_STATIC_PROP(IDS_GREATER_THAN, Doc);
2790 JS_STATIC_PROP(IDS_GT_AND_LT, Doc);
2791 JS_STATIC_PROP(IDS_LESS_THAN, Doc);
2792 JS_STATIC_PROP(IDS_INVALID_MONTH, Doc);
2793 JS_STATIC_PROP(IDS_INVALID_DATE, Doc);
2794 JS_STATIC_PROP(IDS_INVALID_VALUE, Doc);
2795 JS_STATIC_PROP(IDS_AM, Doc);
2796 JS_STATIC_PROP(IDS_PM, Doc);
2797 JS_STATIC_PROP(IDS_MONTH_INFO, Doc);
2798 JS_STATIC_PROP(IDS_STARTUP_CONSOLE_MSG, Doc);
2799
2800 JS_STATIC_PROP(RE_NUMBER_ENTRY_DOT_SEP, Doc);
2801 JS_STATIC_PROP(RE_NUMBER_COMMIT_DOT_SEP, Doc);
2802 JS_STATIC_PROP(RE_NUMBER_ENTRY_COMMA_SEP, Doc);
2803 JS_STATIC_PROP(RE_NUMBER_COMMIT_COMMA_SEP, Doc);
2804 JS_STATIC_PROP(RE_ZIP_ENTRY, Doc);
2805 JS_STATIC_PROP(RE_ZIP_COMMIT, Doc);
2806 JS_STATIC_PROP(RE_ZIP4_ENTRY, Doc);
2807 JS_STATIC_PROP(RE_ZIP4_COMMIT, Doc);
2808 JS_STATIC_PROP(RE_PHONE_ENTRY, Doc);
2809 JS_STATIC_PROP(RE_PHONE_COMMIT, Doc);
2810 JS_STATIC_PROP(RE_SSN_ENTRY, Doc);
2811 JS_STATIC_PROP(RE_SSN_COMMIT, Doc);
2812 //=====================cpdf 需要添加;的======
2813 JS_STATIC_PROP(appEvents, Doc);
2814 JS_STATIC_PROP(methodProxy, Doc);
2815 JS_STATIC_PROP(localStorage, Doc);
2816 JS_STATIC_PROP(http, Doc);
2817 // JS_STATIC_PROP(connectedPdf, Doc);
2818 JS_STATIC_PROP(FX, Doc);
2819 #endif
2820 JS_STATIC_PROP(ADBE, Doc);
2821 JS_STATIC_PROP(author, Doc);
2822 JS_STATIC_PROP(baseURL, Doc);
2823 JS_STATIC_PROP(bookmarkRoot, Doc);
2824 JS_STATIC_PROP(calculate, Doc);
2825 JS_STATIC_PROP(Collab, Doc);
2826 JS_STATIC_PROP(creationDate, Doc);
2827 JS_STATIC_PROP(creator, Doc);
2828 JS_STATIC_PROP(delay, Doc);
2829 JS_STATIC_PROP(dirty, Doc);
2830 JS_STATIC_PROP(documentFileName, Doc);
2831 JS_STATIC_PROP(external, Doc);
2832 JS_STATIC_PROP(filesize, Doc);
2833 JS_STATIC_PROP(icons, Doc);
2834 JS_STATIC_PROP(info, Doc);
2835 JS_STATIC_PROP(keywords, Doc);
2836 JS_STATIC_PROP(layout, Doc);
2837 JS_STATIC_PROP(media, Doc);
2838 JS_STATIC_PROP(modDate, Doc);
2839 JS_STATIC_PROP(mouseX, Doc);
2840 JS_STATIC_PROP(mouseY, Doc);
2841 JS_STATIC_PROP(numFields, Doc);
2842 JS_STATIC_PROP(numPages, Doc);
2843 JS_STATIC_PROP(pageNum, Doc);
2844 JS_STATIC_PROP(pageWindowRect, Doc);
2845 JS_STATIC_PROP(path, Doc);
2846 JS_STATIC_PROP(producer, Doc);
2847 JS_STATIC_PROP(securityHandler, Doc);
2848 JS_STATIC_PROP(subject, Doc);
2849 JS_STATIC_PROP(title, Doc);
2850 JS_STATIC_PROP(zoom, Doc);
2851 JS_STATIC_PROP(zoomType, Doc);
2852 JS_STATIC_PROP(dynamicXFAForm, Doc);
2853 JS_STATIC_PROP(URL, Doc);
2854 JS_STATIC_PROP(dataObjects, Doc);
2855 JS_STATIC_PROP(hostContainer, Doc);
2856 JS_STATIC_PROP(xfa, Doc);
2857 JS_STATIC_PROP(templates, Doc);
2858 JS_STATIC_PROP(page, Doc);
2859 JS_STATIC_PROP(guid, Doc);
2860 JS_STATIC_PROP(isInProtectedViewMode, Doc);
2861 JS_STATIC_PROP(ANSB_None, Doc)
2862 JS_STATIC_PROP(ANSB_Page, Doc)
2863 JS_STATIC_PROP(ANSB_Seq, Doc)
2864 JS_STATIC_PROP(ANSB_Author, Doc)
2865 JS_STATIC_PROP(ANSB_ModDate, Doc)
2866 JS_STATIC_PROP(ANSB_Type, Doc)
2867 JS_STATIC_PROP(ANSB_Subject, Doc)
2868 JS_STATIC_PROP(ANFB_ShouldNone, Doc)
2869 JS_STATIC_PROP(ANFB_ShouldPrint, Doc)
2870 JS_STATIC_PROP(ANFB_ShouldView, Doc)
2871 JS_STATIC_PROP(ANFB_ShouldEdit, Doc)
2872 JS_STATIC_PROP(ANFB_ShouldAppearInPanel, Doc)
2873 JS_STATIC_PROP(ANFB_ShouldSummarize, Doc)
2874 JS_STATIC_PROP(ANFB_ShouldExport, Doc)
2875 JS_STATIC_PROP(ANFB_ShouldCollaborate, Doc)
2876
2877 #if (_FX_OS_ == _FX_IOS_) // PHRD-2628
2878 //======================Global Method ==========
2879 JS_STATIC_METHOD(AFNumber_Format, Doc);
2880 JS_STATIC_METHOD(AFNumber_Keystroke, Doc);
2881 JS_STATIC_METHOD(AFPercent_Format, Doc);
2882 JS_STATIC_METHOD(AFPercent_Keystroke, Doc);
2883 JS_STATIC_METHOD(AFDate_FormatEx, Doc);
2884 JS_STATIC_METHOD(AFDate_KeystrokeEx, Doc);
2885 JS_STATIC_METHOD(AFDate_Format, Doc);
2886 JS_STATIC_METHOD(AFDate_Keystroke, Doc);
2887 JS_STATIC_METHOD(AFTime_FormatEx, Doc);
2888 JS_STATIC_METHOD(AFTime_KeystrokeEx, Doc);
2889 JS_STATIC_METHOD(AFTime_Format, Doc);
2890 JS_STATIC_METHOD(AFTime_Keystroke, Doc);
2891 JS_STATIC_METHOD(AFSpecial_Format, Doc);
2892 JS_STATIC_METHOD(AFSpecial_Keystroke, Doc);
2893 JS_STATIC_METHOD(AFSpecial_KeystrokeEx, Doc);
2894 JS_STATIC_METHOD(AFSimple, Doc);
2895 JS_STATIC_METHOD(AFMakeNumber, Doc);
2896 JS_STATIC_METHOD(AFSimple_Calculate, Doc);
2897 JS_STATIC_METHOD(AFRange_Validate, Doc);
2898 JS_STATIC_METHOD(AFMergeChange, Doc);
2899 JS_STATIC_METHOD(AFParseDateEx, Doc);
2900 JS_STATIC_METHOD(AFExtractNums, Doc);
2901 #endif
2902 JS_STATIC_METHOD(addAnnot, Doc);
2903 JS_STATIC_METHOD(addField, Doc);
2904 JS_STATIC_METHOD(addLink, Doc);
2905 JS_STATIC_METHOD(addIcon, Doc);
2906 JS_STATIC_METHOD(calculateNow, Doc);
2907 JS_STATIC_METHOD(closeDoc, Doc);
2908 JS_STATIC_METHOD(createDataObject, Doc);
2909 JS_STATIC_METHOD(createIcon, Doc);
2910 JS_STATIC_METHOD(createTemplate, Doc);
2911 JS_STATIC_METHOD(deletePages, Doc);
2912 JS_STATIC_METHOD(exportAsText, Doc);
2913 JS_STATIC_METHOD(exportAsFDF, Doc);
2914 JS_STATIC_METHOD(exportAsXFDF, Doc);
2915 JS_STATIC_METHOD(exportAsXFDFStr, Doc);
2916 JS_STATIC_METHOD(exportXFAData, Doc);
2917 JS_STATIC_METHOD(extractPages, Doc);
2918 JS_STATIC_METHOD(exportDataObject, Doc);
2919 JS_STATIC_METHOD(getAnnot, Doc);
2920 JS_STATIC_METHOD(getAnnots, Doc);
2921 JS_STATIC_METHOD(getAnnot3D, Doc);
2922 JS_STATIC_METHOD(getAnnots3D, Doc);
2923 JS_STATIC_METHOD(getField, Doc);
2924 JS_STATIC_METHOD(getIcon, Doc);
2925 JS_STATIC_METHOD(getLinks, Doc);
2926 JS_STATIC_METHOD(getNthFieldName, Doc);
2927 JS_STATIC_METHOD(getOCGs, Doc);
2928 JS_STATIC_METHOD(getPageBox, Doc);
2929 JS_STATIC_METHOD(getPageNthWord, Doc);
2930 JS_STATIC_METHOD(getPageNthWordQuads, Doc);
2931 JS_STATIC_METHOD(getPageNumWords, Doc);
2932 JS_STATIC_METHOD(getPageRotation, Doc);
2933 JS_STATIC_METHOD(getPrintParams, Doc);
2934 JS_STATIC_METHOD(getURL, Doc);
2935 JS_STATIC_METHOD(getDataObject, Doc);
2936 JS_STATIC_METHOD(getTemplate, Doc);
2937 JS_STATIC_METHOD(removeDataObject, Doc);
2938 JS_STATIC_METHOD(embedDocAsDataObject, Doc);
2939 JS_STATIC_METHOD(gotoNamedDest, Doc);
2940 JS_STATIC_METHOD(importAnFDF, Doc);
2941 JS_STATIC_METHOD(importAnXFDF, Doc);
2942 JS_STATIC_METHOD(importDataObject, Doc);
2943 JS_STATIC_METHOD(importTextData, Doc);
2944 JS_STATIC_METHOD(importXFAData, Doc);
2945 JS_STATIC_METHOD(insertPages, Doc);
2946 JS_STATIC_METHOD(mailForm, Doc);
2947 JS_STATIC_METHOD(print, Doc);
2948 JS_STATIC_METHOD(removeField, Doc);
2949 JS_STATIC_METHOD(replacePages, Doc);
2950 JS_STATIC_METHOD(removeIcon, Doc);
2951 JS_STATIC_METHOD(removeTemplate, Doc);
2952 JS_STATIC_METHOD(resetForm, Doc);
2953 JS_STATIC_METHOD(saveAs, Doc);
2954 JS_STATIC_METHOD(submitForm, Doc);
2955 JS_STATIC_METHOD(mailDoc, Doc);
2956 JS_STATIC_METHOD(spawnPageFromTemplate, Doc);
2957 JS_STATIC_METHOD(scroll, Doc);
2958 JS_STATIC_METHOD(syncAnnotScan, Doc);
2959
2960 // JS_STATIC_METHOD(createBulbmessage,Doc);
2961 // JS_STATIC_METHOD(showBulbmessage,Doc);
2962 JS_STATIC_METHOD(addPageOpenJSMessage, Doc);
2963 JS_STATIC_METHOD(showBalloon, Doc);
2964 JS_STATIC_METHOD(hideBalloon, Doc);
2965 JS_STATIC_METHOD(convertTocPDF, Doc);
2966 JS_STATIC_METHOD(saveAsNewcPDF, Doc);
2967 JS_STATIC_METHOD(getDocId, Doc);
2968 JS_STATIC_METHOD(getVersionID, Doc);
2969 JS_STATIC_METHOD(isCpdf, Doc);
2970 JS_STATIC_METHOD(getCurPageIndex, Doc);
2971 JS_STATIC_METHOD(getPageCount, Doc);
2972 // JS_STATIC_METHOD(getDigestId,Doc);
2973 JS_STATIC_METHOD(getSize, Doc);
2974 JS_STATIC_METHOD(readBuf, Doc);
2975 JS_STATIC_METHOD(importAnnotFromXFDF, Doc)
2976 JS_STATIC_METHOD(exportAnonymousAnnot, Doc)
2977 JS_STATIC_METHOD(exportAllAnnots, Doc)
2978 JS_STATIC_METHOD(deleteAnnot, Doc)
2979 JS_STATIC_METHOD(goToAnnot, Doc)
2980 JS_STATIC_METHOD(saveOfflineCopy, Doc)
2981 JS_STATIC_METHOD(getEncryptionMethod, Doc)
2982 JS_STATIC_METHOD(getURI, Doc)
2983 JS_STATIC_METHOD(getPageObjNum, Doc)
2984 JS_STATIC_METHOD(getPageIndexByPageObjNum, Doc)
2985 JS_STATIC_METHOD(isForm, Doc)
2986 JS_STATIC_METHOD(setReviewType, Doc)
2987
2988 JS_STATIC_METHOD(activePin, Doc);
2989 JS_STATIC_METHOD(deletePin, Doc);
2990 JS_STATIC_METHOD(createPin, Doc);
2991 JS_STATIC_METHOD(hoverPin, Doc);
2992
2993 JS_STATIC_METHOD(updateACL, Doc);
2994 JS_STATIC_METHOD(addAdLayer, Doc);
2995 JS_STATIC_METHOD(gotoPage, Doc);
2996 JS_STATIC_METHOD(setPageTabOrder, Doc);
2997
2998 //#ifdef BUILD_PHANTOM
2999 JS_STATIC_METHOD(addWatermarkFromText, Doc);
3000 JS_STATIC_METHOD(addWatermarkFromFile, Doc);
3001 //#endif
3002 JS_STATIC_METHOD(flattenPages, Doc);
3003 JS_STATIC_METHOD(setPageTransitions, Doc);
3004 JS_STATIC_METHOD(getPageTransition, Doc);
3005 JS_STATIC_METHOD(selectPageNthWord, Doc);
3006 JS_STATIC_METHOD(importIcon, Doc);
3007 JS_STATIC_METHOD(movePage, Doc);
3008 JS_STATIC_METHOD(newPage, Doc);
3009 JS_STATIC_METHOD(setPageRotations, Doc);
3010 JS_STATIC_METHOD(addWeblinks, Doc);
3011 JS_STATIC_METHOD(removeWeblinks, Doc);
3012 JS_STATIC_METHOD(setPageBoxes, Doc);
3013 JS_STATIC_METHOD(removeLinks, Doc)
3014 JS_STATIC_METHOD(getOCGOrder, Doc)
3015 JS_STATIC_METHOD(setOCGOrder, Doc)
3016 JS_STATIC_METHOD(setPageLabels, Doc);
3017 JS_STATIC_METHOD(getPageLabel, Doc);
3018 };
3019
3020 class Page : public CFXJS_EmbedObj
3021 {
3022 public:
3023 Page(CFXJS_Object* pObject)
3024 : CFXJS_EmbedObj(pObject)
3025 {
3026 }
3027 virtual ~Page() {}
3028
3029 public:
3030 FX_BOOL pageindex(OBJ_PROP_PARAMS);
3031
3032 void AttachDocument(IFXJS_DocumentProvider* pDoc);
3033
3034 IFXJS_DocumentProvider* m_pDoc;
3035 };
3036
3037 class CFXJS_Page : public CFXJS_Object
3038 {
3039 public:
3040 CFXJS_Page(CFXJS_Runtime* pRuntime)
3041 : CFXJS_Object(pRuntime)
3042 {
3043 }
3044 virtual ~CFXJS_Page(){};
3045
3046 DECLARE_JS_CLASS(CFXJS_Page)
3047
3048 JS_STATIC_PROP(pageindex, Page);
3049 };
3050 } // namespace javascript
3051
3052 #endif //_DOCUMENT_H_
console
The console object is a static object that enables access to the Foxit PDF Editor JavaScript Console ...
Definition: console.h:16
search
The search object is a static object that accesses the functionality provided by the Foxit PDF Editor...
Definition: search.h:115
ReadStream
A ReadStream object is an object literal that represents a stream of data. It contains a method to al...
Definition: soap.h:40
identity
This is a static object that identifies the current user of the application.
Definition: identity.h:10
event
All JavaScript scripts are executed as the result of a particular event. For each of these events,...
Definition: event.h:22
annotation.h
JavaScript API for attachment.
global
This is a static JavaScript object that allows you to share data between documents and to have data b...
Definition: global.h:30
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205
security
The security object is a static JavaScript object that exposes security-related PDF functions such as...
Definition: securityhandler.h:409
app
This object is used to set and get the properties and to set the JavaScript action of a link.
Definition: app.h:169
Annotation
This object represents an Foxit PDF Editor annotation. Annotations can be created using the Foxit PDF...
Definition: annotation.h:317
util
A static JavaScript object that defines a number of utility methods and convenience functions for str...
Definition: util.h:15
Span
A generic object that represents a length of text and its associated properties in a rich text form f...
Definition: span.h:18
color
The color object is a convenience static object that defines the basic colors. Use this object to set...
Definition: color.h:46


Javascript API: Member List

attachment Member List

This is the complete list of members for attachment, including all inherited members.

contentStream(OBJ_PROP_PARAMS) | attachment
creationDate(OBJ_PROP_PARAMS) | attachment
MIMEType(OBJ_PROP_PARAMS) | attachment
modDate(OBJ_PROP_PARAMS) | attachment
name(OBJ_PROP_PARAMS) | attachment
path(OBJ_PROP_PARAMS) | attachment
size(OBJ_PROP_PARAMS) | attachment


Javascript API: Member List

Certificate Member List

This is the complete list of members for Certificate, including all inherited members.

binary(OBJ_PROP_PARAMS) | Certificate
issuerDN(OBJ_PROP_PARAMS) | Certificate
keyUsage(OBJ_PROP_PARAMS) | Certificate
MD5Hash(OBJ_PROP_PARAMS) | Certificate
privateKeyValidityEnd(OBJ_PROP_PARAMS) | Certificate
privateKeyValidityStart(OBJ_PROP_PARAMS) | Certificate
serialNumber(OBJ_PROP_PARAMS) | Certificate
SHA1Hash(OBJ_PROP_PARAMS) | Certificate
subjectCN(OBJ_PROP_PARAMS) | Certificate
subjectDN(OBJ_PROP_PARAMS) | Certificate
validityEnd(OBJ_PROP_PARAMS) | Certificate
validityStart(OBJ_PROP_PARAMS) | Certificate


Javascript API: Member List

identity Member List

This is the complete list of members for identity, including all inherited members.

corporation(OBJ_PROP_PARAMS) | identity
email(OBJ_PROP_PARAMS) | identity
loginName(OBJ_PROP_PARAMS) | identity
name(OBJ_PROP_PARAMS) | identity


Javascript API: Member List

Rendition Member List

This is the complete list of members for Rendition, including all inherited members.

altText(OBJ_PROP_PARAMS) | Rendition
uiName(OBJ_PROP_PARAMS) | Rendition


Javascript API: Member List

RDN Member List

This is the complete list of members for RDN, including all inherited members.


Javascript API: Member List

Annot3D Member List

This is the complete list of members for Annot3D, including all inherited members.

activated(OBJ_PROP_PARAMS) | Annot3D
innerRect(OBJ_PROP_PARAMS) | Annot3D
name(OBJ_PROP_PARAMS) | Annot3D
page(OBJ_PROP_PARAMS) | Annot3D


Javascript API: bookmark.h Source File

  • src
  • javascript
  • inc
bookmark.h
Go to the documentation of this file.
1 #ifndef _BOOKMARK_H_
2 #define _BOOKMARK_H_
3
5 namespace javascript {
6 class Doc;
8
18 class Bookmark : public CFXJS_EmbedObj
19 {
20 public:
21 Bookmark(CFXJS_Object* pJSObject);
22 virtual ~Bookmark();
23
24 public:
53 FX_BOOL children(OBJ_PROP_PARAMS);
54 FX_BOOL color(OBJ_PROP_PARAMS);
55
72 FX_BOOL doc(OBJ_PROP_PARAMS);
73
90 FX_BOOL name(OBJ_PROP_PARAMS);
91
109 FX_BOOL parent(OBJ_PROP_PARAMS);
110 FX_BOOL style(OBJ_PROP_PARAMS);
111
128 FX_BOOL open(OBJ_PROP_PARAMS);
129
146 FX_BOOL createChild(OBJ_METHOD_PARAMS);
147
167 FX_BOOL insertChild(OBJ_METHOD_PARAMS);
168
179 FX_BOOL remove(OBJ_METHOD_PARAMS);
180
197 FX_BOOL setAction(OBJ_METHOD_PARAMS);
198 FX_BOOL execute(OBJ_METHOD_PARAMS);
199
200 private:
201 CPDF_Dictionary* CreateChildDict(CPDF_Dictionary* pParentDict,
202 CFX_WideString wsTitle,
203 CFX_WideString wsJScExpr,
204 int nChildIndex);
205 CPDF_Dictionary*
206 InsertChildDict(CPDF_Dictionary* pParentDict, CPDF_Dictionary* pSrcDict, int nChildIndex);
207 FX_INT32 CheckMoveItemRelation(CPDF_Dictionary* pSrcItem,
208 CPDF_Dictionary* pDestParent,
209 CPDF_Dictionary* pDestAfter);
210 FX_BOOL RemoveDict(CPDF_Dictionary* pRemoveDict);
211 FX_BOOL SetActionDict(CPDF_Dictionary* pCurrentDict, CFX_WideString wsJScScript);
212 FX_BOOL IsExistBookmark(CPDF_Dictionary* pBookmark);
213 FX_BOOL RemoveItemDict(CPDF_Dictionary* pRemoveDict);
214 CPDF_Dictionary* GetTreeRoot(CPDF_Document* pDocument);
215
216 public:
217 void SetDoc(Doc* pDoc)
218 {
219 m_pJSDoc = pDoc;
220 }
221 void SetBookmark(CPDF_Dictionary* pBookmark)
222 {
223 m_pBookmark = pBookmark;
224 }
225 CPDF_Dictionary* GetBookmark()
226 {
227 return m_pBookmark;
228 }
229 void SetRootBookmarkFlag(bool bRoot = true)
230 {
231 m_bRoot = bRoot;
232 };
233
234 protected:
235 std::unique_ptr<CFXJS_Object>
236 CreateObjectAndSet(FXJSE_HVALUE value, CPDF_Dictionary* dict, CFXJS_Runtime* pRuntime);
237
238 private:
239 Doc* m_pJSDoc;
240 CPDF_Dictionary* m_pBookmark;
241 bool m_bRoot;
242 };
243
244 class CFXJS_Bookmark : public CFXJS_Object
245 {
246 public:
247 CFXJS_Bookmark(CFXJS_Runtime* pRuntime)
248 : CFXJS_Object(pRuntime){};
249 virtual ~CFXJS_Bookmark(){};
250
251 public:
252 DECLARE_JS_CLASS(CFXJS_Bookmark);
253
254 JS_STATIC_PROP(children, Bookmark);
255 JS_STATIC_PROP(color, Bookmark);
256 JS_STATIC_PROP(doc, Bookmark);
257 JS_STATIC_PROP(name, Bookmark);
258 JS_STATIC_PROP(parent, Bookmark);
259 JS_STATIC_PROP(style, Bookmark);
260 JS_STATIC_PROP(open, Bookmark);
261
262 JS_STATIC_METHOD(createChild, Bookmark);
263 JS_STATIC_METHOD(insertChild, Bookmark);
264 JS_STATIC_METHOD(remove, Bookmark);
265 JS_STATIC_METHOD(setAction, Bookmark);
266 JS_STATIC_METHOD(execute, Bookmark);
267 };
268 } // namespace javascript
269
270 #endif //_BOOKMARK_H_
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205
color
The color object is a convenience static object that defines the basic colors. Use this object to set...
Definition: color.h:46
Bookmark
A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational p...
Definition: bookmark.h:18


Javascript API: template.h Source File

  • src
  • javascript
  • inc
template.h
Go to the documentation of this file.
1 #ifndef _TEMPLATE_H_
2 #define _TEMPLATE_H_
3
4 #include <map>
6 namespace javascript {
8 class CFXJS_Object;
9 class CFXJS_Runtime;
10
21 class Template : public CFXJS_EmbedObj
22 {
23 public:
24 Template(CFXJS_Object* pObject);
25 ~Template() {}
26
27
38 FX_BOOL name(OBJ_PROP_PARAMS);
39
50 FX_BOOL hidden(OBJ_PROP_PARAMS);
51
81 FX_BOOL spawn(OBJ_METHOD_PARAMS);
82
83 void AttachEmlement(IFXJS_DocumentProvider* pDoc, CFX_ByteString csNames);
84 FX_BOOL SpawnPage(int nPageIndex, FX_BOOL bRename, FX_BOOL bSpawn);
85 CPDF_Object* GetTemplateObj(
86 CPDF_Dictionary* pTemplates); // m_pObj will be empty after execute "hidden = false";
87 private:
88 IFXJS_DocumentProvider* m_pDoc;
89 CFX_ByteString m_csName;
90 std::map<FX_DWORD, FX_DWORD> m_mapNumObj;
91 std::map<FX_DWORD, FX_DWORD>::iterator m_mapIteratorNumObj;
92 };
93
94 class CFXJS_Template : public CFXJS_Object
95 {
96 public:
97 CFXJS_Template(CFXJS_Runtime* pRuntime);
98 ~CFXJS_Template() {}
99
100 DECLARE_JS_CLASS(CFXJS_Template);
101
102 JS_STATIC_PROP(name, Template);
103 JS_STATIC_PROP(hidden, Template)
104 JS_STATIC_METHOD(spawn, Template);
105 };
106 } // namespace javascript
107 #endif
Template
Template objects are named pages within the document. These pages may be hidden or visible and can be...
Definition: template.h:21


Javascript API: Member List

SignatureInfo Member List

This is the complete list of members for SignatureInfo, including all inherited members.


Javascript API: Member List

util Member List

This is the complete list of members for util, including all inherited members.

iconStreamFromIcon(OBJ_METHOD_PARAMS) | util
printd(OBJ_METHOD_PARAMS) | util
printf(OBJ_METHOD_PARAMS) | util
printx(OBJ_METHOD_PARAMS) | util
scand(OBJ_METHOD_PARAMS) | util


Javascript API: annotation.h Source File

  • src
  • javascript
  • inc
annotation.h
Go to the documentation of this file.
1 #ifndef _ANNOTATION_H_
2 #define _ANNOTATION_H_
3
4 #include "fpdfannot/fpdf_annot.h"
5 #include "fxge/fx_color.h"
6 #include "../../../include/javascript/fx_jsAnnotProvider.h"
8
9 namespace javascript {
10 class Doc;
11 class Span;
12 class IFXJS_PageProvider;
13 // class BasicEventInfo;
14 enum JS_ANNOTTYPE
15 {
16 ANNOT_UNKNOWN = -1,
17 ANNOT_CARET = 0,
18 ANNOT_CIRCLE,
19 ANNOT_FILEATTACHMENT,
20 ANNOT_FREETEXT,
21 ANNOT_HIGHLIGHT,
22 ANNOT_INK,
23 ANNOT_LINE,
24 ANNOT_POLYGON,
25 ANNOT_POLYLINE,
26 ANNOT_SOUND,
27 ANNOT_SQUARE,
28 ANNOT_SQUIGGLY,
29 ANNOT_STAMP,
30 ANNOT_STRIKEOUT,
31 ANNOT_TEXT,
32 ANNOT_UNDERLINE,
33 ANNOT_REDACT,
34 };
35
36 enum ANNOT_TYPE
37 {
38 ANNOT_ANNOTNAME = 0,
39 ANNOT_ARROWBEGIN,
40 ANNOT_ARROWEND,
41 ANNOT_ATTACHICON,
42 ANNOT_AUTHOR,
43 ANNOT_BORDEREFFECTINTENSITY,
44 ANNOT_BORDEREFFECTSTYLE,
45 ANNOT_CALLOUT,
46 ANNOT_CARETSYMBOL,
47 ANNOT_CONTENTS,
48 ANNOT_CREATIONDATE,
49 ANNOT_DASH,
50 ANNOT_FILLCOLOR,
51 ANNOT_GESTURES,
52 ANNOT_HIDE,
53 ANNOT_LEADEREXTEND,
54 ANNOT_LEADERLENGTH,
55 ANNOT_LINEENDING,
56 ANNOT_NOVIEW,
57 ANNOT_POINT,
58 ANNOT_POINTS,
59 ANNOT_POPUPOPEN,
60 ANNOT_POPUPRECT,
61 ANNOT_PRINT,
62 ANNOT_READONLY,
63 ANNOT_RECT,
64 ANNOT_SOUNDICON,
65 ANNOT_STROKECOLOR,
66 ANNOT_STYLE,
67 ANNOT_SUBJECT,
68 ANNOT_TEXTFONT,
69 ANNOT_TEXTSIZE,
70 ANNOT_WIDTH,
71 ANNOT_ALIGNMENT,
72 ANNOT_VERTICES,
73 ANNOT_QUADS,
74 ANNOT_NOTEICON,
75 ANNOT_OPACITY
76 };
77
78 struct CFXJS_AnnotObj
79 {
80 CFXJS_AnnotObj()
81 {
82 pAnnot = nullptr;
83 pAnnotAdd = nullptr;
84 }
85 int nAnnotType = 0;
86 ANNOT_TYPE nDoAnnotType = ANNOT_ANNOTNAME;
87 CFX_WideString cwType;
88 IFXJS_AnnotProvider* pAnnot;
89 int nPageNo = 0;
90 int nAlignment = 0;
91 CFX_WideString cwLineBegin;
92 CFX_WideString cwLineEnd;
93 CFX_WideString cwAttachIcon;
94 CFX_WideString cwAuthor;
95
96 CFX_WideString cwSymbol;
97 CFX_WideString cwContents;
98 CJS_IntArray dashArray;
99 CFX_ColorF fillcolor;
100 FX_BOOL bHide = false;
101 int iLeaderExtend = 0;
102 int iLeaderLength = 0;
103 CFX_WideString cwLineEnding;
104 CFX_WideString cwNoteIcon;
105 CFX_WideString cwAnnotName;
106 CPDF_Point pointArray = CPDF_Point(0, 0);
107 CJS_PointsArray pointsArray;
108 FX_BOOL bPopupOpen = false;
109 CPDF_Rect popupArray;
110 FX_BOOL bPrint = true;
111 FX_BOOL bReadOnly = false;
112 CPDF_Rect rectArray;
113 CFX_WideString cwSoundIcon;
114 CFX_ColorF strokecolor;
115 CFX_WideString cwStyle;
116 CFX_WideString cwSubject;
117 CFX_WideString cwTextFont;
118 int iTextSize = 0;
119 int iWidth = 0;
120 CJS_PointsArray verticesArray;
121 CJS_PointsArray gesturesArray;
122 CJS_PointsArray quadsArray;
123 CJS_PointsArray freecalloutArray;
124 float fOpacity = 0.0;
125 CFX_WideString cwBorderEffectStyle;
126 float fBorderEffectIntensity = 0.0;
127 int irotate = 0;
128
129 CFX_WideString cwNM;
130 CFX_WideString cwCreationDate;
131 CFX_WideString cwModDate;
132 CFX_WideString cwIntent;
133 FX_BOOL btoggleNoView = false;
134 FX_BOOL block = false;
135 FX_BOOL bnoView = false;
136 FX_BOOL bdoCaption = false;
137 std::vector<std::unique_ptr<js_RichText_data>> m_arrDefValue;
138 // FAA
139 CFX_WideString cwAttachmentPath;
140 // Stamp
141 CFX_WideString cwStampAP;
142 FX_BOOL bTransparentColor = false;
143 IFXJS_AnnotProvider* pAnnotAdd; // indicate setprops
144 };
145
147
157 class attachment : public CFXJS_EmbedObj
158 {
159 public:
160 attachment(CFXJS_Object* pJSObject);
161 virtual ~attachment();
162
163 void Initial(IFXJS_AnnotProvider* pAnnot)
164 {
165 m_pAnnot.Reset(pAnnot);
166 }
167
178 FX_BOOL name(OBJ_PROP_PARAMS);
179
190 FX_BOOL creationDate(OBJ_PROP_PARAMS);
191
202 FX_BOOL modDate(OBJ_PROP_PARAMS);
203
214 FX_BOOL MIMEType(OBJ_PROP_PARAMS);
215
226 FX_BOOL path(OBJ_PROP_PARAMS);
227
256 FX_BOOL size(OBJ_PROP_PARAMS);
257
274 FX_BOOL contentStream(OBJ_PROP_PARAMS);
275
276 private:
277 IFXJS_AnnotProvider::Observer m_pAnnot;
278 };
279
280 class CFXJS_Attachment : public CFXJS_Object
281 {
282 public:
283 CFXJS_Attachment(CFXJS_Runtime* pRuntime)
284 : CFXJS_Object(pRuntime)
285 {
286 }
287 virtual ~CFXJS_Attachment() {}
288
289 DECLARE_JS_CLASS(CFXJS_Attachment);
290
291 JS_STATIC_PROP(name, attachment);
292 JS_STATIC_PROP(creationDate, attachment);
293 JS_STATIC_PROP(modDate, attachment);
294 JS_STATIC_PROP(MIMEType, attachment);
295 JS_STATIC_PROP(path, attachment);
296 JS_STATIC_PROP(size, attachment);
297 JS_STATIC_PROP(contentStream, attachment);
298 };
300
317 class Annotation : public CFXJS_EmbedObj
318 {
319 public:
320 Annotation(CFXJS_Object* pJSObject);
321 virtual ~Annotation();
322 bool CheckBaseExpects() override
323 {
324 return (bool)m_pAnnot;
325 }
326 static void GetPointsArray(FXJSE_HVALUE hPropValue,
327 CFXJS_Runtime* pRuntime,
328 CJS_PointsArray& pPointsArray);
329 static FX_BOOL ParserParams(JSFXObject pObj,
330 CFXJS_AnnotObj& annotobj,
331 CFXJS_Runtime* pRuntime,
332 IFXJS_DocumentProvider* pDocument,
333 CFX_RectArray& rcWordquads,
334 FX_BOOL bIgnoreAttachmentPath = false);
335
336 public:
362 FX_BOOL alignment(OBJ_PROP_PARAMS);
363
397 FX_BOOL AP(OBJ_PROP_PARAMS);
398
424 FX_BOOL arrowBegin(OBJ_PROP_PARAMS);
425
452 FX_BOOL arrowEnd(OBJ_PROP_PARAMS);
453
472 FX_BOOL attachIcon(OBJ_PROP_PARAMS);
473
474 FX_BOOL attachment(OBJ_PROP_PARAMS);
497 FX_BOOL author(OBJ_PROP_PARAMS);
498
522 FX_BOOL borderEffectIntensity(OBJ_PROP_PARAMS);
523
547 FX_BOOL borderEffectStyle(OBJ_PROP_PARAMS);
548
571 FX_BOOL callout(OBJ_PROP_PARAMS);
572
596 FX_BOOL caretSymbol(OBJ_PROP_PARAMS);
597
624 FX_BOOL contents(OBJ_PROP_PARAMS);
646 FX_BOOL creationDate(OBJ_PROP_PARAMS);
647
670 FX_BOOL dash(OBJ_PROP_PARAMS);
671
693 FX_BOOL delay(OBJ_PROP_PARAMS);
694
718 FX_BOOL doc(OBJ_PROP_PARAMS);
719
742 FX_BOOL doCaption(OBJ_PROP_PARAMS);
743
775 FX_BOOL fillColor(OBJ_PROP_PARAMS);
776
802 FX_BOOL gestures(OBJ_PROP_PARAMS);
803
827 FX_BOOL hidden(OBJ_PROP_PARAMS);
828
852 FX_BOOL inReplyTo(OBJ_PROP_PARAMS);
853
884 FX_BOOL intent(OBJ_PROP_PARAMS);
885
912 FX_BOOL leaderExtend(OBJ_PROP_PARAMS);
913
939 FX_BOOL leaderLength(OBJ_PROP_PARAMS);
940
969 FX_BOOL lineEnding(OBJ_PROP_PARAMS);
970
993 FX_BOOL lock(OBJ_PROP_PARAMS);
994
1012 FX_BOOL modDate(OBJ_PROP_PARAMS);
1013
1035 FX_BOOL name(OBJ_PROP_PARAMS);
1036
1063 FX_BOOL noteIcon(OBJ_PROP_PARAMS);
1064
1090 FX_BOOL noView(OBJ_PROP_PARAMS);
1091
1115 FX_BOOL opacity(OBJ_PROP_PARAMS);
1116
1134 FX_BOOL page(OBJ_PROP_PARAMS);
1135
1160 FX_BOOL point(OBJ_PROP_PARAMS);
1161
1188 FX_BOOL points(OBJ_PROP_PARAMS);
1189
1210 FX_BOOL popupOpen(OBJ_PROP_PARAMS);
1211
1235 FX_BOOL popupRect(OBJ_PROP_PARAMS);
1236
1257 FX_BOOL print(OBJ_PROP_PARAMS);
1258
1282 FX_BOOL quads(OBJ_PROP_PARAMS);
1283
1304 FX_BOOL readOnly(OBJ_PROP_PARAMS);
1305
1328 FX_BOOL rect(OBJ_PROP_PARAMS);
1329
1352 FX_BOOL refType(OBJ_PROP_PARAMS);
1353 FX_BOOL richContents(OBJ_PROP_PARAMS);
1354 FX_BOOL richDefaults(OBJ_PROP_PARAMS);
1355 FX_BOOL rotate(OBJ_PROP_PARAMS);
1356 FX_BOOL seqNum(OBJ_PROP_PARAMS);
1357
1379 FX_BOOL soundIcon(OBJ_PROP_PARAMS);
1380 FX_BOOL state(OBJ_PROP_PARAMS);
1381 FX_BOOL stateModel(OBJ_PROP_PARAMS);
1382
1404 FX_BOOL strokeColor(OBJ_PROP_PARAMS);
1405
1428 FX_BOOL style(OBJ_PROP_PARAMS);
1429
1452 FX_BOOL subject(OBJ_PROP_PARAMS);
1453
1481 FX_BOOL textFont(OBJ_PROP_PARAMS);
1482
1501 FX_BOOL textSize(OBJ_PROP_PARAMS);
1502
1531 FX_BOOL toggleNoView(OBJ_PROP_PARAMS);
1532
1569 FX_BOOL type(OBJ_PROP_PARAMS);
1570 FX_BOOL subType(OBJ_PROP_PARAMS);
1571
1597 FX_BOOL vertices(OBJ_PROP_PARAMS);
1598
1621 FX_BOOL width(OBJ_PROP_PARAMS);
1622 FX_BOOL guid(OBJ_PROP_PARAMS);
1623 FX_BOOL pageIndex(OBJ_PROP_PARAMS);
1624
1635 FX_BOOL destroy(OBJ_METHOD_PARAMS);
1636 FX_BOOL exportToXFDF(OBJ_METHOD_PARAMS);
1637 FX_BOOL setProps(OBJ_METHOD_PARAMS);
1638 FX_BOOL getProps(OBJ_METHOD_PARAMS);
1639 FX_BOOL getStateInModel(OBJ_METHOD_PARAMS);
1640 FX_BOOL transitionToState(OBJ_METHOD_PARAMS);
1641
1642 public:
1643 void Initial(Doc* pDocument, IFXJS_AnnotProvider* pAnnot, CFXJS_AnnotObj& AnnotobjProp);
1644 void SetChangeNotity();
1645 JS_ANNOTTYPE GetAnnotType();
1646
1647 public:
1648 static void UpdateAnnot(IFXJS_AnnotProvider* pAnnot, FX_BOOL bResetApp, FX_BOOL bRefresh);
1649 static FX_BOOL CheckAllow(const CFX_WideString& string);
1650
1651 static IFXJS_AnnotProvider* AddAnnot(IFXJS_DocumentProvider* pDocument,
1652 CFXJS_AnnotObj& annotobj);
1653 static void SetAlignment(IFXJS_AnnotProvider* pAnnot, int nAlignment);
1654 static void ArrowBegin(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwBegin);
1655 static void ArrowEnd(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwEnd);
1656 static void AttachIcon(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwAttachIcon);
1657 static void Author(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwAuthor);
1658 static void BorderEffectStyle(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwBorderEffectStyle);
1659 static void BorderEffectIntensity(IFXJS_AnnotProvider* pAnnot, float fBorderEffectIntensity);
1660 static void CallOut(IFXJS_AnnotProvider* pAnnot, CJS_PointsArray* calloutArray);
1661 static void CaretSymbol(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwSymbol);
1662 static void Contents(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwContents);
1663 static void Dash(IFXJS_AnnotProvider* pAnnot, CJS_IntArray* dashArray);
1664 static void FillColor(IFXJS_AnnotProvider* pAnnot, CFX_ColorF fillcolor);
1665 static void Gestures(IFXJS_AnnotProvider* pAnnot, CJS_PointsArray* gesturesArray);
1666 static void Hidden(IFXJS_AnnotProvider* pAnnot, FX_BOOL bHide);
1667 static void NoView(IFXJS_AnnotProvider* pAnnot, FX_BOOL bNoView);
1668 static void LeaderExtend(IFXJS_AnnotProvider* pAnnot, int iLeaderExtend);
1669 static void LeaderLength(IFXJS_AnnotProvider* pAnnot, int iLeaderLength);
1670 static void LineEnding(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwLineEnding);
1671 static void Name(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwName);
1672 static void NoteIcon(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwNoteIcon);
1673 static void Opacity(IFXJS_AnnotProvider* pAnnot, float fOpacity);
1674 static void Point(IFXJS_AnnotProvider* pAnnot, CPDF_Point pointArray);
1675 static void Points(IFXJS_AnnotProvider* pAnnot, CJS_PointsArray* pointsArray);
1676 static void PopupOpen(IFXJS_AnnotProvider* pAnnot, FX_BOOL bOpen);
1677 static void PopupRect(IFXJS_AnnotProvider* pAnnot, CPDF_Rect popupArray);
1678 static void BPrint(IFXJS_AnnotProvider* pAnnot, FX_BOOL bPrint);
1679 static void BReadOnly(IFXJS_AnnotProvider* pAnnot, FX_BOOL bRead);
1680 static void Rect(IFXJS_AnnotProvider* pAnnot, CPDF_Rect rectArray);
1681 static void SoundIcon(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwSoundIcon);
1682 static void StrockColor(IFXJS_AnnotProvider* pAnnot, CFX_ColorF strokecolor);
1683 static void SetStyle(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwStyle);
1684 static void Subject(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwSubject);
1685 static void TextFont(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwTextFont);
1686 static void TextSize(IFXJS_AnnotProvider* pAnnot, int iTextSize);
1687 static void SetWidth(IFXJS_AnnotProvider* pAnnot, int iWidth);
1688 static void Vertices(IFXJS_AnnotProvider* pAnnot, CJS_PointsArray* verticesArray);
1689 static void Quads(IFXJS_AnnotProvider* pAnnot, CJS_PointsArray* quadsArray);
1690
1691 static void SetDA(IFXJS_AnnotProvider* pAnnot, FX_COLORREF Colo);
1692 static void SetCreationDate(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwDate);
1693 static void SetRichcontents(IFXJS_AnnotProvider* pAnnot, CFXJS_AnnotObj& annotobj);
1694 static CFX_WideString GetStyle(js_RichText_data* data, CFXJS_AnnotObj& annotobj);
1695 static CFX_ByteString GetRVXML(IFXJS_AnnotProvider* pAnnot, CFXJS_AnnotObj& annotobj);
1696 static void SetModDate(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwDate);
1697 static void setcalloutLine(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwLineEnding);
1698 static void setIntent(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwtintent);
1699 static void SetRotate(IFXJS_AnnotProvider* pAnnot, int rotate);
1700 static void NoLock(IFXJS_AnnotProvider* pAnnot, FX_BOOL bNoLock);
1701 static void NoToggleNoView(IFXJS_AnnotProvider* pAnnot, FX_BOOL bNoToggleNoView);
1702 static void SetCaption(IFXJS_AnnotProvider* pAnnot, FX_BOOL bCaption);
1703
1704 static FX_BOOL SetStartPoint(IFXJS_AnnotProvider* pAnnot, const CPDF_Point& point);
1705 static FX_BOOL SetEndPoint(IFXJS_AnnotProvider* pAnnot, const CPDF_Point& point);
1706
1707 static void DoDelay(CFXJS_AnnotObj* pData);
1708 void SetDelay(FX_BOOL bDelay);
1709
1710 static void SetDefaultRect(CPDF_Rect& defArray);
1711 static void SetDefaultQuads(IFXJS_AnnotProvider* pAnnot);
1712 static IFXJS_AnnotProvider* AddLine(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1713 static IFXJS_AnnotProvider* AddCircle(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1714 static IFXJS_AnnotProvider* AddSquare(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1715 static IFXJS_AnnotProvider* AddPolygon(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1716 static IFXJS_AnnotProvider* AddPolyline(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1717 static IFXJS_AnnotProvider* AddInk(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1718 static IFXJS_AnnotProvider* AddUnderline(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1719 static IFXJS_AnnotProvider* AddHighlight(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1720 static IFXJS_AnnotProvider* AddCaret(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1721 static IFXJS_AnnotProvider* AddSquiggly(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1722 static IFXJS_AnnotProvider* AddStrikeOut(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1723 static IFXJS_AnnotProvider* AddFileAttachment(IFXJS_AppProvider* pApp,
1724 IFXJS_PageProvider* pPage,
1725 CFXJS_AnnotObj& annotobj);
1726 static IFXJS_AnnotProvider* AddText(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1727 static IFXJS_AnnotProvider* AddFreeText(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1728 static IFXJS_AnnotProvider* AddStamp(IFXJS_PageProvider* pPage, CFXJS_AnnotObj& annotobj);
1729
1730 static CFX_ByteString GetAnnotSubtype(IFXJS_AnnotProvider* pAnnot, CPDF_Dictionary* pAnnotDict);
1731 // faa
1732 static FX_BOOL AttachFile(IFXJS_AnnotProvider* pAnnot, CFX_WideString cwAttachPath);
1733
1734 static bool GetErrorMsg(CFX_ByteString& errorName);
1735 static void ResetErrorMsg();
1736
1737 private:
1738 static CPDF_Array* GetColorsArray(CFX_ColorF pwlcolor);
1739
1740 public:
1741 FX_BOOL ICommentsAnnotExportAnnotToXFDF();
1742 static FX_BOOL OnExportXFDFMessasge(IFXJS_AnnotProvider* pAnnot, CFX_Object* JsDoc);
1743
1744 private:
1745 FX_BOOL IsValidAnnot();
1746
1747 private:
1748 Doc* m_pDocument;
1749 IFXJS_AnnotProvider* m_pAnnot;
1750 IFXJS_AnnotProvider::Observer m_pAnnotObserver;
1751 CFXJS_AnnotObj m_AnnotobjProp;
1752 static CFX_ByteString m_ErrorString;
1753 // std::unique_ptr<BasicEventInfo> m_hValueExportAnnotToXFDFFunc; //cpdf
1754 };
1755
1756 class CFXJS_Annotation : public CFXJS_Object
1757 {
1758 public:
1759 CFXJS_Annotation(CFXJS_Runtime* pRuntime)
1760 : CFXJS_Object(pRuntime){};
1761 virtual ~CFXJS_Annotation(){};
1762
1763 public:
1764 DECLARE_JS_CLASS(CFXJS_Annotation);
1765
1766 JS_STATIC_PROP(alignment, Annotation);
1767 JS_STATIC_PROP(AP, Annotation);
1768 JS_STATIC_PROP(arrowBegin, Annotation);
1769 JS_STATIC_PROP(arrowEnd, Annotation);
1770 JS_STATIC_PROP(attachIcon, Annotation);
1771 JS_STATIC_PROP(attachment, Annotation);
1772 JS_STATIC_PROP(author, Annotation);
1773 JS_STATIC_PROP(borderEffectIntensity, Annotation);
1774 JS_STATIC_PROP(borderEffectStyle, Annotation);
1775 JS_STATIC_PROP(callout, Annotation);
1776 JS_STATIC_PROP(caretSymbol, Annotation);
1777 JS_STATIC_PROP(contents, Annotation);
1778 JS_STATIC_PROP(creationDate, Annotation);
1779 JS_STATIC_PROP(dash, Annotation);
1780 JS_STATIC_PROP(delay, Annotation);
1781 JS_STATIC_PROP(doc, Annotation);
1782 JS_STATIC_PROP(doCaption, Annotation);
1783 JS_STATIC_PROP(fillColor, Annotation);
1784 JS_STATIC_PROP(gestures, Annotation);
1785 JS_STATIC_PROP(hidden, Annotation);
1786 JS_STATIC_PROP(inReplyTo, Annotation);
1787 JS_STATIC_PROP(intent, Annotation);
1788 JS_STATIC_PROP(leaderExtend, Annotation);
1789 JS_STATIC_PROP(leaderLength, Annotation);
1790 JS_STATIC_PROP(lineEnding, Annotation);
1791 JS_STATIC_PROP(lock, Annotation);
1792 JS_STATIC_PROP(modDate, Annotation);
1793 JS_STATIC_PROP(name, Annotation);
1794 JS_STATIC_PROP(noteIcon, Annotation);
1795 JS_STATIC_PROP(noView, Annotation);
1796 JS_STATIC_PROP(opacity, Annotation);
1797 JS_STATIC_PROP(page, Annotation);
1798 JS_STATIC_PROP(point, Annotation);
1799 JS_STATIC_PROP(points, Annotation);
1800 JS_STATIC_PROP(popupOpen, Annotation);
1801 JS_STATIC_PROP(popupRect, Annotation);
1802 JS_STATIC_PROP(print, Annotation);
1803 JS_STATIC_PROP(quads, Annotation);
1804 JS_STATIC_PROP(readOnly, Annotation);
1805 JS_STATIC_PROP(rect, Annotation);
1806 JS_STATIC_PROP(refType, Annotation);
1807 JS_STATIC_PROP(richContents, Annotation);
1808 JS_STATIC_PROP(richDefaults, Annotation);
1809 JS_STATIC_PROP(rotate, Annotation);
1810 JS_STATIC_PROP(seqNum, Annotation);
1811 JS_STATIC_PROP(soundIcon, Annotation);
1812 JS_STATIC_PROP(state, Annotation);
1813 JS_STATIC_PROP(stateModel, Annotation);
1814 JS_STATIC_PROP(strokeColor, Annotation);
1815 JS_STATIC_PROP(style, Annotation);
1816 JS_STATIC_PROP(subject, Annotation);
1817 JS_STATIC_PROP(textFont, Annotation);
1818 JS_STATIC_PROP(textSize, Annotation);
1819 JS_STATIC_PROP(toggleNoView, Annotation);
1820 JS_STATIC_PROP(type, Annotation);
1821 JS_STATIC_PROP(subType, Annotation);
1822 JS_STATIC_PROP(vertices, Annotation);
1823 JS_STATIC_PROP(width, Annotation);
1824 JS_STATIC_PROP(guid, Annotation);
1825 JS_STATIC_PROP(pageIndex, Annotation);
1826
1827 JS_STATIC_METHOD(destroy, Annotation);
1828 JS_STATIC_METHOD(exportToXFDF, Annotation);
1829 JS_STATIC_METHOD(getProps, Annotation);
1830 JS_STATIC_METHOD(setProps, Annotation);
1831 JS_STATIC_METHOD(getStateInModel, Annotation);
1832 JS_STATIC_METHOD(transitionToState, Annotation);
1833 };
1834 } // namespace javascript
1835 #endif //_ANNOTATION_H_
Doc
This object provides the interface between a PDF Doc open in the viewer and the JavaScript interprete...
Definition: document.h:205
Annotation
This object represents an Foxit PDF Editor annotation. Annotations can be created using the Foxit PDF...
Definition: annotation.h:317
Span
A generic object that represents a length of text and its associated properties in a rich text form f...
Definition: span.h:18
attachment
The annotAttachment object represents the file stored as the attachment for a FileAttachment type ann...
Definition: annotation.h:157


Javascript API: Member List

Span Member List

This is the complete list of members for Span, including all inherited members.

alignment(OBJ_PROP_PARAMS) | Span
fontFamily(OBJ_PROP_PARAMS) | Span
fontStretch(OBJ_PROP_PARAMS) | Span
fontStyle(OBJ_PROP_PARAMS) | Span
fontWeight(OBJ_PROP_PARAMS) | Span
strikethrough(OBJ_PROP_PARAMS) | Span
subscript(OBJ_PROP_PARAMS) | Span
superscript(OBJ_PROP_PARAMS) | Span
text(OBJ_PROP_PARAMS) | Span
textColor(OBJ_PROP_PARAMS) | Span
textSize(OBJ_PROP_PARAMS) | Span
underline(OBJ_PROP_PARAMS) | Span