This module lets you show a preview of PDF files uploaded through FileField.
This module uses ImageMagick to extract the first page of a PDF file to a JPEG image which is used as PDF preview link to the file.
If imagecache module is available, you can select any imagecache preset for the PDF preview image link.
Instead of convert pdf files onto a set of images like PDF to ImageField does, and lost any connection to the PDF file, PDFPreview extract only the first page and uses it as link to PDF file.
The images are stored on a configurable folder inside your files folder, so it's fully compatible with multisite installations. If the image is missing at display moment it will be created.

Motivation:
In the company I work for, we are developing a lot of drupal sites for town council web pages. Most of them use PDF files as the main way to publish content which is delivered in some other ways such as paper. Sometimes theese documents are simply text documents, but other are colorful documents like local publications. The way we worked until now was taking a screenshot of the first page, and upload it as attachment to the same node with the pdf file, and write some ugly code to theme the link. This module permits "upload and forgive" of pdf files.
I've found a module that converts pdf pages to a set of images, but this isn't what we need.

The sandbox page of this module is:
http://drupal.org/sandbox/juanjo_dv/1158034

CommentFileSizeAuthor
#16 pdfpreview-1161358-16.patch8.53 KBtim.plunkett

Comments

1websitedesigner’s picture

Sounds like a very useful module. Just putting a proposal together to include this kind of work, so haven't tested it yet, but thanks for creating it!

tr’s picture

Status: Needs review » Needs work

Remove this from your .info file:

version = "6.x-0.1-dev"
core = "6.x"

Your code needs to be changed to conform to Drupal coding standards. Please read http://drupal.org/coding-standards There are too many problems to mention. Pay special attention to your use of spaces.

The .module and .install files should not end with ?>

Translations are no longer supposed to be bundled with modules. Please remove your translations folder and its contents.

In your documentation comments, "Implementation of" should be "Implements"

Menu titles and descriptions should *not* be wrapped in t():

'title' => t('Configure PDF Preview'),  //wrong
'description' => t('Configure PDF Preview settings'), //wrong

On the other hand, form titles and descriptions *should* be wrapped in t():

'#type' => 'checkbox',
'#title' => 'Description', //wrong
'#description' => 'Show file description beside image', //wrong

Running the Coder module on your project will catch many of these issues.

I didn't try to install the module to see if it works.

juanjo_vlc’s picture

Hi,
I've just run Coder on the module and make suggested changes.

But I don't know if the correct way to document hook implementations is the way TR suggests "Implements" or the way Coder suggests "Implementation of" and other modules use.

tr’s picture

juanjo_vlc’s picture

Ok, I left the coments as you said.

juanjo_vlc’s picture

Hi, have you taked another look?

eL’s picture

It will be great module. Thanks for it!

May be, it will be better to impolement this in ImageField too. Because, I would like to have one field for images and PDF thumbnails, not to have one field for images and second field for PDF files with thumbnail.

r.aubin’s picture

This module looks great. Installed and ran some initial tests and it worked perfectly. Quick, easy first page image generation. Can't wait to see an official release. Great work!

juanjo_vlc’s picture

Thanks for your comments, I still waiting for the promotion to a full project.

juanjo_vlc’s picture

Status: Needs work » Needs review
juanjo_vlc’s picture

Priority: Normal » Major

There are some people waiting to the promotion, please, take a look as soon as possible.

eewing’s picture

Wonderful project! This is exactly what I need. It would really streamline the uploading of PDF newsletters. Will there be a D7 version of this!?

sreynen’s picture

Status: Needs review » Needs work

I reviewed the code and documented issues in the project issue queue. They should all be easy to address, but only the LICENSE.txt issue is important enough to wait on approving this application.

sreynen’s picture

I just noticed another bug, added to the issue queue.

sreynen’s picture

Status: Needs work » Reviewed & tested by the community

Looks like juanjo_dv has addressed all issues I found.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new8.53 KB

I agree that this module is ready for a release, even though it has some coding standards issues.

Attached is a patch that will handle most of the problems for you.

I've granted you full project creation rights. Use this ability carefully!

Thank you for your patience.

juanjo_vlc’s picture

Thank for your review, and for your patch.
I see that one of my weakiest points is quoting.
I'm goint to code a loop for writting 10.000 times " string literal: simple quote, string with variables or escape characters: double quote"

for ( $i = 0; $i < 10000; $i++ ) {
 print('string literal: simple quote,');
 print("string with variables or escape characters: double quote\n");
}

Done ;)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.