2017 © Pedro Peláez
 

symfony1-plugin 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

image

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

  • Monday, December 30, 2013
  • by ncuesta
  • Repository
  • 7 Watchers
  • 0 Stars
  • 7,510 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

pmPDFKitPlugin

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, (*1)

Requirements

wkhtmltopdf library is required. You can download it from wkhtmltopdf on Google code., (*2)

Installation

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

  • Enable the plugin in the project configuration:, (*4)

// 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, (*5)

  • Finally, try to access any resource appending the .pdf format., (*6)

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., (*7)

  • Specify extra parameters for wkhtmltopdf appending them to the url:, (*8)

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

See all options executing wkhtmltopdf -H in the terminal., (*9)

TODO

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

The Versions

30/12 2013

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Desarrollo CeSPI