Keith Johnson

Greenhorn
+ Follow
since Sep 11, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Keith Johnson

ok, I'll give a little more detail about what I'm doing. We are in the process of creating a box office ticketing application that is web based. It is written using ASP/Javascript and running solely in IE 6. At each ticket window will be a pc running Win 2k which is connected to a ticket printer. When the ticket is sold, via the browser based application, I need to print a ticket to the locally connected printer.
To do what I need, to the best of my knowledge, I need an Applet. I imagine some sort of ActiveX control could be written but I tend to think the Applet would be the best solution, if I can get it to work. I will not be displaying the ticket to the screen anywhere. I would simply like to allow the user to click on a button that will call a javascript function that will then call an applet to send a stream of data to the windows printer. I am able to do this fine in VB but, not being able to execute a dll from the browser (unless there is a way) then I figured Java was my only solution.
Hopefully this will shed a little light on what I am trying to accomplish. I have seen discussions online where people seem to have done very similar things but with little to no detail and being inexperienced in Java, detail is what I need. At least a boost in the right direction. I'm struggling through signing an applet now and have most of that working now but will really need to understand how to send a stream of data to a printer. This will include formatting the document, etc.
Thanks.
20 years ago
Hi,
I need to create an applet that will print to a local printer. From what I have read I need a signed applet. I have managed to get a signed applet to work to allow me to write a file to my pc, but when attemting to read a file via FileInputStream I get:
Error: java.security.AccessControlException: access denied (java.io.FilePermission c:\Ticket.txt read)
The code I'm using is:
FileInputStream fis = new FileInputStream("c:\\Ticket.txt");
printStatus( new DataInputStream(fis).readLine());
fis.close();
I added this to my java.policy file:
grant signedBy "mySigner" {
permission java.io.FilePermission "C:\Ticket.txt", "read";
};
I read somewhere that FileInputStream should not be used when reading from the client but don't know what else to use.
Right now, I'm simply trying to read a text file and send it to the printer. What I ultimately would like to do is send a stream of text directly to the printer without a file. I'm completely new to Java so I've been doing lots of reading online to see that some people have been able to do similar things but have yet to find any good material to point me in the right direction.
If anyone has any information that can point me in the right direction I would greatly appreciate it.
Thanks,
Keith
20 years ago