# Express Viewer License Still Shows Watermarks

**URL:** <https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [April 1, 2024, 11:07pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207 "2024-04-01T23:07:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [April 1, 2024, 11:07pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/1 "2024-04-01T23:07:01Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
8.7.4

**Detailed description of issue**  
I upgraded our version of Express Viewer to 8.7.4 and although I have a license key for the domain [trailblazertech.com](http://trailblazertech.com) it is still showing the watermarks on the website path [https://acme.uat.app.trailblazertech.com](https://acme.uat.app.trailblazertech.com) which should match the license domain.

Screenshot of viewer with watermarks

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/1/1b228b4d637b44db024f5d186694d211544c3f13.png)

Console logging info…

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/4/4c12161563bba0ffe246564dde9e28897db200a5.png)

**Expected behaviour**  
I would not expect to see the watermarks.

**Does your issue happen with every document, or just one?**  
Yes all documents

**Link to document**  
N/A

**Code snippet**

```javascript
import {
  AfterViewInit,
  Component,
  ElementRef,
  Input,
  OnInit,
  ViewChild,
  ViewEncapsulation,
} from '@angular/core';
import WebViewer from '@pdftron/pdfjs-express-viewer';
import { environment } from 'src/environments/environment';

@Component({
  selector: 'app-pdf-viewer',
  templateUrl: './pdf-viewer.component.html',
  styleUrls: ['./pdf-viewer.component.scss'],
  encapsulation: ViewEncapsulation.None,
})
export class PdfViewerComponent implements OnInit, AfterViewInit {
  @Input() documentUrl = '';
  @Input() fileName = '';
  @ViewChild('viewer', { static: false }) viewer: ElementRef | undefined;

  wvInstance: any;

  ngOnInit() {
    this.wvDocumentLoadedHandler = this.wvDocumentLoadedHandler.bind(this);
  }

  wvDocumentLoadedHandler(): void {
    // you can access docViewer object for low-level APIs
    this.wvInstance.setFitMode(this.wvInstance.FitMode.Zoom);
    this.wvInstance.setZoomLevel(2);
  }

  ngAfterViewInit(): void {
    if (this.viewer) {
      console.log('license', environment.pdfjsExpressKey);
      WebViewer({
        path: '../../../wv-resources/lib',
        licenseKey: environment.pdfjsExpressKey,
        disabledElements: ['toggleNotesButton', 'menuButton', 'viewControlsButton'],
      }, this.viewer.nativeElement).then((instance: any) => {
        console.log('window.location.origin', window.location.origin);
        console.log('window.location.host', window.location.host);
        instance.UI.loadDocument(this.documentUrl, { filename: this.fileName });
        this.wvInstance = instance;
        // now you can access APIs through the WebViewer instance
        const { Core } = instance;
        instance.UI.disableElements(['ribbons']);
        instance.UI.setToolbarGroup('toolbarGroup-View');

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

      });
    } else {
      throw Error('no viewer available');
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [April 2, 2024, 3:22pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/3 "2024-04-02T15:22:56Z")

</div>

Hi there,

Thank you for reaching out to pdf.js express forums,

Is your domain registered exactly as " [trailblazertech.com](http://trailblazertech.com/)"?  
If so, is the network request connecting to the pdf.js express server? Is your licenseKey correctly being set (i.e. is the environment variable set correctly)?  
Here is a forum post for reference:

> [@License key is not recognized in production](https://pdfjs.community/t/license-key-is-not-recognized-in-production/1301/4):
>
> Hey there! I checked out and tested your license key and did not find any issues. Can you confirm that process.env.REACT\_APP\_PDFTRON\_EXPRESS\_KEY is being set correctly? You should see a request to [auth.pdfjs.express](http://auth.pdfjs.express) in the network tab - can you send me a screenshot of that via DM? Thanks, Logan

Best regards,  
Kevin Kim

---

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [April 2, 2024, 3:40pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/4 "2024-04-02T15:40:46Z")

</div>

Hi @kkim,

Yes, the domain is registered exactly as [trailblazertech.com](http://trailblazertech.com).

I checked the network call to [https://auth.pdfjs.express/?key=xxxxx](https://auth.pdfjs.express/?key=xxxxx) and the key value matches the key I see in my PDF Js Express admin listed for this domain.

The network auth call returns a 200 response. The response looks to be some binary value so I can’t tell exactly what its content is.

I registered this domain a while back on an older version. Is it possible I need to delete the key and create a new one? I’m at a loss for what could be missing here.

Thanks,  
Steve

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [April 2, 2024, 7:18pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/5 "2024-04-02T19:18:11Z")

</div>

Hi there,

Could you please try re-registering the key and see if that works for you?

Best regards,  
Kevin Kim

---

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [April 6, 2024, 4:47am UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/6 "2024-04-06T04:47:01Z")

</div>

Hi @kkim,

I registered a new key for [trailblazertech.com](http://trailblazertech.com) and I’m still am seeing the pdfjs express watermarks

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/b/b9483341829d5fc3a0eb88fbcc96d28952c76178.png)

Network tab for auth.pdfjs with new key. Based on the referer URL can you tell why this is proving so difficult?

 ![Screenshot 2024-04-05 at 11.39.14 PM](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/a/a851b48ca99dc8616eb4fd5a9600c32df3e93a71.png)

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/6/6d9742f21f0168fed21c204f93ff24ac0fe687a1.png)

Thanks,  
Steve

---

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [April 6, 2024, 2:57pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/7 "2024-04-06T14:57:24Z")

</div>

What I don’t understand is that in past product versions (8.4.1 for example) if I used a license key that didn’t match the domain I would get a response in the console like this…

> [PDFJS.express](http://PDFJS.express): A valid license key is required to use the view only build of PDF.js Express. Get your free license key at [PDF.js Express](https://pdfjs.express/profile)

However I’m not getting that message just the overlay graphic with pdfjs express in corners and middle.

Can you tell me what causes that watermark to show up and maybe I can check those items off to see where the disconnect is?

Thanks.

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [April 8, 2024, 3:27pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/8 "2024-04-08T15:27:23Z")

</div>

Hi there,

It looks like the request to the authentication server is being made correctly using the key. However the subdomain might not be registering correctly.  
Please see this forum post for more details:

> [@Local domain + port; licenseKey not recognised](https://pdfjs.community/t/local-domain-port-licensekey-not-recognised/2007):
>
> Our development site runs off a domain, rather than localhost: however the licenseKey I have set up for the local domain isn’t being recognised as valid. Eg: the development domain is of the format [http://sub.domain.local:4001](http://sub.domain.local:4001) - I tried setting the domain as both domain.local and including the port number with domain.local:4001 in the license-key settings … but neither worked. I still got the “a valid license key is required…” error in the web-app (waited the 10 minutes suggested by the Profile…

Best regards,  
Kevin Kim

---

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [April 8, 2024, 9:54pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/9 "2024-04-08T21:54:41Z")

</div>

Hi,

Thanks for that link. Here are the following items I’ve tried to confirm.

1. I downloaded a fresh zip of the Webviewer Express View Only just to start clean. I took the contents of the lib folder from that zip and put it in a folder within my Angular application. I included that path in my assets angular.json file. I also included the webviewer.min.js in the scripts property my my angular.json file.

2. Related to the reference link you mentioned last… I am locally using a root URL for my website of [https://acme.app.local](https://acme.app.local). I have added both app.local and acme.app.local to my /etc/hosts files on my Mac.

```javascript
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
127.0.0.1 app.local
127.0.0.1 acme.app.local

