aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to disable pdf toolbar buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to disable pdf toolbar buttons" Watch "How to disable pdf toolbar buttons" New topic
Author

How to disable pdf toolbar buttons

Bairavarsu Kamalakar
Greenhorn

Joined: Apr 06, 2005
Posts: 10
Hi All,

I have a web service which will return pdf stream for a given document id and I will set the content type to application/pdf and write the out put to IFRAME upto this point I am done and OK!
My problem is :
My client requirement is to disable the pdf toolbar buttons except the print button in IFRAME, is there any way using JavaScript to disable all the PDF toolbar buttons?

Thanks in Advance.
Kamalakar B.
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
If the PDF plugin version supports passed in control options, you can hide all the toolbar buttons by appending #toolbar=0 to the src:


At least it works with direct links to the document. I'm assuming it will also work with a stream:



Problem is, this will hide the Print button as well. Note that the right-click menu is unaffected, so you can print and do anything else with it as well. There might be a similar control for disabling the right-click menu, or maybe you can do it with plain javascript.

Also note that there will still be a "show toolbar" button at the bottom left of the document, unless you disable the scrollbar, and the user can use it to show the toolbar again.

The only control options I'm aware of are toolbar, page, zoom, and scrollbar. You can string them together separated by ampersands: #toolbar=0&page=3&zoom=50%. I've tried searching for a comprehensive list of all available controls, but couldn't find one.

-Yuriy
[ August 02, 2005: Message edited by: Yuriy Zilbergleyt ]
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
My bad, just tested it out, and for the streaming version the query parameters must go before the plugin controls:

src="getDocument?docId=456#toolbar=0" instead of src="getDocument#toolbar=0?docId=456

-Yuriy
Bairavarsu Kamalakar
Greenhorn

Joined: Apr 06, 2005
Posts: 10
Hi Yuriy,

Thanks a lot It worked.

How to disable the left panel i.e. "Bookmark/Signatures/Layers/Pages"?

Thanks in Advance.

- Kamal
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
I listed all the plugin commands I know of. I got the idea from http://www.schubert-it.com/pluginpdf/webdev/, which lists some commands for their custom plugin, and through testing found that some of them work with the standard Acrobat Reader plugin. Unfortunately "pagemode", which is what the site lists for bookmarks, isn't one of them. If you figure out how to disable bookmarks in the plugin, please let me know.

-Yuriy
Yesudas S Solomon
Greenhorn

Joined: Jun 28, 2005
Posts: 2
Originally posted by Bairavarsu Kamalakar:
Hi Yuriy,

Thanks a lot It worked.

How to disable the left panel i.e. "Bookmark/Signatures/Layers/Pages"?

Thanks in Advance.

- Kamal


use #toolbar=0&navpanes=0

it will work.
you can get the complete list from here,
http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf


.
Hope it will help others as well!
[ September 04, 2008: Message edited by: Yesudas S Solomon ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Yesudas, this post is over 3 years old. Please refrain from digging up old posts. Please read this for more information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to disable pdf toolbar buttons