Use javascript to switch pages in acrobat reader in webbrowser - javascript

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!

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!

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.

This won't solve all of your feature requests, but you may want to take a look at the PDF open parameters. If you open a pdf with the appropriate hash-url, you can control reader's behavior.
For example, the following will open a PDF and go to the third page of the pdf:
http://example.org/doc.pdf#page=3

Related

PDFs viewing possibility

Is there any application or method to view PDFs as "picture-in-picture"?
I wanted to try this as a means of duping a window focus tracker on a remote proctoring site.
The examination is open-book and since I don't have the prints I'm trying to explore ways to view PDFs without having to change windows or tabs.
The best way to do so is by using PDF.js as it renders PDF's in HTML5 in your browser. I haven't come across any better solutions.
see: https://github.com/mozilla/pdf.js

How to embed a pdf into a html page for android browsers

So,
At the moment I embed a base64 encoded pdf into a html page using iframe and I have no problem with this but I want to display it also on android browsers like chrome and firefox.
I also tried object or embed tag but none worked.
What should I do ?
You should try Viewer.JS or PDF.JS. If none of those work, you could possibly use Google Docs Viewer. This site will help you generate the URL for that : iTools.com. I prefer Google Docs currently because the performance is a little sluggish using both of those Javascript viewers. Keep in mind that in order for the Google Docs Viewer to work, you must have the file published to the web and accessible for Google's servers.
Another option would be to use a conversion library (such as imageMagick) to turn the PDF into an image and then offer a link to the full file. If your html is going to be viewed by other devices such as desktops, you could always check to see if Adobe Reader is installed and then, if not, offer an image instead with a link to the file. I use PluginDetect to check for support for PDFs.
There are other commercial options like iSSUU or FlexPaper but I don't have any experience with those. iSSUU is a software service that allows embedding viewers on your website and FlexPaper is a software that you buy and install to your website.
This is assuming you're trying to embed a PDF to a website. :/

print and download protected pdf viewer for web

i want to add viewer to web site.
the basic idea of the pdf viewer is show uploaded pdf files in the server to the client.
user cant print or download document.as a example for this kind of pdf viewer is slideshare.
it has no default option for download(slideshare people provide their custom button for do that)
Only users can be able to view document.
I tried several PHP,JavaScript plugins for doing that but unable to find one that has no print and downloadable options.
Printing option is a built in browser option so you can't restrict it by any kind of plugins or scripts.
You can Render the page empty in case of printing using CSS
#media print { .no-print {display: none; }}
and you should try to find an option to stop the control that views your PDFs from printing
Basically, you have the Flash and Javascript solutions. While Flash technology is safer, it looks a bit obsolete and is avoided by some developers. Javascript, being a client-side technology, can only obfuscate the actual URL of the document or document content (pdf file).
For the Javascript side, the pdf.js viewer is quite popular.

Running JavaScript code on PDF pages on my domain?

I it possible to run javascript code on for example: mydomain.com/pdf/pdf-example.pdf?
Any ideas how to accomplish this?
My intention is to add live chat code so that we can help customers while they are looking at the PDF
You can use pdf.js to render a PDF file onto a standard HTML page. So instead of linking directly to the PDF file, you would create a new HTML page, where you would embed the pdf.js viewer, as well as any additional custom Javascript. Here is a demo. The downside to pdf.js, is browser support is limited.
Another option is pdfobject, which enables you to embed PDF's within pages. This uses the browsers native PDF viewer for rendering.

Convert HTML page into image using Javascript

Hi,
EDIT: I want to achieve it by with out using any third party software..My application is a SAP product and I cannot go to every customer and install that software in his system.
I have the following scenario.. There is a button in my webiste(ofcourse,its a business applicaion) named "Save as image".so whenever user presses that button the content of the page has to be converted to image file and saved in his system.
Can we achieve it by either javascript or jquery?
If we cannot do it in javascript ,can we do it in SAP BSP,since my application is being developed in SAP BSP?
I had already searched in this site and found one solution which only works in Firefox extesnion. But I need a cross-browser solution which must work for IE,Chromer,ect.
The way to do this would be render the HTML page in hidden <canvas> element and then saving the canvas content as an image.
It is possible, but you won't have perfect rendering output or a solution working on legacy browsers.
Please see
https://stackoverflow.com/a/12660867/315168
for more information.
Alternatively submit a stateless page URL to the server-side where a headless browser renders the page and takes a screenshot using Selenium automation. If the page is public some web services exist for this too.
One easy but partial IE solution, it uses ActiveX so not crosswbrowser and a general one that is a bit more cumbersome
The IE solution
function printScreen(){
var oWordBasic;
if (window.ActiveXObject){
oWordBasic = new ActiveXObject("Word.Basic");
oWordBasic.SendKeys('%{1068}');
oWordBasic.SendKeys('%{PRTSC}'); //or if the above doesnt work..
//save or transfer the clipboard contensts
}
}
The general solution:
Use a screen capture utility like Gadwin PrintScreen http://www.gadwin.com/printscreen/, it's for windows but i'm sure there are the like for Linux and Mac. You can define a hotkey and let this save the image to a fixed location with autonumbering. The program doesn't need to be installed, it's portable so it can reside on a networkshare.
you may also try to create java applet or jar included into site that would capture some part of the screen or browser. i saw mechanism for real time screen sharing based on jar loaded files, but i didn't see the code.
here is some lib for java html into image conversion
http://code.google.com/p/java-html2image/
heres simmilar topic
How to capture selected screen of other application using java?

Categories

Resources