OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

PDF.js Message : Unexpected server response (0) while retrieving PDF

  • Thread starter Thread starter jdow
  • Start date Start date
J

jdow

Guest
I'm still fairly new to PDF.js. I'm trying to link my viewer.html with my pdf which are located in another server, eg: 100.0.55.10. Code shown below is how I embed the pdf in my iframe.

Code:
//LocalDir = http:///127.0.0.1/Main/Apps/Document/web
//BookLoc = http:///100.0.55.10/pdfFolder/pdfname.pdf

<iframe id="framePDF" name="framePDF" src="#LocalDir#/viewer.html?file=#BookLoc#" frameborder="0" height="500px" width="100%"></iframe>

I've managed to go around the issue with CORS by changing the mode in viewer.js to 'no-cors'. However, now it can't retrieved the pdf from the server 100.0.55.10.

Console error

<p>I'm still fairly new to PDF.js. I'm trying to link my viewer.html with my pdf which are located in another server, eg: 100.0.55.10. Code shown below is how I embed the pdf in my iframe.</p>

<pre class="lang-html prettyprint-override"><code>//LocalDir = http:///127.0.0.1/Main/Apps/Document/web
//BookLoc = http:///100.0.55.10/pdfFolder/pdfname.pdf

<iframe id="framePDF" name="framePDF" src="#LocalDir#/viewer.html?file=#BookLoc#" frameborder="0" height="500px" width="100%"></iframe>
</code></pre>

<p>I've managed to go around the issue with CORS by changing the mode in viewer.js to 'no-cors'. However, now it can't retrieved the pdf from the server 100.0.55.10. </p>

<p><a href="https://i.sstatic.net/L5VX2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L5VX2.png" alt="Console error"></a></p>
 

Latest posts

A
Replies
0
Views
1
Alvah_Franey
A
H
Replies
0
Views
1
habrewning
H
Top