Watermark doesn't disappear although I added the licence key

PDF.js Express Viewer

UI Version 8.7.0
Core 8.7.2
webviewer.min.js 8.7.2

Watermark doesn’t disappear although I added the licence key

… but it should disappear

… and it happens with every document under localhost and under my registered domain: schuldenonline.at
Cache is deleted.

** WebViewer({
path: ‘/pdfjs/lib’, // path to the PDF.js Express’lib’ folder on your server
licenseKey: ‘SZJ5A4Quf47qW1mAlDRj’,
initialDoc: ‘/dropzone/sendfile?dokid=3557042&fromdz=dropzoneablage’,
}, document.getElementById(‘viewer’))
.then(instance => {
// now you can access APIs through the WebViewer instance
const { Core, UI } = instance;

// adding an event listener for when a document is loaded
Core.documentViewer.addEventListener('documentLoaded', () => {
  console.log('document loaded');
});

// adding an event listener for when the page number has changed
Core.documentViewer.addEventListener('pageNumberUpdated', (pageNumber) => {
  console.log(`Page number is: ${pageNumber}`);
});

instance.UI.setHeaderItems(function(header) {
  var myCustomButton = {
    type: 'actionButton',
    img: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',
    onClick: function() {
		const xfdfString = instance.Core.annotationManager.exportAnnotations();
		saveToDatabase(3554923, xfdfString)
    }
  }

  header.push(myCustomButton);
});

});**

Thank you for your support!

Hi there,

Thank you for contacting pdf.js express forums,

Please note that in development mode (i.e. localhost) the watermark will always show up.

One common reason this happens is when you have different pdf.js packages (i.e. having both viewer and pro versions when you should only use one)

When loading the viewer under your domain, could you provide any console error messages if any? Here’s another forum post where it was solved via unblocking csp headers:

Best regards,
Kevin Kim

1 Like