承接 desarrollo-cespi/pm-p-d-f-kit-plugin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

desarrollo-cespi/pm-p-d-f-kit-plugin

Composer 安装命令:

composer require desarrollo-cespi/pm-p-d-f-kit-plugin

包简介

symfony1 plugin that enables you to export any page as a PDF file by only adding the pdf format to the request

README 文档

README

The pmPDFKitPlugin plugin is a clone on jdpace's PDFKit library for Ruby (and Ruby on Rails). It allows you to export any page as PDF only adding the pdf format to the request. IE: calling http://example.com/post/1.pdf

Requirements

wkhtmltopdf library is required. You can download it from wkhtmltopdf on Google code.

Installation

  • Via composer:
{
  "require": {
    "desarrollo-cespi/pm-p-d-f-kit-plugin": "dev-master"
  }
}
  • Or using git, from source.

  • Enable the plugin in the project configuration:

// in config/ProjectConfiguration.class.php add:
$this->enablePlugin('pmPDFKitPlugin');

Usage

  • Enable the pmPDFKitFilter
pm_pdfkit:
  class: pmPDFKitFilter
  • By default, this plugin expects the wkhtmltopdf executable to be in /usr/local/bin/wkhtmltopdf. If it does not you can specify it in app.yml:
all:
  pm_pdf_kit:
    executable: /home/patricio/bin/wkhtmltopdf
  • Clear the cache

  • Finally, try to access any resource appending the .pdf format.

Advanced usage

  • Edit the default routes so any page can be transformed as pdf:
default_index:
  url:   /:module.:sf_format
  param: { action: index, sf_format: html }

default:
  url:   /:module/:action.:sf_format/*
  param: { sf_format: html }
  • You can save any view to a file (instead of inline view in the browser) using the pmPDFKit class.

  • Specify extra parameters for wkhtmltopdf appending them to the url:

http://somedomain.com/something/1.pdf?orientation=landscape&page-size=Letter&print-media-type=true

See all options executing wkhtmltopdf -H in the terminal.

TODO

  • fix images paths (because images are loaded from the stylesheets).

统计信息

  • 总下载量: 9.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 7
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-28