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".
The origin problem can be marked as solved. With the hard coded name of the PDF file, it works.
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!
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:
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.
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.
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.
Copy link to clipboard
Copied
The origin problem can be marked as solved. With the hard coded name of the PDF file, it works.
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!