12.13
I like Foxit Reader very much. It’s fast, small and give you pretty much everything you need for a PDF Reader. Although they have the Linux version, I don’t really like it because I don’t seem to be able to automatically open a PDF file with a single click from Nautilus (although I already set ReaderLinux as the default Application).
Before we proceed, I am assuming you already have Wine up & running, and have installed the Windows version of Foxit Reader. What we need to do next is to associate the PDF file to Foxit Reader through Wine in Nautilus (or other File Manager that you have). If you have not install Wine, you could read the tutorial HERE.
After you have Wine up and running, download the Windows version of Foxit Reader HERE. Install it using the default settings.
First save the following script as foxit.sh in your home directory
#!/bin/bash
# Purpose: To convert Linux-style filename to Windows-style to pass as an argument
# to wine when starting Foxit Reader
Filename="z:"${1//\//\\}
#assuming you use the default installation folder for Foxit in Wine
App='eval wine "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" "'$Filename'"'
$App
Use foxit.sh as the Default Application for PDF File (select any PDF file in Nautilus, Right-Click -> Properties -> Open With -> Click [+ Add] Button -> Browse for foxit.sh located in your home folder.
Voila! Foxit Reader is now the default application for your PDF documents.
(Disclaimer: This post was based on 64-bit Ubuntu Gutsy Gibbon and Foxit Reader 2.1 Build 2023)
Share and Enjoy
Possibly Related Posts

Hi,
Thank you for your excellent guide!
I’ve my Win32 Firefox 1.5 running on wine 0.9.51 in order to access our company’s Oracle Form Server via JRE1.5.0.11 (via wine also) , but the only problem was that I can’t find any working Win32 PDF viewer to use under WINE’s fake Windows, until I read your blog today.
I also like Foxit Reader very much after I’ve evaluated in my wine applications, and now I also want to use it for my Linux Desktop to replace the slow acroread, crippled evince, and ugly xpdf etc….
But I can’t get it work according to your above mentioned script.
My foxit reader is locating under ~/.ies4linux/ie6/drive_c/Foxit/Foxit-Reader.exe
I tried to add WINEPREFIX=/home/xxx/.ies4linux/ie6 in front of the line, but it’s not working…
Please let me know as to how I should modify your script in order to get it work?
Thanks!
Bryan
Hi Bryan,
I think my source code displayed wrongly because my syntax highlighter doesn’t support BASH.
Looking at your case, you could try to modify it as follows:
App=’eval wine “C:FoxitFoxit-Reader.exe” “‘$Filename’”‘
UPDATE: the javascript hides few of my back-slashes ()
Hi,
Thanks for your reply.
I’ve re-modified it again accordingly, but I got the following error:
foxit.sh: 4: Syntax error: Bad substitution
Any ideas?
Can you please put your script file somewhere for download?
Thanks!
Bryan
Hi Bryan,
just use the ‘View Plain’, copy the whole string, then save it as foxit.sh
There is alrady a native Linux version of Foxit Reader. Check out the official site..
> coldpi : There is alrady a native Linux version of Foxit Reader. Check out the official site..
it doesn’t work moron
Hi, I’m trying out Ubuntu 8.04 and running Wine 1.0 (yes I’m a linux noob)
I got Foxit 2.3 to install and if I double click on the icon on my Desktop it opens, so far so good.
I tried copying your script but when I try to Add Application I get the following:
Could not find application
Could not find ‘/home/xxx/foxit.sh’
Well, that’s where I saved the script, so am now stuck.
Any help much appreciated.
Thanks,
Jon.
OK, hope this helps
Tried running foxit.sh in the terminal,
Foxit opens but with an error message:
Z:homexxx
Couldnot open file.
File not found.
any idea as to what file its looking for and where it should be? Clicking on the OK in the error message promptly shuts Foxit back down again.
so close!
OK don’t worry about it, its all working now
Thanks for the script, Jon.
Cheers to you, John.
I’ve noticed that this script has difficulty opening filenames with several spaces. I suggest modifying line four as follows:
Filename=’”z:”${1////\}’
#Added graves before and after the filename
This should be a bit more “robust” with filenames. Hope this helps. ^,^
I am having the same problem as Jon. Any thoughts on how to fix it.
Hey Jon, how to you overcome the problem?
Fixed the problem by making the script executable.
But now when I open a pdf it only opens foxit, and does not open the pdf in foxit. Any suggestions would be greatly appreciated.
Hi Isomer,
I’ll update this post. I think I’ll attach the bash script file. WordPress messes up the characters.
Thanks very much. It is working wonderfully now.
Ok.. finally I uploaded the script.
Just a caution though, the script will fail to open file with double quote(“). This is the difference between Windows and Linux/Unix. Windows filename doesn’t allow double quote.
Hi,
I have the problem that Jon seemed to have but that he apparently solved… any help would be very useful
i created the SH script but whenever I do ‘Open with’ and go find the script where I put it, whenever I try to hit OK I get an error message saying “could not find application”…
what should I do?
thanks
JB
I tried your scripts but it did not work for me. The following way works for me.
App=’eval wine “/media/OS/Program Files/Foxit Software/Foxit Reader/Foxit
See here http://ubuntuforums.org/archive/index.php/t-343515.html , the last
I meant
App=’eval wine “/media/OS/Program Files/Foxit Software/Foxit Reader/Foxit Reader.exe” “‘$Filename’”‘
Well, I created a launcher.
In the Create Launcher popwindow
select Tyep: Application in Terminal
Name: you-name_it
Command: wine “/media/OS/Program Files/Foxit Software/Foxit Reader/Foxit Reader.exe”
click ok.
A launcher will be created on your desktop. I works.
but I have to run the launcher to open the foxitreader then open pdfs inside foxitreader. How to link this launcher to my pdfs?
Hi green,
Have you tried download foxit.sh, modify “C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe” into “/media/OS/Program Files/Foxit Software/Foxit Reader/Foxit Reader.exe”
then run it. What is the error message? does Foxit Reader launched?
For those people having trouble getting the foxit.sh file to run make sure it has the appropriate permissions.
To allow excecution,
Rightclick on foxit.sh
click permissions tab
check “Allow excecuting file as program”
close window and associate with pdf
This should solve your “could not find app” problem
sebastian
Wow, thanks! I was just searching for generic tips on converting to wine filenames so I could do exactly this with Foxit. Things just got way easier!
Thanks a lot sebastian for the tip.its working fine
Hello Hardono,
I am very thankful to you for this guide.For other newbies here coz I am also one I will just put the order of things I did and what problems I faced.Also sabestian’s suggestion was very helpful.
1.completed the installation of wine and then foxit in wine
a.As a result I got a foxit icon on my ubuntu desktop .Installation
went to the following directory-”/home/varun/.wine/Program File
s/Foxit Reader/Foxit Reader.exe”
2.Then I tried saving the script given in multicolor above in a text editor and saved it as Foxit.sh
3.Tried opening a pdf by right clicking on it and selecting permissions–>add–>,browed to foxit.sh and clicked okay but got the error message that file was not found.
4.Used sabastian’s tip and changed the file type to exe,and tried the step 3 above again.,but no good.
5.There is another file on this page just after the disclaimer(top of the page and not very visible and so u need to see.)which says “download Foxit.sh”.I downloaded that and put overwrote it on the earlier file I had from the earlier step.
6.I did step 3 again [but I guess there is no need].
and voila!!!!!success.
So thanks everyone and hope this step by step thing helps someone.
The only thing I have not tested till now is shutting down the computer and seeing if on restarting the same arrangement works for me or not.
Has the thread died.If not I have another little problem.I can start foxit and do stuff but when I use open office and then close foxit I am not able to open it again with the sh script of with the exe created on the destop.Can someone help
thanks in advance
varun
hi Varun,
If you try to execute the instruction through command line, what is the error message shown?
good post. its working fine..thanks a lot to hardono & sebastian..
@lakshminarayanan v, Cheers
For those who have had difficulty getting the script working I suggest they re-type it themselves. A number of characters did not copy correctly with me, including the quotes. This is my script, maybe this will copy and paste correctly for you:
#!/bin/bash # Purpose: To convert Linux-style filename to Windows-style to pass as an argument # to wine when starting Foxit Reader Filename='"z:"${1////\}' #assuming you use the default installation folder for Foxit in Wine App='eval wine "C:Program FilesFoxit SoftwareFoxit ReaderFoxit Reader.exe" "'$Filename'"' $AppHi Chris,
It has something to do with the way WordPress/MySQL store those back-quotes. I have put the script as a downloadable script though, hopefully it will be
It works perfectly, thank you very much. I always wondered how to do this…
Another trick would be to use the builtin WINE function called winepath :
Watch for the double quotes as they are badly copied from this blog (at least in my case, in gedit)
I have used almost all PDF readers there are for both Gnome and KDE, only to find out Foxit renders them best.
Many thanks for writing awesome script.
God bless you Maxim!
The first code didn’t worked for me (using Ubuntu 9.10 Karmic Koala) but the one you posted on 2009.06.21 20:56 with “winepatch” worked right away (I used the “view source” option on the little window). I just can’t do without foxit reader functions of: highlight, note and “replace document colors”. I use black background with red text. The linux version of Foxit haven’t got those yet.
Thanks a lot. This solved my problem perfectly.
Hi! I don’t know for other Ubuntu releases but I have 10.04 LTS and what you are trying to do is done easily like this:
Right-click with your mouse on a .PDF file and choose “Properties”, go to the “Open With” tab and there you should see a list of programs used for opening .PDF files, in which “FoxitReader” should be. (If it isn’t then click Add and from the list of programs that opens select “FoxitReader” and click again Add. Now FoxitReader should be in the initial list.)
Now just click on the radiobutton on the left of FoxitReader and then click Close.
Your .PDF files should be associated with Foxit Reader.
Try to click different .PDF files and you should see them open with Foxit Reader.
Hi Lika,
Yes, provided you’re using the Linux version of Foxit Reader. Last time I tried, the Foxit Reader on top of Wine is much better than the Linux version.
Hi,
As a recent convert to Ubuntu 10.04 from Windows, I’ve downloaded Foxit Reader Setup v3.3.1.0518 and apparently the setup window did not run; but instead it went straight to running the application (without installing). I can open my pdf files using Foxit Reader by dragging and dropping them onto the interface.
The problem is, I’ve tried the method Hardono posted, and it couldn’t run as a “default app”. Even tried modifying the .exe (setup) file to the suggested name as Foxit Reader.exe so foxit.sch can recognize it, still didn’t work. Can anyone help?
Hi Choe,
I have tried Ubuntu 10.04. And installed Adobe’s Acrobat Reader for Linux. It’s surprisingly fast and easy. I guess that makes this post moot
Hi Choe, I had the same exact problem as you. Using Ubuntu 10.04, I tried installing Windows Foxit 3.31, 4.0, and 4.1, and the install wizard was just skipped under Wine 1.1.42 and Wine 1.2. Foxit just opened… not really supposed to work that way.
If you’re intent on using a PDF reader with decent annotation capabilities, you can resort to PDF-XChange Viewer, which is also free but looks more cumbersome (LOTS of functions, way more than I need). It installed successfully under Wine, and I was also able to right click and set PDF files to open with it by default — no need for any special script.
hi, I am glad it looks like this thread is still open.
I have tried getting this to work, but no success yet. I am running 9.04 Xubuntu, but I do not think that should be a problem.
I had to change:
App=`eval wine “C:Program FilesfoxitFoxitReader411_enu_Setup” “‘$Filename’”`
to:
App=`wine “C:Program FilesfoxitFoxitReader411_enu_Setup” “‘$Filename’”`
removing eval to get Foxit to open up by clicking on a PDF file in Thunar (X’s Nautilus), and now Foxit opens fine but without opening the PDF file I clicked on. I can easily click on the open file icon and click the file, but it would be sweeter if you let me know what I might be overlooking getting Foxit to actually open the PDF file I click on.
cheers,
nap
are you still monitoring this thread? if so I would appreciate getting this working for me if you can see anything that might be worth a try.
thanx,
nap
Hi Hardono, thank.
I seem to have run into another problem, “Filename” with parentheses error.
$ homemtropycsfoxit.sh exemple(1).pdf
bash: syntax error near unexpected token `(‘
Hi mtropycs,
perhaps you could add escape character to the bracket “(“
Hi Hardono,
Your script works well on my Fedora14 x86_64,
A question here:
When I already open one pdf file using Foxit, can I open another by “double click” ?
(It seems cant work like this, I get a pop-up window showing “Setup.exe Could not open file. File not found”.)
( somethings need to say : The way in which I “wine” the foxit is a little strange. It do not need to click several “next step” to install, I have never saw “next step” when “wine”ing Foxit )
Your script works well under Arch Linux x64
Cheers for sharing!
I use that script:
[code]
#!/bin/sh
ROOT_DRIVE="Z:\"
for arg
do
wine "/home/.../.wine/drive_c/Program Files/Foxit (...)/Foxit Reader.exe" ${ROOT_DRIVE}$(echo $arg | sed 's///\/g')
done
[code]
and placed it in ~/bin and added the bin folder to PATH via:
[code]
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
[code]
If you use GNOME/KDE then place the last code sample into ~/.gnomerc (~/.kderc) otherwise ~/.xsessionrc is a good place.