This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes how to access print job in print spooler or print server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to access print job in print spooler or print server" Watch "how to access print job in print spooler or print server" New topic
Author

how to access print job in print spooler or print server

Dilanka Muthukumarana
Greenhorn

Joined: Mar 28, 2009
Posts: 7

hi guys,

actually I want to know how to access print job in the print spooler or print server. Thing is I want to do as follows:

I want to develop a tool for counting print jobs of the printers in the print servers and get how many number of pages are printed and also get owner machine of print job in the network.

I got JOB_INFO_2 structure in the msdn but I want to do in java. I wrote simple program using java. but it will give only printer name and small things. I want to get what is the machine print job coming from and how many pages in that print job. I have included msdn struct and simple java class that I have written. as per the msdn doc, all the print jobs are associated with all those parameters, but how we access and retrieve them using java. hope you guys help me in this case..
--------------------------------MSDN Struct--------------------------------------------------------------
typedef struct _JOB_INFO_2 {
DWORD JobId;
LPTSTR pPrinterName;
LPTSTR pMachineName;
LPTSTR pUserName;
LPTSTR pDocument;
LPTSTR pNotifyName;
LPTSTR pDatatype;
LPTSTR pPrintProcessor;
LPTSTR pParameters;
LPTSTR pDriverName;
LPDEVMODE pDevMode;
LPTSTR pStatus;
PSECURITY_DESCRIPTOR pSecurityDescriptor;
DWORD Status;
DWORD Priority;
DWORD Position;
DWORD StartTime;
DWORD UntilTime;
DWORD TotalPages;
DWORD Size;
SYSTEMTIME Submitted;
DWORD Time;
DWORD PagesPrinted;
} JOB_INFO_2, *PJOB_INFO_2;

----------------------------END of MSDN Struct-----------------------------------------------------------


package it.dmm.printer;

import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.Attribute;
import javax.print.attribute.AttributeSet;

public class Printer {

public static void main(String[] args) {

PrintService printer = PrintServiceLookup.lookupDefaultPrintService();

AttributeSet att = printer.getAttributes();

for (Attribute a : att.toArray()) {

String attributeName;
String attributeValue;

attributeName = a.getName();

attributeValue = att.get(a.getClass()).toString();

System.out.println(attributeName + " : " + attributeValue);


}

}

}
results are :
queued-job-count : 0
color-supported : supported
printer-is-accepting-jobs : accepting-jobs
printer-name : Microsoft XPS Document Writer


please help asap for this case..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to access print job in print spooler or print server
 
Similar Threads
singleton class
how to access print job in print spooler or print server
is there any guide lines for this problem ?
Networking Linux and Windows Me
Windows - Java - Printer - PDF - Status Issue.