Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.3: A workaround for VirtualPC printing failures Apps
I have an aviation program that provides instrument approach charts and it only runs on Windows. I needed to print out chart updates today and ran into a major problem: printing to my printers on the local network wasn't working!

As many of you know, Virtual PC's ability to print to a Mac printer is broken in Panther, and Microsoft has yet to post a fix, or even acknowledge a problem on their support site. A workaround published in the MacFixit Forums is to print to a file in Virtual PC and save that file on a shared disk. One can then drag those "*.prn" files onto a desktop printer in Panther and be able to print.

One can also convert these .prn files to PDF, using the ghostscript command ps2pdf. Unfortunately, ps2pdf doesn't seem to handle batch processing of files with automated file extension substitution. There is probably a way to do this in bash or tcsh, but I couldn't figure it out.

So to make batch processing work for me, I wrote a little perl program that will take any files that end in ".prn" passed on the command line (including file globs like "*"), convert the files to PDF, and save the new file with a .pdf extension. Though I haven't gotten that far yet, this perl script could be embedded into an AppleScript application, allowing one to drag and drop the .prn files onto the applet.

Read the rest of the hint for the script...

Here's the code. I'm a perl newbie, so go easy on me if you see ways to make the code below more efficient.


#!/usr/bin/perl
#MyPS2PDF.plx
#takes <STDIN> which consists of a list filenames and
#uses ps2pdf to convert to pdf files
#Norman A. Cohen, MD
#29 November 2003
use warnings;
use strict;
use File::Basename;

foreach my $arg (@ARGV) {
  my ($base, $path, $type)=fileparse($arg,qr{\.\w+});
  my $newext="\.pdf";
  my $newname=$path.$base.$newext;
  # make sure file extension is .prn
  # (assumes that this will assure correct filetype)
  if ($type =~ /\.prn/) {
    print "Converting $arg into pdf file $newname.\n";
    my $command = "ps2pdf $arg $newname";
    system $command;
  }
  else
  {
    print "$arg is not a Windows .prn file. Skipping file!\n";
  }
}
Now that I can save the files to PDF, I can use OS X's printing system to print multiple charts on a page or print selected pages. I can also look at aviation charts stored in PDF archives without the hassle of opening up Virtual PC every time. All-in-all, this bug has provided me more flexibility than I used to have!
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[9,927 views]  

10.3: A workaround for VirtualPC printing failures | 3 comments | Create New Account
Click here to return to the '10.3: A workaround for VirtualPC printing failures' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.3: A workaround for VirtualPC printing failures
Authored by: frank_martin on Tue, Dec 9 2003 at 1:31AM PST
I am using VPC 6.1 with Windows 2000 on Panther, and I can print fine. I just sent a page from Acrobat reader on VPC to my HP 4600 (PCL). Works great.

[ Reply to This | # ]
10.3: A workaround for VirtualPC printing failures
Authored by: jelockwood on Tue, Dec 9 2003 at 8:06AM PST
It is printing to the Virtual PC emulated printers that is broken (the emulated printers automatically redirect the print job to the current default Mac printer).

If instead you create a printer in Windows (in Virtual PC) that directly talks to the printer (bypassing the emulation) then it works fine.

[ Reply to This | # ]
10.3: A workaround for VirtualPC printing failures
Authored by: schrammalama on Fri, Jan 9 2004 at 3:33PM PST
I'm using VPC 6.1 under OS 10.3.2. And I'm able to print from Windows 95 to a networked printer using print emulation. However, I cannot print from DOS nor can I set-up the networked printer through Windows, add a printer program. I'm running an old DOS program called BOSS, which I need to print from. If anyone has any suggestions, PLEASE post a reply.

[ Reply to This | # ]