Fixing OCR support in gscan2pdf on Ubuntu 14.04 & derivatives

Edit: Jeffrey Ratcliffe, the very active developer of gscan2pdf, has released an update that fixes this bug. Ubuntu users can access it his PPA (see below).

In this post the other day I talked about my relatively painless experience upgrading to Xubuntu 14.04. Since then, I have discovered a couple of bugs in some OCR software I use fairly regularly.

Here is a solution to a slightly annoying regression in gscan2pdf, an otherwise great little PDF scanning, clean-up and OCR solution.

In Ubuntu 14.04 gscan2pdf has a bug in it’s tesseract OCR support meaning it appears to OCR the document but once completed no text is added to the OCR layer. Although the bug does not affect the gocr OCR engine, tesseract (which was developed by Google HP Labs) is a much better engine and the one I prefer to use.

My first attempt at rectifying the problem was to upgrade gscan2pdf to the latest version (from 1.2.3-1 to 1.2.4) which doesn’t seem to have made it into the Ubuntu 14.04 repos, a shame considering Trusty is an LTS release. On the upside Jeffrey Ratcliffe, gscan2pdf’s developer, has a PPA that contains the latest version, so upgrading was relatively painless. The process is well documented here on the RCLUBLINUX blog.

Unfortunately, the bug is not fixed in gscan2pdf 1.2.4 so the upgrade didn’t fix my problem.

A little poking about on the gscan2pdf Sourceforge page however, showed this bug report, and also patch to fix the problem contributed by user tzieg (Thomas Zieg?).

After applying the patch and firing up gscan2pdf I was glad to see tesseract again worked as expected, thanks Thomas!

Problem: After upgrading to Xubuntu 14.04 the tesseract OCR engine no longer worked in gscan2pdf.

Solution: Patch gscan2pdf using the patch supplied by Thomas Zeig.

Procedure: Download a copy of the patch from gscan2pdf’s Sourceforge bugtracker.

Copy the patch to the gscan2pdf directory.

sudo cp Tesseract.pm.patch /usr/share/perl5/Gscan2pdf/

Change to the gscan2pdf directory.

cd /usr/share/perl5/Gscan2pdf/

Apply the patch,

sudo patch -p0 < Tesseract.pm.patch

OCR with tesseract should now work as expected, easy.

 

Right, now to figure out why OCRFeeder crashes when exporting to PDF.

Xubuntu 14.04 – Notification Area Missing Icons

Yesterday I bit the bullet and upgraded my fairly stable Xubuntu install from 13.10 Saucy Salamander to 14.04 Trusty Tahr.

I had no pressing need to upgrade (aside from an the occasional reminder when I logged in that a new release was available) but since Trusty had been out for a few weeks I figured any show stopping bugs would be ironed out by now.

First, I have to comment on how painless the upgrade procedure has become, a couple of clicks and it was away. After about an hour or so spent downloading and installing updates, a reboot and a slightly extended initial login, everything seemed to be right where I left it. No longer are we faced fixing a bunch of small things that go awry during the upgrade process.

I did, however, find one minor annoyance. No longer did all my running apps (the ones that I want to anyway) show up in the notification area I have in the top left of my screen.

Notification area Missing Icons

Missing Icons

Conspicuously missing were Network Manager, Dropbox, Spideroak, KeePass and perhaps a few more, leaving me with just the volume control and power indicator icons showing. This was true even though each of my apps appeared to be running after being correctly started at login.

Indicator Plugin

Indicator Plugin

After a bit of poking around in the XFCE panel preferences I found that replacing the Notification Area applet with the Indicator Plugin applet all my application icons were restored.

This, however, left me with another dilemma, as Indicator Plugin also includes a bunch of icons for mail, bluetooth and keyboard that, although I could hide, I couldn’t easily remove. What I really wanted was for Notification Area to work the way it did before the upgrade.

Notification Area with Icons

Notification Area

After further investigation and a little google-fu, I found that by killing indicator-application-service my icons would reappear. A quick delve into ‘Sessions and Startup’ settings found in XFCE’s Settings Manager found this service (listed as Indicator Application) was started on login and by unticking the box next to it I could tell it not to start. Problem solved. Now my notification area looks the way I like it with grey and black icons showing and the more and out of place looking coloured icons nicely hidden away.

