Skip to main content

PDF Preview

Project description

This extension provides preview for PDF.

Features

Given a PDF URL return preview image of first page

Installation

  • Prerequisite: Following system libraries are required:

  • Install using pip

    $ pip install tc_pdf
  • Register the extension within Thumbor’s configuration file

    COMMUNITY_EXTENSIONS = [
        'tc_pdf',
        ...
    ]
  • Launch thumbor with the Thumbor Community custom application:

    $ thumbor -a tc_core.app.App

Usage

tc_pdf handler route requires /pdf/ in URL after all filters but before the resource URL part e.g.

http://<thumbor_server>/unsafe/240x240/smart/pdf/localhost:8000/media/document/test.pdf

If you are using libthumbor to generate URLs then you can use this patch for CryptoURL class and then use it like this:

from crypto import CryptoURL

crypto = CryptoURL(key='my-security-key')

encrypted_url = crypto.generate(
    width=300,
    height=200,
    smart=True,
    image_url='/path/to/my/pdf_file.pdf',
    pdf=True, # <-- Pass this
)

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

tc_pdf-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file tc_pdf-1.0.0.tar.gz.

File metadata

  • Download URL: tc_pdf-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.6.0 pkginfo/1.9.6 requests/2.30.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.10.4

File hashes

Hashes for tc_pdf-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bb4a06f054a8a9651a83f20c2ae09531dd60877b090eb3c31dd22e282df19a9b
MD5 dece324d8dc04909bc66a030c0c91a1a
BLAKE2b-256 31237ca3317f6bf78253603006f1eca7134d99f9e520f68cbc03b8c78844bde7

See more details on using hashes here.

Supported by

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