Open pdf files within Firefox window

Xyie
  13 years ago
  1

I view a fair number of pdf documents online, and it occasionally seems a hassle to me when evince opens a new window for them, especially since the browser window then is directed to a more or less empty page, depending on whether or not frames are involved. I've had to fix this issue a few times after reinstalls - mozplugger is usually good about opening things, but evince isn't by default swallowed into the application for some reason. This is how you can fix this minor nuisance.

Step 1: Check to make sure the package mozplugger is installed. To check this, go to Menu > Software Manager, and type mozplugger into the search field. If the package is not installed, install it. If the package is installed, there should be a green checkmark by the icon, or the page describing the package should say "remove" instead of "install," which means it is already installed.

Step 2: Check to make sure it isn't already working. Open Firefox and look for a pdf document to open as a test. For the simplest example, try opening the Linux Mint User Guide. If the pdf opens inside the Firefox window, and does not open a new window, then no further configuration is necessary. Otherwise, continue to step 3.

Step 3: Copy the default configuration file. Mozplugger puts a default configuration file in /etc called "mozpluggerrc". (Full path to file: /etc/mozpluggerrc ) Copy this file into your home folder, inside the hidden folder ".mozilla". To make this folder visible, press Ctrl + H while looking inside your home folder in Nautilus (the file browser). Again, we're copying /etc/mozpluggerrc into the folder ~/.mozilla so we can modify as needed. This file will be loaded by mozplugger instead of the default one when you restart Firefox.

Step 4: Edit the configuration file. Open the file you just copied, ~/.mozilla/mozpluggerrc with gedit. Press Ctrl + F and search for "pdf" within the document. You should find a section similar to this:

application/pdf:pdf:PDF file
application/x-pdf:pdf:PDF file
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file
    ACROREAD()
    repeat noisy swallow(kpdf) fill: kpdf "$file"
    repeat noisy swallow(Xpdf) fill: xpdf -g +9000+9000 "$file"
    repeat noisy swallow(okular) fill: okular "$file"
    GV()
    repeat noisy fill exits: evince "$file"

Notice how evince is listed with "exits" instead of "swallow". We want it to be swallowed by firefox, so that the pdf opens within the browser window. To do this, paste the following line just under the line with "okular" in it...

    repeat noisy swallow(evince) fill: evince "$file"

Save the file, and close it.

Step 5: Confirmation test... Restart Firefox and attempt to open the same pdf file you tested. It should open inside the Firefox window now.