How to write Virtual Printer driver

Hello.I’m learning how to write virtual printer driver with EMFPrinter (an example from sourceforge.net).
it works well with text, but when i’m trying to print a WORD document.it doesn’t work well. for example , i print a document with two pictures and some texts , then got the SPOOL file and open it , i found that the pictures’re not showen correctly, i mean datas of pictures’re missing.

And i also test the document with Microsoft XPS Document Writer or other printer. all work fine.

So,can anybody give me some suggestions about the virtual printer.

thanks in advance…
_Present.

Hello
I would like to warn you that there are people here, who instead of help you out will criticize you for using words that they are not expecting, I have been a victim if you do not believe me just go through what happened http://www.osronline.com/showThread.CFM?link=201851 I am of an opinion that these guys did not have an answer, and deliberately changed the trajectory

Date: Mon, 28 Mar 2011 22:42:47 -0400
From: 40291409@163.com
To: xxxxx@lists.osr.com
Subject: [ntdev] How to write Virtual Printer driver

Hello.I’m learning how to write virtual printer driver with EMFPrinter (an example from sourceforge.net).
it works well with text, but when i’m trying to print a WORD document.it doesn’t work well. for example , i print a document with two pictures and some texts , then got the SPOOL file and open it , i found that the pictures’re not showen correctly, i mean datas of pictures’re missing.

And i also test the document with Microsoft XPS Document Writer or other printer. all work fine.

So,can anybody give me some suggestions about the virtual printer.

thanks in advance…
_Present.


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

I don’t have anything to offer to OP.
I tried hard not to hijack his discussion but I guess it has been already.

Abhishek, take a chill man. Nobody said anything disrespectful here.
There are all kind of people and same is true for this forum also.
But this forum is not meant to mend the behavior of people.
There are certain laid down rules which I think were followed in the post
you pasted.

Infact your question was very much uncooked which invited the satire from
some people.

Your unnecessary ranting on someone else’s post might invite you a ban here
by Peter
which I think will be bad for you since it looks like you are developing a
minifilter and you can get invaluable help from NTFSD community if asked
correctly.

-Deepak

On Tue, Mar 29, 2011 at 10:42 AM, abhishek tara wrote:

> Hello
>
> I would like to warn you that there are people here, who instead of help
> you out will criticize you for using words that they are not expecting, I
> have been a victim if you do not believe me just go through what happened
> http://www.osronline.com/showThread.CFM?link=201851 I am of an opinion
> that these guys did not have an answer, and deliberately changed
> the trajectory
>
>
>
>
>
> > Date: Mon, 28 Mar 2011 22:42:47 -0400
> > From: 40291409@163.com
> > To: xxxxx@lists.osr.com
> > Subject: [ntdev] How to write Virtual Printer driver
>
> >
> > Hello.I’m learning how to write virtual printer driver with EMFPrinter
> (an example from sourceforge.net).
> > it works well with text, but when i’m trying to print a WORD document.itdoesn’t work well. for example , i print a document with two pictures and
> some texts , then got the SPOOL file and open it , i found that the
> pictures’re not showen correctly, i mean datas of pictures’re missing.
> >
> > And i also test the document with Microsoft XPS Document Writer or other
> printer. all work fine.
> >
> > So,can anybody give me some suggestions about the virtual printer.
> >
> > thanks in advance…
> > _Present.
> >
> > —
> > 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
>
> —
> 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
>

Unfortunately, I do not know the first thing about printer drivers, virtual
or otherwise. They’re kind of their own beast, and one that very few who
lurk here tangle with, in my opinion.

The good news is that at some point Scott Robbins will be along and will
probably be able to help you out, should no one else be able to do so
sooner.

That being said, I would also like to warn you that there are people here,
who instead of helping you out, will take ANY opportunity to bitch and
complain that they’re not getting everything they want, exactly when they
want it, for free, and then cry about it when they are told that if they
wish to get help, they might consider being less of an unhelpful rude dick.

For example, you might ask about, say virtual printer drivers, and they
might tell you about how they’re a victim and are also all pissed off that
they’re not Prom Queen.

Don’t believe me? Just read this thread:

http://www.osronline.com/cf.cfm?PageURL=showThread.CFM?link=202128

