Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Works only with PDF' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Works only with PDF
Authored by: ujwal on Feb 10, '02 04:14:50AM

Thanks for your tips. However, /usr/sbin/Print works only with PDF on my HP PSC 750 (non-PS) printer. I had to modify your script to convert everything to PDF:

#!/usr/bin/env perl
$temp_file = "/tmp/printing.$$";
# LPD passes via STDIN the file to be printed
# (we don't have any knowledge of the original filename...too bad)
# save this as a file to be processed
# This filter eventually calls /usr/sbin/Print. Print likes to print PDF
# files and does not seem to like anything else, so convert to PDF

@lines = <STDIN>;
open(TMPFILE,">/tmp/printing.$$");
print TMPFILE @lines;
close(TMPFILE);
# Enscript does not pass through PDF, so do it here
if ( $lines[0] =~ /%PDF/ ) {
`cp /tmp/printing.$$ /tmp/printing.$$.pdf`;
}
else {
`enscript --pass-through --no-header -o /tmp/printing.$$.ps /tmp/printing.$$`;
`ps2pdf /tmp/printing.$$.ps /tmp/printing.$$.pdf`;
}
# Now print the PDF file
`/usr/sbin/Print /tmp/printing.$$.pdf`;
`/bin/rm -f /tmp/printing.$$ /tmp/printing.$$.ps /tmp/printing.$$.pdf`;



[ Reply to This | # ]
Works only with PDF
Authored by: goedel on Apr 18, '02 06:57:40AM

That's funny!... I tried the script (btw, many thanks to eagle!), but for my nearest networked printers (HP LaserJet 2100TN and 2200DN) it only works with PS files!!!

I _have to_ use enscript for TEXT files and pdf2ps for PDF files. I don't mind, since that's what I should do anyway from a standard Unix box, but I'm a bit puzzled...



[ Reply to This | # ]