ebs.openPdfEditor

(FintechOS Studio 24.4.3 and later)

Opens a PDF document stored in a file attribute in the PDF editor.

Syntax

Copy
ebs.openPdfEditor(fileInfo : IPdfEditorFileInfo, options? : IPdfEditorOptions): void
 
Parameter Data Type Description
fileInfo IPdfEditorFileInfo Metadata required to locate the PDF document.
options (optional) IPdfEditorOptions Configuration options used to initialize and customize the PDF editor and track file updates.
IMPORTANT!  
Saving a PDF document from the editor changes the file's real name. For subsequent file operations, you can use the listener callback in the options parameter to track the real name updates instead of refreshing the session context.

Returns

void

Opens the PDF editor interface. File save events can be handled through the optional listener callback.

Interfaces

IPdfEditorFileInfo

Metadata for a PDF document stored in a file attribute.

Copy
interface IPdfEditorFileInfo {
    entityName: string;
    attrName:  string;
    fileRealName: string;
    fileName: string;
    recordId?: string;
    entityExtension?: string;
}
 
Property Type Description
entityName string The name of the entity that owns the file.
attrName string The name of the file-type attribute that stores the file.
fileName string The name of the PDF document.
fileRealName string The full name of the file, including its unique identifier and file extension. The file must be in PDF format.
recordId (optional) string The identifier of the entity record that contains the file.
entityExtension (optional) string If the file is stored in an entity extension, use this to specify the name of the extension.

IPdfEditorOptions

Configuration options used to initialize and customize the PDF editor.

Copy
interface IPdfEditorOptions {
    containerId?: 'pdf-editor-container' | string;
    theme?: 'light-blue' | 'viewer' | 'light' | 'dark' | 'dark-yellow';
    readOnly?: boolean;
    listener?: (event: IPdfEditorUploadEvent)=>Promise<void> | void;
}
 
Property Type Description
containerId
(optional)
'pdf-editor-container' | string ID of the DOM element where the editor will be rendered. pdf-editor-container is the ID of the default editor container, which is created automatically.
theme
(optional)
'light-blue' | 'viewer' | 'light' | 'dark' | 'dark-yellow' Sets the visual theme of the editor. Default: light.
readOnly
(optional)
boolean

Determines whether the document can be saved:

  • true - disables saving
  • false - saving is enabled
listener
(optional)
(event: IPdfEditorUploadEvent) => Promise<void> | void

Callback invoked when the PDF editor saves a document. The callback receives an event payload implementing the IPdfEditorUploadEvent interface. It may return a Promise to perform asynchronous operations, otherwise it executes synchronously.

IPdfEditorUploadEvent

Event payload passed to the listener callback when the PDF editor saves a document.

Copy
interface IPdfEditorUploadEvent {
    data: IPdfEditorFile[] | { error: string };
    context: IPdfEditorFileInfo;
}
 
Property Type Description
data IPdfEditorFile[] | { error: string } Result of the save operation. On success, this contains an array of IPdfEditorFile objects representing the saved files. If an error occurs, the object contains an error property describing the failure.
context IPdfEditorFileInfo Metadata describing the PDF document that was opened in the editor.

IPdfEditorFile

Metadata describing a file saved by the PDF editor.

Copy
interface IPdfEditorFile {
    Name: string;
    RealName: string;
}
 
Property Type Description
Name string The name of the PDF document.
RealName string

The full name of the file, including its unique identifier and file extension.

IMPORTANT!  
The file's real name changes every time the PDF editor saves the document.

Examples