2007
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)

Download foxit.sh

Share the love:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Live
  • MySpace
  • StumbleUpon
  • Technorati
  • Reddit
  • HackerNews
  • Twitter

 

Advertise Here

 

36 comments so far

Add Your Comment
  1. 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

  2. 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:\Foxit\Foxit-Reader.exe” “‘$Filename’”‘

    UPDATE: the javascript hides few of my back-slashes (\)

  3. [...] Now, to make sure you can use Foxit as the default PDF reader application by using the guide at SODEVE. [...]

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

  5. Hi Bryan,

    just use the ‘View Plain’, copy the whole string, then save it as foxit.sh

  6. There is alrady a native Linux version of Foxit Reader. Check out the official site..

  7. > coldpi : There is alrady a native Linux version of Foxit Reader. Check out the official site..

    it doesn’t work moron

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

  9. OK, hope this helps
    Tried running foxit.sh in the terminal,
    Foxit opens but with an error message:
    Z:\home\xxx\
    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!

  10. OK don’t worry about it, its all working now
    Thanks for the script, Jon.

  11. Cheers to you, John.

  12. 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. ^,^

  13. I am having the same problem as Jon. Any thoughts on how to fix it.

    Hey Jon, how to you overcome the problem?

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

  15. Hi Isomer,

    I’ll update this post. I think I’ll attach the bash script file. Wordpress messes up the characters.

  16. Thanks very much. It is working wonderfully now.

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

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

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

  20. I meant

    App=’eval wine “/media/OS/Program Files/Foxit Software/Foxit Reader/Foxit Reader.exe” “‘$Filename’”‘

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

  22. Hi green,

    Have you tried download foxit.sh, modify “C:\Program Files\Foxit Software\Foxit Reader\Foxit 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?

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

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

  25. Thanks a lot sebastian for the tip.its working fine :)

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

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

  28. hi Varun,

    If you try to execute the instruction through command line, what is the error message shown?

  29. good post. its working fine..thanks a lot to hardono & sebastian..

  30. 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 Files\Foxit Software\Foxit Reader\Foxit Reader.exe" "'$Filename'"'
    $App
    
    • Hi 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 :)

  31. It works perfectly, thank you very much. I always wondered how to do this…

  32. Another trick would be to use the builtin WINE function called winepath :

    #!/bin/sh
    # Purpose: To convert Linux-style filename to Windows-style to pass as an argument
    # to wine when starting Foxit Reader
    # We use Wine's winepath function to convert our unix path to a windows path name
    # where $@ access the selected file(s) path names
    filename="$(winepath -w "$@")"
    # assuming you use the default installation folder for Foxit in Wine
    wine "C:Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" "$filename"
    

    Watch for the double quotes as they are badly copied from this blog (at least in my case, in gedit)

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

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