FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
Thumbnail Class Reference

Represents a Thumbnail Addon in the PDFUI. More...

Inheritance diagram for Thumbnail:
UIXAddon

Public Member Functions

 getZoomScale ()
 Retrieves the current zoom scale value of the thumbnail view in the sidebar. More...
 
 onSelectThumbnail (callback)
 Registers event listeners to track the selection and deselection of thumbnail items. More...
 
 zoomTo (scale)
 Zooms the thumbnail view of the sidebar to a specified scale. More...
 
- Public Member Functions inherited from UIXAddon
 afterMounted (root)
 Lifecycle method: this method is called after the UI component element mout into DOM tree. More...
 
 beforeMounted (root)
 Lifecycle method: this hook is called before the UI component element mount into DOM tree. More...
 
 destroy ()
 Lifecycle method: to override this method to implement the destroying logics. This method is called when a PDFUI instance is destroyed or the addon is dettached from PDFUI. More...
 
 fragments ()
 UI fragment configurations of this addon. More...
 
 getI18NResources ()
 Get I18n resources. More details about I18Next, please visit: https://www.i18next.com/. More...
 
static getName ()
 Returns the name of an addon. More...
 
 init (pdfui)
 Called when initializing this addon instance. More...
 
 pdfViewerCreated (pdfviewer)
 Lifecycle method: this method is called when PDFViewer instance has been created and is before the afterMounted method . More...
 

Additional Inherited Members

- Protected Member Functions inherited from UIXAddon
 receiveAction (actionName, args=[])
 When the user calls PDFUI.callAddon, the receiveAction method on the corresponding Addon will be triggered. Addon exposes the API through this method and different action values. In the custom Addon subclass, you should implement this method to implement exposed APIs. More...
 
- Static Protected Member Functions inherited from UIXAddon
static initOnLoad ()
 Called after loading this addon, and only called once, The UI modules, components and controllers should be initialized and registered in this function.
 

Detailed Description

Represents a Thumbnail Addon in the PDFUI.

The Thumbnail Addon provides functionality related to thumbnail previews of PDF pages in the PDFUI. You can obtain an instance of this addon using the PDFUI.getAddonInstance method.

Since
9.2.0
Example of obtaining and using the Thumbnail Addon instance:
pdfui.getAddonInstance('Thumbnail').then(thumbnailAddon => {
if (thumbnailAddon) {
// You can now use the thumbnailAddon to interact with the Thumbnail Addon.
thumbnailAddon.zoomTo(1);
} else {
console.error("Thumbnail Addon instance not found.");
}
});

Member Function Documentation

◆ getZoomScale()

Thumbnail::getZoomScale ( )
inline

Retrieves the current zoom scale value of the thumbnail view in the sidebar.

This method allows you to obtain the current zoom scale of the thumbnail view within the PDF viewer's sidebar.

Returns
number - The current zoom scale value of the thumbnail view. The scale value is between 0 and 10, where 0 represents the minimum zoom (completely zoomed out), and 10 represents the maximum zoom (completely zoomed in).
Since
9.2.0
Example of obtaining the current thumbnail zoom scale:
pdfui.getAddonInstance('Thumbnail').then(thumbnailAddon => {
const currentZoomScale = thumbnailAddon.getZoomScale();
console.log(`Current thumbnail zoom scale: ${currentZoomScale}`);
});

◆ onSelectThumbnail()

Thumbnail::onSelectThumbnail (   callback)
inline

Registers event listeners to track the selection and deselection of thumbnail items.

This method allows you to set up event listeners that will notify you when thumbnail items in the sidebar are selected or deselected.

Parameters
callback(selectedPageIndexes:number[],lastSelectedPageIndexes:number[])=>void - A callback function that will be invoked when thumbnail items are selected or deselected. The callback receives two parameters:
  • selectedPageIndexes (array of numbers): An array of indexes representing the currently selected thumbnail items.
  • lastSelectedPageIndexes (array of numbers): An array of indexes representing the previously selected thumbnail items before the change.
Since
9.2.0
Returns
()=>void - A function that can be used to unregister the event listeners.
Example of registering event listeners for thumbnail selection:
pdfui.getAddonInstance('Thumbnail').then(thumbnailAddon => {
const callback = (selectedPageIndexes, lastSelectedPageIndexes) => {
console.log('Currently selected page indexes:', selectedPageIndexes);
console.log('Previously selected page indexes:', lastSelectedPageIndexes);
};
return thumbnailAddon.onSelectThumbnail(callback);
}).then(unregisterEvent => {
// To unregister the event listeners when no longer needed:
unregisterEvent();
})

◆ zoomTo()

Thumbnail::zoomTo (   scale)
inline

Zooms the thumbnail view of the sidebar to a specified scale.

This method allows you to change the zoom level of the thumbnail view within the PDF viewer's sidebar.

Parameters
scalenumber - The zoom scale to set for the thumbnail view. The value should be between 0 and 10, where 0 represents the minimum zoom (completely zoomed out), and 10 represents the maximum zoom (completely zoomed in).
Returns
boolean - A boolean value indicating the success of the zoom operation. Returns true if the zoom operation was successful, and false otherwise.
Since
9.2.0
Example of zooming the thumbnail view to a specific scale:
pdfui.getAddonInstance('Thumbnail').then(thumbnailAddon => {
const zoomScale = 0.96; // Adjust the desired zoom scale.
const success = thumbnailAddon.zoomTo(zoomScale);
if (success) {
console.log(`Thumbnail zoomed to ${zoomScale} successfully.`);
} else {
console.error(`Failed to zoom thumbnail to ${zoomScale}.`);
}
});

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.