Odyn
October 26, 2020, 10:53am
1
Hello
I have simply dashboard which holds the records from SQL database.
I would like to render PDF preview on subpage but I am unable.
PDF preview is generated based on path to invoice on local resources.
For example I have folder C:/Review/Incoice123.pdf and this path is located inside database.
I am pulling out this information but i am unable to display this PDF preview.
Got following error:
dashboard:6840 GET http://localhost:8080/resources/pdfjs/web/viewer.html?file=c%3A\pbCCMData\PROJECT\REVIEW\Incoice123.pdf 404 (Not Found)
Is this possible to preview PDF from local folder using PDFJS?
Any ideas?
Thanks
Odyn
October 26, 2020, 11:23am
2
For example if I try to use IFRAME object to load some dummy PDF from path:
<object data="file:///./test/8013124A.pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0" width="400" type="application/pdf" height="500">
<p>
Unable to load PDF preview!
</p>
</object>
I got console error that I am not allowed to load local resource.
I know this is bocked due security reasons but I need to load PDF from local folder.
Is there any way to load this?
Odyn
October 27, 2020, 5:25am
3
I just did it wrong, the PDF JS works fine when You submit PDF using Ajax call. We can;t read directly from local drive.
Odyn
October 28, 2020, 5:29am
4
Maybe this will help someone but the Planet Press Connect workflow preferences need to have proper HTTP Input 2 resources set inside of it.
Otherwise any Ajax calls, especially to GET pdf from any local folder will not work.