Is there a module that will allow pdf documents to be viewed in a browser window? The site I'm working on requires digital asset management functionality but it would all be so much easier if the actual PDF assets could be viewed directly in the browser rather than donwloading and then launching an external viewer.

This site pretty much does what I'm after, just not within the Drupal environment: http://view.samurajdata.se/

thanks very much.

Comments

vm’s picture

pdfview.module may be worth investigating

stormer’s picture

but I really want to be able to view the document in the browser rather than launching external viewers.

Had a look at pdfview but that seems to be the opposite direction ie. genrating PDFs from nodes as opposed to viewing PDFs.

vm’s picture

seems to me you can use the viewer available in the link you provided to the example ? It's Open Source and downloadable on the page you've given.

Maybe contacting the author of the psview script itself to help develop the script into a Drupal module ? Although a module may be overkill for what you are asking, unless you are using "other" drupal modules to upload the pdfs

adam_b’s picture

Unless I'm misunderstanding what you want, installing Acrobat Reader will (IIRC) install a browser plug-in which allows you to view the PDF within the browser window. This will blat out your existing page, but you can then use the "back" button to return to it easily. If you want to view the PDF with the page navigation around it I suppose you could do it with an iframe arrangement of some kind.

xtfer’s picture

I agree. This looks like you are describing a client issue, not a drupal one. How a PDF displays on a pc depends on how Acrobat (or another reader) has been installed, or in the case of a mac, it will display in Safari or Preview depending on your settings.

stormer’s picture

but that's precisely what I'm trying to circumvent. I'm trying to set up a system that will allow all of our clients to view PDFs online, regardless of their system or client.

adam_b’s picture

I don't think you can do that. Viewing any sort of file when it's downloaded will depend on what software is available on the client machine. For what you'd want, you'd have to (thinking off the top of my head) pre-render the PDF into HTML - not easy, and then you'd still have all the issues of various browsers interpreting HTML differently.

The example you give appears to scan a bitmap of the PDF, which looks really lousy and loses all the benefits of PDFs (scalable fonts & vector images, etc). I'd much rather expect people to have a PDF reader installed - most people do already.

itzme’s picture

thats quiet impossible. it is one of those incompatibility that everyone face.

stormer’s picture

in the form of Adobe/Macromedia's FlashPaper (http://www.adobe.com/products/flashpaper/examples/) which is what is used at http://www.scribd.com/. Strictly speaking you're not viewing the actual PDF but as far as the client's concerned that's beside the point.

adam_b’s picture

thanks for the feedback - this could be useful.

stormer’s picture

however, I now need to figure out how to get the system to automatically convert uploaded PDFs with FlashPaper as well as how to get it to work on a non-Windows server. If you make any headway in this direction I'd love to hear how you go about it.

jamesmcd’s picture

I presume you figured out a way to do this in the end, I would appreciate it if you could share your solution

I require the same facility to show uploaded CVs on user profiles

Many thanks

Christefano-oldaccount’s picture

Perhaps you can use non-Drupal software to do this. I'd take a look at installing pdftotext on the server and use shell scripts to index your PDFs.

Mel55113’s picture

If you're willing to hand craft some html you can display a pdf file in a window in your node using code similar to this:

<embed src="/files/Your-PDF-File.pdf#view=FitBH,top&pagemode=none&scrollbar=1&statusbar=0&messages=1&navpanes=1" border=0 height=500 width=99% alt="Display Your-PDF-File">

Specifying the width as a percentage seems to work well, although in my experience percentages don't work very well for height.

Unfortunately, TinyMCE (and maybe the other WYSIWYG editors, too) strips this construction. It should be (and probably is) possible to configure TinyMCE to accept this construct but I haven't been able to figure out how to do it, yet.

Also, I believe that EMBED has been deprecated in favor of the OBJECT tag although it appears (from reports that I read) the older versions of IE (no big surprize) don't handle OBJECT very well.

Mel

taqwa’s picture

subscribing

mattrweaver’s picture

you can grab set a default setting for the snippet so that it grabs the field. My PDFs are links, so I did this:

<?php 
$node = node_load(arg(1));
$field = $node->field_link_to_pdf[0]['url'];
echo '<embed src="' . $field . '#view=FitBH,top&pagemode=none&scrollbar=1&statusbar=0&messages=1&navpanes=1" border=0 height=500 width=99% alt="Display Your-PDF-File">';
?>

