"But I'm just sending data to Windows - why doesn't the Windows printer driver just take care of it?"
I probably hear that question at least a dozen times a year. Somebody wants to send Unix/Linux print jobs through Samba to a shared Windows printer and it's not working. Why not?
Well, if the printer is a so called GDI, Windows-only ( sometimes called host-based) printer, the reason is simple: you aren't giving the driver what it wants.
GDI printer drivers expect GDI data, a Microsoft format that is used both for displays and printers. It's basically a bit map of the page to be printed, but what's more important is what it is not: it isn't text, it isn't PostScript and it isn't PCL. The driver that Windows sends the GDI data to can't handle anything complicated like that; it can't convert text to graphics, can't draw lines from vector descriptions, etc. It needs GDI data and that's that.
You'd think that there would be things that convert arbitrary data (text? PostScript?) to GDI. In fact, if you are even vaguely familiar with Linux, you would immediately think that GhostScript has an output that will produce GDI. You'd be right, too, except that it's apparently only available on Windows Ghostscript. That's called "mswinpr2", and you'd use it in combination with Redmon (a Windows print redirector) to do the translation. See Creating a Virtual Postscript Printer in Windows using Ghostscript for details.
You could also use PrintFile but again, that's done on the Windows side.
You'd think that the easy way to do this would be to produce GDI output on the Linux side and then ship that through Samba to unmodified Windows machines. Or that's what I'd think anyway, and tantalizingly enough, "gs --help" lists "gdi" as one of its output formats. However, it looks to me like that produces PJL files. Unless I'm horribly misunderstanding what GDI looks like (see GDI printers under Linux), this isn't the answer.
There ARE Linux drivers for some GDI printers. These seem to be printer specific and don't solve the general problem of shipping to any old Windows shared printer. There's also a "libgdiplus" that's part of Mono; the description makes you wonder if it could be used to construct such a general purpose translator.
If anyone reading this knows more than I do about this, please do comment. At a casual glance, converting to GDI seems like the most direct method - and indeed it's what the Windows GhostScript does. I suspect the reason is that the Windows GS mswinpr2 can call upon Windows DLL's to do it's work, and that's why I wonder if Mono's libgdiplus would be the answer for that.. but I haven't been able to find out enough about that to say.
More Articles by Anthony Lawrence - Find me on Google+
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar