Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have googled alot for the past few days to find an answer but i am unable to find anything.

Problem Statement:

I want to save a .prn file for each print job without prompting the user. but my problem is not restricted to a particular printer. I want to capture the .prn file for each file that is printed through any printer on my pc. I want to integrate this functionality in my C# application.

Any help, guidance, links or sample codes will be highly appreciated
Posted
Comments
Richard MacCutchan 6-Sep-14 9:08am    
Most printer drivers send the data direct to the printere, there is no .prn file involved. Maybe you need to clarify exactly what you are trying to do.

You most likely need to hook into the spool server in order to do what you want.

This CodeProject article describes how to do it.
API hooking revealed[^]

More specifically you need to look into methods inside spoolsv.exe, spoolss.dll and gdi32.dll

Here is a list of printer functions
Print Spooler API Functions[^]

Good luck with the coding.
 
Share this answer
 
Comments
George Jonsson 7-Sep-14 13:30pm    
So what is wrong with these tips?
Aitizaz Khan 8-Sep-14 9:48am    
I have used the spooler api functions it provides you the details of the job but no the exact data in the job and that is what i want
What if you attach a FileSystemWatcher to %SystemRoot%\SYSTEM32\SPOOL\PRINTERS
 
Share this answer
 

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