国外设计欣赏网站 - DOOOOR.com

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

[Drupal模块] Drupal 7.X/6.X模块介绍:PDF to ImageField图像字段模块

[复制链接]
发表于 5-12-2012 08:21 | 显示全部楼层 |阅读模式

PDF to ImageField

logo.png

The PDF To ImageField module provides automatic conversion of uploaded PDF files to images.

PDF To ImageField模块可以将上传的PDF文件自动转换为图像。

It can be used either to create a snapshot of the front page to use as a preview thumbnail, or to generate a gallery of images from each page in the document.

它可以用来创建一个快照头版使用预览缩略图,或从文档中的每一页产生的图像库。

The module is implemented as CCK widget for FileField where PDFs are uploaded to. It places generated images into a CCK ImageField on the same content type.

CCK的部件FileField字段其中的PDF上传到模块实现。它放入一个CCK : x' L4 a \( Y* j+ o' c ImageField的生成的图像上相同的内容类型。


Requirements:

D6

  • FileFieldImageFieldImageAPI - required
  • The module requires the ImageMagick toolkit to be available on your server via command-line interface. GD cannot do this.

D7

  • Image(core), Field(core), Field UI (core), ImageMagick

Either:

Installation

Once the module is enabled, check your site status at /admin/reports/status .You should see a message that will tell you if your system is ready to run.
If not, you need to check the requirements, and the ImageMagick settings at /admin/settings/imageapi/config/imageapi_imagemagick. See the ImageAPI project docs for troubleshooting that. Generally you would need to enter the path to ImageMagick there - this can be found by goinf which convert on your server, or your host may provide that information. The default is /usr/bin/convert

If ImageMagick appears to be available but still does not convert PDFs, it could be it wasn't installed with 'Ghostscript' libraries or other required dependencies. You'll have to go to the ImageMagick forums for help with that.

Configuration

  • First, add an imagefield on your chosen content type. This is where the generated images wil be stored.
  • Set the allowed fields to 1 if you just want a cover page, or 'unlimited' if you want all pages to be generated.
  • Next add a filefield to your chosen content type and choose 'pdf_to_imagefield' as the renderer. This filefield should be configured to only accept PDF file types.
  • When configuring this field, you will be required to link the uploaded file field with the target image field.
  • You can add imagecache handling to the imagefield rendering as normal to adjust the size of the results and how they display on the page.

Processing

Processing of PDF may take some time.
Larger documents use the 'batch' process to generate each page.

Quickstart

There is a drush make file and a 'Features' demo example you can use to help set
up and try this functionality immediately.

Use drush make to fetch all required modules

  • If you have "drush" and "drush make" :
  • Change to a working directory you want to install a new site into.
  • Get the stub makefile fromhttp://drupalcode.org/project/pdf_to_imagefield.git/blob_plain/refs/head...
  • Run
        drush make --working-copy pdf_to_imagefield.make.stub

    This will download all the dependencies required to run pdf_to_imagefield and the demo feature pdf_document.
  • Install the Drupal site and configure the database as usual.

Use the Feature to auto-configure a content type

  • Enable the "PDF Document" feature through modulw admin, or via
    drush en pdf_document
  • Check your site status at /admin/reports/status to ensure ImageMagick works.
  • A new content type will be available at /node/add/document
    Adding a PDF file to it should create an image when the node is saved (not on preview)

Comparison:

  • There is no other modules which provide creation of raster copy of PDF.
  • See also PDF Stamper for manipulation of uploaded PDFs

Downloads

|2011-2026-版权声明|平台(网站)公约|DOOOOR 设计网 ( 吉ICP备2022003869号 )

GMT+8, 3-20-2025 15:51 , Processed in 0.303337 second(s), 105 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表