Setting the default printer in Wine

There’s a CUPS server on the network, sharing multiple printers, and there’s a virtual machine running a Windows application via Wine. The virtual machine is running CUPS too, so all printers of the main CUPS server are available for the mentioned Windows application.

Now I need to force one specific printer as the default (Windows) printer because my application is too stupid and will use always the default (Windows) printer.

And the short answer is: just look at the first few lines of /home/user/.wine/drive_c/windows/win.ini, in my case there was something like this:

[windows]
device=pdf,WINEPS.DRV,CUPS:pdf

So that was probably the reason for the Windows application to always use the pdf printer (shared by the main CUPS server). I changed this into:

[windows]
device=test,WINEPS.DRV,CUPS:test

because I wanted to force a printer named test. But the Windows application was still using the printer named pdf… I’ve checked win.ini again, and my changes were gone!

I solved this problem by changing win.ini again, and then:

su
chown root:root /home/user/.wine/drive_c/windows/win.ini
chmod 644 /home/user/.wine/drive_c/windows/win.ini

Seems brutal, but works. Problem solved.

2 thoughts on “Setting the default printer in Wine

  1. Artur Linhart

    Configure your default system printer in Linux via CUPS configuration by connecting to
    http://localhost:631
    – the default printer from CUPS seems to be used as default printer in Wine’s win.ini.

    And by the way – there is no “virtual machine” for Wine applications, it is the native implementation of windows API functionality which isused for every Windows appliaction installed in Linux.

    Reply
    1. Thomas Szteliga Post author

      Thank You Artur for your comment :) Short explanation.

      The described situation was the following: a Slackware server – running multiple virtual machines (using Linux KVM). One virtual machine was running OpenSUSE and inside this guest machine – Wine was running a Windows application.

      The OpenSUSE guest machine was running CUPS, without any printers – CUPS inside the OpenSUSE guest was retrieving printers (via BrowseAllow) from the CUPS instance running on the Slackware host machine. On Slackware hosts CUPS server I needed to have another default printer.

      I’m not sure if I’m able – in this situation (no printers, all came via BrowseAllow) – to force a default printer for the CUPS instance running inside the OpenSUSE guest? But I’ll check this.

      BTW, I’m aware of Wine Is Not an Emulator, neither a virtual machine :-)

      Reply

Leave a Reply