File preview not available, please reload to try again.

New Here ,
Mar 22, 2021 Mar 22, 2021

Copy link to clipboard

Copied

Hi, 

 

Getting the 'File preview error'. 

Screenshot 2021-03-22 at 09.01.36.png

Here's my code:

<div id="adobe-dc-view" style="height: 360px; width: 500px;"></div>
<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
<script type="text/javascript">
	document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
		var adobeDCView = new AdobeDC.View({clientId: "9c33198fee83473a82173dc0b3b464b0", divId: "adobe-dc-view"});
		adobeDCView.previewFile({
			content:{location: {url: "https://static1.squarespace.com/static/59ca375d80bd5e1a6eaed324/t/600d8e3a8c87b41f30253201/1611501114873/UK-COVID-19.pdf"}},
			metaData:{fileName: "UK-COVID-19.pdf"}
		}, {embedMode: "SIZED_CONTAINER"});
	});
</script>

The URL to the file works fine. 

 

What am I doing wrong? Thanks!

Views

126

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 22, 2021 Mar 22, 2021

Copy link to clipboard

Copied

Do you see any CORS error in the browser console?

 

This is the information available in the PDF Embed API documentation:

Cross-origin resource sharing (CORS) issues may occur when you pass PDF content as a URL and the PDF Embed API needs to download the file from the provided location in order to render it. To avoid this situation, you can choose one of two methods:

 

Please see if this fixes the issue.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2021 Mar 22, 2021

Copy link to clipboard

Copied

These are the errors:

 

Screenshot 2021-03-22 at 09.46.24.png

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 22, 2021 Mar 22, 2021

Copy link to clipboard

Copied

These errors can be ignored for now. These won't impact the functionality.

Could you please check that it's not due to CORS? Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 29, 2021 Mar 29, 2021

Copy link to clipboard

Copied

LATEST

Hi there,

After trying all possible hits and trials, I found a solution that worked for me.

Below is the code I was trying and was getting the same File Preview Error. As you can see, the url starts with http and ends with the file name.

Screenshot 2021-03-30 at 4.26.16 AM.png

 

I just removed the http://syncit.in and gave the rest of the path for the file name like below, and it worked for me:

Screenshot 2021-03-30 at 4.30.35 AM.png

 

Hope this helps solve the issue.

 

Regards

Adnan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines