I’m trying to add a watermark before the file is downloaded and then remove the watermark.
It worked yesterday, and today, for some reason, the watermark isn’t removed after the download.
my code looks like this:
window.webviewerFunctions = {
initWebViewer: function () {
const viewerElement = document.getElementById( 'viewer' );
WebViewer( {
path: 'lib'
}, viewerElement ).then( ( instance ) => {
const { docViewer } = instance;
const { annotationManager, documentViewer, Tools, Core } = instance.Core;
document.querySelectorAll( '.download-file-button' )
.forEach( input => input.addEventListener( 'click', async ( e ) => {
documentViewer.setWatermark( {
diagonal: {
fontSize: 40,
fontFamily: 'sans-serif',
fontWeight: 'bold',
color: '#00a0df',
opacity: 25,
text: 'test'
}
} );
await instance.UI
.downloadPdf( { includeAnnotations: !!e.target.getAttribute( 'data-include-annotations' ) } )
.then( () => documentViewer.setWatermark( { diagonal: { text: '' } } ) );
} ) );
} )
}
};