I don't know, what's wrong here? I'm always getting the error message:
The requested document was not found on this server.
The pdf-files are stored in the directory "resources" under the domain "domain.xy".
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:
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.
Have you actually reported the value of directory.concat(name)? I don't see that in your screen shots, and that's what matters.
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
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!