Image only virtual printer driver

Hi,
I was looking in the WDK samples and I found the Bitmap sample and the TTY sample. The first prints everything like a bitmap, including text, and the second prints only text. My idea is that if I found a way to distinguish images (non text) I could work with this samples to build and hybrid.
I am working in a PDF printer, the clients don’t want any …Script solution, so I have to do my own work to generate the pdf.
Resuming: Using the Bitmap sample like the starting point I got every page in the pdf printed like an image. I think I have a way to print the text using the TTY sample, but the question is how to know when I have to print an image to the pdf.
I really need help on this, any hint would be very appreciated. My life depends of that :frowning:
Thanks in advance,
Darksice

I haven’t looked at either sample, so I may be talking nonsense here.? BUT, if you? hook DrvTextOut in the bitmap sample (and DrvGetGlyphMode) you should be able to output text in a different manner.? My guess is that this would be easier than adding bitmap support to a TTY sample.

  1. There are probably some applications out there that output “text” as bitmaps instead of calling DrvTextOut, so you will probably never get it to work 100% of the time.

  2. What is the objection to outputting text as bitmaps anyway?

ScottR


From: “xxxxx@gmx.com
>To: Windows System Software Devs Interest List
>Sent: Friday, June 3, 2011 10:01 AM
>Subject: [ntdev] Image only virtual printer driver
>
>Hi,
>I was looking in the WDK samples and I found the Bitmap sample and the TTY sample. The first prints everything like a bitmap, including text, and the second prints only text. My idea is that if I found a way to distinguish images (non text) I could work with this samples to build and hybrid.
>I am working in a PDF printer, the clients don’t want any …Script solution, so I have to do my own work to generate the pdf.
>Resuming: Using the Bitmap sample like the starting point I got every page in the pdf printed like an image. I think I have a way to print the text using the TTY sample, but the question is how to know when I have to print an image to the pdf.
>I really need help on this, any hint would be very appreciated. My life depends of that :frowning:
>Thanks in advance,
>Darksice
>
>—
>NTDEV is sponsored by OSR
>
>For our schedule of WDF, WDM, debugging and other seminars visit:
>http://www.osr.com/seminars
>
>To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>
>

Hi,
Thanks for your answer! (you can’t imagine how many times I pressed F5 on this page)

I was hooking that functions just to see what comes and is a big relief that you comfirm my initial ideas. By my problem maybe resides in the way the bitmap sample is implemented. It hooks ImageProcessing and adds everything to a buffer, on enddoc it prints the buffer to a file and you get a .bmp. I had used this design sucessfully for PNG,TIFF,JPEG images, but now my client wants a pdf output. Initially I was thinking that would be the same but in a pdf page built with an image in this way you can’t select text and so on.
If I add text to the pdf pages like I am generating now I will have the text printed over the image of the same text. My idea is to find a way to distinguish where and image and not a text is to be printed.

Thanks again,
Darksice

Hi,
There is any hooks other than ImageProcessing where I could filter images of the printing document???
Thanks in advance,
Darksice

I cant say this would be true all fo the time, but generally…

Calls to DrvStretchBlt with a non solid brush are usually images (photos, multi colored bmps, jpgs, etc)

Calls to DrvFillPath, DrvTextOut, DrvStrokePath, etc, are not images.

Any calls which use a SOLID brush are most likely not a “photo”.

Exceptions would be clip art, where a “image” is produced by vector art via multiple
calls to DrvFillPath, DrvBitBlt, DrvStrokePath with wide pen, etc.

If you have an image which is created via vector art “draw and fill” commands, there is practially no way to detect that.

But if in general you wish to pull off “images” from every thing else, you can usually count on calls
to DrvStretchBlt or DrvBitBlt with non solid brush to be “photos”.

Cary J.