Proving Print window on the client PC using JApplets

Posted on 2006-11-14
Last Modified: 2010-03-31

I'm looking for a way to provide the client side with a Print window so that he/she can select the printer where the document can b printed.
So i've wriiten a JApplet code which pops-up the Java Print window and was able to print the document when invoked it on my local PC.

But when tried to call this applet from an HTML page that was deployed on the tomcat server, it was not showing any print window.
So can u tell me is this bcoz Applets r not given access to client side resources? If yes, is there any other alternative for providing this functionality?

Kindly reply me asap as this is urgent requirement.

Question by:hemanth146
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 13

Expert Comment

ID: 17941268
if you want to print an html page, use window.print() from within the html (javascript).

Author Comment

ID: 17941298
I dont wanna print an html page. But want to display a Print window on the client side using Applet showing his local printers so that I can configure and retrieve the printer settings.
LVL 13

Expert Comment

ID: 17941332
if you want to use the applet, you will have to sign it:

//generate a key
keytool -genkey -keyalg rsa -alias your_alias_here
//save the certificate
keytool -export -alias your_alias_here -file your_certificate.crt
// sign the jar file
jarsigner your_applet.jar your_alias_here
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 17941353
so if i sign it will i able to access client side printer resources?
LVL 13

Expert Comment

ID: 17941362

Author Comment

ID: 17941379
so if my applet name class is 'PrintApplet.class" can u show me an eg of how to call this from a html page aftering signing it
LVL 13

Expert Comment

ID: 17941397
you will have to create a jar file first ... then sign it

creating a jar file:
LVL 13

Accepted Solution

kawas earned 500 total points
ID: 17941420
Not sure how you embedded your applet in the html, but I had this once:

    <APPLET  CODE = "./my_applet.jar" WIDTH = "775" HEIGHT = "385" NAME = "applet" VSPACE = "10" HSPACE = "10">
            <PARAM NAME = CODE VALUE = "" >
            <PARAM NAME = CODEBASE VALUE = "." >
            <PARAM NAME = ARCHIVE VALUE = "./my_applet.jar" >
            <PARAM NAME = NAME VALUE = "applet" >
            <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
            <PARAM NAME="scriptable" VALUE="false">

then place the jar file and the html file at tomcat_home/webapps/your_web_app/

Author Comment

ID: 17941437
well thanks for the help.will try the above things and get back to u if have any issues.

Expert Comment

ID: 17941945
Thanks Kawas Now my crazy mobile JPad will actually work!!! :) too bad I can't save the file directly to my remote server....

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question