Re: bitmap printer driver by Steve
Steve
Tue Jul 18 14:20:00 CDT 2006
"Tobias Erichsen" <t.erichsen@gmx.de> wrote in message
news:2rdpabF17tme4U1@uni-berlin.de...
> How can I find out in my rendering-plugin, at what point there is a
> page-break?
> As far as I understand the IPrintOemUni::FilterGraphics could be called
> multiple times per page - right?
>
> I use filtergraphics to convert the rendered data into my format and write
> it down into a file, but I need to provide
> a.) a document header
> b.) a page header
> c.) an end-of-file header
> So I need to get the information about those states / state-changes. I
> have
> only found an interface for this information in the ui-plugin - but this
> really
> does not help me during the rendering/conversion process :-(
>
> At the end of the printing process I want to start up an executable with a
> graphical-frontend for further processing of the generated file. This exe
> must be run in the context of the user that has invoked the print-task.
> How can this be done?
>
> Thanks a lot in advance for any pointers in the right direction :-)
Hi Tobias,
I've not used the Unidriver, but know a fair amount about the PostScript OEM
driver, and this smells to me a bit like you're going down the wrong road
with this. Take all this with a grain of salt - I'm winging it on Unidriver
issues.
FilterGraphics is called on a scanline basis, not text, and I don't think
that's really the avenue to solve this problem.
If you're trying to add a header and footer to each page, looking at the
Watermark sample in the DDK is probably your best bet. Look in
src\print\oemdll\watermarkuni\ for this sample code. There seem to be some
helper routines in IPrintOemDriverUni which will allow you to move around
(DrvXMoveTo, DrvYMoveTo, DrvUniTextOut) on the output bitmap.
Unfortunately, the only way I know of to get access to the start/end page
code in the rendering DLL is to implement IPrintOemUni::EnableDriver and
hook DrvStartPage / DrvEndPage. The bummer is that the low-level code has no
meaningful access to the DEVMODE: though it can reach the public and private
parts, the private part is the *Unidriver* private part.
There is no portable method for finding your part of the private DEVMODE,
though Microsoft told me they were "thinking about it" for Vista. The only
way I've been able to get around this is to hook
IPrintOemUI2::DocumentEvent's DOCUMENTEVENT_STARTDOCPOST to grab the job ID,
and stuff the parameters as a string into JOB_INFO_1.pParameters with
SetJob().
Then, in the rendernig DLL, you'd have to hook DrvStartDoc (likewise, from
EnableDriver), take the job ID provided to you there, and stuff it and the
parameters into your OEMPDEV. It's really cumbersome, but it works.
Hooking the output data is going to be even more tricky, because the UI part
doesn't ever get a hook to the actual output data stream. I guess one way to
handle this would be for the UI part to actually create a temp file, and
pass the name to the rendering DLL: "Please send your output here". You
might have to use the SetJob() thing.
If you want a *Document* header, that's really starting to smell like the
kind of thing that belongs in a print processor.
Good luck,
Steve
--
Steve Friedl / UNIX Wizard / Microsoft Security MVP / www.unixwiz.net