Document generation of private pages (and images)

Is there any add on that can make documents ( docx or pdf ) of private pages with private images (on a closed intranet)?

1 Like

Do you mean manually? When I view a page in any web site I can 'print' it to a virtual PDF printer. I'm sure this is not only Macs/iOS that can do it. Or do you mean you want to do this in some kind of automated way?

No, 'automatically'.

Something like 'Produce and Publish', collective.documentgenerator or eea.pdf. (or something similar).

My PP connector?

Just need something simple that can produce a pdf of Word doc, so anything that works is OK for me.

PP was my first try since I know it works with Plone 5, but I did no see any way to include private images.

EDIT: should be PDF or Word doc.

@espenmn We are in the early stages of developing a Plone site where a tree of content can be exported to a word document without dependencies. We have a proof of concept, and the basic requirements seem 'simple' (with python-docx you can create Word docx documents on the fly), but the devil is in many details.

@mauritsvanrees and me will do a talk in Ferrara on what we have learned so far.

I just realised we never published what we use. I've now made this repo public.

It's badly named. It has no dependencies on plomino. I'll rename it before it goes to the collective.

It uses subrequests and lets you download a pdf from any plone url including images. It will use the print stylesheet but you can also add special css just for pdf. It doesn't support all css so its not a solution for any plone view.

1 Like

Thanks a lot.

Do you know which versions (of Plone and weasyprint) you used (
Python 2 or 3 ? )

Our production we are using Plone 5.0.10 and weasyprint = 0.42.3. Also with Plone 4.1 but I think we are using an older version with xhtml2pdf in that case.

Sorry it really needs some tests to show what versions it works with. The code is fairly simple so upgrading it to python 3 would not be hard.

A bit off topic, but related to djays approach. Providing a proper Print CSS is often underestimated in the current web. We used a nice print.css for the Boston Conf site to generate a lot of the print tables for the schedules onsite, for the digital signage and the sponsorship options PDF versions. The remaining httrack mirror at https://2016.ploneconf.org/ does not contain those tables anymore. But you can get an idea what is possible (special pages and templates need to be reviewed and fine tuned) See an overview of the resulting material in the slides of my conf talk https://de.slideshare.net/acsrarmin/using-intranets-to-manage-location-experience at page 17 and 19.

Related to the topic: The issue of the print to PDF or generate docx with private stuff in pages actually always needs a generator running with the correct privileges. The real challenge is here how to protect the now extracted document from floating around without access control and permission management. If you have paranoid applications I suggest stamping and hidden steganographic watermarking and individual encryption with footprint of the creator/distributor/datetime.

The CSS we used (in fact, all the code we used for 2016, 2017, and 2018 conference sites) is in this repo