Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Any advice appreciated for newbie building printer driver

25 views
Skip to first unread message

Kunle Odutola

unread,
Jun 26, 2005, 10:17:04 AM6/26/05
to
Hi,

I'm a device driver newbie starting out on the road to what I hope would be
a basic fax printer driver (a la WinFax or Ms Fax).

As a first step, I'd like to build a print driver that prints to an image
file (e.g. png or tiff). What resources would help me at least get this
far?. Any sample source code for something similar? Book recommendations?
Websites?

<aside>
PDFCreator claims to have a printer driver that prints to a PDF. Does anyone
here know if this is a true Windows print driver or a GhostScript driver?
</aside>

Cheers,

Kunle

Calvin Guan

unread,
Jun 27, 2005, 1:58:33 AM6/27/05
to
Printer drivers live in their own world. I guess your best bet is the DDK
docs and samples.

http://www.paulyao.com/training/index.asp would be helpful.

--
Calvin Guan Windows DDK MVP
Staff SW Engineer, NetXtreme MINIPORT
Enterprise Network Controller Engineering
Broadcom Corporation www.broadcom.com


"Kunle Odutola" <kunle....@REMOVETHISokocha.freeserve.co.uk> wrote in
message news:eR4%23IfleF...@TK2MSFTNGP12.phx.gbl...

Tim Roberts

unread,
Jun 28, 2005, 1:55:23 AM6/28/05
to
"Kunle Odutola" <kunle....@REMOVETHISokocha.freeserve.co.uk> wrote:
>
><aside>
>PDFCreator claims to have a printer driver that prints to a PDF. Does anyone
>here know if this is a true Windows print driver or a GhostScript driver?
></aside>

How would you define a "true Windows print driver"? Many (most? all?) of
the inexpensive PDF generators use GhostScript as their GDI-to-PostScript
converter. It doesn't make them any less of a driver.
--
- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc

Kunle Odutola

unread,
Jun 28, 2005, 12:30:20 PM6/28/05
to

"Tim Roberts" <ti...@probo.com> wrote in message
news:b9p1c15jv93g98sfn...@4ax.com...

> "Kunle Odutola" wrote:
> >
> ><aside>
> >PDFCreator claims to have a printer driver that prints to a PDF. Does
anyone
> >here know if this is a true Windows print driver or a GhostScript driver?
> ></aside>
>
> How would you define a "true Windows print driver"?

Given that my goal is to build a fax printer driver, a "true windows
printer" in this context would be one whose architecture doesn't hinder or
complicate it's use for that purpose.

Cheers,

Kunle

Tim Roberts

unread,
Jun 30, 2005, 1:39:52 AM6/30/05
to
"Kunle Odutola" <kunle....@REMOVETHISokocha.freeserve.co.uk> wrote:

>
>"Tim Roberts" <ti...@probo.com> wrote:
>> How would you define a "true Windows print driver"?
>
>Given that my goal is to build a fax printer driver, a "true windows
>printer" in this context would be one whose architecture doesn't hinder or
>complicate it's use for that purpose.

In that case, a PDF creator isn't going to be of any help. You need
something that produces bitmaps, not something that produces PostScript.

Kunle Odutola

unread,
Jun 30, 2005, 10:00:03 AM6/30/05
to

"Tim Roberts" <ti...@probo.com> wrote in message
news:db17c1522uubt65h9...@4ax.com...

> "Kunle Odutola" wrote:
> >
> >"Tim Roberts" <ti...@probo.com> wrote:
> >> How would you define a "true Windows print driver"?
> >
> >Given that my goal is to build a fax printer driver, a "true windows
> >printer" in this context would be one whose architecture doesn't hinder
or
> >complicate it's use for that purpose.
>
> In that case, a PDF creator isn't going to be of any help. You need
> something that produces bitmaps, not something that produces PostScript.

OK, thanks Tim. Actually, you might be able to help me clarify my
thoughts...

Am I right in presuming that the "boilerplate code"[*a] and "front-end"[*b]
of the PDF Creator driver is still useful architecturally?. By this I am
referring to:
- [*a] the bits of PDF Creator that all Windows print drivers must have (if
only I can identify them) and,
- [*b] the bits that receive the bitmaps/information that Windows
applications send to a print driver when they print a document.

If I can separate them from the PDF/PostScript/Ghostscript specific bits,
would I have the beginnings of a printer driver that works on Windows
9x/Me/NT/2k/XP/2k3 (although I only really care about 2k/XP/2k3) and can be
easily customized to "print" to [multi-page] bitmaps by hooking it to a
decent TIFF library?.

