question

27669006 avatar image
0 Votes"
27669006 asked 27669006 answered

v4 printer driver - Get bitmap handle without XPS transormations

Hi,
I am developing a v4 printer driver for a custom printer which will be able to only print bitmap files - all other formats should be discarded.
This printer requires some software pre-processing (which I am implementing within a custom v4 render filter component) to be performed on the bitmap itself, without any tranformations.

Is there a way to get a handle of the original bitmap within the render filter?

Current solution is to extract the image from the XPS stream as an IXpsOMImageResource object. Unfortunately, this image differs slightly from the original bitmap because the XPS writer changes the format either to a JPG or to a PNG.

Basically my target is to have the raw bitmap inside the render filter, without any transormation involved (e.g. by disabling or replacing the XPS writer).
Is this possible?


Many Thanks,
Carlo

windows-server-printwindows-hardware-wdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello,

Thank you for your question.

The v4 driver model does not use the XPSDrv rendering module for any other purpose. Therefore, drivers for XPS-direct devices do not need to include any filters. But drivers for all other devices must include filters that render in the device's PDL or must use the existing rendering support of a Print Class driver using the RequiredClass directive in the v4 manifest file.

See some information below in the following articles:

V4 Print Class Driver Rendering
https://docs.microsoft.com/en-us/windows-hardware/drivers/print/print-class-driver-rendering

Standard XPS Filters
https://docs.microsoft.com/en-us/windows-hardware/drivers/print/standard-xps-filters

Improvements in XPSDrv
https://docs.microsoft.com/en-us/windows-hardware/drivers/print/improvements-in-xpsdrv

V4 Printer Driver Rendering Architecture
https://docs.microsoft.com/en-us/windows-hardware/drivers/print/v4-driver-rendering-architecture

I believe you need to take a good look at the above articles before proceeding with v4 printer driver development.

If the answer was helpful, please don't forget to vote positively or accept as an answer, thank you.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

27669006 avatar image
0 Votes"
27669006 answered

Hi,
Many thanks for your answer.
I looked into the articles you have posted but I am still struggling to understand how I should proceed.


Assuming I am printing an image from a GDI application (e.g. paint.exe), is it possible to get a handle of the original printed file (bitmap) within the render filter of a v4 model driver?
In my understanding it's not possible because the v4 model filter receives an XPS (or OpenXPS) stream and it cannot be configured to receive the raw untransformed printed file. Correct?


In your opinion, should I look into a different printer driver architecture? Is there a sample driver capable of performing such requirement?

Many Thanks!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.