Can I force a CTRL+P?

For general issues related to PWB v2.

Moderators: Tyler, Scott, PWB v2 Moderator

Post Reply
carylib
Observer
Observer
Posts: 8
Joined: Tue Sep 27, 2005 9:18 am

Can I force a CTRL+P?

Post by carylib »

Hi,
We have created a library information kiosk with some big buttons like "Home," "Map," and "Print." Even though I've set the ini to False under "ShowPrintButtonDialog," I still get the print dialog when that programmed "Print" button is clicked. I've looked into changing the html to do this, but have had no luck. (I'm not an experienced html coder.) Is there a setting I can add to my ini so that my html button "Print" forces a Ctrl+P to print directly?

This is the html behind the button:
href="#" onclick="window.print();return false;">

I appreciate any help you can give me.
M. Donovan
M. Donovan
Cary Memorial Library
Lexington, MA

Scott
Site Admin
Site Admin
Posts: 2539
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Post by Scott »

The JavaScript command:

onclick="window.print();return false;"

Is hardwired to show the Print Dialog for security purposes. Imagine the mess if web sites were able to print directly without user intervention. It would give an entirely new meaning to pop-up advertising.

With PWB you can get around this by using the PWB Dynamic External Java Commands. The external commands allow a web site to talk directly to PWB. To print with the external commands do the following.

1. Enable the External Java Commands in PWB:

[Java]
EnableExternalJava=True

2. Add a dynamic command to print.

[Java]
JavaPrint=MyPrintCommand

3. Use the External Java Command to print instead of the JavaScript print function.

onclick="window.external.MyPrintCommand();return false;"

This will be the same as clicking on the PWB print button, and will also follow the other PWB print functionality such as Force Print Preview.

Here is more information on the PWB Dynamic External Java Commands.

http://www.teamsoftwaresolutions.com/beta/external.htm

--Scott

Post Reply