Sorry for the long paragragh/quation above.


Cheers,

Kunle

PS Are you perchance familiar with the PDF Creator driver's internals?
(Or, is anyone else here that may happen to be reading/following this
thread)?

Kunle Odutola

unread,
Jun 30, 2005, 10:12:18 AM6/30/05
to
Does anyone have a fave book or books that was really helpful in building a
print driver to work on for Win 2k/XP/2k3 (and perhaps Win 9x/Me as a
bonus)?

Other helpful resources?

Cheers,

Kunle

Kunle Odutola

unread,
Jun 30, 2005, 7:24:07 PM6/30/05
to

"Kunle Odutola" wrote in message
news:O2UtGvXf...@TK2MSFTNGP10.phx.gbl...

> Does anyone have a fave book or books that was really helpful in building
a
> print driver to work on for Win 2k/XP/2k3 (and perhaps Win 9x/Me as a
> bonus)?

So far, I the following recommendations [all freely available or for minimal
cost]:

1. Start with
http://www.microsoft.com/whdc/driver/foundation/DrvDev_Intro.mspx

2. Get "Programming the Windows Driver Model" 2nd ed. by Walter Oney

3. Get the Windows Server 2003 SP1 DDK

4. Use 'windbg' as debugger (SoftIce is pricey but good)

5. Use 'VMware' or 'Virtual PC' for remote machine (or just use another PC)


Any opinions on these?


Kunle

Don Burn

unread,
Jun 30, 2005, 7:16:54 PM6/30/05
to
Well while I really like the paper and the book, they cover kernel mode
drivers, which a printer driver is not. Definitely get the Windows Server
2003 SP1 DDK, since this stuff is usermode you will not nessecarily need two
machines.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

"Kunle Odutola" <kunle....@REMOVETHISokocha.freeserve.co.uk> wrote in

message news:euqDujcf...@TK2MSFTNGP10.phx.gbl...

Kunle Odutola

unread,
Jun 30, 2005, 10:30:23 PM6/30/05
to
> Well while I really like the paper and the book, they cover kernel mode
> drivers, which a printer driver is not.

What would you recommend that does help with printer drivers (apart from the
DDK)?.

> Definitely get the Windows Server
> 2003 SP1 DDK, since this stuff is usermode you will not nessecarily need
two
> machines.

Thanks. I was planning on using Virtual PC in any case.


Kunle


Tim Roberts

unread,
Jul 2, 2005, 5:55:35 PM7/2/05
to
"Kunle Odutola" <kunle....@REMOVETHISokocha.freeserve.co.uk> wrote:
>
>Am I right in presuming that the "boilerplate code"[*a] and "front-end"[*b]
>of the PDF Creator driver is still useful architecturally?. By this I am
>referring to:
> - [*a] the bits of PDF Creator that all Windows print drivers must have (if
>only I can identify them) and,
> - [*b] the bits that receive the bitmaps/information that Windows
>applications send to a print driver when they print a document.

Probably so, but the same can be said of the sampple drivers in the DDK.
One of the samples creates straight bitmaps, and is probably a better
starting point for you all around. The process of converting to a bitmap
is so radically different from the process of converting to Postscript that
I'm afraid you'll be misled.

>If I can separate them from the PDF/PostScript/Ghostscript specific bits,
>would I have the beginnings of a printer driver that works on Windows
>9x/Me/NT/2k/XP/2k3 (although I only really care about 2k/XP/2k3) and can be
>easily customized to "print" to [multi-page] bitmaps by hooking it to a
>decent TIFF library?.

Possibly, but you'd be better off starting with a bitmapped sample.

Think about the difference. When a Postscript driver needs to send the
string "xyz", all it has to send is the three characters "xyz", along with
HLL instructions on where to put it. When a bitmapped driver needs to send
the string "xyz", it has to fetch the glyphs, blit them to a rectangle,
worry about resolution, and ship the bitmap to the printer. Very
different.

>PS Are you perchance familiar with the PDF Creator driver's internals?
>(Or, is anyone else here that may happen to be reading/following this
>thread)?

No, but the process has already been described earlier in the thread. You
use a PostScript driver (like GhostScript or PSCRIPT) to convert the GDI
calls to PostScript, and then do a rather small amount of conversion to
produce a PDF file.

Ali

unread,
Jul 3, 2005, 3:44:45 AM7/3/05
to
What is PDFCreator?
PDFCreator is user mode virtual printer driver Or image process
driver, it depends on another openSource printing library for printing
process.