Session and Startup Properties

Session and Startup Properties

Problem: After upgrading to Xubuntu 14.04 some application icons no longer show in the notification area.

Solution: Stop indicator-application-service from starting at login.

Procedure:

  • Open XFCE Settings Manager and navigate to Session and Startup preferences.
  • Click on the Application Autostart Tab and scroll down to Indicator Application
  • Untick the tickbox.
  • Click close, log out and log back in again.

 

Adding a printer to Linux Mint, LMDE or Ubuntu: an Encore

Some time ago I blogged about the difficulty of installing printers under Linux Mint 12 and Ubuntu 11.10, a post that to date remains the most popular on this blog.

After messing about with installing printers again, I’d like to expand upon that post.

Recently I felt the need to change the OS on my primary laptop, a black Macbook 2,1.

Until then I had been using Linux Mint 12 and despite coming with the somewhat unpopular Gnome-Shell it had proved quite stable and usable.

This time, instead of moving to the latest regular Linux Mint release (currently Mint 14, Nadia), I decided to install Linux Mint Debian Edition (LMDE), the distribution that I use on my desktop in my office. LMDE, however proved less than ideal on the Macbook so I’ve since replaced it with Ubuntu 12.10.

When it came to installing printers under LMDE and Ubuntu I had hoped that I would not encounter the frustration I blogged about last time. Unfortunately the same problem exists under both distributions, so once again I was forced to utilise the Gnome 2.x printer configuration application, system-config-printer described in my earlier post.

As it turns out, I actually prefer the old Gnome 2.x printer application rather than the newer Gnome 3.x one that ships with Gnome-Shell, Cinnamon and Unity.

Although built upon GTK 2.x, it retains all the features that were present under Gnome 2.x (such as printer properties and the ability to easily delete jobs from the print queue) that for some reason seem to have gone AWOL in the Gnome 3.x printer application.

Unfortunately although the app is installed by default under Mint, LMDE and (I believe) Ubuntu, it does not appear in the menu for any of these DTEs

On the upside, there are at least two ways an application can be added to the menu with relative ease.

Problem: Gnome 2.x Printers Application does not appear in menu for Cinnamon, Gnome-Shell or Unity.

Solution 1: One way to add this application to the menu is to fire up the Alacarte Menu Editor (also called Main Menu) and add an entry for the printer application by hand.

Procedure: Check to see if alacarte and system-config-printer are installed by opening a terminal and typing the following:

$ sudo apt-get install alacarte system-config-printer

Now, Alacarte should be accessible under Accessories in Cinnamon or by searching in Gnome-Shell or Unity.

Failing that, it can be launched from the command line by typing the following command:

$ alacarte

Next, navigate to the sub-menu where you would like to add the new launcher, I use System Tools | Preferences.

AlacarteClick the ‘New Item’ button, add a name, comment and the command ‘system-config-printer’, find a nice icon (something like /usr/share/icons/gnome-colors-common/scalable/devices/printer.svg should do).

Alacarte2

Finally, click OK and you should be good to go.

Solution 2: A second, more elegant, way of making sure you have easy access to your printer settings is to add a .desktop file to your ~/.local/share/applications folder. This file is read by your desktop environment and a menu entry is automatically created for you.

I won’t go into detail on just what .desktop files are and how they are interpreted by your system, as Joe over at the Linux Critic blog has a great post titled the Anatomy of a .desktop File that does just that and I encourage you to go and read his post.

What I will do here is show you how to do what I have done on my system.

Procedure: First, open a new file called system-config-printer.desktop in your favourite text editor. As we know we need to save this file in our ~/.local/share/applications directory, lets go ahead and open it there straight away.

$ gedit ~/.local/share/applications/system-config-printer.desktop

Next copy and paste the following into the file.

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_AU]=printer1
Name[en_AU]=Printers (Non-Gnome Shell Config)A
Exec=system-config-printer
Comment[en_AU]=Traditional Gnome Printer Management Application
Name=Printers (Non-Gnome Shell Config)
Comment=Traditional Gnome Printer Management Application
Icon=/usr/share/icons/gnome-colors-common/22x22/devices/printer.png
Categories=Settings

