GithubHelp home page GithubHelp logo

cteh / princely Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mbleigh/princely

0.0 3.0 1.0 102 KB

A simple Rails wrapper for the PrinceXML PDF generation library.

Home Page: http://www.mbleigh.com/plugins/princely-rails-prince-xml-wrapper

License: MIT License

Ruby 100.00%

princely's Introduction

Princely

Princely is a simple wrapper for the Prince XML PDF generation library. The plugin will also automatically register the PDF MimeType so that you can use pdf as a format in Rails controller respond_to blocks.

Example

class Provider::EstimatesController < Provider::BaseController
  # You can render PDF templates simply by
  # using the :pdf option on render templates.
  def show
    respond_to do |format|
      format.html
      format.pdf do
        render :pdf => 'file_name',
               :template => 'controller/action',
               :handlers => %w[erb],
               :formats => %w[pdf],
               :stylesheets => %w[application prince],
               :layout => 'pdf',
               :locals => { :foo => 'bar' },
               :disposition => 'inline', # PDF will be sent inline, means you can load it inside an iFrame or Embed
               :relative_paths => true # Modify asset paths to make them relative. See [the AssetSupport module](/lib/princely/asset_support.rb)
      end
    end
  end

  # Alternatively, you can use make_and_send_pdf to render out a PDF for the
  # action without a respond_to block.
  def pdf
    make_and_send_pdf "file_name"
  end
end

Render Defaults

The defaults for the render options are as follows:

layout:          false
template:        the template for the current controller/action
locals:          none
stylesheets:     none
disposition:     attachment (created PDF file will be sent as download)
relative_paths:  true
server_flag:     true
javascript_flag: false
timeout:         none

Contributors

Resources

  • Copyright (c) 2007-2013 Michael Bleigh and Intridea, Inc., released under the MIT license.

princely's People

Contributors

modsognir avatar drnic avatar parndt avatar andrewvos avatar edwinv avatar jerph avatar brian4d avatar hardbap avatar ilake avatar repinel avatar rdunlop avatar prakashmurthy avatar jmckible avatar jbarket avatar jondruse avatar igreg avatar cpjolicoeur avatar bwlang avatar

Watchers

 avatar Hicks avatar James Cloos avatar

Forkers

mirzac

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.