Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use javascript to switch pages in acrobat reader in webbrowser

For a project I am looking for a good way to display pdf files in a webbrowser (IE8 and newer). The browsers used in my project have acrobat reader installed, so thatwillbe the preferred way to visualize thepdf file.

Is there a way to access acrobat reader currently opened in a div to (for instance) switch pages or jump to a given bookmark? Is it also possible to listen for text selection events?

Thanks in advance!

like image 714
Bjarne77 Avatar asked Aug 17 '26 04:08

Bjarne77


2 Answers

I'm not sure you can control the PDF from the outside of the page. However, pdf.js is a PDF renderer written in Javascript. It allows you to embed a PDF viewer inside a page and fully control it, including flipping pages, and the like. It may just be what you're looking for!

like image 182
Jonathan Protzenko Avatar answered Aug 19 '26 19:08

Jonathan Protzenko


Having worked on this problem for some time, I now use the following solution:

  • Use pdfObject.js to embed the pdf file in my webpage.
  • Communicate between pdf and html using the HostContainer. Important here is that you are able to put some javascript in the PDF file.
  • Important note is that this only works with the embedded Acrobat Reader/Pro version.
  • see: http://www.javabeat.net/articles/print.php?article_id=301)

Good luck. If you encounter problems, just leave a message, perhaps I can help.

like image 34
Bjarne77 Avatar answered Aug 19 '26 19:08

Bjarne77



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!