Giter Club home page Giter Club logo

processwire-fieldtypepdf's Introduction

PDF Fieldtype/Inputfield

Module for ProcessWire allowing you to easily generate thumbnails of the PDF files embedded to the site.

Requirements

  • Processwire 2.4
  • ImageMagick PHP extension
  • Ghostscript

Installation

Place the files in /site/modules/FieldtypePDF and install the FieldtypePDF module.
How to install or uninstall modules.

How to use

In site's administration

Add a field and set its type to PDF. Use the field the same way as the file field (obviously, this accepts only *.pdf files). After the file is uploaded you will see a small thumbnail of it.

In templates

The PDF field type extends file field and adds new method to generate the thumbnail image of the PDF with the size of width x height in pixels.

$page->pdfFile->thumbnail(width, height)

If you set one of the dimensions to 0 it will be computed automaticaly preserving the aspect ratio.

The generated image is saved in page's assets, so it will be created only once. The thumbnail is the instance of PageImage, so you can do with it whatever you can do with image fields. When you delete the PDF file the thumbnails are deleted too.

Notes

In some cases, the thumbnail's colors might not match the colors in PDF. To fix that, you need to made some changes in ImageMagick delegate files.

Detailed instructions can be found here: http://www.lassosoft.com/CMYK-Colour-Matching-with-ImageMagick

Changelog

1.0.1

  • Set important ImageMagick settings before conversion [issue #1]
  • Added module requirements check [issue #2]
  • Updated README

processwire-fieldtypepdf's People

Contributors

somatonic avatar uiii avatar

Watchers

 avatar  avatar

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.