skip to navigation
skip to content

Not Logged In

eea.converter 7.1

SVG, PNG, PDF converters using external tools as ImageMagick

Latest Version: 9.6

Introduction

This package provides utilities to convert images and PDF files using ImageMagick. It also provides a generic /download.pdf browser view that allow your users to download Plone pages as PDF files with custom PDF cover, disclaimer and back cover (requires wkhtmltopdf and pdftk system-packages installed on your server).

Installation

Customize output PDF

Cover

Provide custom browser:page called @@pdf.cover:

<browser:page
  for="my.package.interfaces.ICustomContent"
  name="pdf.cover"
  class=".app.pdfview.Cover"
  template="zpt/pdf.cover.pt"
  permission="zope2.View"
  />

Disclaimer

First page after PDF Cover containing author details and copyrights. Provide custom browser:page called @@pdf.cover:

<browser:page
  for="my.package.interfaces.ICustomContent"
  name="pdf.disclaimer"
  class=".app.pdfview.Disclaimer"
  template="zpt/pdf.disclaimer.pt"
  permission="zope2.View"
  />

Body

Provide custom browser:page called @@pdf.body:

<browser:page
  for="my.package.interfaces.ICustomContent"
  name="pdf.body"
  class=".app.pdfview.Body"
  template="zpt/pdf.body.pt"
  permission="zope2.View"
  />

Back Cover

Provide custom browser:page called @@pdf.cover.back:

<browser:page
  for="my.package.interfaces.ICustomContent"
  name="pdf.cover.back"
  class=".app.pdfview.BackCover"
  template="zpt/pdf.cover.back.pt"
  permission="zope2.View"
  />

Table of contents

To enable Table of contents provide an empty browser:page called @@pdf.toc:

<browser:page
  for="my.package.interfaces.ICustomContent"
  name="pdf.toc"
  template="zpt/pdf.toc.pt"
  permission="zope2.View"
  />

Options

For PDF cover you’ll have to provide a named adapter like:

<adapter
  name="pdf.cover"
  for=" my.package.interfaces.ICustomContent"
  provides="eea.converter.interfaces.IPDFOptionsMaker"
  factory=".adapters.CoverOptionsMaker" />

Same for PDF disclaimer:

<adapter
  name="pdf.disclaimer"
  for=" my.package.interfaces.ICustomContent"
  provides="eea.converter.interfaces.IPDFOptionsMaker"
  factory=".adapters.DisclaimerOptionsMaker" />

Or for PDF back cover:

<adapter
  name="pdf.cover.back"
  for=" my.package.interfaces.ICustomContent"
  provides="eea.converter.interfaces.IPDFOptionsMaker"
  factory=".adapters.BackCoverOptionsMaker" />

For PDF body you’ll have to provide a named adapter like:

<adapter
  name="pdf.body"
  for=" my.package.interfaces.ICustomContent"
  provides="eea.converter.interfaces.IPDFOptionsMaker"
  factory=".adapters.BodyOptionsMaker" />

For global PDF options provide an unamed adapter like:

<adapter
  for=" my.package.interfaces.ICustomContent"
  provides="eea.converter.interfaces.IPDFOptionsMaker"
  factory=".adapters.OptionsMaker" />

Also add custom print.css for your needs. See more at eea.pdf

Restrict access

In order to restrict access to /download.pdf you’ll have to provide a multi-adapter named pdf.support with a read-only attribute called can_download like:

<browser:page
  name="pdf.support"
  for="zope.interface.Interface"
  class=".support.Support"
  permission="zope.Public"
  allowed_interface="eea.converter.interfaces.ISupport"
  />

See default implementation within eea.converter.browser.app.support

Dependencies

Note

These are not hard dependencies. You can use all features of eea.converter or just the ones that you need.

  • pdfinfo to parse pdf metadata (part of the xpdf package):

    yum install xpdf (fedora)
    apt-get install xpdf (debian)
    
  • pdftk to generate a cover image from a pdf file:

    yum install pdftk (fedora)
    apt-get install pdftk (debian)
    
  • ImageMagick (6.3.7+):

    yum install ImageMagick
    apt-get install imagemagick
    

Source code

Latest source code (Zope 2 compatible):

Documentation

See the doc directory in this package.

Funding

EEA - European Environment Agency (EU)

Changelog

7.1 - (2014-08-12)

  • Bug fix: Align PDF Table of Contents trailing dotted with page number [voineali refs #20431]
  • Bug fix: Fix long PDF header and footer texts and align left or right according with page parity [voineali refs #20431]
  • Feature: Added i18n translations [voineali refs #20431]
  • Feature: Added possibility to avoid truncated sentences in description [voineali refs #20456]
  • Feature: Enabled javascript by default within PDF export. [voineali refs #20459]
  • Feature: Added API to restrict access to download.pdf [voineali refs #20436]

7.0 - (2014-07-15)

  • Feature: Added Table of Contents support [voineali refs #20268]
  • Cleanup: Remove collective.sendaspdf dependency [voineali refs #20268]

6.8 - (2014-06-06)

  • Feature: Added PDF Back Cover support [voineali refs #19882]
  • Feature: Added PDF Disclaimer support (the first page after cover containing author details and copyrights) [voineali refs #19882]

6.7 - (2014-03-10)

  • Bug fix: Do not add table of content on PDF cover [voineali refs #18630]
  • Change: pass a doctype to the header pdf template in order to workaround wkhtmltopdf 0.12 issue which fails to insert the header without it [ichim-david refs #18550]

6.6 - (2014-01-21)

  • Bug fix: removed wrongly added blockquotes within README.rst [ichim-david refs #18064]
  • Feature: adding Sphinx-generated documentation in Page Template format [batradav refs #9502]

6.5 - (2013-10-22)

  • Bug fix: return first page on pdf to image conversion; refactor cover [simiamih refs #16799]

6.4 - (2013-10-07)

  • Feature: Added utility method to truncate text by the number of characters without cutting words at the end [voineali refs #16946]
  • Feature: Added utility method to convert relative urls to absolute urls [voineali refs #16946]

6.3 - (2013-10-04)

  • Bug fix: Fixed PDF cover asking for credentials for non-published documents [voineali refs #14904]
  • Feature: Added custom PDF html-header and html-footer in order to easily customize them (just override @@pdf.header and @@pdf.footer for your contexts) [voineali refs #16802]

6.2 - (2013-09-23)

  • Feature: Export HTML to PDF with custom cover (requires collective.sendaspdf) [voineali refs #14904]

6.1 - (2013-02-25)

  • Feature: added information for contributors [ciobabog refs #13892]
  • Add Windows support for close_fds parameter of Popen [erral #1]

6.0 - (2012-10-08)

  • Fixed dependencies, cleanup and make the package run on a clean Zope [ghicaale #5426]

1.1 - (2012-06-12)

  • Added watermark utility [szabozo0]

1.0 - (2012-03-05)

  • Initial release [voineali]
 
File Type Py Version Uploaded on Size
eea.converter-7.1.zip (md5) Source 2014-08-13 155KB
  • Downloads (All Versions):
  • 6 downloads in the last day
  • 322 downloads in the last week
  • 2998 downloads in the last month