GithubHelp home page GithubHelp logo

tc_pdf's Introduction

Thumbor / PDF Preview

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
)

tc_pdf's People

Contributors

intellisense avatar relthyg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tc_pdf's Issues

Thumbor 7/Python 3 support?

Can anyone tell whether this should run with Thumbor 7 without changes, or does the code have to be updated?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.