Watermark not remove after license key filled

Hi i updated license key in the code and upload new build on server but watermark not remove.
link = Frontend

Hi malkeet.seefat,

Thank you for contacting pdf.js express forums,

Do you have the license key correctly placed inside the WebViewer Constructor?

Was it working before the new build?

I also see an error in the console, so there might be something going on with your constructor

Best Regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

import {AfterViewInit, Component, ElementRef, OnInit, ViewChild,} from ‘-angular/core’;
import WebViewer from ‘-pdftron/pdfjs-express’;

-Component({
selector: ‘app-root’,
templateUrl: ‘./app.component.html’,
styleUrls: [‘./app.component.css’]
})
export class AppComponent implements OnInit, AfterViewInit {

-ViewChild(‘viewer’) viewer: ElementRef;

ngOnInit(): void { }

ngAfterViewInit(): void {
WebViewer({
licenseKey: “j8xvB4tENiFdfjmzLWlr”,
path: ‘lib’,
initialDoc: ‘/assets/file-sample.pdf’
}, this.viewer.nativeElement)
.then(instance => {
const watermarkOptions = {
header: {
fontSize: 15,
color: ‘blue’,
center: ‘center watermark’,
},
diagonal: {
fontSize: 30,
fontFamily: ‘sans-serif’,
color: ‘red’,
opacity: 100,
text: ‘Watermark’
}
};

  const { documentViewer } = instance.Core;
  const promise = new Promise(resolve => {
    // some asynchronous operations to generate the watermark options object
    resolve(watermarkOptions);
  });

  documentViewer.setWatermark(promise);
  documentViewer.getWatermark().then(() => {
    documentViewer.refreshAll();
    documentViewer.updateView();
  })

  console.log('Malkeet '+documentViewer);

});

}

}

this is my code

Hi malkeet.seefat,

I took a look at your version and it seems you’re using an older version of pdf.js express, which means you are using new references when they are not yet defined: Migrating to PDF.js Express 8.0 | Documentation
which explains the documentViewer error in the console.

Could you try either updating pdf.js to the newest version or changing your reference to the older namespaces and retry and let us know your results?

Best Regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Can you send latest code

Hi there,

You can find the latest version in our download link here:

And depending on whether you are using
Express Viewer:

or Express Plus:

Best Regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here