This package allows your users to download Plone content as PDF files. As admin
you can define specific PDF themes per content-type.
[instance]
eggs =
...
eea.pdf
zcml =
...
eea.pdf
By default all PDFs are generated asynchronous, therefore some extra config is
needed within your buildout in order for this to work properly.
First of all you'll need a folder were to store generated PDF files. For this
you can create it manually within buildout:directory/var/ or you can let buildout
handle it:
[buildout]
parts +=
media-downloads
media-downloads-temp
media-downloads-path = ${buildout:directory}/var/downloads/pdf
media-downloads-temp = ${buildout:directory}/var/downloads/tmp
[media-downloads]
recipe = ore.recipe.fs:mkdir
path = ${buildout:media-downloads-path}
mode = 0700
createpath = true
[media-downloads-temp]
recipe = ore.recipe.fs:mkdir
path = ${buildout:media-downloads-temp}
mode = 0700
createpath = true
This will create a folder named downloads within buildout:directory/var/
Next, in order for this folder to be visible from your website and your users to
be able to download generated PDFs you'll need to tell to your zope instances
about it:
[buildout]
media-downloads-name = downloads
media-downloads-path = ${buildout:directory}/var/downloads/pdf
media-downloads-temp = ${buildout:directory}/var/downloads/tmp
[instance]
environment-vars +=
EEADOWNLOADS_NAME ${buildout:media-downloads-name}
EEADOWNLOADS_PATH ${buildout:media-downloads-path}
EEACONVERTER_TEMP ${buildout:media-downloads-temp}
Also, don't forget to setup plone.app.async
[buildout]
[instance]
eggs +=
plone.app.async
zcml +=
plone.app.async-single_db_worker
For more information about wkhtmltopdf options like Table of contents XSL file,
header and footer parameters, etc. see wkhtmltopdf documentation.
A page template to be used for PDF Cover. Leave empty to disable it.
Default: pdf.cover
A page template containing copyright and author information. This page will be
placed between cover and PDF body. Leave empty to skip it.
Default: pdf.disclaimer
A page template to be used for PDF body. An empty value will skip PDF body.
Default: pdf.body
A page template to be used for back cover. Leave empty to disable back cover.
Default: pdf.cover.back
An XSL page template to be used for PDF Table of contents. See wkhtmltopdf
documentation for more information about XSL format. Leave empty to disable
Table of contents.
Default: pdf.toc
Enable or disable Table of Contents internal links and also
PDF bookmarks (outline)
Default: False
Enable or disable javascript.
Default: True
Wait some seconds for javascript to finish
Default: 0
Abort PDF conversion after this number of seconds
Default: 3600
Generate PDF asynchronously and send an email to the user when it's done
Default: True
Start counting pages within PDF Body from this number. Usefull when cover and/or
disclaimer are enabled.
Default: 0
This option defines the maximum depth a folderish item can go while recursively
includes it's children within PDF.
Default: 1 (include only direct children, non-folderish ones)
This options limit the number of direct children a folderish item can include
within PDF.
Default: 100
The total items to be included within PDF export for a folderish item, including
depth and breadth.
Default: 1000
Apply this theme to selected portal types.
Default:
This package uses Plone Content-rules to notify users by email when an asynchronous
PDF job is done. Thus 3 custom content-rules will be added within
Plone > Site Setup > Content-rules
Warning
As these content-rules are triggered by an asynchronous job, while
you customize the email template for these content-rules,
please DO NOT USE OTHER string substitutions that the ones that start
with $download_ as you'll break the download chain.
Also if you disable these content-rules the users will never know when the
PDF is ready and what is the link where they can download the output PDF.
Notify the person who requested a PDF export that the PDF successfully exported
and provide a link to the downloadable PDF
Notify the person who requested a PDF export that the PDF export failed.
Notify admin that there were issues while exporting PDF
In order to be able to easily customize emails sent by this package the following
custom email template string substitutions can be made
The absolute URL of the Plone object which is downloaded as PDF
Email address of the user that triggered the download as PDF action
Error traceback when download as PDF job fails
Site Admin email address customizable via Plone > Site Setup > Mail
Site Admin name customizable via Plone > Site Setup > Mail
Title of the Plone object which is downloaded as PDF
The absolute URL where the generated output PDF can be downloaded
Download type. Default to PDF for this package. It is package specific and it
can be PDF, EPUB, etc.
You have the possibility to temporarily disable dynamic PDF export contextually
by adding a static PDF file (or a Python Script, Page Template, etc)
within context called action-download-pdf. This way /download.pdf will
return this file instead of generating one based on context data.
Note
This works only with folderish items.
PDFs are generated asynchronously using a parallel zc.async queue.quota.
The number of workers that will generate PDFs in parallel is automatically
calculated based on the number of zeo-clients registered with
plone.app.async-*_db_worker.
As every db_worker can handle simultaneously maximum 3 jobs (hard-coded in zc.async Agent),
if you have 2 workers then the maximum number of PDFs that will be generated
at the same time will be 6 (2 workers * 3). Same if you have 5, you'll get
15 PDFs generated at the same time.
If for any reason you don't want them to be generated simultaneously you can set
environment variable EEAPDF_ASYNC_THREADS to 1 within buildout:
[buildout]
...
[instance]
...
environment-vars +=
EEAPDF_ASYNC_THREADS 1
Also, if you experience issues by having too many simultaneously PDF jobs, you
can limit them in the same way as above.
The Initial Owner of the Original Code is European Environment Agency (EEA).
All Rights Reserved.
The EEA PDF (the Original Code) is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later
version.
More details under docs/License.txt