The app storage
Add an event listner of given event for the app.
A string representing the event type to listen for.
The event listner to be add to the event target.
Add a discovery card in home page
Options is used in creating a new discovery card. example:
{
title: "test",
icon: "http://test-color.svg",
description: "this is a test card",
url: "https://localhost:8080/panel.html",
buttonText: "hello",
index: 1
}
addDriver
driver Title
icon.
example:
let title = 'testDriver';
let icon = {
selected: 'http://driver-color.svg',
normal: 'http://driver-gray.svg'
};
Sets a custom font in the app for editing PDF text.
Before using this function, you should call setJRFontMaps() to map the available fonts.
example:
function example (pdfViewer) {
pdfViewer.addFontMaps([
{
"name": "SimSun",
"style": 34,
"charset": 134
}
])
}
Add a menu item in home page
Options is used in creating a new menu item example:
{
label:"test",
icon:"http://test-color.svg",
url:"http://localhost:8080/index1.html",
}
Add a Tooltip in page
Options is used in creating a tooltip example:
{
title: "title",
content: "content",
el: ".class-name" // or position:{x:100, y:100}
}
Instruct the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.
A string you want to display in the alert dialog
Check if Context Menu Exists
The plugin id.
the context menu.
menu Name.
closeDialog
void
Send event to the app.
The event to be sent.
To log in with your account
Driver download file
The file url.
The http headers. Referer: https://developer.mozilla.org/en-US/docs/Glossary/Request_header
The http Method. the value is 'POST' or 'GET'
The http params, user defined. example:
headers= {
'Content-type': 'application/json'
}
data = {} // user defined.
driverSetFileList
The driver Plugin id.
The file list. example:
success:
let filelst = [{
"id": "id:ABCDEFG",
"isFolder": true,
}, {
name: 'test.pdf',
id: 'file id',
modifiedTime: '2022-05-30T10:36:41Z',
size: 6438,
} ];
let result = {
"fileList":filelst
}
error:
let result = {
"error":{"errorMsg":"user define errorMsg"}
}
upload file result
The driverId
The upload result. example:
let result = {}
let result = {
"error":{"errorMsg":"errorMsg"}
}
driverSetUserInfo set UserInfo
The driver Plugin id
The user info. example:
let result = {
userInfo: {'id':"driverId",'title':userAccount},
};
let result = {
{"error":{"errorMsg":"errmsg"}}
}
Get the active pdf document of this app.
The active pdf document.
Get default style of annot
Get the AnnotManager
Get Editor colors
Get the title of the app.
The title of the app.
Get character size
unicode of character
let str = "hello";
let ret = await window.Foxit.ReaderApp.getCharBBox(1,str.charCodeAt(0));
Get character width in PDF by specific font
same with getCharBBox fontId @see getCharBBox
unicode of character
get the menu count.
Get the name of current active tool.
Get the Position and size of dialog according to Parameters: "pluginId" and "dlgId"
If the dialog corresponding to "dlgId" does not exist, it will return undefined
Get Ascent Descent
same with getCharBBox fontId @see getCharBBox
Used to specify numeric formatting based on language Settings.
the input number.
string - The language code, The built-in supported languages are these: 'en-US', 'zh-CN', 'de-DE', 'zh-TW', 'es-419', 'fr-FR', 'it-IT', 'ja-JP', 'nl-NL', 'ko-KR'.
Get the FormatTool of the app.
The FormatTool instance.
Get basic information of the app.
Checks if PDF js can be executed.
True means JavaScript can be executed, and false means the opposite.
get current Mesurement Units
Get the PageEditor of the app.
Get the RibbonBar of the app.
The RibbonBar instance.
get userinfo
Get the width and height of Editer online's viewport.
To check if the user is logged in
Open doc by blob.
Specify PDF file's stream.
The open file options.
Open doc by url.
The pdf url.
The open file options.
register For contenxt menu by index
The plugin id.
the context menu.
the position.
true: menu Name.
register For contenxt menu by name
The plugin id.
the context menu.
the target menuName.
menu Name.
: the customer directory value.
registerSecurityHandler Register the security handler to implement encryption and decryption functions.
The plugin id.
Indicates an encrypted dictionary.
true: success false: fail
Regiter a ToolHandler to the app.
The ToolHandler to be registered to the app.
Let the app to switch to specific tool.
The name of the tool to be switched to.
Configure printing settings.
Printing Settings.
Set the Position and size of dialog according to Parameters: "pluginId" and "dlgId"
Position and size of dialog
setDriverSignInResult
The sign in result,
Set app custom fonts.
example:
function example (pdfViewer) {
pdfViewer.setJRFontMap([{
nameMatches: [
// A string or regular expression that matches a literal name. Can be an empty array or unset.
/(helvetica)|(helveticabold)|(helveticaoblique)/,
],
glyphs: [
{
bold: 0x1f0, // 0b111110000 match 500,600,700,800,900 weight font
flags: 0x80000, // Font Descriptor Flags
url: 'NotoSans-Bold.ttf.brotli',
isBrotli: true,
},
{
bold: -1, // Matches any word width
flags: 0x80000,
url: 'NotoSans-Regular.ttf'
},
],
charsets:[0], //The charsets of the font.
}])
}
Custom fonts. The Settings are valid before opening the document.
Set whether JavaScript is allowed to be executed or not.
ShowDialog
The dialog title.
The iframe url.
The dialog rect. eg: { width: 790, height: 800, x: 0, y: 0 }
If dialog contains the header. default value: Frame
Customize dialog style. Only support padding and margin at present. The default value is empty object
void example:
window.Foxit.ReaderApp.showDialog(
'dlgId',
'12345',
'title',
'http://localhost:10001/demo.html',
{ width: 790, height: 800 },
'Frame',
{
padding: '0',
margin: '0',
}
);
Show A MessageBox
ShowWarningMessageParams example:
let ret = Foxit.ReaderApp.showWarningMessage({
message: 'hello world',
iconType: 'warning',
title: '12345',
ok: 'ok',
cancel: 'cancel'
});
string - Specifies the state handler's name. Currently, only the following types are supported. If you have any requirements, please contact us CreateSignStateHandler CreateTextStateHandler CreateDateStateHandler
undefined, At present, it is only used for signature purposes. Switch to real-time drawing status and do not pass this parameter. Please take a place and supplement it if needed in the future
unregister For contenxt menu by name
The plugin id.
the context menu.
the target menuName.
menu Name.
: the customer directory value.
unRegisterSecurityHandler UnRegister the security handler.
The plugin id.
Indicates an encrypted dictionary.
true: success false: fail
Represents the Foxit PDF Editor application.
This class offers functions to interact with the Foxit PDF Editor application.
To get the app, please use