Skip to content

collective/collective.documentviewer

Repository files navigation

collective.documentviewer

collective.documentviewer integrates DocumentCloud viewer and PDF processing into Plone.

Examples

You can be seen in action the functionality that implements this add-on at the following sites:

Features

  • Very nice document viewer.
  • OCR.
  • Searchable on OCR text.
  • Works with many different document types.
  • collective.celery integration.
  • Lots of configuration options.
  • PDF Album view for display groups of PDFs.

Works with

Besides displaying PDFs, it will also display:

  • Word.
  • Excel.
  • Powerpoint.
  • HTML.
  • RTF.

Translations

This product has been translated into

  • German.
  • Spanish.
  • Basque.
  • French.
  • Italian.
  • Dutch.
  • Simplified Chinese.

You can contribute for any message missing or other new languages, join us at Plone Collective Team into Transifex.net service with all world Plone translators community.

Installation

Install requirements

  • GraphicsMagick.
  • ghostscript (version 9.0 preferred).
  • Poppler
  • tesseract (optional)
  • qpdf
  • OpenOffice or LibreOffice (optional, for doc, excel, ppt, etc. types)
  • md5 or md5sum command line tool.

Installation on Cent OS/Red hat

Special instructions for CentOS have been contributed by Eric Tyrer. You can access them via the git hub repo file location.

Installation on Debian

Special instructions for Debian have been contributed by Leonardo J. Caballero G. You can access them via the git hub repo file location.

Issues installation

If on a Linux/Ubuntu/Debian machine you run into an error like:

/var/lib/gems/1.9.1/gems/docsplit-0.7.2/lib/docsplit/image_extractor.rb:51:in `exists?': can't convert nil into String (TypeError)
from /var/lib/gems/1.9.1/gems/docsplit-0.7.2/lib/docsplit/image_extractor.rb:51:in `ensure in convert'

This is because the ruby docsplit library is having an issue with the temp folder accesses, and removal of temp files. Just run the following command:

sudo chmod 1777 /tmp && sudo chmod 1777 /var/tmp

And retry the conversion of your document

Development

Normal flow:

git clone git@github.com:collective/collective.documentviewer.git

cd collective.documentviewer

virtualenv .

bin/pip install -r requirements.txt

bin/buildout

Async Integration

It it highly recommended to install and configure collective.celery in combination with this package. Doing so will manage all PDF conversions processes asynchronously so the user isn't delayed so much when saving files.

Settings

The product can be configured via a control panel item Document Viewer Settings.

Some interesting configuration options:

Storage Type
If you want to be able to serve you files via Amazon Cloud, this will allow you to store the data in flat files that can be synced to another server.
Storage Location
Where are the server to store the files.
OCR
Use tesseract to scan the document for text. This process can be slow so if your PDFs do not need to be OCR'd, you may disable.
Auto Select Layout
For PDF files added to the site, automatically select the document viewer display.
Auto Convert
When PDF files are added and modified, automatically convert.
Auto layout file types
Types that should automatically be converted to document viewer.

Dexterity support

If you want to use it with your own Dexterity content type. You need to edit the FTI in ZMI/portal_types/yourtype to add "documentviewer" in the available view methods like this:

<property name="view_methods" purge="False">
  <element value="documentviewer"/>
</property>

Also you need to set the primary field in the schema, for example:

<field name="myfile" marshal:primary="true"
       type="plone.namedfile.field.NamedBlobFile">

File storage integration

If you choose to use basic file storage instead of ZODB blob storage, there are a few things you'll want to keep in mind.

  1. Use Nginx to then serve the file system files. This might require you install a local Nginx just for serving file storage on the Plone server. You can get creative with how your file storage is used though.
  2. Since in Plone's delete operation, it can be interrupted and the deletion of a file on the OS system system can not be done within a transaction, no files are ever deleted. However, there is an action you can put in a cron task to clean up your file storage directory. Just call the url http://zeoinstace/plone/@@dvcleanup-filestorage.

Upgrading from page turner

If you currently have page turner installed, this project will supercede it. Your page turner views will work but no future files added to the site will be converted to page turner.

To convert existing view, on every page turner enabled file, there will be a button Document Viewer Convert that you can click to manually convert page turner to document viewer.

To convert all existing views, go to portal_setup in the ZMI, upgrades, select collective.documentviewer, click to show old upgrades and there should be an upgrade-all step to run.

Tests status

This add-on is tested using Travis CI. The current status of the add-on is:

Travis CI badge PyPI badge

Contribute

Have an idea? Found a bug? Let us know by opening a ticket.

Authors

This product was developed by Wildcard Corp. team.

Produced by wildcardcorp.com

License

The project is licensed under the GPLv2.