Windows 7: Way to screw up printing!

admin, 12 July 2009, No comments
Categories: Gadgets and Tech, Software

For the most part I am liking Windows 7 pretty well.  I like the eye-candy in the interface.  The Task Bar layout is starting to grow on me.  Microsoft has taken quite a few things and tweaked them just enough to make things nice.  So far the only program I’ve tried to run that doesn’t is Trillian Pro, so I switched to using Digsby instead.  Trillian may have fixed the issue on their end, however my subscription has run out so I am stuck with the version I paid for, and would have to pay again to maybe fix the issue.

That said, I have found a huge oversight on Microsoft’s part, supporting old printers.  I have an older HP Laserjet 4L in my garage attached to my Linux server.  It is shared to the network using CUPS.  In Windows XP they had drivers included for that printer, so I just set up a new printer, pointed it at the right network address, and selected the driver and was up and running.  Piece of cake!  Not so with Windows 7.

I tried to set up the printer on Windows 7 and I noticed the list of available printers is very small, and my printer was nowhere to be found.  No big deal I thought, I’ll go find the Generic Post Script driver and use that, since CUPS and my printer work just fine that way.  Again, nowhere to be found.  Whiskey Tango Foxtrot?  From what I read it appears Vista suffers from the same shortcoming.  I can understand they need to let go of legacy hardware at some point.  Interfaces change, and the wider range of hardware that needs to be supported just holds back advancement and introduces more opportunities for bugs to show up.

The problem here is I don’t even need to directly interface to the printer.  All I need is a postscript file generated and sent across the wire, where the print server will take care of the rest of it.  There is no reason for the generic post script driver to not be included with the OS since it is non-hardware-specific.  I’m communicating using Internet Printing Protocol, which Windows 7 knows how to do.  I don’t need any fancy proprietary USB driver that should never have been supported in the first place.

With the big effort being made by people across the world to be “green” this is clearly a step in the wrong direction.  If I was most any consumer I’d throw the perfectly good printer in the trash and go buy a new one.  Besides the environmental impact, Microsoft is expecting me to not only shell out $300 for the SuperDuperUltimate edition of the OS, they’re now expecting me to spend another $200-300 for a new “compatible” printer.  Upwards of $500 and another hunk of landfill space being taken up is the wrong answer!

What I did was a simple and (I think) elegant solution.  It does involve a couple of extra steps now, but I think the advantages far outweigh the drawbacks, and actually gives me some benefit over direct printing.

  1. I created a directory on my Linux box acting as the CUPS server and shared it using SMB.
  2. On my Windows 7 machine I connected a drive letter to it.
  3. I installed the basic free edition of the CutePDF print driver, so now when I hit print it gets saved as a PDF document rather than being sent to an actual printer
  4. When I want to print something, I “print” it using whatever program I normally use, then drop the generated file on the mapped drive.
  5. cron runs a script (listed at bottom of post) runs every 5 minutes checking for the presence of PDF documents.  If they exist it sends them to the printer and moves them to a “printed” directory.

To me the extra step of saving the file and moving it to the print queue is a good thing.  If I want to print a page for my records, it gives me the opportunity to just keep it electronically while having the exact paper copy later if I need it.  I’ve also gone to print webpages and have it be completely screwed up when it comes out, even though the “print preview” looked good.  This way I have the opportunity to see exactly what is going to come out of the printer before it is ever on the queue.

The biggest disadvantage of this setup is it won’t work with any printing services that require direct contact with the printer, such as printing postage from the USPS website or some of those online coupon printing programs.  Luckily for those I can still use my wife’s PC.  As I said, these small disadvantages are trivial to me considering I don’t print very much, but when I need to print I can.

Hopefully this will help someone else out who wants to move to a newer Microsoft OS but doesn’t want to throw out some perfectly good hardware in the process.  It took me probably a half hour total of setup time (the print sharing and samba sharing was already set up) to get everything figured out and the script debugged.  You’ll need to extend your time if you need to install additional components that I already had setup.

Here is the bash script I use, triggered by cron every 5 minutes during normal PC usage times:

#!/bin/bash
cd ~/PrintQueue/

# Space removing portion of script lifted from #http://www.linuxconfig.org/Bash_scripting_Tutorial

DIR=”.”
# Controlling a loop with bash read command by redirecting #STDOUT as
# a STDIN to while loop
# find will not truncate filenames containing spaces

find $DIR -type f | while read file; do

# using POSIX class [:space:] to find space in the filename

if [[ "$file" = *[[:space:]]* ]]; then

# substitute space with “_” character and consequently rename #the file
mv “$file” `echo $file | tr ‘ ‘ ‘_’`
fi;

# end of while loop
done

#sleep 5

for f in $( ls ~/PrintQueue/*.pdf ); do
echo “$f”;
lpr “$f”
mv “$f” ~/PrintQueue/Printed/
done

Comments

Leave a Reply:

Name *

Mail (hidden) *

Website