# Printing Tips

If you are having problems with command line printing it may be because your .bashrc is not using the correct printer name. Have a look at your .bashrc file. Near the top there are some lines that set your default printer. If they don't look like the lines below, then cut out everything in your .bashrc from &&[ -z "$PRINTER" ] && case groups in && to && esac && and replace that with the following lines:  [ -z "$PRINTER" ] && case groups in
faculty)
export PRINTER="cscopy"
lpstat -a $PRINTER > /dev/null 2>&1 || export PRINTER=${PRINTER}@spooler
;;
*)
export PRINTER="Asprey"
lpstat -a $PRINTER > /dev/null 2>&1 || export PRINTER=${PRINTER}@spooler
;;
esac      

We have a central print spooler. This means that when you print something the print job leaves the computer you are sitting at and goes to this print spooler. Once there it waits its turn to print.

You can check on your print job, delete your job, restart it or move it to another one of our printers while it is on the spooler. To do any of these, head over to:

Your web browser may complain that the site certificate chain is incomplete. Should you wish to check, here is what you should see. (Exactly which of these things you see depend on your browser and its settings.)

DNS mr43.cs.vassar.edu 63:B3:94:2C:04:4D:B1:FD:4B:84:F5:36:5A:6E:94:69:61:0B:96:97 64:F2:5E:82:5E:82:ED:15:B7:4C:24:18:E5:B6:97:13:A7:5A:A4:DE A6:2D:44:EC:42:90:A7:BF:37:E5:4B:FA:4C:61:A0:DF

Greg Priest-Dorman 2009/02/13 13:23

Any of the CS Linux Desktops can produce a pdf file from any program that can print. Simply choose the printer called Virtual_Printer@mr43 and your printout will be saved into /usr/local/Virtual_Printer/YOUR_ACCOUNT_NAME/. The file name will eventually be the title or name of the file being printed prepended with an underscore (“_”) and ending in “.pdf”, but currently may simply be “stdin.pdf”.  Files in /usr/local/Virtual_Printer/ are removed once they are more than a day old. !!Please note!!: the pdf conversion program does not check if a file by that name already exists, if it does, it will be overwritten.

If you find you are using this feature you might want to create a link in your home directory as shown below replacing YOUR_ACCOUNT_NAME with your account name.

ln -s /usr/local/Virtual_Printer/YOUR_ACCOUNT_NAME ~/pdf-printout

Once you do that, any time you send a file to the pdf virtual printer, you can find it (for the following day) in your pdf-printout directory

The pdf “Virtual Printer” is a work in progress. Please give me feedback so I can make it better. — Greg Priest-Dorman 2008/10/13 14:54

Some students have reported that they no longer have a default printer set when using their CS Linux account.  This can cause problems when using programs like enscript to process your printout.

While you can give these programs a printer to use, there is no reason not to set a default for yourself.

Let's see if a default is in fact set.

Open a terminal, in that terminal type:

echo $PRINTER If it came back with a blank line, then you don't have a default printer set. This is easy to fix. Use whatever editor you please (emacs, vim, gedit, whatever) to open your ~/.bash file. Originally, that file contained the following code which set your printer based on your group: [ -z "$PRINTER" ] && case groups in
faculty)
export PRINTER="comsc2"
;;
*)
export PRINTER="Asprey"
;;
esac


The above code looks if a printer is set and if not sets it.  It sets a printer in the Department Office for faculty, everybody else gets set to a printer in the lab.  If the above lines are not there you could just add them in, but you don't need to type that much.

Since you already know where you want to print, you don't need the script to try and decide.  All you need to do is add a line to set the printer you want for your default printer.  There are two printers in the lab, they are called Asprey and Loaner.   Once you decide which one you would like as your default printer 2) simply add one of the two following lines to your .bashrc and save it.

export PRINTER="Asprey"

or

export PRINTER="Loaner"

Save the file.  Exit the editor.

The next time you log in your printer will be set to the one you have selected.

You can check this by repeating the test in section 1.

If this procedure did not help, please mail me. Tell me your account name and what you tried. I'll help you get it working.

-Greg

Greg Priest-Dorman 2008/03/25 18:59

This is a known netbeans problem. It has nothing to do with our printers or the print setup. Below you will find instructions on how to print from the command line.

The problem is the result of the way netbeans trys to print, Petr Nejedly from NetBeans/Sun Microsystems explains:

 As I wrote before, Java prints it as a sequence of line strokes for every
single letter(not using macros in outgoing .ps), this could be as much
as 1kB PER LETTER.
This is probably because Java has its own opinion how the letter glyphs
should look, while a2ps simply uses printer builtin font and does only
some transformations on it (scaling, rotating, setting attributes, ...)
I didn't examined the Java printing APIs, but I don't think we can do
much with it.

Bottom line, the output is really nasty and gets rejected.

The best thing to do is save your file and print it from the command line outside of netbeans using enscript or a2ps. Both of these programs will allow you to print more than one page on a sheet and have various pretty print options for many different programming languages. Both use many of the same options. To print ??foo.java?? try either:

a2ps -2r foo.java

or

enscript -2r foo.java

These commands put 2 pages of output reduced and printed side by side (the 2) in landscape layout (the r) and since the file ends in .java they will each use highlighting rules for java when they print.

Greg Priest-Dorman 2009/02/13 13:08

1)
The server is only reachable from machines that can print in the CS Department.
2)
Can't decide? Flip a coin or better yet, write a random number program to pick one for you.  Bonus points if you can put it in your .bashrc and have it pick one each time you log in.