Installing the Windows printer driver does not work.
I have not tried to install the virtual printer, but I studied the problem (within the limits of my knowledge / skills) and I managed to find a "workaround". Here is the description.
When POL is installed, it creates a "/home/user/.wine" folder where it reconstructs the virtual c: driver with the windows structure and the .exe programs installed by default, including "notepad.exe", "explorer.exe "and" regedit.exe ".
It also creates three reg files for Registry ("system.reg" for HKLM, "user.reg" for HKCU and "userdef.reg" for HK_USERS \ .default) and a "win.ini” file with information about the language, country, ... and installed printer. These are the last 6 lines of "win.ini" in the “.wine” directory:
[devices]
printer_name=wineps.drv,CUPS:printer_name
[PrinterPorts]
printer_name=wineps.drv,CUPS:printer_name,15,45
[dindows]
device=printer_name,wineps.drv,CUPS:printer_name
I know that the content of registry is visible and manageable through the application "regedit" installed by default (typing in the terminal "wine regedit"): I also know that I must not change "by hand" any of the three .reg file I mentioned above.
In Registry there are 5 keys that are important to manage printers:
- HKLM\System\CurrentControlSet\Control\Print\Environments\WindowsNTx86\Drivers\Version-3\
- HKLM\System\CurrentControlSet\Control\Print\Printers\
- HKCU\Software\Microsoft\WindowsNT\CurrentVersion\Devices\
- HKCU\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\
- HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\
The five registry keys and the last 6 lines of 'win.ini' in the ".wine" folder, contain correct information regarding the installed printer (moreover the last three registry keys above mentioned contain the same information as the last six "win.ini" lines).
POL installation also creates the "/home/user/.PlayOnLinux" folder, with a series of separate folders, one for each application installed by POL (eg "/home/user/.PlayOnLinux/wineprefix/Office2007" for Microsoft Office2007). In this folder there is the virtual c: drive with .exe programs - libraries - etc. relating to the application, the three .reg files ("system.reg", "user.reg" and "userdef.reg") and the "win.ini" file with information related to the installed printer.
I do not know for what reason, the registry keys and the “win.ini” files for Office2007 contain incorrect or missing information regarding the printer installed on the system.
Particularly, the last three registry keys are empty and the last three win.ini lines are as follows:
[devices]
[PrinterPorts]
[windows]
This is why 'notepad' recognizes the installed printer, and Office2007 not.
The workaround consists (after you open an Office application through POL) in modifying the five registry keys above mentioned, related to Office, in the same way as they are defined in ".wine"; once this is done, I replaced the Office "win.ini" file with a new one, where the last three lines (incorrect) are replaced by six lines (correct) contained in the "win.ini" in ".wine" directory.
After this substitution (it takes about 30 seconds for registry update), the Office application already open will see the installed printer and will allow proper printing of its content.
I did all this with a simple script, defining the WINEPREFIX variable that says to wine which directory you are working with (".wine" or ".PlayOnLinux /wineprefix/Office2007”), using the command "wine regedit name_of_reg_file_to_import” in registry and using the command "cp".
The .reg file to import consists of the five registry keys above mentioned that I exported from the register of ".wine" and I put in a single file named "/home/user/Documents/POL_OK_regmod.reg".
The correct "win.ini" file was created by replacing the last three lines with the last six lines of the "win.ini" in the ".wine" directory. I named it "/home/user/Documents/POL_OK_win. ini ".
Here's the script:
#!/Bin/bash
env WINEPREFIX="/home/user/.PlayOnLinux/wineprefix/Office2007" wine regedit /home/user/Documents/POL_OK_regmod.reg && cp /home/user/Documents/POL_OK_win.ini /home/user/.PlayOnLinux/wineprefix/Office2007/drive_c/windows/win.ini
exit 0
Summing up
- Open an Office application (excel, word or PP); the printer is not seen.
- Launch the script and wait 20-30 seconds for the registry update.
Now the printer is properly "captured" by Office and you can print regularly.
I still have at least two questions.
Why POL has not successfully created the correct registry keys and "win.ini" file during the installation of Office (as it did for ".wine").
I also do not know why it is not enough to correct registry and “win.ini” file once; in fact, at each log-off/ new launch of an Office app, registry and "win.ini" are recreated by default incorrectly. Ergo I must always run the script any time I open an Office app.
I will be grateful to anyone who can give me explanations.
For the moment I settled with the workaround.
The reflection continues ...