It is sometimes challenging, slow and problematic to use the PDF softwares (e.g. Adobe Acrobat Reader) for printing at NUS SoC. As an alternative, or if you prefer to use CLI like me, you can use the following guide to print your PDFs via the stu servers.

Credit to Aaron Choo who wrote this excellent guide on Medium. There are a lot of overlapping in content between this guide and his, so kudos to Aaron! The major difference is that it has been a bit outdated and the Sunfire servers have been officially phased out at SoC in 2023.

TL;DR The Code

# At your local computer
# 1. Convert your pdf to ps
pdftops <your_pdf>.pdf

# 2. Copy the ps file to the stu servers
scp <your_pdf>.ps <your_soc_id>@stu.comp.nus.edu.sg:/home/e/<your_soc_id>/

# 3. SSH into the stu servers
ssh <your_soc_id>@stu.comp.nus.edu.sg

# 4. Print the ps file
lpr -P <printer_id> <your_pdf>.ps

Preparation

SoC Account

You will need a SoC account to access the stu servers. If you are a SoC student or students from other faculties taking SoC modules, you should have been issued an SoC UNIX account (with the domain name of “@comp.nus.edu.sg”). Do not mix this up with your NUSNET account, because they may have different username and password.

You should also note that you need to activate the SoC account if you are using for the first time. You can do so by following the instructions here.

Convert PDF to PS

First, you need to convert your PDF file to PS file. You can do so by using the pdftops command. For example, if you want to convert hello_jerry.pdf to hello_jerry.ps, you can do so by running the following command in your terminal.

pdftops hello_jerry.pdf

Copy the PS file to the stu servers

Find out the root directory of your account

# ssh into the server, assume e0123456 is your soc id 
ssh e0123456@stu.comp.nus.edu.sg

# the directory you are in is the root directory of your account
pwd

# the result should be something like this 
/home/e/e0123456

Let’s copy!

Next, you can use the need to scp command to copy the PS file to the stu servers. Continuing our example, you can do so by running the following command.

scp hello_jerry.ps e0123456@stu.comp.nus.edu.sg:/home/e/e0123456/

More details of scp can be found using man scp.

Printing

Find out the printer id

(Credit to Francis Yeo) You may find about more about the printer information (e.g. printer id and its location) here. For example, the printer that I used the most has the id psts and it is located at COM1 Level 1.

Let’s Print!

Finally, you have logged it, settled everything and you can print your PS file using the lpr command.

# print hello_jerry.ps using the printer psts
lpr -P psts hello_jerry.ps

That’s it and happy printing!

(Optional) Other Resources

  • SSH Key: If you do not know how to set up the SSH key, you can simply google it. There are many good guides out there. For example, you can follow this guide.
  • Unix commands: When I was a freshman, I followed this guide. It could be slightly outdated and feel free to choose your favorite one.
  • PostScript files: A quick chat with ChatGPT returns the following list of (unverified) relevant common commands.

    1. psnup: The psnup command rearranges pages to print multiple pages per sheet. Example: psnup -2 input.ps output.ps imposes 2 pages of input.ps onto 1 page of output.ps (i.e. 2-up printing).
    2. psselect: The psselect command selects specific pages from a PostScript file.
  • As a side note, there is a guide on NUS IT counter duty. Particularly, when I was using MacOS and Adobe Reader for printing, I sometimes encounter the error ‘Hold for Authentication’. The solution provided (with the assumption that your account is valid and password is correct) is

    1. Open ‘Keychain Access’ in your Mac.
    2. Search the problem printer’s name (usually the id) and delete all ‘network passwords’ related to the problem printer.
    3. Try again for printing and it should prompt you to enter your username and password now.

Last Updated: 5th Sep 2023