I recently got into the position where I needed to get something printed from a Windows XP application which ran in Virtualbox.
My host OS was Ubuntu Linux, and while you could attempt to use USB passthrough for the printer, often there are not any drivers for Windows XP.
In my scenario I had no printer available at the time either, which is why I wanted a PDF instead.
CUPS is the answer. The following are some notes on how I got my PDF even though the Windows application thought it was printing on a regular printer
First step is to configure CUPS to allow remote connections
$ cupsctl --remote-any
Then to create the PDFs I used CUPS-PDF. This is not required if you want to use CUPS to print on a actual printer. To install CUPS-PDF:
sudo apt install cups-pdf sudo systemctl restart cups
This will give you a printer named “PDF” on your system. By default, everything you print will end up as .pdf’s under
To enable printer sharing, open up a web-browser on your system and navigate to http://localhost:631. If prompted for credentials, enter the username and password you use for logging into the computer.
Printerstab on the top to list your installed printers, and press the
When viewing the printer, press the
Administrationdropdown, and select
Continueuntil the screen showing a option for
Sharingappears. Select the checkbox for
Share This Printerand press Continue until done.
Then to allow connections between the Virtualbox VM and the host OS I configured Virtualbox host-only networking.
First I created the connection as such, under Host Network Manager.
Then I configured the VM to use the connection as it’s primary interface. Note that this will disable internet access for the VM unless you perform some additional tricks, however this is out of scope for this post.
In my setup I had to temporarily deactivate the systemd firewall to get the connection to work. I could of course only open up the relevant ports, but as I were on a trusted and safe network I opted to simply temporarily disable it until I was done printing instead.
sudo systemctl stop firewalld
To ensure that the networking is working as it should, you can use Python’s simpleHTTPserver to test.
$ python3 -m http.server Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
When browsering to
http://192.168.56.1:8000 you should see a directory listing from the folder where you ran the command above. If so, then you have configured the networking correctly!
If you do not see the listing, ensure the settings in VirtualBox, and that there are no firewall rules which blocks the connection.
On the Windows XP side of things we first need to install a printer driver which matches our setup. For this any PostScript compatible driver should work. The first Google search for me resulted in Epsons Universal driver for WP-4590, which worked perfectly fine with CUPS for me.
Download the following driver, and install it in your Windows XP VM.
- Printer Driver - Postscript 3 v1.0: https://epson.com/Support/Printers/All-In-Ones/WorkForce-Series/Epson-WorkForce-Pro-WP-4590/s/SPT_C11CB31201?review-filter=Windows+XP+32-bit
Then to configure Windows to use CUPS I went through the normal “Add Printer Wizard”.
I selected “Connect to a printer on the Internet ..” and filled in the following URL:
When asked for a driver, I pressed “Have Disk” and navigated to where the Epson driver had extracted it’s content:
Press Next until done
Then to test your setup, simply find your PDF printer in Windows XP’s “Printers and faxes”, right click for Properties and press “Print Test Page”. You should then end up with a file under
(Note, you might need to change the permissions of the file to access it.)
And thats it! Hopefully this page found it’s way and was of help to the one other person that needed this. If you’re out there, and you are still stuck even after reading this, then feel free to contact me at email@example.com 🖨️.