PDF documents can not be found on the server

Community Beginner ,
Oct 02, 2021 Oct 02, 2021

Copy link to clipboard

Copied

I don't know, what's wrong here? I'm always getting the error message:

The requested document was not found on this server.

<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
    <script type="text/javascript">
	document.addEventListener("adobe_dc_view_sdk.ready", function(){
           var name = '<?php echo $_GET["p3"]; ?>';
           var directory = 'https://domain.xy/resources/';
	   var adobeDCView = new AdobeDC.View({clientId: "key", divId: "adobe-dc-view"});
		       adobeDCView.previewFile({
			          content:{location: {url: directory.concat(name)}},
			          metaData:{fileName: name}
		       }, {embedMode: "SIZED_CONTAINER"});
	      });
    </script>

 The pdf-files are stored in the directory "resources" under the domain "domain.xy". 

TOPICS
PDF Embed API

Views

158

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

correct answers 1 Correct answer

Community Beginner , Oct 04, 2021 Oct 04, 2021

The origin problem can be marked as solved. With the hard coded name of the PDF file, it works. 

4_Screenshot 2021-10-04 124716.png

So now, I have to find out, why it does not work, with dynamic values for the variable "name". But that is a different story.

Thank you guys!

Likes

Translate

Translate
Adobe Employee ,
Oct 02, 2021 Oct 02, 2021

Copy link to clipboard

Copied

I don't think there is enough information to be able to troubleshoot your issue, but have you checked to output your directory.concat(name) and see if it correctly passes your URL to the PDF? If you do that, and you just go to it in your web browser, does it resolve? 

 

PDF Embed API is client-side, so that means that any CORS issues apply. If you aren't on the same domain, then your web browser might be preventing cross-domain loading. Usually you can see this in the errors in your console.log. Another possible way to address this in your PHP script is to read the foreign location, load it as base64:

https://codepen.io/practicalPDF/pen/vYLoKMj

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
Community Beginner ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

Thank you, Ben, for this quick reply.

I checked the "directory.concat(name)" code. It works: the output is leading to the PDF. But I still get the error: The requested document was not found on this server., when I let the server do the work.

Any further Ideas? I give more pictures as attachements to be able to troubleshoot the problem.

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
LEGEND ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

Have you actually reported the value of  directory.concat(name)? I don't see that in your screen shots, and that's what matters.

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
Community Beginner ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

You're right, I did not report the value of "directory.concat(name)" yet...

In the picture you can see, that there are two possibilities to use the concat function. With both of them I get a resolvable URL. So, it is not the concat function that is the cause of the problem. I still get get the 404 error.

concat.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
Community Beginner ,
Oct 04, 2021 Oct 04, 2021

Copy link to clipboard

Copied

LATEST

The origin problem can be marked as solved. With the hard coded name of the PDF file, it works. 

4_Screenshot 2021-10-04 124716.png

So now, I have to find out, why it does not work, with dynamic values for the variable "name". But that is a different story.

Thank you guys!

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
Resources