How PDFCreator works?
PDFCreator installs user visible printer entity with redmon as its
port monitor, redmon will redirect all the port output to
PDFCreator.exe which will in fact produce the output file.

Tim>How would you define a "true Windows print driver"? Many (most?


all?) of the inexpensive PDF generators use GhostScript as their
GDI-to-PostScript converter.

Yeah Tim is right here , in fact it is a postscript driver, you can see
following link for more understanding on postscript driver.
[ http://west-wind.com/weblog/posts/1440.aspx ]

Normally every printer driver does following steps.
1) Guess user is initiating printing process via File->Print menu.
2) If application implements the GDI calls like getfont, setfont
getarea etc. then windows will start rendering its print stream to
build the EMF [enhanced meta file] file which is infact nothing more
than a common protocol for rendering and redirecting the print stream
from one file to other. Today almost every GUI application implements
above functionality. Remember you can't never see print of poor written
ActiveX control if its not implementing GDI calls;-)
3) Mr. redmon now start redirecting the print stream from port to
application [PDFCreator.exe]. Think about piped input.
4) PDFCreator.exe convert that file to required format with the help of
GS [ghostscript] printing library.
Well you can't print doc to image or pdf directly from GS because GS
just accept pdf or ps [postscript] files as input.
So the equation for GS is
ps2IMG = IMG is pdf ,bmp, tif, jpeg, png etc.
pdf2IMG = IMG is bmp, tif, jpeg, png etc.
And equation for applications with postscript case.
XXX2ps = XXX is doc , ppt , xls , bmp etc.
YOU CAN'T DIRECTLY PRINT doc2IMG or ppt2pdf.

PDFCreator Project management:

PDFCreator consists on several projects following is the short
description of these projects. These projects can be found sourceforge
under PDFCretor group.

PDFCreator = Modules with printing logic , saving files and all other
stuff related to printing.
PDFSpooler = Modules including the logic for integrating the windows
print stream mechanism.
UnInst = Uninstaller of PDFCreator driver .
Printer = Files from Adobe and redmon required to set the postscript
printer.
Additional files = batch files for deletion and copy purpose .
Common = common directory to avoid multiple versions of same module
used in different projects.
System Files = Files included from MS for setting a printer on their
OS.
Transtool = For debug and trouble shooting.
Setup = This directory contains the installer script of inno setup
,some more files are included in setup directory for compiling the
PDFCreator.exe


Vendor specific tools and technologies used in PDFCreator:
InnoSetup = Inno Setup version 4.2.0 Copyright Jordan Russell.
InnoSetup preprocessors = iscmplr-1.0.1.229 by Y
GhostScript = GNU version 8.15
PDFCreator = GPL 0.8.0 by Frank and Philips.
RedMon = Print Stream Redirector from Russell lang.
IDE = MS VB 6 with VBA.
pdfenc.exe = For PDF encryption purpose(see iText on sourceforge).
Adobe = Adobe postscript printer files
MSDN = For printer driver specification and files.

See following project in DDK for writing a printer driver but it is
text only driver.
[ \WINDDK\3790\src\print\tty ]
See following group post for Books and other stuff, especially read
Don's 13th June post.
[

http://groups-beta.google.com/group/comp.os.ms-windows.programmer.nt.k

ernel-mode/browse_frm/thread/34e4781306706873/ad32336fd9e5cdd4?hl=en#a

d32336fd9e5cdd4]


Cheers,
Sorry for such a BiG pOSt.

Maxim S. Shatskih

unread,
Jul 4, 2005, 8:01:14 PM7/4/05
to
> use a PostScript driver (like GhostScript or PSCRIPT) to convert the GDI

No, GhostScript is a PostScript renderer - converts PostScript to a bitmap.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
ma...@storagecraft.com
http://www.storagecraft.com


Ali

unread,
Jul 5, 2005, 12:38:15 PM7/5/05
to
>No, GhostScript is a PostScript renderer - converts PostScript to a bitmap.
Isn't GS postscript interpreter rather postscript renderer?

Maxim S. Shatskih

unread,
Jul 5, 2005, 2:12:59 PM7/5/05
to
For PostScript, "interpreter"="renderer". Interpreting PostScript means -
drawing all these primitives.

GhostScript (and customized versions of it) is a core of UNIX's CUPS and
Foomatic printing engines.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
ma...@storagecraft.com
http://www.storagecraft.com

"Ali" <abdul...@gmail.com> wrote in message
news:1120581495.8...@g14g2000cwa.googlegroups.com...

0 new messages