• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAVA API ( JPS ) For Printing out in JAVA

 
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
I have an requirement to print an out file using JAVA API ( JPS ) in windows environment. I should be able to control parameters like
page size , page width , page break while printing the out file. I would appreciate some one letting me know the appropriate JAVA API
to be used. Some of the resource material I got from net

http://java.sun.com/j2se/1.4.2/pdf/JPS_PDF.pdf

Regards,
Anil
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The examples in that PDF demonstrate how to use various attributes; what else are you looking for? Check out the classes in the javax.print.attribute.standard package for what else is possible.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I need to search for the print services capable of printing the specified attribute. This search is to performed at the client and not server. How do I proceed further ?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I need to search for the print services capable of printing the specified attribute.


And there's a code example in that PDF that demonstrates how to do that; it's called "PrintPS".

This search is to performed at the client and not server.


I don't understand what you mean by client and server in this context.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let us assume that we have 2 PC configured in a LAN environment . One among them is say server and other is client.
When I search for the services capable of printing , this search is performed at the server and not at client.
Printer is configured at client and not at server. So how do I Locate print services installed at the client ?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to discover printers on the "client", why would you run the code on the "server"? I'm putting those in quotes because I'm still not sure what those designations have to do with the problem.

Is this maybe a web app, and you want to print something on a printer connected to the client? If so, that's only possible if the printer is set up as a network printer so it's visible to the server.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like I have not been able to explain my problem clearly .
My application server runs on Linux OS. Printing of the reports is done by executing shell script on the text file. The general syntax used is ssh root@client_ip_adress script file name text file name. Execution of shell script is not possible if the client accesses the application from windows. This is because executing script file is not possible in windows environment. I want to avoid the use of script and directly send the text file to the printer port for printing. Each client will have its own printer , none among them will be using shared printer. For this I had thought of using JPS api.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm still not sure on which machine the code that should do the printing runs; I'm guessing the app server - is that correct? If so, then this approach won't work because the server does not have access to client-side printers.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The execution of print job is at the client . That is why when the app sever is accessed from windows environment , printing can not be done. This is because script file can not be executed in windows environment. To avoid all this I was thinking of using JPS api .
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me know if there is way to print an text file generated in app server to local machine connected to the printer. Accessing the out file from local machine is not a problem . But I am not able to populate list of print service installed in local machine. As discussed the code written is executed at the server , so it populates the list of print services running on the server and not the client.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I've said before, code running on the server can't access printers installed on the client, so you'll need to find a way to transfer the file to the client where it can be printed in various ways.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
K thanks for your reply . I will try to work out a solution.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have made use of a signed applet to access client resource ( Local printer installed ) . Print code works fine . Currently it is only possible to track the print job status. For this we can make use of methods ( printJobCompleted , printJobFailed ..... ) defined in PrintJobListener interface . How should one check the status ( on line and off line ) of the printer. Do we have any third part api to check the status of the printer ?.

PS : I am not sure If I should be opening up a new the thread for this issue but as the issue is connected to the earlier issues faced by me , I have continued the discussion here.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anil Kumar wrote:I have made use of a signed applet to access client resource ( Local printer installed ) . Print code works fine . Currently it is only possible to track the print job status. For this we can make use of methods ( printJobCompleted , printJobFailed ..... ) defined in PrintJobListener interface . How should one check the status ( on line and off line ) of the printer. Do we have any third part api to check the status of the printer ?.

PS : I am not sure If I should be opening up a new the thread for this issue but as the issue is connected to the earlier issues faced by me , I have continued the discussion here.




Added the following comments on 29/04/10

Currently no Java api provides support to check the status of the printer. Thanks Ulf Dittmer for your timely help. It can be done only through the use of script.

reply
    Bookmark Topic Watch Topic
  • New Topic