View PDF on a website using pdf.js

I want to place a file sample.pdfon your website and want to display it using pdf.js . I want to show my own file, for example demo , using the toolbar, zoom / off, etc. So far I can’t do what else.

I looked at the helloworld example , but it just shows the file as an image, without a toolbar, scaling / deleting, etc. When I put another file with many pages instead helloworld.pdf, it just shows the first page.

+5
source share
1 answer

I'm not quite sure what you are looking for, but I was able to get this to work just like a demo. Although you may not want to use this example for your project, you can use the working code as a starting point for your own requirements.

For a simple test, you can simply clone the project somewhere under the web server into a directory, such as myproject, and visit http://yourservername.com/myproject/web/viewer.html . You will see how pdf appears. This could be the starting point for working with this project. I did this by starting a very simple Apache server on Linux.

, , this jsbin , , - / ( , ).

, , Safari. . , , .

, CORS.

+1

All Articles