« Back

Live Preview for Document Library

Company Blogs January 31, 2011 By Alexander Chow Staff

Liferay's engineering team has been doing a lot of work on the Document Library for version 6.1.  But in one of the recent weekly meetings, a discussion sparked off about the possibility of having some kind of live preview for the Document Library.  This is meant in terms of both (1) thumbnails of files in the file listing and (2) previews of the actual document that you can go through without downloading the file.   So, after a little toying around, I got a first cut of this working in trunk (see LPS-13145).  Both of them still need to be reskinned (our UI guys are great at that), but I thought I would show a few screenshots of what things roughly look like.

For thumbnails (note that the future version will allow you to pick a plaino list view vs. a thumbnail'd view):

Then, you can also go through each page of the document as well (eventually with zooming capabilities):

 

How does it work in the backend?  Well, first, it converts files to PDF format using OpenOffice.  So you need to make sure you have that installed.  Then, it breaks up the PDF into images -- one for each page.  Now, OOTB, it does it using PDF-box.  But, ideally, you should install ImageMagick.  This is because PDF-box is great for fairly simple PDF documents, but can get a bit gibberish if you use fonts it doesn't know about and things like that.  ImageMagick also runs significantly faster.  So, all in all, it is much better if you install ImageMagick.

Threaded Replies Author Date
Nice improvement! Thanks a lot, Alex! Jonas Yuan January 31, 2011 1:14 PM
Awesome... was just thinking how useful a... Ryan Paul Schultz January 31, 2011 1:25 PM
Cool. Looks a lot like the alfresco share... S L B January 31, 2011 1:57 PM
Great job Alex. But why not implementing pdf2swf ? Christophe Cariou January 31, 2011 2:54 PM
in my opinion, we should avoid using SWF flash... Jonas Yuan January 31, 2011 3:41 PM
Yah, like Jonas's comment, we decided against... Alexander Chow February 1, 2011 1:13 AM
Thats cool. Open Office is to be installed in... Sandeep Nair January 31, 2011 9:11 PM
Very nice! What about the conversion speed for... Peter Mesotten February 1, 2011 12:37 AM
@Sandeep OpenOffice and ImageMagick on the... Alexander Chow February 1, 2011 7:36 AM
Great job Alex! :) Sergio González February 1, 2011 4:44 AM
Cool feature! Juan Fernández February 1, 2011 5:22 AM
Hi Alex, This improvement along with the other... Shagul Khajamohideen February 1, 2011 5:28 AM
will this preview also be available when using... Kathleen Acton January 19, 2012 10:27 AM
Yes, it is. Actually, you can already download... Alexander Chow January 19, 2012 4:35 PM
This feature is automatically available on... Igor Kanshyn June 19, 2014 2:20 PM

Nice improvement! Thanks a lot, Alex!
Posted on 1/31/11 1:14 PM.
Awesome... was just thinking how useful a feature like this would be! thanks!
Posted on 1/31/11 1:25 PM in reply to Jonas X. Yuan.
Cool. Looks a lot like the alfresco share preview.
Posted on 1/31/11 1:57 PM.
Great job Alex. But why not implementing pdf2swf ?
Posted on 1/31/11 2:54 PM.
in my opinion, we should avoid using SWF flash - SWF flash does not get supported in iPad, and iPhone.
Posted on 1/31/11 3:41 PM in reply to Christophe Cariou.
Thats cool. Open Office is to be installed in server right? And what about ImageMagick, should it be on server or on client machine?
Posted on 1/31/11 9:11 PM.
Very nice!

What about the conversion speed for this? How long did it take to convert the 27 pages long document?
Posted on 2/1/11 12:37 AM.
Yah, like Jonas's comment, we decided against that since we didn't think it needed to be done with flash. It's also another thing the admins have to install on their systems and you don't really buy yourself anything either.
Posted on 2/1/11 1:13 AM in reply to Jonas X. Yuan.
@Sandeep OpenOffice and ImageMagick on the server. Nothing special needed for the client.

@Peter It of course depends on the complexity of the document, but all processing is offloaded to an asynchronous call (so it doesn't slow your upload and continuing on your way). But once the asynch call starts running, it processed a 27 page test document in a minute with ImageMagick and a bit longer using PDFBox. Mind you, these are unscientific tests done on my untuned development environment.
Posted on 2/1/11 7:36 AM in reply to Peter Mesotten.
Great job Alex! emoticon
Posted on 2/1/11 4:44 AM in reply to Alexander Chow.
Cool feature!
Posted on 2/1/11 5:22 AM.
Hi Alex,

This improvement along with the other DL changes will definitely make Liferay a much powerful platform.

Great Job!!!
Posted on 2/1/11 5:28 AM.
will this preview also be available when using the document library display as well?
Posted on 1/19/12 10:27 AM.
Yes, it is. Actually, you can already download the 6.1 release from the downloads page and check it out yourself!
Posted on 1/19/12 4:35 PM in reply to Kathleen Acton.
This feature is automatically available on Liferay 6.2 now. Is there is a way to turn it OFF and have .pdf work like all the other documents?
Posted on 6/19/14 2:20 PM.