Watermark not disappearing despite valid license

Which product are you using?
PDF.js Express Viewer

PDF.js Express Version
8.4.0

Detailed description of issue
Even though I have entered the correct key, the watermark is still displayed when running on the server.
It’s an angular application. I tried using @pdftron/pdfjs-express as well as @pdftron/pdfjs-express-viewer. In both cases, the watermark never disappears.
However, there are some differences.

@pdftron/pdfjs-express:
locally: PDF is displayed, watermark is displayed, no console output regarding license
server: PDF is displayed, watermark is displayed

@pdftron/pdfjs-express-viewer:
locally: PDF is displayed, watermark is displayed, console output says the license is valid for the correct domain
server: PDF is not displayed (never stops loading), console shows error:

Expected behaviour
Watermark should disappear on server

Does your issue happen with every document, or just one?
With every document

Link to document
n/a

Code snippet

@ViewChild('viewer', { static: false }) public viewer: ElementRef;

public ngAfterViewInit(): void {
    this.fileDownloadService.downloadBlob(this.fileDownloadService.downloadDocumentPath.replace('{documentId}', this.documentId))
    .subscribe((result: BlobWithFilename) => {
      WebViewer({
        licenseKey: 'MY-KEY',
        path: '../assets/pdfjs-express-viewer',
        disableLogs: true},
        this.viewer.nativeElement)
        .then(instance => {
          // https://pdfjs.express/documentation/ui-customization/hiding-elements
          instance.UI.loadDocument(result.blob, { filename: result.filename });
          instance.UI.disableFeatures([instance.UI.Feature.Print]);
          instance.UI.disableFeatures([instance.UI.Feature.TextSelection]);
          instance.UI.disableFeatures([instance.UI.Feature.Annotations]);
          instance.UI.disableElements(['panToolButton']);
          instance.UI.disableElements(['selectToolButton']);
          instance.UI.disableElements(['toolsHeader']);
      });
    }, (error) => {
      throw error;
    });
  }

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi there,

This topic was marked as resolved - I just want to confirm that you got everything working?

Thanks!
Logan

Yes, Logan, thanks.
We found out that the issue is actually caused by our service worker caching CSP headers, so now they are blocking even though they should be enabled. In a new browser, it works.

Thank you.

1 Like