PDF export of Plone content based on the weasyprint library.
Project description
plone.pdfexport
Provides PDF export functionality for Plone content.
Features
Exports Documents, Event, News items and other custom content.
Can be customized via CSS in the PDF Export control panel.
Long tables which will be rendered on more than one page, will have the thead repeated on every page.
One can use Plone body tag CSS classes to define CSS rules for specific Plone content.
This add-on is based on the great WeasyPrint library.
Translations
This product has been translated into
english
german
Installation
Install plone.pdfexport by adding it to your buildout:
[buildout] ... eggs = plone.pdfexport
and then running bin/buildout
Note: for Python 2 (Plone 5.1) you have to pin some packages:
weasyprint = 0.42.3 cairocffi = 0.9.0 tinycss2 = 0.6.1 soupsieve = 1.9.6 cssselect2 = 0.2.2
Usage
After installing the add-on you can call the “aspdf” view on any Plone content.
http://localhost:8080/Plone/news/aspdf
for testing, you can add the GET parameter “html=1” to see the HTML version before it get rendered into a PDF.
http://localhost:8080/Plone/news/aspdf?html=1
We provide portrait and landscape mode with separate page setting for each mode:
@page {
margin: 2.75cm 1.4cm 1.4cm 1.4cm;
size: landscape;
@top-center {
font-size:12px;
color:#666666;
content: "Beautiful Plone content, deserves a beautiful PDF export!";
}
@bottom-left {
font-size:12px;
color:#666666;
content: "provided by derico.de";
}
@bottom-right {
font-size:12px;
color:#666666;
content: "Page " counter(page);
}
}
You can set which mode is the default. To use a different mode, you can add a request parameter:
http://localhost:8080/Plone/front-page/aspdf?mode=landscape
http://localhost:8080/Plone/front-page/aspdf?mode=portait
Contribute
Issue Tracker: https://github.com/plone/plone.pdfexport/issues
Source Code: https://github.com/plone/plone.pdfexport
Support
If you are having issues, please let us know.
License
The project is licensed under the GPLv2.
Contributors
Maik Derstappen, md@derico.de
Changelog
2.2 (2024-07-21)
Add Banner image field, render banner in page headers [MrTango]
2.1 (2022-11-04)
fix python_requires definition [MrTango]
require Py >=3.7 and remove restapi down pinning [MrTango]
2.0 (2021-10-26)
Provide both page mode’s (landscape and portrait) with a default setting and switch thru a request mode parameter [MrTango]
1.1 (2021-10-08)
- Improved image handling, now support also original images (without @@images/scales).
[MrTango]
1.0 (2021-10-06)
Improve German translations [MrTango]
Improve error handling and add more tests [MrTango]
1.0b1 (2021-07-15)
Resolve images internally in a custom WeasyPrint url_fetcher, this removes the need to resolves url’s for WeasyPrint, which was problematic with permissions or https cert issues [MrTango]
1.0a4 (2021-07-14)
Don’t use optimize_images=True in weasyprint for now, it only works in Py3 versions [MrTango]
1.0a3 (2021-07-14)
Add print_image_scale to control panel and use custom image scale for PDF export [MrTango]
1.0a2 (2021-07-14)
Fix missing lead image viewlet in PDF export [MrTango]
Merge content css classes with body tag classes instead of overriding them [MrTango]
1.0a1 (2021-07-13)
Initial release. [MrTango]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file plone.pdfexport-2.2.tar.gz
.
File metadata
- Download URL: plone.pdfexport-2.2.tar.gz
- Upload date:
- Size: 4.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/42.0.2 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93fef6eca9724d2245ef2b50ccca4bce79ecc001a23df93f9a5377be4c2367b2 |
|
MD5 | 7ceb2c665c91ae284daafa62e54c650a |
|
BLAKE2b-256 | 5657dcbabaeebc78738cd0dbc2fb85249ae972e4c59a98ce80e919b666f74141 |