Finally, save the file and exit your text editor.

Which ever of the above solutions you’ve followed you should now have a new Printers menu item under your Preferences sub-menu. If you don’t, go ahead a log out and back in again.

Shotwell – unable to upgrade library.

Yesterday I wrote a post about a permissions error I came across when when trying to move items to the trash in Linux Mint. Today I’d like to do a follow-up post on a very similar issue I came across when I fired up Shotwell the other day.

As the last post was fairly involved I’ll keep this one brief, however, do check that post if you need a little more detail as it covers very similar ground.

Problem: When attempting to start Shotwell the application gives the following error:

“Shotwell was unable to upgrade your photo library from version 0.9.3 (schema 12) to 0.11.6 (schema 14). “

Solution: Ensure that the user has read/write permissions to Shotwell’s configuration directory.

Procedure:

Open a terminal, and check the permissions to ~/.shotwell

ls -al ~/.shotwell

If you find, like I did, that Shotwell’s data and thumbs directories are owned by root rather than your user then:

sudo chown -R $USER:$USER .shotwell/

It may also be a permissions error where your user doesn’t have the correct permissions to read/write to these directories. In this case then the following should fix it:

sudo chmod -R 755 .shotwell/

Fire up Shotwell and all should be dandy.

Disabling Bluetooth as Default in Debian Based Distros

In the wonderful world of modern linux desktops many distros will detect and configure the majority of your hardware out of the box. This is a great feature and in this area linux is often ahead of its counterparts.

Sometimes, however, there is a piece of hardware that you either don’t need, or don’t want handled automatically for you. One such thing for me is bluetooth.

Although my laptop is equipped with bluetooth, I just don’t use it very often. This is fine except that I’d rather not waste the battery power on something I’m unlikely to to use anytime soon. Unfortunately in Ubuntu based distros if you turn bluetooth off from within the desktop it is re-enabled upon a reboot.

Problem: Bluetooth remains on by default at boot even when turned off in bluetooth manager during last use.

Solution: A simple way to ensure bluetooth is turned off by default but still available to switch on via whichever bluetooth manager applet is provided by your particular desktop environment is to kill it upon boot with rfkill. This is done by adding a line to /etc/rc.local which is a file run by Debian based systems near the end of the boot cycle.

Procedure:
In a terminal enter the following command to edit rc.local

gksudo gedit /etc/rc.local

Add the following line between the comments and the line ‘exit 0’

rfkill block bluetooth

Save & Exit

Reboot

Edit: After recently installing Linux Mint Debian Edition I’ve noted that it does not come with the package rfkill installed by default as does Ubuntu or regular Linux Mint. This package can be installed as below.

sudo apt-get install rfkill

Adding a printer to Linux Mint 12 or Ubuntu 11.10 with GnomeShell

After installing Linux Mint 12 the other day, today I set about reinstalling my printer which is usually a process of a few clicks of the mouse. Unfortunately GnomeShell that ships with Mint 12 (and, I believe, Ubuntu 11.10 if Unity is not your bag) ships with a broken printer configuration tool that, believe it or not, doesn’t let you install a printer.

On the upside, there is an easy solution to the problem, read on.

Problem: Mint 12/Ubuntu 11.10 has a bug in the printing configuration tool that inhibits installation of new printers and displays the following error.

“FirewallD is not running. Network printer detection needs services mdns, ipp, ipp-client and samba-client enabled on firewall.”

Problem is, FirewallD is a Fedora specific daemon and no matter how long we wait, it’s not about to start under Mint, Ubuntu or Debian.

Solution: In Ubuntu/Debian/Mint printers can be installed using the traditional printer dialog which can be accessed from the command line with using the following command:

system-config-printer

Solution2: Printers can also be installed by using the CUPS web interface which can be accessed by pointing your browser at http://localhost:631/

Note: The CUPS web interface is available from any distro that has CUPS installed. You will, however, need to know the root password for those distros that utilse a root shell rather than sudo.

Many thanks to the good people (especially altair4) over the Linux Mint forums from where this solution was sourced.