pmPDFKitPlugin - 1.0.0

Export a page as PDF

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

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

Requirements

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

Installation

  • Via subversion

    $ svn co http://svn.symfony-project.com/plugins/pmPDFKitPlugin/trunk plugins/pmPDFKitPlugin
  • Via the symfony plugin system

    $ ./symfony pl:p pmPDFKitPlugin

Usage

  • enable the pmPDFKitFilter

    pm_pdfkit:
      class: pmPDFKitFilter
  • Optionally, you can add some parameters to the wkhtmltopdf command in app.yml

    all:
      pm_pdfkit:
        page-size: Letter

    You can view the parameters in the wkhtmltopdf help.

  • Clean the cache

    $ ./symfony cc
  • 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.

TODO

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