Solved

Proving Print window on the client PC using JApplets

Posted on 2006-11-14
13
204 Views
Last Modified: 2010-03-31
Hi,

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.

Thanks.
0
Comment
Question by:hemanth146
[X]
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
13 Comments
 
LVL 13

Expert Comment

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

Author Comment

by:hemanth146
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.
0
 
LVL 13

Expert Comment

by:kawas
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
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

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

Expert Comment

by:kawas
ID: 17941362
yes
0
 

Author Comment

by:hemanth146
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
0
 
LVL 13

Expert Comment

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

creating a jar file: http://www.javacoffeebreak.com/faq/faq0028.html
0
 
LVL 13

Accepted Solution

by:
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 = "package.to.PrintApplet" >
            <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">
      </APPLET>

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

Author Comment

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

Expert Comment

by:SamsonChung
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....
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

739 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