```

1. I created a new license key just to be safe for app.local.  

2. My source code is pretty simple. I’m loading a document from an S3 presigned URL.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/1/1e7e3fead13877a24de920960905c230d1fd6952.png)

1. My console log in the browser shows the following. The license key matches what I would expect to work for the domain app.local.  

2. My network tab shows the auth call with a 200 OK response.  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/b/b47b57d7acae3305a97ef2d56880a4bc79d17e29.png)

3. There’s some additional event that looks to be posting to [pdfjs](https://pi.pdfjs.express/events) after the console error and interestingly there’s no license key. However the response is a 200 OK. I don’t know if this is pertinent information or not.  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/f/f584d1b8ffbc4e54e28be6fbf082411032d8e4f6.png)

Can you loop in Logan Bittner who in the other thread said he got a local dev custom URL to work? Or is there a test I can run locally to mimic how the local site domain is being evaluated? At this point based on that other thread it seems that a local dev domain other than localhost should work (at least according to Logan).

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [April 10, 2024, 4:42pm UTC](https://pdfjs.community/t/express-viewer-license-still-shows-watermarks/3207/10 "2024-04-10T16:42:59Z")

</div>

Hi there,

It looks like from the backend, you still have an old 2022 key registered with the same domain:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/a/a27a6fd4e70554c358c4647f27f2651aca769577.png)

Please try using your old API key or change the key from April 22, 2022 key to be a different domain.  
Please try also removing the **-new** from the new domain.

Best regards,  
Kevin Kim
