WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: (Solved) View PDF in browser  (Read 7574 times)

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
(Solved) View PDF in browser
« on: November 09, 2011, 10:16:19 AM »
I was able to find a previous post about this for Chromium, but there was no resolution so I am asking again.

Does anyone know of a way to be able to view a PDF in a browser?

I have tried both Chromium and Firefox but I have not been able to either to work.  I am running TC 4.0.2 with Chromium 140.0.835.186 and Firefox 6.0.2 and Xpdf installed.

For Chromium:
I tried following the Arch Linux Wiki page (sorry I can't link yet).  I downloaded the google-chrome-stable_current_i386.deb (and the amd64.deb) and I extracted the libpdf.so.  I had to use my Ubuntu box as I couldn't run tar -xJf on an tgz.lzma file (I'll play with that later).  Anyways I copied the libpdf.so over into /usr/local/chromium/plugins and then I did a chmod 755 on libpdf.so.  From there I opened Chromium and went to about:plugins and it showed libpdf was loaded, but it only had a location displayed (/usr/local/chromium-browser-addons/plugins/libpdf.so
But when I go to a website that has a PDF it still asks if I want to download the PDF.

For Firefox:
I am attempting to play with mozplugger and see if I can get that to work.  I have downloaded the m4 for the parsing, but I am not sure where to place mozplugger as of yet.  I have tried in /usr/local/lib/mozilla/plugins but that did not appear to work.  I also tried removing the .mizilla/firefox/pluginreg.dat but that did not appear to work either.  I have been testing by going to about:plugins in Firefox but mozplugger never shows up.

I haven't tried Opera, SeaMonkey or Icecat yet.

Any suggestions?  This is a bit of a requirement for the web app that I am trying to use this for.
« Last Edit: November 14, 2011, 06:11:52 AM by KHarvey »

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: View PDF in browser
« Reply #1 on: November 09, 2011, 12:15:43 PM »
I have also tried Opera now and still no success.

So far I still do not have this working, but I was able to collect a little more information.
I found that if I run Chromium frm the CLI using chromium-browser --debug-plugin-loading the I get a bunch of errors.
When Chromium tries to load libpdf.so I receive the following error:
Quote
[1107:11078:15639645438:ERROR:plugin_lib_posix.cc(211)] Plugin /usr/local/chromium-browser-addons/plugins/libpdf.so has no GetValue() and probably won't work.

Also I received the following error when Chromium tried to load the mozpluggerrc that I have in the Mozilla directory:
Quote
[11070:11078:15639649076:ERROR:plugin_lib_posix.cc(149)] Skipping plugin /usr/local/lib/mozilla/plugins/mozpluggerrc because it doesn't match the current architecture.
Now I think this one is caused as I used my mozpluggerrc file from my 64-bit Ubuntu box.  So I am attempting to download 32-bit Ubuntu to see if I compile it on there if it will work.

I'll keep troubleshooting, but I am open to advice / suggestions.

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
Re: View PDF in browser
« Reply #2 on: November 09, 2011, 01:58:29 PM »
I use epdfview. its small, fast.
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: View PDF in browser
« Reply #3 on: November 09, 2011, 03:32:51 PM »
I recently switched to mupdf. It is command line, but with a select front end is very nice.
10+ Years Contributing to Linux Open Source Projects.

Offline genec

  • Full Member
  • ***
  • Posts: 240
Re: View PDF in browser
« Reply #4 on: November 10, 2011, 06:06:37 AM »
In my experience, I've found opening a document (PDF or otherwise) within the browser window to be bothersome, buggy and frustrating.  I've normally found it far better to open outside the browser.  The back/forward buttons, printing and searching are just some of the functions I've seen frustrations/issues with.  Unless it embeds nicely within an HTML page, I've always avoided it.  I also try to ensure it targets a new window/tab (to avoid the back/forward issues).

That said, I've never tried or seen it working within the browser on Linux.

Your issue with extracting the .lzma is probably that you didn't download the needed extensions to handle the decompression first.

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: View PDF in browser
« Reply #5 on: November 10, 2011, 07:04:56 AM »
Thank you all for your responses, but I am not sure it is the PDF reader that is the problem.  But I will try using epdfview and mupdfto see if I can get them working.

In my experience, I've found opening a document (PDF or otherwise) within the browser window to be bothersome, buggy and frustrating.  I've normally found it far better to open outside the browser.  The back/forward buttons, printing and searching are just some of the functions I've seen frustrations/issues with.  Unless it embeds nicely within an HTML page, I've always avoided it.  I also try to ensure it targets a new window/tab (to avoid the back/forward issues).
I tend to agree, and that was the way that I had it originally configured.  But now I have management asking me to change it to where it runs more like IE, and have the PDF's open in the iFrame that is on the website.  This will make it easier on our production floor to find the correct PDF, without having to continually close Xpdf every time they click on a link.  This is partly a limitation of the website. 
The website was originally built for IE, so we have had to make a bunch of changes so that it will even pull up anything in FF or Chrome.  Eventually the website will be rewritten so that it is cross browser compatible but that is a couple of months out.

That said, I've never tried or seen it working within the browser on Linux.
I have been able to get FF in Ubuntu to open PDF's inline inside the browser.  But that is using the mozpluggerrc plugin.  But the problem that I have is I haven't been able to find a way to compile mozplugger on TC yet.  I tried copying the mozpluggerrc from Ubuntu (32 and 64) over to my TC but I get the "doesn't match your architecture" error.  I will try again today to try and actually compile mozplugger from source on TC as I think that may solve my problem.

So I installed M4 and GCC which were prereqs for mozplugger.  But when I run ./configure I receive the following error:
Quote
checking whether the C compiler works... no
configure: error: in /home/tc/Downloads/mozplugger-1.14.3:
configure: error: C compiler cannot create executables

Then when checking config.log I think it is erroring out at:
Quote
configure:2622: checking whether the C compiler works
configure:2644: gcc conftest.c >&5
gcc: error trying to exec 'as': execvp: no such file or directory
I havn't taken a look at .configure to see if I can change it to where it runs in TC.  To be quite honest I don't think my scripting skills are up to par to change it to fix it, but I will at least try.  If you have any suggestions on getting it compiled, I am all ears.

Your issue with extracting the .lzma is probably that you didn't download the needed extensions to handle the decompression first.
I did find the problem with this yesterday.  I had made a dumb mistake and did not install the full tar.tcz.  Once I did that I had full functionality again.


Any other suggestions would be greatly appreaciated.  My last resort will be to attempt to use a FF addon or plugin that converts PDF's to HTML, but I am unsure how well that would work, and that seems kind of like a poor way of doing it.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10974
Re: View PDF in browser
« Reply #6 on: November 10, 2011, 07:39:39 AM »
compiletc.tcz will get the full toolchain, and busybox tar should support lzma archives based on autodetection (-xvf, not sure if it recognizes -J).

I read Mozilla has a pdf viewer in javascript, perhaps you could use that?
The only barriers that can stop you are the ones you create yourself.

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: View PDF in browser
« Reply #7 on: November 10, 2011, 12:20:30 PM »
compiletc.tcz will get the full toolchain, and busybox tar should support lzma archives based on autodetection (-xvf, not sure if it recognizes -J).
Thank you for that.  I apologize I have only been using TC for a couple of weeks now, and pretty much everything I have needed has been in the repository.  But this allowed me to configure mozplugger, but I couldn't do a make on it.  Pretty much everything failed when I tried.

I read Mozilla has a pdf viewer in javascript, perhaps you could use that?
Even though it hasn't been completed the PDF.js is awesome.  It does have some font problems, but over all it is an excellent tool.  The current version on GitHub appears to be stable enough for me to test out.  So thank you so much for this suggestion.  I am pretty sure this will be the direction that I go, although I have to edit the web app a little bit for it to work, but I think I have figured most of that out already.

Even though I will most likely use the PDF.js suggested by curaga (THANK YOU), I do have one last question.  Does anyone know how to configure Chromium to auto open PDF's in Xpdf?  I found the setting to have it auto open things, but it still doesn't open any PDF's.  I am assuming the problem is because there isn't a file association with Xpdf and PDF's, I tried for a couple of minutes to play with XDG and the Chromium Preferences file, but I never got anything working.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1228
Re: View PDF in browser
« Reply #8 on: November 12, 2011, 08:39:45 AM »

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: View PDF in browser
« Reply #9 on: November 14, 2011, 06:11:19 AM »
Peferct, that answered my other question Hiro.  Thank you very much.