Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

PDF thumbnailer and viewer for django applications

Project Description
`Turn.js <>`_ integration to django projects

`django_turnit` provides a way to display PDF files in a `turn.js <>`_ player.


With django_turnit, you can choose between several backends for PDF image extraction :

+ ghostscript :

This method does not seems to support threading...
The `Ghostscript <>`_ application / library. It can be installed as a package in linux
distributions, such an in debian / ubuntu :

.. code:: sh

$ sudo apt install ghostscript # on debian
$ sudo apt-get install ghostscript # on ubuntu

+ pdftocairo : Prefered method

- `pdftocairo <>`_ through subprocess

+ pdftoppm : Prefered method

- `pdftoppm <>`_ through subprocess

+ poppler : I've no clue on how to use it directly, which would be great, I was net able to setup the library at all...


.. code:: sh

$ pip install django-turnit

This installs the packages that are required by django_turnit:

- `django <>`_ (< 1.10, I haven't yet tested django 1.10)
- `django-appconf <>`_: Helper for configuration of applications
- `easy-thumbnails <>`_: Creates thumbnails from images
- `pdfminer <>`_: Extract texts from PDF files

Those requirements may also be needed:

- `python-ghostscript <>`_:
C python binding for the Ghostscript library, if you choose ghostscript as backend

.. code:: sh

$ python migrate django_turnit # Creates the table needed for caching the names of the page images


`django_turnit` can create and manage page images for PDF files. This images are stored in the `media` folder, a database stores .

Management command

The `turnit` command creates the missing thumbnails for each FileField containing a PDF file.

.. code:: sh

$ ./ turnit <app_label>[.<model_name>[.<pk>[.<field_name>]]] [arg]


- <app_label> is the application label. If set, the whole application is scanned for PDF files, and they are thumbnailed.
- <model_name> is the madel name. If set, the model is scanned.
- <pk> is the row pk. If set, the row is scanned
- <field_name> field name.

Signals processing



Supported file MIME types.

.. code:: python



Name of the sub-folder created under the MEDIA_ROOT folder, to store the output image files.

.. code:: python

TURNIT_OUTPUT_MEDIA_ROOT = 'django_turnit'


Ghostscript output file name format.

.. code:: python

TURNIT_OUTPUT_FILE_FMT = '%(basename)s.%(i)03d.%(ext)s'


Ghostscript output file format, as defined in `Ghostscript documentation <>`_.

You can choose between:


- `png16m`: 24 bit color PNG (default value)
- `pnggray`: 8 bit gray scale PNG
- `png256`: 256 colors PNG
- `png16`: 16 colors PNG
- `pngmonod`: Black and white monochrome PNG


- `jpeg`: jpeg standard output


- `tiffgray`: 8-bit gray output.
- `tiff12nc`: 12-bit RGB output (4 bits per component).
- `tiff24nc`: 24-bit RGB output (8 bits per component).
- `tiff48nc`: 48-bit RGB output (16 bits per component).
- `tiff32nc`: 32-bit CMYK output (8 bits per component).
- `tiff64nc`: 64-bit CMYK output (16 bits per component).

.. code:: python



Global settings for ghostscript library.

.. note::

Global arguments order in important in ghostscript !
**You MUST start with the `-q` argument !**

.. code:: python

'-dSAFER', ]


Extra parameters for ghostscript. You can add format options here.

.. code:: python


Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_turnit-0.2.1a2.tar.bz2 (314.3 kB) Copy SHA256 Checksum SHA256 Source Jun 30, 2016 (398.1 kB) Copy SHA256 Checksum SHA256 Source Jun 30, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting