Question: At my university we have a web service which allows us to upload PDF files and print them. Sometimes I want to print two or even four pages of the document on one page of the paper. As the online service doesn't allow me to choose this option (like Adobe Reader does), I have to change the PDF.

How can I change the PDF in this way (on a Ubuntu Linux machine)?

Answer: 
You'll need to connect to ToR's control port and issue certain signals to have it create a new connection. You might have to manually check what the end IP is.

[This document](https://svn.torproject.org/svn/torctl/trunk/doc/howto.txt) has some example code in Java and Python for interfacing with ToR along with some of the signals and how to use them. The one you're looking for is probably `NEWNYM`, but it's not brought up in the linked document. With a little bit of googling, you may be able to find more info on controlling ToR via its control port.
Use this in bash:

```
(echo authenticate '""'; echo signal newnym; echo quit) | nc localhost 9051

```

Use this in PHP:

```
// flush Tor circuit, obtain new IP
$password = '""'; // replace with your Tor password (if any)
exec("(echo authenticate $password; echo signal newnym; echo quit) | nc localhost 9051", $out);
print_r($out);

```