Good luck,

Mm

On Mar 29, 2011 1:13 AM, “abhishek tara” wrote:

Why, thank you Martin.? I had no idea I had a reputation here.

Comment for the OP: I just looked at the source for EMFPrinter briefly and it says in the comments that it is a vector-only ("
??? // NOTE: phSurfacePatterns don’t need to be handled by us as
??? //??? we are a vector driver, not a raster one; DrvRealizeBrush()
??? //??? will take care of brushes
")

The “picture” data from Word would be output as raster, so a vector-only driver would ignore it.

Elsewhere comments say that raster formats are supported via ImageMagick, some command line utility. I don’t know about this. It looks like some configuration needs to be done to enable this support (from the UI?). Maybe you will be able to figure this out yourself. I wasn’t able to get it to build without changes, probably because it doesn’t appear to have changed in the last 3 years and I only have the most recent WDK.

Also, you should be more specific about exactly what you need your driver to do. Just saying “Virtual Printer Driver” doesn’t explain a lot.

Unfortunately, I *need* to work on my resume today, so I can’t get into it much more right now. Once the resume work is done, I will be able to look into it further.

ScottR

— On Tue, 3/29/11, Martin O’Brien wrote:

From: Martin O’Brien
Subject: RE: [ntdev] How to write Virtual Printer driver
To: “Windows System Software Devs Interest List”
Date: Tuesday, March 29, 2011, 3:29 AM

Unfortunately, I do not know the first thing about printer drivers, virtual or otherwise.? They’re kind of their own beast, and one that very few who lurk here tangle with, in my opinion.
The good news is that at some point Scott Robbins will be along and will probably be able to help you out, should no one else be able to do so sooner.

That being said, I? would also like to warn you that there are people here, who instead of helping you out, will take ANY opportunity to bitch and complain that they’re not getting everything they want, exactly when they want it, for free, and then cry about it when they are told that if they wish to get help, they might consider being less of an unhelpful rude dick.

For example, you might ask about, say virtual printer drivers, and they might tell you about how they’re a victim and are also all? pissed off that they’re not Prom Queen.
Don’t believe me?? Just read this thread:
http://www.osronline.com/cf.cfm?PageURL=showThread.CFM?link=202128

Good luck,
Mm

On Mar 29, 2011 1:13 AM, “abhishek tara” wrote:


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

Hey, membership has its privileges.

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Scott Robins
Sent: Tuesday, March 29, 2011 8:57 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to write Virtual Printer driver

Why, thank you Martin.? I had no idea I had a reputation here.

Comment for the OP: I just looked at the source for EMFPrinter briefly and
it says in the comments that it is a vector-only ("
??? // NOTE: phSurfacePatterns don’t need to be handled by us as
??? //??? we are a vector driver, not a raster one; DrvRealizeBrush()
??? //??? will take care of brushes
")

The “picture” data from Word would be output as raster, so a vector-only
driver would ignore it.

Elsewhere comments say that raster formats are supported via ImageMagick,
some command line utility. I don’t know about this. It looks like some
configuration needs to be done to enable this support (from the UI?). Maybe
you will be able to figure this out yourself. I wasn’t able to get it to
build without changes, probably because it doesn’t appear to have changed in
the last 3 years and I only have the most recent WDK.

Also, you should be more specific about exactly what you need your driver to
do. Just saying “Virtual Printer Driver” doesn’t explain a lot.

Unfortunately, I *need* to work on my resume today, so I can’t get into it
much more right now. Once the resume work is done, I will be able to look
into it further.

ScottR

— On Tue, 3/29/11, Martin O’Brien wrote:

From: Martin O’Brien
Subject: RE: [ntdev] How to write Virtual Printer driver
To: “Windows System Software Devs Interest List”
Date: Tuesday, March 29, 2011, 3:29 AM

Unfortunately, I do not know the first thing about printer drivers, virtual
or otherwise.? They’re kind of their own beast, and one that very few who
lurk here tangle with, in my opinion.
The good news is that at some point Scott Robbins will be along and will
probably be able to help you out, should no one else be able to do so
sooner.

That being said, I? would also like to warn you that there are people here,
who instead of helping you out, will take ANY opportunity to bitch and
complain that they’re not getting everything they want, exactly when they
want it, for free, and then cry about it when they are told that if they
wish to get help, they might consider being less of an unhelpful rude dick.

For example, you might ask about, say virtual printer drivers, and they
might tell you about how they’re a victim and are also all? pissed off that
they’re not Prom Queen.
Don’t believe me?? Just read this thread:
http://www.osronline.com/cf.cfm?PageURL=showThread.CFM?link=202128

Good luck,
Mm

On Mar 29, 2011 1:13 AM, “abhishek tara” wrote:


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


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

thank you all.
Sorry for my bad english.

I want to audit the content which people want to print.
First, i try to disable other printers and just enable mine. people use my printer(EMF printer) to print,
and then i can get the SPOOL file.With the SPOOL file that i can convert it to EMF file, then i can convert the EMF file to BMP,JPG or others files.

What i’m confused is that SPOOL file created via my printer is different from SPOOL file created via other printers.for example.a print a WORD document with two pictures, but only one picture is shown properly, another is missing.

As Scott Robins said. the “picture” data from WORD would be output as raster format. then i choose the raster format from UI of EMFprinter , but a found nothing changed.

now I hope you understand what i mean and give me some advice about printers or give me any way can do what i’m doing.

Thanks.

[offtopic]
On 03/29/2011 07:12 AM, abhishek tara wrote:

I would like to warn you that there are people here, who instead of help
you out will criticize you for using words that they are not expecting,
I have been a victim if you do not believe me just go through what
happened http://www.osronline.com/showThread.CFM?link=201851 I am of an
opinion that these guys did not have an answer, and deliberately changed
the trajectory

As far as I can read from the post, these “people” wanted to help you
but got very frustrated because your posted question did not contain
enough useful information to even start.

Please read:
http://www.catb.org/~esr/faqs/smart-questions.html
[/offtopic]

Here is my suggestion. Look thru the source code and figure out what “ImageMagick” is and how it is used in this driver. Then set things up so that what the driver expects, is set up correctly. In particular, I believe there has to be a registry entry which points to the “ImageMagick” command line utility. There may be more, I only took a few minutes to look at it.

ScottR

— On Tue, 3/29/11, 40291409@163.com <40291409@163.com> wrote:

From: 40291409@163.com <40291409@163.com>
Subject: RE:[ntdev] How to write Virtual Printer driver
To: “Windows System Software Devs Interest List”
> Date: Tuesday, March 29, 2011, 11:13 PM
> thank you all.
> Sorry for my bad english.
>
> I want to audit the content which people want to print.
> First, i try to disable other printers and just enable
> mine. people use my printer(EMF printer) to print,
> and then i can get the SPOOL file.With the SPOOL file that
> i can convert it to EMF file, then i can convert the EMF
> file to BMP,JPG or others files.
>
> What i’m confused is that SPOOL file created via my printer
> is different from SPOOL file created via other printers.for
> example.a print a WORD document with two pictures, but only
> one picture is shown properly, another is missing.
>
> As Scott Robins said. the “picture” data from WORD would be
> output as raster format. then i choose the raster format
> from UI of EMFprinter , but a found nothing changed.
>
> now I hope you understand what i mean and give me some
> advice about printers or give me any way can do what i’m
> doing.
>
> Thanks.
>
> —
> 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
>

On 03/30/2011 04:04 PM, Scott Robins wrote:

Look thru the source code and figure out what “ImageMagick” is and
how it is used in this driver.

…from http://www.imagemagick.org:

ImageMagick is free software delivered as a ready-to-run binary
distribution or as source code that you may freely use, copy, modify,
and distribute in both open and proprietary applications. It is
distributed under the Apache 2.0 license, approved by the OSI and
recommended for use by the OSSCC.

GIYF.

Just throwing in two cents…

ImageMagick is a third party imaging library which allows for typical image manipulations such as resizing, cropping, rotations, type conversions between jpg, bmp, gif, tiff, etc. It’s s decent library to get an image from one format into another, save it out, rezize it, etc. At the time I used it (8 years ago) it’s functionality did not include halftoning or dithering, but perhaps that has been added by now.

It offers a standard C interface as well as a C++ interface.

Cary J.