# Is there any CDN url for PDFJS express library

**URL:** <https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [July 29, 2021, 3:56pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910 "2021-07-29T15:56:42Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![yavula](https://avatars.discourse-cdn.com/v4/letter/y/58f4c7/32.png) [@yavula](https://pdfjs.community/u/yavula)\
**Post date:** [July 29, 2021, 3:56pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/1 "2021-07-29T15:56:42Z")

</div>

Hi Team,

We are giving the web-viewer folder library path for rendering the pdf. In local it is working. But in our server we are getting path issue. In our angular project we are using only main.js.

Do you have CDN url for the library so that we don’t want to store the lib folder in our project and our path issue will be solved.

Regards,  
Yuva

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [July 29, 2021, 3:56pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/2 "2021-07-29T15:56:48Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

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

Guides:
- [Integrating existing Angular project with PDF.js Express - Setup](https://pdfjs.express/documentation/get-started/angular/exist-project#setup)
- [Set up real-time collaboration](https://pdfjs.express/documentation/collaboration/setup)
- [Integrating Vue.js with PDF.js Express JavaScript PDF library - Sample overview](https://pdfjs.express/documentation/get-started/vue#sample-overview)

APIs:
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [UndefinedWebViewer(options, viewerElement)](https://pdfjs.express/api/global.html#WebViewer__anchor)
- [VerificationOptions](https://pdfjs.express/api/VerificationOptions.html#__anchor)

Forums:
- [Evaluating PDF.Js Express as alternative for PDF.Js](https://pdfjs.community/t/evaluating-pdf-js-express-as-alternative-for-pdf-js/474/6)
- [WebViewer not being initialized in firefox](https://pdfjs.community/t/webviewer-not-being-initialized-in-firefox/435/1)
- [CORS issue correspondence](https://pdfjs.community/t/cors-issue-correspondence/878/1)

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [July 29, 2021, 4:16pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/3 "2021-07-29T16:16:11Z")

</div>

Hi there,

PDF.js Express does not have a CDN unfortunately. The reason for this is because Express leverages iframes, and loading assets inside an iframe from a 3rd party URL causes issues due to browser restrictions. It is highly recommended to load your assets from the same domain as your application.

Let me know if there’s anything I can do to help you with your path issues.

Thanks!  
Logan

---

<div class="post-metadata">

**Author:** ![yavula](https://avatars.discourse-cdn.com/v4/letter/y/58f4c7/32.png) [@yavula](https://pdfjs.community/u/yavula)\
**Post date:** [August 10, 2021, 7:14pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/4 "2021-08-10T19:14:02Z")

</div>

Thanks Logan for your reply.

In Adobe Experience Manager portal we have to store the PDF JS plugins folder. But it is not allowing to upload the files with 2 dots in the file name. Is there any possible to rename the files  
Ex: webviewer.min.js to webviewer\_min.js

Can you please help on this issue.

Below is the error message when upload the file with 2 dots in the file name.

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

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [August 10, 2021, 7:26pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/5 "2021-08-10T19:26:01Z")

</div>

Hi there,

Unfortunately this is a change we cannot make as it would be a breaking change for every other user. We also have a lot of other files that have multiple periods in their name, so renaming just `webviewer.min.js` won’t resolve your issue.

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![yavula](https://avatars.discourse-cdn.com/v4/letter/y/58f4c7/32.png) [@yavula](https://pdfjs.community/u/yavula)\
**Post date:** [August 12, 2021, 8:19pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/6 "2021-08-12T20:19:51Z")

</div>

Thanks Logan for your reply,

We have stored the plugin in different domain, when the pdf loading we are getting cross origin domain.  
I think iframe is blocking the API call.

We had some information from the PDFTRon site for cross origin,

> **[PDFTron](https://www.pdftron.com/documentation/web/guides/wv-inside/#loading-webviewer-from-another-domain)**
>
> World's #1 PDF SDK Library for Web, Mobile, Server, Desktop

We added domain in configorigin.txt in lib/ui folder. Still see the cross origin domain issue.  
Did we miss anything from our end ?  
Can you please help us in cross origin domain issue.

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

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [August 13, 2021, 4:31pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/7 "2021-08-13T16:31:51Z")

</div>

Hi there,

When using this approach you must use a [config file](https://pdfjs.express/documentation/learn-more/advanced/config-files) to execute Express APIs. You cannot use the `instance` returned from the constructor promise when loading assets cross origin.

I believe you still see that first error message even when using a config file, but you can safely ignore it. To hide the error, you can append a `catch` call like so:

```javascript
Express(
  {
    path: "https://yourwebsite/static/lib",
    config: '/static/config.js'
  },
  element
).catch(() => { })

```

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![yavula](https://avatars.discourse-cdn.com/v4/letter/y/58f4c7/32.png) [@yavula](https://pdfjs.community/u/yavula)\
**Post date:** [September 9, 2021, 4:12pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/8 "2021-09-09T16:12:50Z")

</div>

Hi Logan,

As you suggested, we have created a config file to execute the view document API. (both application & plugin under cisco. com domain)

Our application : [https://trustportal-nprd.cisco.com](https://trustportal-nprd.cisco.com) ( From this site on click of document, we are calling the pdfjs plugins)

We stored pdf js plugins : [https://www-stage.cisco.com/web/fw/ctp/wv-resources/wv-resources/lib](https://www-stage.cisco.com/web/fw/ctp/wv-resources/wv-resources/lib)  
under the lib folder we created config folder and mention file.js → this is the config file  
From this config file we are calling the WebViewer, PDF document file to load.

But still we are getting CORS issue.

As we discussed in mail, please suggest do we are missing anything?

Do you have any working sample code it is good to validate from our end.

Please help us in this CORS issue. Thanks in advance.

Regards,  
Yuva

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [September 10, 2021, 4:02pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/9 "2021-09-10T16:02:34Z")

</div>

Hi there,

Does your server `www-stage-cisco` have proper CORS headers set? Is `trustportal-nprd` allowed to make cross origin requests to it?

Can you send me a screenshot of the exact errors you are seeing?

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![user10](https://avatars.discourse-cdn.com/v4/letter/u/d2c977/32.png) [@user10](https://pdfjs.community/u/user10)\
**Post date:** [October 27, 2021, 5:54am UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/11 "2021-10-27T05:54:07Z")

</div>

Good day Logan,

Have you been able to solve this issue? I am facing a similar situation. My config file is located in an azure storage ([xxx.blob.core.windows.net/public](http://xxx.blob.core.windows.net/public)) and my application runs elsewhere. I have whitelisted the domain of my application in `ui/configorigin.txt` but I am still getting the cross domain error.

 ![Screenshot 2021-10-27 at 07.50.57](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/8f227b721d19019909eba2bae1e6552060cbc1a2.png)

Kind regards,

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [October 29, 2021, 2:45pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/12 "2021-10-29T14:45:10Z")

</div>

Hey!

That warning is expected and should not impact what you are doing. All it is saying is that you will not be able to use the `instance` returned from the `WebViewer` function (which is why you need a config file).

You should be able to safely ignore that warning.

Logan

---

<div class="post-metadata">

**Author:** ![user10](https://avatars.discourse-cdn.com/v4/letter/u/d2c977/32.png) [@user10](https://pdfjs.community/u/user10)\
**Post date:** [November 4, 2021, 5:18pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/13 "2021-11-04T17:18:35Z")

</div>

Hey Logan,

Thanks a lot from your response. I managed to replicate the issue locally by pointing to the resource on the other domain. The actual issue is the fact that from inside the iframe, I try to access a button on the page on my server.

`let signButton = window.parent.document.getElementById("sign-now");`

```javascript
Uncaught DOMException: Blocked a frame with origin "https://xxx.blob.core.windows.net" from accessing a cross-origin frame.
    at https://xxx.blob.core.windows.net/public/js/signature.js:16:32

```

Any ideas how to get around this issue?

Regards,

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [November 5, 2021, 6:59pm UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/14 "2021-11-05T18:59:06Z")

</div>

Hi there!

There is no way to work around this specific error unfortunately. This is a security restriction imposed by web browsers that disallows iframes on a different origin to access the contents of the main window. Without this restriction, malicious code could be loaded in an iframe which would then have access to the main window, which is a huge security risk.

What you _can_ do however, is use the [`postmessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) API to send messages between windows. The only drawback to this is that the data sent must be serializable, so you cannot pass DOM elements. You may need to rework your code a tiny bit to make this work, but it is an option.

You could do some kind of flow where when your `#sign-now` button is clicked, you can post an “onClick” message to the iframe window, and handle the event in there.

Hope this helps,  
Logan

---

<div class="post-metadata">

**Author:** ![user10](https://avatars.discourse-cdn.com/v4/letter/u/d2c977/32.png) [@user10](https://pdfjs.community/u/user10)\
**Post date:** [November 6, 2021, 7:58am UTC](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/15 "2021-11-06T07:58:42Z")

</div>

Thank you so much for the detailed explanation.

I am giving it a try. Just hoping that it is the last hurdle.

Do you perhaps have an example of set up for this implementation of the we viewer with the config file. Just to make sure all is in order.

I am getting this error now, all my files (/pdfjs-express/public, config.js) are located in the remote server:  
`Uncaught (in promise) DOMException: Permission denied to access property "WebViewer" on cross-origin object [PDFJSDocumentType.js:1967](http://178.128.171.157:5010/static/js/pdfjs-express/public/core/pdfjs/PDFJSDocumentType.js)`
