Skip to main content

A set of portal transform to change pdf into images

Project description

Introduction
============

The main goal of this product is to allow PDF into ImageFields in
Plone. It uses code written by David Brenneman for
collective.pdfpeek.

Install
=======

Just add the following lines in your buildout:
collective.pdfpeek
collective.pdftransform

You must install pdftransform with the quick installer (no need to
install pdkpeek, but it must be in the buildout as we use its methods)


Using pdftransform in your site
===============================

collective.pdftransform adds a 'pdf_to_image' transform in Plone
portal_transform.
As transforms can not be used with FileField (or at least I did not
find how ...) it also provides a method in utils called update_form.
You can use it in the 'post_validate' method of your Archetype
objects.

Here is an example (from Products.plonehrm, the Employee Archetype
object):

...
from collective.pdftransform.utils import update_form
...
class Employee(BaseFolder):
...

security.declarePrivate('post_validate')
def post_validate(self, REQUEST, errors):
update_form(self, REQUEST)

...

With this, all files submitted in the edit form, if they are PDF, are
transformed into jpg files.
You can specify an extra argument in update_form which is the list of
fields, for example, if we had written this:

security.declarePrivate('post_validate')
def post_validate(self, REQUEST, errors):
update_form(self, REQUEST,
['portrait_file', 'idScan_file'])

only the files submitted in the portrait and idScan fields would have
been transformed.

You can also use the validator called 'isValidImageOrPDF' in your
Image fields.


Changelog
=========

0.1 (2010-05-19)
----------------

- added translations for french and dutch. [vincent]

- updated the validator to return an error if the PDF file can not be
transformed. [vincent]

- added is_transformable_pdf in utils, tells if the PDF file uploaded
can be transformed with pdf_to_image. [vincent]

- added validator called 'isValidImageOrPDF' that checks that the
submitted if is a PDF or an image (except BMP images as it can cause
problems). [vincent]

- added update_form in utils, that can be used in
the post_validate method of your Archetype objects. [vincent]

- Added transform to the portal_transform. [vincent]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.pdftransform-0.1.tar.gz (15.5 kB view details)

Uploaded Source

File details

Details for the file collective.pdftransform-0.1.tar.gz.

File metadata

File hashes

Hashes for collective.pdftransform-0.1.tar.gz
Algorithm Hash digest
SHA256 d1446b57adb60ce119a33e1f007396c407652339e9a31af55649e2e25e55e7a3
MD5 c9395a4cff4900a2254a1e5700c575b9
BLAKE2b-256 cdcaa5e5a7f7d3d01e088af6e7c869cdece515f4ee9dd5cf6f9460f8586ee5b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page