Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pdf.js v2.1.266 Missing PDF #11183

Closed
wen2204 opened this issue Sep 27, 2019 · 3 comments
Closed

pdf.js v2.1.266 Missing PDF #11183

wen2204 opened this issue Sep 27, 2019 · 3 comments

Comments

@wen2204
Copy link

wen2204 commented Sep 27, 2019

Attach (recommended) or Link to PDF file here:
https://advdownload.advantech.com.cn/productfile/Downloadfile/1-1U1QEN/ADAM-5000-TCP_DS_CHS.pdf
Configuration:
Web browser and its version:chorme 75.0.3770.100
Operating system and its version:win10
PDF.js version:v2.1.266
Is a browser extension:No

Steps to reproduce the problem:

  1. remove the throw error code in viewer.js at line 1750:
    if (origin !== viewerOrigin && protocol !== 'blob:') {
    //throw new Error('file origin does not match viewer's');//this line is commented
    }
  2. edit the html to show the pdf file:
<iframe src="~/lib/pdf/web/viewer.html?file='https://advdownload.advantech.com.cn/productfile/Downloadfile/1-1U1QEN/ADAM-5000-TCP_DS_CHS.pdf'" frameBorder="0" width="900" scrolling="no" height="600"></iframe> it cames out the error message: fetch_stream.js:100 GET http://localhost:62023/lib/pdf/web/'https://advdownload.advantech.com.cn/productfile/Downloadfile/1-1U1QEN/ADAM-5000-TCP_DS_CHS.pdf' 404 (Not Found).

it can not show also.why?

@Snuffleupagus
Copy link
Collaborator

remove the throw error code in viewer.js at line 1750:
if (origin !== viewerOrigin && protocol !== 'blob:') {
//throw new Error('file origin does not match viewer's');//this line is commented
}

Such a modification is (obviously) not supported, see PR #6916 for additional details. Furthermore it's quite likely that you, as is already explained in the FAQ (see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr), are running into CORS issues.

However, it's unfortunately somewhat difficult to understand exactly what you're actually trying to ask/report here!
Please rephrase your question/issue, by providing clear and concise steps to reproduce the problem. Furthermore, please see https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):

If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us on the IRC channel -- keep in mind that just code snippets won't help us troubleshoot the problem.#

@timvandermeij
Copy link
Contributor

I agree with the above. The PDF file works fine with the default viewer, so it's most likely a CORS issue.

@wen2204
Copy link
Author

wen2204 commented Sep 28, 2019

yes,it's may be a cors issue,even though I have removed the warning message

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants