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


Click here to return to the 'Print to Unix systems without direct printer access' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Print to Unix systems without direct printer access
Authored by: Sathamoth on Apr 22, '05 01:21:33AM
You have to quote $printResult properly to get its content displayed in a dialog box. In addition to that, the exit status of SSH command should be checked as well. So, my suggestion:

#!/bin/bash

PRINT_RESULT=`ssh username@server lpr 2>&1 < "$3"`
EXIT_STATUS=$?;

if [ -n "$PRINT_RESULT" ] || [ $EXIT_STATUS -ne 0 ]; then
	osascript -e 'tell application "System Events"' -e "display dialog \"$PRINT_RESULT\" buttons {\"OK\"} default button 1" -e 'end tell'
	exit 3
fi

rm -f "$3" || exit 2

---
--
Sathamoth

[ Reply to This | # ]

Print to Unix systems without direct print er access does not quite work
Authored by: ars on Apr 25, '05 11:31:53AM

I used this script from home with one modification to print on the printer in my office at work. I specified the name of the printer by modifying the lpr command to: lpr -Pmyprintername
I put the file in PDF services folder and printed a test page from Textedit. The file was printed, but it was not recognized as a pdf file, so that I got several pages of print-out most of them with only a few lines with gibberish on them. I guess that I might need to append the output file with .pdf. What is the syntax for this?



[ Reply to This | # ]
Print to Unix systems without direct print er access does not quite work
Authored by: Sathamoth on Apr 27, '05 01:05:00AM

The PDF file which is produced contains .pdf extension already (the temporary file is something like /tmp/printing.123456/Print job.pdf, filename being always "Print job.pdf") so you shouldn't have to append the .pdf extension by hand. Try adding -p option to lpr command.

---
--
Sathamoth



[ Reply to This | # ]
Print to Unix systems without direct print er access does not quite work
Authored by: PeteVerdon on Apr 27, '05 11:25:31AM

It sounds more like your printer doesn't understand PDF natively. That's not at all surprising - most big lasers only speak Postscript and plain ASCII. My department's printers are new this year; the old ones didn't do PDF. As I suggested, you'll need to include pdf2ps or something similar in the process; off the top of my head I don't know the best way to do that. I'm sure some of the more skillful Bash users who've already posted here can help.



[ Reply to This | # ]