Skip to main content
Known Participant
January 1, 2022
Answered

Embed PDF API Error Message.

  • January 1, 2022
  • 2 replies
  • 5336 views

Hello,

I am trying to display a PDF online via my website/web domain but can't seem to make it work. I have tried the code shared by Adobe and have also installed a SSL certificate thinking perhaps this was the reason it wasn't working.

Both the index file and PDF file are both at the root level of my directory, and are the only two files in it. As I enter my web address it starts to load the file. It then displays the first page of the PDF file briefly and it is quickly replaced by the following message in a white rectangular box in the middle of the browser window:

 

"File preview not available

This application domain (https://www.domain.com( is not authorized to use the provided PDF Embed API Client ID."

 

This is what displays on the JavaScript Console:

 

Successfuly preconnected to https://use.typekit.net/

Successfuly preconnected to https://p.typekit.net/

Unrecognized Content-Security-Policy directive 'worker-src'.

Origin https://www.domain.com is not allowed by Access-Control-Allow-Origin.

Fetch API cannot load https://viewlicense.adobe.io/viewsdklicense/jwt due to access control checks.

Failed to load resource: Origin https://www.domain.com is not allowed by Access-Control-Allow-Origin.

 

Can anyone please help? I really need to make this work and have tried just about everything I can think of without any success.

Thank you.

 

This topic has been closed for replies.
Correct answer Raymond Camden

As a followup to this, the issue was that he took our sample code:

var adobeDCView = new AdobeDC.View({clientId: "<YOUR_CLIENT_ID>", divId: "adobe-dc-view"});

And replaced "YOUR_CLIENT_ID", but left in the < and >. So for example:

var adobeDCView = new AdobeDC.View({clientId: "<a real id here, but inside brackets>", divId: "adobe-dc-view"});

The solution is to ensure you remove the < and >. I've worried about this mistake in the past, so I'm filing a bug to our docs to see about changing it. 

2 replies

Raymond Camden
Community Manager
Raymond CamdenCommunity ManagerCorrect answer
Community Manager
January 7, 2022

As a followup to this, the issue was that he took our sample code:

var adobeDCView = new AdobeDC.View({clientId: "<YOUR_CLIENT_ID>", divId: "adobe-dc-view"});

And replaced "YOUR_CLIENT_ID", but left in the < and >. So for example:

var adobeDCView = new AdobeDC.View({clientId: "<a real id here, but inside brackets>", divId: "adobe-dc-view"});

The solution is to ensure you remove the < and >. I've worried about this mistake in the past, so I'm filing a bug to our docs to see about changing it. 

JRC_UserAuthor
Known Participant
January 8, 2022

Hi Raymond,

Again, I can't thank you enough. I had been trying to do this for quite some time but couldn't get it right. You took one look at the code and immediately identified the problem.

I am incredibly enthusiastic about this solution. I had been working with Flipbooks for some time but was very unhappy with their quality. They never looked the same way and with the same quality as the PDF from which they were converted.

The ability to use PDFs online will be a game changer for many out there who wish to display their documents or information online but don't want to be involved with or don't have the knowledge to do web design.

My only suggestion, as I have already mentioned, is for Adobe to add the capability to view documents as a two-page spread instead of a single-page document so users can create a similar experience to that of using a flipbook (now that Flash is gone and many don't want to use flipbooks based on HTML5 Adobe PDF Embed API may easily take their place).

Thank you again, Raymond.

Raymond Camden
Community Manager
Community Manager
January 6, 2022

Did you get a key that is tied to your domain? I assume it isn't domain.com.

JRC_UserAuthor
Known Participant
January 7, 2022

Hi Raymond,

Yes, I did. I created my credentials entering my domain name along with a username and in return received a key from Adobe. 

You are right. Domain is not the name but I felt it may not be secure or appropriate to share my real domain name here.

Any ideas as to what might be causing this behavior?

Thank you!

Raymond Camden
Community Manager
Community Manager
January 7, 2022

I assume you are also on https, and the subdomain matches? Ie, you told our console, "I want to use www.foo.com", and you are testing on https://www.foo.com, not foo.com?