So every time you create a node with a PDF link, you don't have to manually add the embed. Until the file viewer module sorts out the stupid dependance on the non-existant file module, this will have to do. :-)

Finished products are for decadent minds. -- Isaac Asimov

marknr’s picture

Adobe is beta testing an Online PDF service at http://share.adobe.com . It requires that you create an account, or have an existing AdobeID, but works great for browsing PDF's in the context of a web page.

I recorded a brief tutorial on how to use share.adobe.com to embed a PDF. View it here - http://my.adobe.acrobat.com/p78879723/

Mark Niemann-Ross

jglynn’s picture

Try http://www.pdfmenot.com/, it renders the pdf in flash and is free.

harkonnen’s picture

Try http://www.swftools.org/
not a module, but it converts pdf to swf

asb’s picture

Try http://www.swftools.org/
not a module, but it converts pdf to swf

Is the swftools module something different? According to the project page, the swftools 3 module is supposed to be able to display PDF files.

However, for me, swftools-6.x-3.0-beta5 with swfobject_2_2.zip and flowplayer-3.2.7.zip wont show anything. Anyone else having more luck?

vm’s picture

you have to use flexplayer.module which comes in swftools.module not a mediaplayer for pdf files.

asb’s picture

You probably mean "FlexPaper"? I can enable this submodule and set it as "Default player for a single swf movie" at ./admin/settings/swftools/handling, but not connect it to PDF files in a file field. In the node with attached PDF files, it just renders with the message: "You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly."

WorldFallz’s picture

pdf != swf and flexpaper doesn't automatic convert one to other. You need to setup a conversion of the pdf to swf before flexpaper can display it. Probably the simplest way to do it would be with rules (Setup a rule that kicks off when the pdf is added and then coverts it and places it in another filefield (or you can use a single filefield limited to 2 values). See the flexpaper docs at http://flexpaper.devaldi.com/docs.htm for the conversion.

It's relatively straight forward, but somewhat technical and likely to involve some php and advanced rules configuration.

It also help to check a module's issue queue: #759198: Convert automatically a PDF to SWF and use Flexpaper to display. Seems some users have had success using the media_mover module instead of rules. Though if you already use rules, there's no reason to load yet another module for this one function.

nachiket-1’s picture

i searched a lot on this, but unable configure out correctly, can you post the steps of configuration or any video that clearly tells about this important functionality...
it will be helpful for many.. plz help

scottprive’s picture

Older comments say you can not view PDFs in a browser without a plugin.

This may have been true then, but is not true any longer. Users of gmail know this fact... you can click on PDF attachments, and have the option to download it or have gmail display it as a Google Document.

Gmail watches for this filetype/content type, and instead of sending it down as "Content-type: application/pdf" or whatever, they feed it to a sophisticated PDF viewer built in (I think) Javascript (and probably some additional preprocessing on the server). The browser gets a "screen resolution" set of text and images, and it's quite accurate to the original PDF.

This is something that would be quite useful in Drupal as a contributed module - it's not true to say it is a client problem anymore, because we have example websites that have solved it (gmail for instance).

I have not seen any such Drupal module, and this is probably not something you could write in a weekend. If someone has a client who requires this, it would be wonderful to see something started and sponsored. :-)

benone’s picture

YEAH!

SUBSCRIBE

56rosa’s picture

I agree! However, I'm no technical expert. Wish that I could be more helpful on that one!

56rosa’s picture

Hello,

I have managed to display a .PDF file within the browser by using an <iframe>tag, and it worked!

shenzhuxi’s picture

Seph’s picture

I've been doing research on this as well. I've tried embedding a pdf and I've managed to use shadowbox to view pdf's, but I had to change some code. Plus the client browser still needs to have a pdf viewer plugin installed whether it's Reader or another one. Yoxview says it supports pdf's, but I haven't been able to figure out how to do it.

http://drupal.org/project/yoxview

I recently came across some Javascript that will embed it in the webpage...but client still needs a viewer on that end. That code can be found here:

http://pdfobject.com/

I have an 8 page pdf application form that I need members to fill out and sign digitally without them downloading it. I have been looking for a variety of solutions. It's seeming like Adobe Reader is my only option at this point.

I thought with so many government agencies using Drupal these days, there would already be some modules for pdf viewing/editing & digital signatures etc???

Any ideas out there?

gforce301’s picture

I have read through this thread and I really don't understand the point of all this so I'm going to ask the stupid question.

What exactly is the problem with requiring the user to install a pdf reader plugin to their browser?

