Brian O Carroll
Brian O Carroll

Reputation: 500

Google Drive Doc Viewer - Use javascript to scroll and zoom document

Here is a link to a document of mine in Google Drive/Docs. What I'd like to be able to do is scroll around that document (up/down/left/right) and also to zoom in and out (without using the mouse to press the zoom in/out buttons or the scroll bar buttons). Preferably by passing in a Javascript command like window.scrollBy(x,y); which works fine on normal HTML pages but not on the above page because the PDF document is inside an iframe. I've tried scrolling the iframe too but it doesn't work because the scrolling is not handled by the iframe. It's handled by a component inside the iframe.

Environment: I'm using Java 1.6 to write a Windows7-based application. I'm using an embedded Java web browser called JWebBrowser (a very convenient utility that's part of the DJ Native Swing package). JWebBrowser has a method to execute a Javascript command given as a string. This works for me to scroll normal HTML pages.

Background: I'm making an application to allow people with physical disabilities to access a computer without using the standard keyboard & mouse. The user only has very limited physical input options - In some cases, just one or two buttons/switches. This is why the existing zoom and scroll buttons are of no use to me. Below is a screenshot of my program. The user navigates the options on the left by pressing a move button and picks one by pressing a select button. By the way, I'm using Google Drive as a viewer for email attachments. This screenshot shows one such attachment.

enter image description here

If anybody has any suggestions for an entirely different online document viewer that better suits my needs and can be used to display PDFs, spreadsheets, Word Docs, etc., please let me know!

Thanks.

Upvotes: 1

Views: 2046

Answers (1)

Sergio Fernandez
Sergio Fernandez

Reputation: 1

Use Mozilla's ViewerJS, it has a page property for the Angular version. In Angular you can use ng2-pdfjs-viewer with [page]="page".

Upvotes: 0

Related Questions