If you’ve been following the recent activity on Share Extras you’ll notice that most of the work for the last few weeks has been going into the Media Viewers project and in particular the ‘PdfJs’ based viewer which it supplies.
If you’re not familiar with the underlying pdf.js project then you should know that it provides a means of direct rendering of PDF content items using HTML5 and JavaScript in the web browser, with no requirement from additional client-side plugins such as Flash.
Combined with the ability of the Alfresco repository to transform just about any standard document into PDF format, we think this provides a compelling reason to try the Media Viewer add-on if you have not done so before.
An initial version of the PdfJs viewer shipped in the Media Viewers 2.0 release for Alfresco 4, and version 2.5 which we’re releasing today builds on that with support for Alfresco 4.2 while also maintaining backwards compatible with the 4.0 and 4.1 Alfresco product lines.
There’s so much in this release that it felt like much more than a v2.1 release and 2.5 seemed much more appropriate. You can read on for more details of these exciting new capabilities, or go straight to the download, installation and configuration instructions to try it out today.
Easy Configuration
The first thing you’ll notice when enabling the add-on using Share’s Module Deployment console is that additional modules have been added, which provide the configuration needed to bind the viewer into the document details page.
Unless you want a specific custom configuration, you can just enable the new PdfJs Configuration module (in addition to the existing PdfJs Viewer module), click Apply Changes and you should see PDF documents will now use the new viewer. You no longer need to edit your web-preview.get.config.xml file although if you’ve made changes there they will continue to be respected.
Persistent View Settings
Can’t see the text clearly? You can use the zoom controls in the viewer to zoom in, our out if you want to see more. Or pick a preset from the drop-down and the zoom will be auto-calculated.
The next time you come back to the document, these settings – plus the page number you were on – will be remembered.
Powerful Search
Use the Search button in the toolbar or Ctrl+F (Cmd+F on MacOS) to search through the document contents for a particular item of text. You can easily step through the matches one by one, or highlight all matches found.
When you’ve found what you’re after, you can copy the relevant text to the clipboard in order to include it somewhere else, for example in an e-mail.
The feature I like the most will make you wonder how you lived without it before, if you’ve ever searched for a document in Alfresco and then struggled to find the reference to that term in the document itself.
Now, the viewer detects that you have clicked through from the search page, and automatically searches for and highlights the first match of that term. Just hit Enter to continue through any further matches, or Escape to close the search dialog.
Link to Document
The Link button in the toolbar generates a link to the document, or even to a specific page in the document, that you can send to co-workers. If you want them to review Slide 24 in your presentation then simply send them straight there.
Improved Sidebar
You can click the button on the left of the toolbar to toggle the side bar on and off. The side bar shows a thumbnail view of all pages in the document by default and can also show an outline of the document structure if available in the file.
Presentation Mode
At DevCon last November Jared neatly showed how you can use the the new Google Docs integration to deliver a presentation directly from your web browser using Google Drive’s presentation mode, but with the PdfJs viewer you can now do the same thing directly from the Document Details page.
Just click Ctrl+Enter (or Cmd+Enter on MacOS) to go full-screen, then use the left and right arrow keys to move between your slides (the arrow keys will also work in the normal Document Details view).
Document Viewer Dashlet
Just like Site Admins can use the Wiki dashlet to add a selected page to a site dashboard, the Document View dashlet supplied with the add-on allows you to display any chosen document on the dashboard.
The dashlet works well with the PdfJs viewer, but will also work with the others supplied by the add-on or the base viewers supplied with Share (yes, that includes the Flash document viewer, if you really want).
Password-protected PDFs
Viewing password-protected PDFs is no longer a problem with the PdfJs viewer. You will be promoted for the password required to open the file and once supplied the viewer will work as normal.
Lots More
Of course there are many other improvements that you can’t see directly, but that you will benefit from. Peter has been working tirelessly to keep the version of the pdf.js library up-to-date, ensuring that we stay up to date with the improvements in performance and compatibility that the latest versions now provide. We have also improved the performance of page rendering within the dashlet code itself, with improved lazy rendering of all page and thumbnail content.
And of course PdfJs is not the only viewer in the add-on. The Flash-based audio and video players are still supplied, the Embed viewer offers a compelling Flash-free alternative for IE users not on IE 10 who have the Adobe Reader or another PDF plugin installed and the Prettify viewer is great at syntax highlighting any code stored in Alfresco.
Feedback
Like all Share Extras add-ons, we welcome constructive feedback to help us to deliver the next version of Media Viewers. Please use the Issues section on the project to report specific technical issues or ideas for enhancements, or general feedback can be left as comments below.
Hi Will,
very nice article and really cool module!
The only thing that I am actually fighting with is that the pdfjs viewer always telling me “Could not load PDF content”. The message is shown in die viewer itself when you open the document-details page of a document. The same message comes up for PDF and DOC. I could not find any errors related to transformations (there are no errors at all).
Have you got an idea? Seems that the PDF that will be pushed to the viewer is not correct?
Tested on Alfresco 4.1.2 and 4.2.c both with media-viewers-2.5.jar + web-preview.get.config.xml config, same result.
Thanks!
Thorsten
Great stuff Will. Really impressive, useful and scalable 🙂
And great choice of your demo presentation 😛
Thanks, Thorsten! Unfortunately there was a problem with the build which went out as 2.5.0, but you should find that 2.5.1 works much better. Sorry about that.
i have 4.2.c and media viewers 2.5.1 and have followed instructions. however when i view a pdf the viewer just displays grey area. on 4..0d it works fine.
sorry i meant on 4.2.d does not work. 4.2.c it works
I had it working in an earlier 4.1.x release, but after trying with the new 4.2.0 Enterprise release, it doesn’t work.
The PDF.js viewer frame is displayed on the document details page, but the document doesn’t get loaded into it.
It’s a fresh install of the 4.2 software. I’ve added the jar file and then enabled it via the module deployment page.
Is this a known problem, or am I doing something wrong?