Click here to Skip to main content
15,073,511 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to create a windows application using windows forms in which i want to catch all the printing request sent to printer.

How can I achieve this?

What I have tried:

I'm looking for the solution, but haven't got anything useful yet.
Updated 24-Apr-17 0:18am
Maciej Los 24-Apr-17 12:53pm
You may need to write and install windows service...

How to get the status of a printer and a print job - MSDN

1 solution

Have a look at the CodeProject article Monitor jobs in a printer queue (.NET)[^].

If it does not fulfill all your requirements it should be at least a good starting point.
Sachin Makwana 24-Apr-17 8:13am
Thanks. It's useful. How to catch which document is printing( whole file not document's name) ? Above solution is giving me name of the document being printed, but i am not getting attached document or file.
Jochen Arndt 24-Apr-17 8:34am
I had no deeper look into it. So I can't answer.

But I guess that it is not possible to get a file name. The print queue holds the data to be sent to the printer after having been prepared by applications. And often there is even no file. Examples are not yet saved docucments, printing web pages, or printing application generated reports.
Sachin Makwana 24-Apr-17 8:42am

Please share the link if you find "how to get printing data"?.
i can see printStream property while debugging above project using PrintingSpoolerAPI, but it's always null .
Jochen Arndt 24-Apr-17 9:11am
What do you mean by "how to get printing data"?

Do you want access to the raw data send to the printer?

If so, why (the data are printer specific)?
Sachin Makwana 25-Apr-17 1:30am
I meant, printing data which are being sent to the printer for printing.
Jochen Arndt 25-Apr-17 3:12am
You should read about how printing on Windows works.
See for example
But note that the above link is for Win 2000/XP and there has been changings with newer Windows version.

When the printer uses raw mode, one of the spool files already contains the data to be send to the printer. With other modes, there will be additional processing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900