The forum

PoL Office2007 doesn't see any printer

Author Replies
neversaynever Sunday 4 December 2016 at 18:54
neversayneverAnonymous

Hi

I use Linux Mint 18 Cinnamon 32bit and I have a USB HP printer installed (with hplip driver); the printer works properly with any Linux native software (LibreOffice too).

I installed Office2007 by PlayOnLinux (4.2.10_2) and everything seems to work properly.

But I have a problem: when I try to print something from Excel or Word, I get the message “No printer installed”.

If I use ‘notepad’ (installed automatically during the PoL installation) by wine, I can print because wine recognizes the printer. But Office2007 by PoL, doesn’t see it.

What can I do?

Am I obliged to install Office2007 by wine and not by PoL? (with all related difficulties and  risks)

Is there an easy solution by copying  some existing config file in the wineprefix of Office2007?

Have I to install the windows driver for my printer by PoL? (but it would be a big waste of space)

Can I bypass the problem by installing with PoL a windows pdf printer in the same wineprefix of Office2007?

Any advice will be appreciated.

Thanks

neversaynever Tuesday 13 December 2016 at 20:28
neversayneverAnonymous

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 ...

KaleoTecno Friday 23 December 2016 at 15:23
KaleoTecnoAnonymous

Hello dears,

I have been this problem, and installled lpr packages to solve this. See in the directory /etc/printcap, if there is this file, after install package. I hope that this help you to solve your problem. My system is: mint mate 64 on core i5 laptop, and I installed the libcups-pdf too, and cups packages in general.

Because I am from Brazil, I take sorry about my english, :-).... so long everybody!

Att

Kaleo Tecno

Edited by KaleoTecno

neversaynever Saturday 24 December 2016 at 17:25
neversayneverAnonymous

Thank you very much Kaleo Tecno for your reply.

But i have cups-bsd installed that is not compatible with lpr: I should have to uninstall it before installing lpr ... and I fear to create other problems in Linux printing (that works very well up to now).

So I think I'll go on using my workaround up to someone will explain me the reason why of this problem.

Bye

edoomaki Wednesday 22 February 2017 at 22:41
edoomakiAnonymous

Hi, guys!

I've tryed to follow Kaleo's suggestion and scr***wd my linux... It did not fix, mess it all and was hell to get rid of the modifications.

After researching printing files structure etc, I've found an better solution! It seems that some distro doesn't point to the right printcap file.. So, tha's what I did:

First, make sure you have CUPS installed:

     sudo apt-get install cups cups-pdf

then, if you have it, backup original printcap

     sudo mv  /etc/printcap /etc/printcap.bkp

now create a symlink to the CUPS' printcap. In my case it was at /var/run/cups/
     ln -s /var/run/cups/printcap /etc/printcap

Hope it fix things to you guys

By the way, Kaleo, your english made mine looks like native speaker's
hehehehe... Sou brasileiro tb!

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com