Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drnic-princely

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drnic-princely

  • 1.2.5
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Princely

Princely is a simple wrapper for the Prince XML PDF generation library (http://www.princexml.com). It is almost entirely based on the SubImage Prince library found on this blog post:

http://sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-ruby-on-rails

I have taken the helpers and made them a little bit more generalized and reusable, and created a render option set for pdf generation. The plugin will also automatically register the PDF MimeType so that you can use pdf in controller respond_to blocks.

Example

class Provider::EstimatesController < Provider::BaseController
  def show
    respond_to do |format|
      format.html
      format.pdf do
        render :pdf => "file_name", 
               :template => "controller/action.pdf.erb", 
               :stylesheets => ["application","prince"]
               :layout => "pdf"
      end
    end
  end

  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
stylesheets: none

Resources

FAQs

Package last updated on 06 Oct 2009

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc