Link to home
Start Free TrialLog in
Avatar of Kubilay74
Kubilay74

asked on

Read printer queue

I need to read the content of the document waiting in the printer queue form a Visual Basic application. Not the size, or date only the content. I suppose that if the printer can print it, there must be a way to get this content beofre it reaches the printer. Can you help me ??
SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Merrion
Merrion

In Windows NT, 2000 and XP spooling each print job is stored (while it is being printed) in two linked files: a .SHD file which has basic details of the print job (user name, document name, number of pages etc.) and a .SPL file which holds the actual printed document.  The name of the file corresponds to the JobId of the print job (e.g. JobId 16 would be stored in file 000016.SHD and 000016.SPL)

The actual SPL file can be in either an EMF file or in the printer raw language (PostScript, PCL5, etc.)  The EMF format is undocumented (but reasonably easy to decypher) and the other languages are documented by their manufacturer.  You can query the print job with the GetJob API call to find out what language is being used.

Therefore any application that wishes to read the content of the printed document (as I have done in http://www.merrioncomputing.com/Business/case4.htm - "Print Content Indexing")  needs to be extensible in order to support any new printer languages that are added.  

Hope this helps,
  Duncan