GcDocs PDF Viewer constructor.
root container element or selector pattern used to select the root container element.
Viewer options. @see ViewerOptions for further information.
Product license key.
Activated editor mode name.
Gets all document annotations.
Ask the user if he want to leave the page when document is modified. Requires SupportApi.
Ask the user if he want to leave the page when document is modified. Requires SupportApi.
Indicates whether the open document can be edited using SupportApi. Requires SupportApi.
Specifies the current user name. The property is used by Annotation Editor as default value for 'author' field.
Specifies the current user name. The property is used by Annotation Editor as default value for 'author' field. Note, current user name is saved in the browser's local storage and it will be used on the next page reload if userName option is not set.
PDF document meta data loader. Used by some sidebar panels.
Internal event bus. Available event names are: outlineloaded, attachmentsloaded, namedaction, pagemode, fileattachmentannotation, pagerendered, pagecancelled, scalechange, pagesinit, pagesloaded, documentchanged, rotationchanging, updateviewarea, undostorechanged, show-custom-layout, hide-custom-layout, annotationeditstarted, unselectannotation, annotation-bounds-change, pagechange, mousemodechange, request-answer, textlayerready, viewersizechanged, articlebeadnavigate, error, open, pagelabels, documentload.
Gets the file data. Available when keepFileData option is set to true.
Gets the file name that was used to open the document. The file name is determined as follows:
Gets the PDF document file size in bytes.
Gets the URL that was used to open the document. Returns an empty string when the document was opened from binary data.
An unique document identifier.
Gets the GcPdf library version used by the SupportApi, if available.
Indicates whether the document has been modified by the user.
Indicates whether the copy buffer contains any data.
Indicates whether the document is loaded into view.
Gets a value indicating whether the active document has any form fields.
Gets a value indicating whether the viewer has a persistent connection to the server.
```javascript if(viewer.hasPersistentConnection) { viewer.listSharedDocuments().then(function(result) {
}); }
Gets a value indicating whether the pdf viewer can redo document changes. Requires SupportApi.
Indicates whether the Reply Tool has been added.
Gets a value indicating whether the pdf viewer can undo document changes. Requires SupportApi.
Determines whether the annotation layer is hidden.
Determines whether the annotation layer is hidden.
Gets a value indicating whether the active document is open in shared mode. Requires SupportApi.
Returns true if the active edit mode is sticked by the user. Indicates that the stickyBehavior for the active edit button is enabled and the button is checked. See the toolbarLayout.stickyBehavior property for details.
Gets a value indicating whether the editor mode is currently active.
Returns true if notifications suspended by calls to @see:beginUpdate.
Gets or sets the layout mode (0 - Viewer, 1 - AnnotationEditor or 2 - FormEditor).
Gets or sets the layout mode (0 - Viewer, 1 - AnnotationEditor or 2 - FormEditor).
Left sidebar API.
Gets current log level. Available log levels are: 'None', 'Critical', 'Error', 'Warning', 'Information', 'Debug', 'Trace'. Default level is 'None'.
Sets current log level. Available log levels are: 'None', 'Critical', 'Error', 'Warning', 'Information', 'Debug', 'Trace'. Default level is 'None'.
Gets modifications state for active document. Requires SupportApi.
After add annotation event.
The event raised when the user changes the viewer theme.
After remove annotation event.
After update annotation event.
Before add annotation event. The event is cancelable.
Occurs immediately before the document opens.
Before remove annotation event. The event is cancelable.
viewer.onBeforeRemoveAnnotation.register(function(args) {
console.log(args);
args.cancel = true; // set the cancel flag to cancel event.
});
Before update annotation event. The event is cancelable.
viewer.onBeforeUpdateAnnotation.register(function(args) {
console.log(args);
args.cancel = true; // set the cancel flag to cancel event.
});
The event indicating error.
Occurs when the viewer theme changed by user.
Default optional content config. An optional content is a collection of graphics that can be made visible or invisible dynamically.
The viewer options.
PDF viewer options.
Gets pages count.
Gets/sets the active page index.
Gets/sets the active page index.
Gets the required SupportApi version that is compatible with the current version of the GcPdfViewer.
Gets right sidebar object. Use this object if you want to manipulate the right sidebar.
Specifies the rotation in degrees.
Specifies the rotation in degrees.
Gets the scroll view HTML element. Note, the left scroll position is calculated by the viewer automatically - so, usually, you don't need to change left scroll position.
Document search worker instance. Searches currently opened document for a text.
// Highlight all search results without opening SearchPanel.
const searchIterator = viewer.searcher.search({ Text: "test", MatchCase: true, HighlightAll: true });
searchIterator.next();
searcher.applyHighlight();
// Iterate all search results
const searcher = viewer.searcher;
var searchResults = [];
const searchIterator = searcher.search({ Text: textToSearch, MatchCase: true });
var searchResult = await searchIterator.next();
if (searchResult.value)
searcher.highlight(searchResult.value)
while (searchResult.value && !searchResult.done) {
const searchResultValue = searchResult.value;
searchResults.push(`index: ${searchResultValue.ItemIndex}, text: ${searchResultValue.DisplayText}, pageIndex: ${searchResultValue.PageIndex}`);
searchResult = await searchIterator.next();
}
console.log("Search results: " + (searchResults.length ? searchResults.join("; ") : "No search results"));
Second toolbar API.
Second toolbar layout. Use the secondToolbarLayout property to configure available tools.
Second toolbar layout. Use the secondToolbarLayout property to configure available tools.
Returns data storage which can be used to store and retrieve current signature tool settings and images. Please, note, the storage data depends on current user name, @see:currentUserName property
Data storage for the active document.
Structure tree data.
A promise that is resolved with a
{@link StructTreeNode[]} objects that represents the page's structure tree,
or null
when no structure tree is present for the page.
Gets the SupportApi client. Requires SupportApi.
Gets the connected version of the SupportApi, if available.
Defines the layout of the toolbar for different viewer modes: viewer, annotationEditor, formEditor.
Defines the layout of the toolbar for different viewer modes: viewer, annotationEditor, formEditor.
Gets the number of levels(commands) on the undo stack. Requires SupportApi.
Gets the index of the current Undo level (command). This is the Undo command that will be executed on the next call to redoChanges(). Requires SupportApi.
The current state of the undo store. Note that this property is read-only, do not programmatically change the elements of the collection. Use the Undo API methods to change the viewer's editor state. Undo API properties: hasUndoChanges, hasRedoChanges, undoIndex, undoCount Undo API methods: undoChanges(), redoChanges()
Returns the current version of the GcDocs PDF viewer.
Gets initial viewer preferences.
Gets/sets the current zoom node. Accepted values are: 0 - Value, 1 - PageWidth, 2 - WholePage.
// Set zoom mode to 'WholePage'
viewer.zoomMode = 2;
Gets/sets the current zoom node. Accepted values are: 0 - Value, 1 - PageWidth, 2 - WholePage.
Gets/sets the current zoom percentage level.
Gets/sets the current zoom percentage level.
Gets i18next instance which can be used to add viewer translations. See https://www.i18next.com for details about i18next framework.
Add annotation to document. Requires SupportApi.
Add annotation editor panel. Requires SupportApi.
Add articles panel.
Add attachments panel.
Add default set of sidebar panels with default order: 'Thumbnails', 'Search', 'Outline', 'Layers', 'StructureTree', 'Attachments'
Adds document list panel to the Viewer with available document array specified in documentslist.json file (URL specified by documentListUrl option), located in the root directory of your application. You can specify service at the end point for documentListUrl option. The service should return JSON string with available documents array, e.g.: ["pdf1.pdf", "pdf2.pdf"]
Optional. Document list service URL.
Add form editor panel. Requires SupportApi.
Add optional content layers panel.
Add outline panel.
Enable the Text Annotation Reply Tool. Note, in order to enable ability to edit/remove or add existing replies you need to configure SupportApi, otherwise the Reply Tool will be in read-only mode.
pass 'expanded' value if you wish the Reply tool to be expanded initially. Default value is collapsed.
Add Search panel.
Add a panel with a list of shared documents.
Add stamp annotation.
Uint8Array, binary image data.
Add sticky note to the document. Requires SupportApi.
page relative point. Origin is top/left. Note, pageIndex must be specified.
Add Thumbnails panel
Adds a css style to the view area.
style element identifier.
Call this method in order to apply changed options.
Call this method in order to apply changes in @see:toolbarLayout.
Suspends notifications until the next call to @see:endUpdate.
This method changes coordinate system origin for rectangle given by parameter bounds and returns converted rectangle value;
Page index (Zero based).
bounds array: [x1, y1, x2, y2]
Source coordinate system origin. Possible values are: 'TopLeft' or 'BottomLeft'.
Destination coordinate system origin. Possible values are: 'TopLeft' or 'BottomLeft'.
Optional. Default is true. Normalize rectangle [x1, y1, x2, y2] so that (x1,y1) < (x2,y2).
This method changes coordinate system origin for y coordinate given by parameter y and returns converted value.
Converts the origin of the Y coordinate to the bottom.
Converts the origin of the Y coordinate to the top.
Clone annotation or field given by parameter annotation. Requires SupportApi.
Annotation to clone.
Closes the currently open document.
Closes the side panel.
Optional. Panel handle or panel id to close.
Delete page. Requires SupportApi.
page index to delete.
Use this method to close and release resources occupied by the GcPdfViewer.
Downloads the PDF document loaded in the Viewer to the local disk.
the destination file name.
Resumes notifications suspended by calls to @see:beginUpdate.
Execute Copy action (Ctrl + C shortcut). Requires SupportApi.
data to copy.
Execute Cut action (Ctrl + X shortcut). Requires SupportApi.
data to cut.
Execute Delete action (DEL shortcut). Requires SupportApi.
data to delete.
Execute Paste action (Ctrl + V shortcut). Requires SupportApi.
insert position.
Find annotation(s) within opened document. Returns promise which will be resolved with search results.
Find query.
Find parameters. By default annotation will be searched by id without page index constraint.
Gets meta data information for the current document.
Gets security information for the current document.
Get event object.
Returns position of the page view relative to the browser window.
Get the page rotation value.
Include view rotation, default is true.
Returns the page size. By default, return size without scale, pass true for the includeScale argument if you want to get the scaled value.
Page index (Zero based).
Optional. If true, the method will return scaled value.
Get page annotations tabs order. A name specifying the tab order that shall be used for annotations on the page. Possible values are: R - Row order. C - Column order. S - Structure order (not supported by GcPdfViewer). A - Annotations order. This order refers to the order of annotation in the annotations collection. W - Widgets order . This order uses the same ordering as "Annotations" order, but two passes are made, the first only picking the widget annotations and the second picking all other annotations.
Returns the contents of the text selection.
Get information about signature used in document.
Returns PDF page view port information.
Page index (Zero based).
Object containing following fields: { viewBox: // Original page bounds: [x1, y1, x2, y2]. // If you want to know original page's width/height, you can get it using viewBox values: // var pageWidth = viewBox[2] - viewBox[0]; // var pageHeight = viewBox[3] - viewBox[1]; width: // Current width of the page in user space (scale and rotation values are applied), height: // Current height of the page in user space (scale and rotation values are applied) scale: // Active scale value rotation: // Active rotation value }
Move back in the document history.
Move forward in the document history.
Go to the first page.
Go to the last page.
Go to the next page.
Go to the page with the specific page index.
Go to the page with the specific page number (numbering starts at 1).
Go to the previous page.
Hide second toolbar.
Ensures that all visual child elements of the viewer are properly updated for layout. Call this method to update the size of the inner content when the viewer is dynamically resized.
The method loads the page at the index specified by the pageIndex parameter, and scrolls the page into the view.
Destination page index.
Array with destination information. destArray[0] // not used, can be null, pdf page reference (for internal use only). destArray[1] // contains destination view fit type name: { name: 'XYZ' } - Destination specified as top-left corner point and a zoom factor (the lower-left corner of the page is the origin of the coordinate system (0, 0)). { name: 'Fit' } - Fits the page into the window { name: 'FitH' } - Fits the widths of the page into the window { name: 'FitV' } - Fits the height of the page into a window. { name: 'FitR' } - Fits the rectangle specified by its top-left and bottom-right corner points into the window. { name: 'FitB' } - Fits the rectangle containing all visible elements on the page into the window. { name: 'FitBH' } - Fits the width of the bounding box into the window. { name: 'FitBV' } - Fits the height of the bounding box into the window. destArray[2] // x position offset destArray[3] // y position offset (note, the lower-left corner of the page is the origin of the coordinate system (0, 0)) destArray[4] // can be null, contains bounding box width when view name is FitR, contains scale when view name is XYZ, destArray[5] // can be null, contains bounding box height when view name is FitR
Returns the boolean promise that resolves when the page is fully loaded (including text and annotation layers) and scrolled. A promise is resolved with false value when the page does not exist or an error occurs, otherwise the promise is resolved with true value.
Load an updated document list into document list panel.
Optional. Document list service URL.
Loads the updated list of shared documents into the shared documents panel.
Lock annotation for editing.
annotation id
Creates and opens a new blank document. Requires SupportApi.
Parameters object: fileName - name of the file for a new document, confirm - show confirmation dialog if there are changes in the document.
Adds a blank page to the document. Requires SupportApi.
parameters object: width - page width in points, height - page height in points, pageIndex - target page index.
Open PDF document.
URL to PDF document(string) or binary data(Typed array - Uint8Array).
Loading parameters object.
Show the file open dialog where the user can select the PDF file.
Opens the side panel.
Panel handle or panel id to open.
Open shared document.
Convert a PDF date string to a JavaScript 'Date' object. The PDF date string format is described in section 7.9.4 of the official PDF 32000-1:2008 specification.
Opens the browser's print document dialog box.
Redo document changes. Requires SupportApi.
Remove annotation from document. Requires SupportApi.
Removes a css style from the view area by its id.
style element identifier.
Repaint pages. This method also redraws the page annotations.
If specified, page indices to be redrawn, otherwise, this method redraws visible pages.
Reset form values.
Resolve page index using PDF page reference.
Save the modified PDF document to the local disk. Requires SupportApi.
Destination file name.
Additional save settings.
Saves the pages of the current PDF document as PNG images, zips the result images, and downloads the result zip archive. Requires SupportApi.
optional, destination zip archive file name.
Additional save settings.
Upload local changes to server. Requires SupportApi.
Scroll annotation into view.
Scroll page into view.
object. Scroll parameters: pageNumber - number. Page number. destArray - Array with destination information: destArray[0] // not used, can be null, pdf page reference (for internal use only). destArray[1] // contains destination view fit type name: { name: 'XYZ' } - Destination specified as top-left corner point and a zoom factor (the lower-left corner of the page is the origin of the coordinate system (0, 0)). { name: 'Fit' } - Fits the page into the window { name: 'FitH' } - Fits the widths of the page into the window { name: 'FitV' } - Fits the height of the page into a window. { name: 'FitR' } - Fits the rectangle specified by its top-left and bottom-right corner points into the window. { name: 'FitB' } - Fits the rectangle containing all visible elements on the page into the window. { name: 'FitBH' } - Fits the width of the bounding box into the window. { name: 'FitBV' } - Fits the height of the bounding box into the window. destArray[2] // x position offset destArray[3] // y position offset (note, the lower-left corner of the page is the origin of the coordinate system (0, 0)) destArray[4] // can be null, contains bounding box width when view name is FitR, contains scale when view name is XYZ, destArray[5] // can be null, contains bounding box height when view name is FitR
Select the annotation to edit. Requires SupportApi.
Page index (zero based) or annotation id.
Annotation id or annotation object itself.
Use the setAnnotationBounds method to set the position and / or size of the annotation.
annotation object or annotation id.
Destination bounds - x, y, width and height are optional.
Source coordinate system origin. Default is TopLeft
Select annotation after editing. Default is false.
Set the absolute page rotation in degrees. Valid values are 0, 90, 180, and 270 degrees. Requires SupportApi.
Set page size. Requires SupportApi.
Set page annotations tabs order. A name specifying the tab order that shall be used for annotations on the page. Possible values are: R - Row order. C - Column order. S - Structure order (not supported by GcPdfViewer). A - Annotations order. This order refers to the order of annotation in the annotations collection. W - Widgets order . This order uses the same ordering as "Annotations" order, but two passes are made, the first only picking the widget annotations and the second picking all other annotations.
Set active viewer theme.
theme name, specified in themes option.
Displays 'Form filler' dialog.
Shows the message for the user.
Show PDF Organizer dialog.
Show a second toolbar with a key specified by the toolbarKey argument.
Displays the 'Add Signature' dialog. Requires SupportApi.
Optional. These settings will take priority over signSettings option.
Executes "Submit A Form action" to send filled form data to a web server or email. Form data is submitted as HTML form using HTML submit method.
Trigger event.
Undo document changes. Requires SupportApi.
Unlock annotation for editing.
annotation id
Reset annotation selection. Requires SupportApi.
Update annotation. Requires SupportApi.
Promise, resolved by updated annotation object.
Update multiple annotations at the same time. Requires SupportApi.
Promise, resolved by updated annotation objects.
Update radio buttons group given by parameter fieldName with new field value.
Grouped radio buttons field name
New fieldValue
skipPageRefresh boolean - set to true if you don't need to update page display. Default is false. propertyName string - property name to update. Default is "fieldValue".
Promise resolved by boolean value, true - radio buttons updated, false - an error occurred.
Use this method to validate an active form and get the validation result.
Optional. The validator function which will be called for each field in the form. You can return a string value with message about validation error, this message will be shown in UI. Return true or null for success result.
Optional. Pass true if you don't want to display any messages to the user, but just want to get the final validation result.
Optional. Pass true to skip validation using field attributes such as required, min, max, minLength, maxLength, email and pattern, these attributes will be ignored.
Returns true if validation was successful, false, or a string with a validation error message when validation is failed.
Gets the viewer instance using the host element or host element selector
GcDocs PDF Viewer control.