mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.37k stars 9.97k forks source link

what method does these site like studocu use to show the pdf #15664

Closed sanzgrapher closed 1 year ago

sanzgrapher commented 1 year ago

what method does these site like studocu use to show the pdf https://www.studocu.com/it/document/politecnico-di-milano/costruzione-di-macchine/appunti/appunti-costruzione-di-macchine-aa20172018/968837/view

i am working on pdf js and using read only mode of the pdf.js . Currently when i need to open an pdf file i need to give this type of url https://example.com/generic/web/viewer_readonly.html?file={path-to-the-file} or https://example.com/generic/web/viewer_readonly.html?file=./docs/PoU-CMP-225-DSA%20Tutorial-1666968672 in which if we alter the link like
removed viewer_readonly.html?file=./ https://example.com/generic/web/docs/PoU-CMP-225-DSA%20Tutorial-1666968672 we will be shown a pdf which is rendered from browser where we can download it enter image description here

The thing i want to achieve is that i want to show document to user but don't want to allow user to download it or access it directly from file path if i alter the url from https://example.com/generic/web/viewer_readonly.html?file={path to the file}

to https://example.com/generic/web/viewer_readonly/file/{path-to-the-file}

Or are there any method to use so that user cannot access pdf file directly using file path to a pdf or anything to protect from downloading and only show pdf where we want show in webpage

Snuffleupagus commented 1 year ago

Please keep in mind that this is first and foremost a bug tracker for the PDF.js project, hence this sort of question is unfortunately out-of-scope of what we can/will help with here.

what method does these site like studocu use to show the pdf https://www.studocu.com/it/document/politecnico-di-milano/costruzione-di-macchine/appunti/appunti-costruzione-di-macchine-aa20172018/968837/view

Have you considered simply contacting the website in question and asking?

i am working on pdf js and using read only mode of the pdf.js .

What does "read only mode" of PDF.js even mean, since that's not really clear here.


When opening an issue, please provide all of the information requested in https://github.com/mozilla/pdf.js/blob/master/.github/ISSUE_TEMPLATE.md such that the issue becomes actionable/valid. 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 in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.