Hello,
I want to add a new menu item after add-blank-page item menu.
please see my code below:
On the FoxitPDFSDKForWeb_8.1.1 its works just fine but after i have upgraded to the new FoxitPDFSDKForWeb 8.2.1 version, I’m getting the following messages "Uncaught (in promise) Error: target component not found: "contextmenu-item-thumbnail-add-blank-page".
Please advice,
Thanks,
Adam.
I want to add a new menu item after add-blank-page item menu.
please see my code below:
Code:
var duplicatePageFragment = { target: 'contextmenu-item-thumbnail-add-blank-page', action: FRAGMENT_ACTION.AFTER, template: '<contextmenu-item name="contextmenu-item-thumbnail-duplicate-page">Duplicate Page</contextmenu-item>', config: [{ attrs: { // This attribute is necessary if the specified component is not marked by it, otherwise it is optional '@tooltip': '', 'tooltip-title': "Duplicate Page" }, target: 'contextmenu-item-thumbnail-duplicate-page', callback: function () { this.getPDFUI() .getPDFViewer() .then(pdfViewer => { var pdfdoc = pdfViewer.getCurrentPDFDoc(); var currentIndex = this.component.parent.getCurrentTarget(); var destIndex = currentIndex + 1, password = "", flags = "", layerName = "", startIndex = "", endIndex = ""; extractPages(pdfdoc, currentIndex).then((buffer) => { let blob = new Blob(buffer, { type: 'application/pdf' }); pdfViewer.getCurrentPDFDoc().insertPages({ destIndex: Number(destIndex), file: blob, password: password, flags: Number(flags), layerName: layerName, startIndex: Number(startIndex), endIndex: Number(endIndex) }); }) }); } }] }; var pdfui = new PDFUI({ viewerOptions: { libPath: '../../../lib', jr: { readyWorker: readyWorker } }, renderTo: '#pdf-ui', appearance: UIExtension.appearances.adaptive, fragments: [duplicatePageFragment], addons: UIExtension.PDFViewCtrl.DeviceInfo.isMobile ? '../../../lib/uix-addons/allInOne.mobile.js' : '../../../lib/uix-addons/allInOne.js' });
Please advice,
Thanks,
Adam.
Comment