MODELLING AND SIMULATION, WEB ENGINEERING, USER INTERFACES
July 29th, 2009

How to Use Foxit PDF Reader 3.0 on Ubuntu 8.04 under Wine

I figured out how to set up and run Foxit PDF Reader on Ubuntu 8.04 a little while ago, and I’m just now writing it down. Foxit works extraordinarily well under Wine: displaying documents, editing PDF form fields, annotating documents, and printing to a USB printer all worked for me out of the box. There are certain tricky things involved in setting it up, though, hence this How To blog post.

First, download Foxit. The Foxit Windows installer didn’t work for me, but fortunately Foxit offers a .zip which contains the application frozen into a single Windows executable. Here’s a direct link at the time of this writing: http://mirrors.foxitsoftware.com/pub/foxit/reader/desktop/win/3.x/3.0/enu/FoxitReader30_enu.zip

Unzip the executable and put it somewhere in your home directory where it won’t be touched, for example, ~/apps/.

You’re now going to make a small shell script to run Foxit under Wine. Copy the following text into a file on your PATH, and make the file executable. I put it in /usr/bin/foxit.


#!/bin/sh

#got code to test whether path is absolute, here:

#http://www.unix.com/shell-programming-scripting/38018-test-whether-absolute-path-variable.html

PATH_TO_FOXIT="/home/jacob/apps/Foxit Reader.exe"

case $1 in

/*) absolute=1 ;;

*) absolute=0 ;;

esac

if [ "$absolute" = "1" ]; then

#we assume that root is mounted at Z: as is default on most wine distro

wine "$PATH_TO_FOXIT" "Z:/$1"

else

wine "$PATH_TO_FOXIT" "$1"

fi

This shell script is smart enough that it will actually take arguments that you pass to it on the command line, and pass it into the Foxit executable. This makes it possible open a PDF in Foxit from the command line, e.g.

jacob@jacob-laptop:~$ foxit Documents/Research/papers_to_read/MDAUML.pdf &

You should now be able to open PDF’s in Nautilus by right-clicking the PDF and choosing Open With -> Open With Other Application -> Use a Custom Command -> {type in “/usr/bin/foxit” and click “Open”}. PDF files should now open automatically in Foxit when you open them from Nautilus.

Finally, you can configure Firefox to open PDF’s in Foxit whenever you download a new PDF. Just go to Edit -> Preferences -> Applications -> {type “pdf” into the search bar} -> {under the dropdown menu, select “Use other …”} -> {select file “/usr/bin/foxit” and click “Open”}. Note that this doesn’t fully change the default PDF reader for Firefox, as, for example, when you open a PDF from the Download dialog, it will still open in Evince, the GNOME default. I, unfortunately, haven’t found a way to change this behaviour, and I’d be very grateful for any comments anyone might have on this.

  • Anonymous

    Works fine, thanks :-)

This work is licensed under GPL - 2009 | Powered by Wordpress using the theme aav1