Last I checked Acrobat Reader was free? Furthermore converting the .pdf to .swf makes absolutely no sense. Last I checked in order to play a flash movie one must (** wait for it **) ....... install a plugin to make it work, and (*gasp*) that format is made by the same people and for the same price (yes FREE) that introduced pdf format in the first place?

IMO if you are on the net and you can't view .pdf files..... you aren't qualified to launch your browser. So much information is in .pdf format these days.

asb’s picture

@gforce301: You are completely missing the point. Launching an external PDF reader or hoping for correctly installed browser plugins leaves you without any control about what the user gets displayed; sometimes the Acrobat reader might pop up, in corporate environments Adobe Acrobat is often blocked because of it's security flaws, on Linux any other PDF capable reader might try to open a PDF document it can not process, other browser plugins might open the PDF inline etc. And, of course, Acrobat Reader is by no means Free Software (opposed to Drupal and all modules and themes on drupal.org).

However, I agree that replacing PDF with Flash is like driving out demons by the power of Beelzeboul. I'd definitely prefer it if Drupal would have better support for real web standards like MathML so we do not have to use crutches like PDF or Flash to display non trivial math formulae.

gforce301’s picture

Really? Tell me when you paid for it and how much they charged you. I have a bridge in New York city and some swamp land in Florida I would be interested in selling you.

asb’s picture

@gforce301: Please educate yourself about Free Software and the licensing of Drupal:

http://www.gnu.org/philosophy/free-sw.html

http://opensource.org/docs/osd

gforce301’s picture

We were not talking about the licensing of Drupal. This thread is not about that. You point me to a link where Adobe charges for Acrobat Reader any link, anywhere. There is more than one definition of the word Free.

free
   adjective, fre·er, fre·est, adverb, verb, freed, free·ing.

–adjective
11. provided without, or not subject to, a charge or payment: free parking; a free sample.

I never claimed it was open source. I never suggested it should ship with Drupal. I never claimed it was without proprietary license.

The next time you decide to climb up on a soap box, show your ass and put your foot squarely in your mouth; use a dictionary first.

asb’s picture

@gforce301: You asked:

I have read through this thread and I really don't understand the point of all this

Obviously you still don't get it. Please be quiet if you are not able or willing to listen.

@WorldFallz: Thanks for the pointers. We got the processing working, and Flexpaper actually is quite nice, if it works properly; however, we got very mixed browser behaviours, e.g.

  • FF/Win: Working fine, moving the document with the mouse doesn't work well or not at all
  • IE/Win: Working fine
  • Iceweasel/Linux: Flash works, Flexpaper doesn't, not even on the Flexpaper homepage
  • Open/Linux: Crash ("Programm operapluginwrapper-native received X-Windows-Error"); it's working fine in Opera 10.10 on Ubuntu
  • Safari/MacOS: Crash
  • FF/MacOS: Working fine
  • Opera/MacOS: Working fine

Bottomline: Flexpaper seems not to enhance the platform and browser independence significantly. So probably the most robust approach so far seems to be the PDF-to-Imagefield conversion (in our case not suitable as alternative to DruTeX for math formulae).

WorldFallz’s picture

That's good to know-- thanks for posting back your experience.

triple5’s picture

PDF.js is an open source product that uses Javascript to render pdf documents, it does a similar thing like google docs and it seems to work okay.
https://github.com/mozilla/pdf.js
They seem to do a good job, of course this again uses Javascript which is not flash and is much more widely useable.

shenzhuxi’s picture

http://drupal.org/project/pdf was just released.
PDF.js is used for displaying PDF in file field.

rwilson0429’s picture

In Drupal 7, you can specify which file types should be shown in the browser (vs. being downloaded) when using FileField and Private files by setting a variable in your settings.php file such as this:
Put this line in settings.php

$conf['file_inline_types'] = array('application/*', 'image/*', 'text/*', 'flash$', 'audio/midi?');

The above variable in the settings.php file will cause pdf and other media files to be loaded in the browser window and eliminate the dialog to save the file to the user's local system. Of course the user's browser must have the applicable plugin for this to work.

Check out http://drupal.org/node/1409782 and http://drupal.org/node/1228480

ReggieW

Xiuqing Li’s picture

Thanks ReggieW,
It works. Anyway to suggest user to use plugin for their browser. my pdf looks fine in IE and Chrome, not in Firefox because it's using pdf.js.

reflectu’s picture

i found a best pdf editer platfrom in web - reflectu