Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printer monitor program in java  RSS feed

 
pulijala hari
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I want to make a program/service in Java that logs the print jobs with the file name and number of pages printed etc..,

Is this possible in Java?

Please help any sample appication/code/article etc...

regards,
hari
 
Shoumin Li
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not easy , Print job are highly system-dependent things.
If you need,I think you should use the api of printer.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think Java Printing (javax.print) supports this, so it could not be done in Pure Java.

However, a mostly-Java implementation would be possible. Your two approaches to getting the information that's not available in Java are: -

  • Use native APIs via JNI. You would define an abstract printer queue information API in Java, then implement it in native code for each platform you had to support.
  • Run external programs via Runtime.exec() or ProcessBuilder. Most OS have console utilities for querying printers. You could run these from Java and use Java to parse the results.

  •  
    pulijala hari
    Ranch Hand
    Posts: 70
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,

    Thank you for the insight. I have been going through so many forums in this regard. I hope the best way could be using VB or VC++ to interact with Win32 API and pull in all the information and put that into a DB.
    We can use our java program to work on this DB to display the results ,etc.

    Does anybody have sample code in VB or VC++ on this?

    Thanks again.
     
    laure mkl
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    did you find a solution, please? could you post it?

    thanks

    laure
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!