Keeping a soft copy of print jobs

K

Keith M

Hi

I'm working on a Win2000/XP security based system and one of the
requirements is that when a print job is made, a copy of whatever gets sent
to the printer should be saved on disk and an audit entry made to identify
this.
Our software already hooks certain Print API's; StartDoc, StartPage,
EndPage, EndDoc and we also have a custom print driver written using the DDK
that can manipulate the device contexts of the print jobs to add our own
text.

Does anyone have an idea how I can capture the printed job and save details?
This should work for printing from any application.

My initial thoughts are to try and mimic what happens when you select 'print
to file' when printing and then end up with a *.prn file but I don't know
how to achieve this through code.

Any advice welcomed.

Thanks

<x-posted to microsoft.public.win2000.printing>
 
D

Dieter

Hi Keith,

you have the following possibilities:
(sorry, i have only a german version of windows - so names will be different
;)

1) tell the printers to keep jobs after printing:
by disabling "extended print function" the generated SPL-Files are
exactly the raw *.prn-Files you want.
When not disabled they are saved in EMF-Format in most cases.
You can simply use "EnumJobs" to get extended information about the
jobs.
2) Write a "print processor" like "genprint"-sample from DDK.
Print Processors get EMF or RAW-Files dependend on Applications,
Operating Systems and Printer Configuration.
You can duplicate RAW-Files and have all information from JOB_INFO
Problem: Your printers must use the use new "print processor" and some
drivers will use there own (hp). I don't know
if they still work when using others.
3) Write a "local monitor" like "localmon"-sample from DDK. It's a better
place to duplicate raw-Files, but
you have fewer information than in print processors.

For an example in point 1) you can download "splview" from my homepage
www.lvbprint.de.
Sorry it's only available in german language, but you can see all delivered
information about kept print jobs (Ctrl+J).

Dieter
 
K

Keith M

Thanks Dieter

that has given me some ideas to think on.

We already have printprocessor that handles EMF types.
I wonder if there is a way to duplicate the EMF files from within our print
processor?

I tried your option 1 and sure enough the printer spl files stay in the
spool directory. Unfortunately the print jobs never came out of the printer
though even though they did appear in the print queue with a 'printed'
status.
 
D

Dieter

Hi Keith,

if you find out the name of the SPL-File you can use the functions:

AddJob () //returns name of a spl-File to copy your file to
RevertToPrinterSelf (); // get system-rights
copy files
ImpersonatePrinterClient ();
ScheduleJob ()

to schedule the job to another printer.
Spooler must be configured to start when last side is spooled.

An other posibility is to examine the SPL-File, which consist of
multiple EMF-Pages, and play each page to another device. You have to
extract embedded fonts
(clients embed them, when fonts are not present on print servers).

2000/XP print processors could have other possibities to.
I think it's possible to read the spool-file by ReadPrinter with
printer opened in a special way ("<PrinterName>,job")


Some hints to get the name of the spl-File:

Under XP spool-jobs are named "fp*.spl". You advise XP
to generate SPL-Files in old style names ("%05d", jobid) by keeping
print files or by setting a per printer spool directory in the registry
<HKLM>\System\CurrentControlSet\Control\Print\Printers\<Your
Printer>\SpoolDirectory.

Dieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top