PDFTron中的页面重新排序事件

问题描述

我正在“面板”>“缩略图”视图中处理“重新排序页面”。 PDFTron提供功能,因此我可以拖动和重新排列/重新排列页面。然后使用该事件,我将在服务器上上传新的PDF。但是我无法找到仅当用户在缩略图控件中执行重新排序时才会触发的正确事件。

到目前为止,我正在使用pageNumberUpdated事件,但是当用户滚动到PDFVeiwer中的PDF时会触发该事件。

WebViewer({
    licenseKey: 'KEY',path: './public/webviewer',css: './css/pdftron-custom.css'
},document.getElementById('pdfEditor') as HTMLElement).then(async(instance: WebViewerInstance) => {
    webViewerInstance = instance;
    
    webViewerInstance.docViewer.on('pageNumberUpdated',async() => {
         // OTHER STUFF
    });
});

PDFTron链接:https://www.pdftron.com/documentation/web/guides/manipulation/thumbnails-controls/#reordering-pages

基本上,我应该使用哪个事件在用户拖放缩略图以移动页面时触发?

解决方法

您可以在DocumentViewer上使用layoutChanged事件。例如:

//instantiate the viewer as usual 
const { docViewer } = instance;
docViewer.on('layoutChanged',() => console.log('PAGES UPDATED'))

当缩略图面板中发生更改时,将触发此事件。 https://www.pdftron.com/api/web/CoreControls.DocumentViewer.html#event:layoutChanged__anchor

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...