v4 printer driver - Get bitmap handle without XPS transormations

Carlo Manasse 1 Reputation point
2021-09-15T11:14:21.5+00:00

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 Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
692 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,640 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 39,721 Reputation points
    2021-09-16T09:08:26.833+00:00

    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://learn.microsoft.com/en-us/windows-hardware/drivers/print/print-class-driver-rendering

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

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

    V4 Printer Driver Rendering Architecture
    https://learn.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.

    0 comments No comments

  2. Carlo Manasse 1 Reputation point
    2021-09-16T14:41:15.837+00:00

    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!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.