Giter Site home page Giter Site logo

prawn's Introduction

= Prawn: Fast, Nimble PDF Generation For Ruby

Prawn is a PDF writing library for Ruby designed to be tiny, fast, and nimble,
just like the majestic sea creature.

Development on this library was initially made possible thanks to 
the many people who donated to the Ruby Mendicant project: 
http://rubymendicant.wikidot.com 

The project is currently maintained by Gregory Brown, with lots of help from
the community.

== Quick Start

Getting started with Prawn can be as simple as:

 require 'prawn'
 pdf = Prawn::Document.new
 pdf.text("Prawn Rocks")
 pdf.render_file('prawn.pdf')

But prawn can do a lot more:

===Any page size you can think of

 Prawn::Document.new('A0')

...gives you an _really_ big page.

 Prawn::Document.new(:size => [11.32, 8.49],
                     :page_orientation => :portrait)

...giving you a postage stamp.

{Learn more}[link:classes/Prawn/Document.html]

===Multiple Font Handling with UTF-8 Support

 pdf.text("Prawn Rocks")
 pdf.font("/myfont.ttf")
 pdf.text("Prawn still rocks in a different font")

...allowing you to use any font you want.

{Learn more}[link:classes/Prawn/Font.html]

===Drawing graphics directly into the page

Simple shapes:

 pdf.stroke do
   pdf.circle_at [100,100], :radius => 25
   pdf.rectangle [300,300], 100, 200
 end

(note, you need to stroke the path to put "ink" there)

{Learn more}[link:classes/Prawn/Graphics.html]

===Embedding JPEG and PNG Images Natively

Reading an image directly from a file:

 prawn_logo = "#{Prawn::BASEDIR}/data/images/prawn_logo.png"
 pdf.image prawn_logo, :at => [50,450], :width => 450

Or reading it from an IO stream:

 require "open-uri"
 pdf.image open("http://prawn.majesticseacreature.com/media/prawn_logo.png")

{Learn more}[link:classes/Prawn/Images.html]

===Measurement Conversion Tools for Your Sanity

Prawn deals exclusively in PDF points... which work out to about 2.83464567mm... 
don't try and do it in your head, instead, let Prawn help you:

 require "prawn/measurement_extensions"

 Prawn::Document.generate(:page_layout => :portrait, 
                     :left_margin => 10.mm,    # different
                     :right_margin => 1.cm,    # units
                     :top_margin => 0.1.dm,    # work
                     :bottom_margin => 0.01.m, # well 
                     :page_size => 'A4') do
   text "Prawn Rocks"
 end

{Learn more}[link:classes/Prawn/Measurements.html]

== Resources

=== Website:

http://prawn.majesticseacreature.com

=== Examples:

http://github.com/sandal/prawn/tree/master/examples

(or gem unpack prawn, if you want to run them locally)

=== Bug Tracker / Wiki:

http://github.com/sandal/prawn/issues

=== Source Code:

http://github.com/sandal/prawn

=== Mailing List:

http://groups.google.com/group/prawn-ruby

=== IRC:

Find us in #prawn on irc.freenode.net
  Gregory Brown: <sandal>
  James Healy: <yob>               
  
== Notes to Developers: 

See HACKING file for details on getting set up with a local build.

prawn's People

Contributors

practicingruby avatar yob avatar jamis avatar bradediger avatar p8 avatar riopro avatar caifara avatar andrewtimberlake avatar ptzn avatar torgoton avatar djanowski avatar trym avatar jeg2 avatar esb avatar augustl avatar mikel avatar brandonh avatar hcf avatar koke avatar marnen avatar scoopr avatar toretore avatar

Stargazers

Kevin Ridgway avatar  avatar

Watchers

James Cloos avatar  avatar

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.