Skip to content

CHANGELOG

Gregory Brown edited this page · 258 revisions

NOTE: This wiki page has been deprecated and will no longer be updated. For release notes from Prawn 1.0+, see the CHANGELOG.md file included with Prawn’s source code.

Prawn 0.15.0 — 2014.02.16

Summarized notes follow, but you can also check out the complete diff from 0.14.0 to 0.15.0.

This release is a stepping stone to next month’s 1.0 release, and it involves more internal restructuring and policy updates than it does new fixes or features. However, there are a few minor fixes and improvements that shipped with this code, and we may do one or two more maintenance releases of 0.15.x before 1.0 ships in mid-March.

It should be safe to upgrade to 0.15 if you’ve been using 0.13 or 0.14. If you’re still using 0.12 or earlier, you should either invest the time to upgrade those projects now, or treat them as legacy code indefinitely. Extension authors are encouraged to try out 0.15, because it is our last major release before 1.0, and is a good snapshot of where we currently are with things.

We’ve laid out a plan for post-1.0 API compatibility

Every user-facing feature in Prawn has now been assigned a level of API compatibility support. Stable API features will not break backwards-compatibility throughout the 1.x release, extension API features will only be updated after some period of deprecation warnings, and experimental API features are free to change on minor releases without warning.

For a lot more details, and a compatibility matrix broken out by namespace, see our API Compatibility Notes. Links are included to the API documentation for every namespace.

We will do our best to not break backwards compatibility between this release and 1.0 for anything marked stable. If you’d like to know why a certain feature is marked experimental rather than stable, please discuss it with us on our mailing list.

Prawn now officially now support Ruby 2.1.0

We now test against MRI 2.1.0 in CI and use it in development, but if you run into any problems please let us know.

MRI Ruby 1.9.3 and 2.0.0, as well as JRuby 1.7 (1.7.9+) will continue to be supported as well.

A couple new gems have been extracted

pdf-core: This gem provides low level PDF functionality for Prawn, and is meant for working with the PDF format directly. If you only are concerned with generating PDF documents, you don’t need to know anything more about this gem. But those who are looking to do low-level PDF work may want to check it out.

prawn-templates: This gem provides the template functionality that existed in earlier versions of Prawn. It is completely unsupported, and has only been extracted to make it easier for someone to pick up maintenance on it if they’d like. Use at your own risk, but get in touch if you want to work on maintaining it.

Grids can now be safely redefined

In earlier versions of Prawn, it was not safe to call define_grid multiple times, because we never invalidated the box dimensions cache.

Now it is possible to redefine grids at any point in the document, as in the example below:

Prawn::Document.generate("x.pdf") do
  define_grid(:columns => 5, :rows => 8, :gutter => 10)

  grid(4,0).show

  start_new_page

  define_grid(:columns => 3, :rows => 5, :gutter => 10)

  # this box will be a different size than the first one!
  grid(4,0).show
end

Note that each call to define_grid completely replaces the underlying Grid object, and grids cannot be nested like bounding boxes. Still, this change should make the feature much more useful as it gets rid of an awkward undefined behavior.

(#663, Simon Traels Ravn)

Document#render no longer raises encoding errors on JRuby+Windows

This was a bit of weird edge case with our use of StringIO objects internally, and it is not reproducible on MRI, nor is it reproducible in JRuby on OS X or Linux. But if you happen to be using JRuby on Windows, you should be able to safely use Document#render now.

(#661, Pierre Paridans)

Table column width calculations now tolerate minor floating point rounding errors

Hartwig Brandl continues on his quest to rid the world of bugs in our table cell width calculations. This fix should make it so that minor float rounding errors won’t affect the computed size of a cell significantly, and comes in handy when you have to convert other units to PDF points, (i.e. mm to pt):

(#639, Hartwig Brandl)

TTFunk has been upgraded to 1.1.0, which provides Unicode astral plane support in TTF files.

This upgrade allows for the use of fonts that provide glyphs for characters that have codepoints larger than 16 bits. No special options are needed, these Astral-plane fonts should “just work” like any other TTF font.

(TTFunk #10, Robert Pelkey)

Prawn once again has no third-party runtime dependencies!

The removal of the templates feature allows us to use PDF::Reader during development and testing only. We also went back to using our own implementation of the RC4 algorithm just for the sake of completeness.

This probably does not matter to anyone at all, but it guarantees (for better or worse) that if you find a bug in Prawn, it’s something in one of our own gems or in your Ruby interpreter!

Prawn 0.14.0 — 2014.01.15

This release includes minor improvements, bugfixes, and cleanup. It is generally safe to upgrade to if you’ve been running 0.13.x, but if you are coming from 0.12.0 or one of the now obsolete 1.0 release candidates, keep in mind a lot has changed since then!

Column boxes can now be reflowed to fill their parent boxes on new page creation.

A practical use case for this is when you want some header text on the first page of a document followed by columns of flowing text throughout the rest of the document. Try this example to see the resulting behavior:


Prawn::Document.generate('columns.pdf') do
    bounding_box([0, cursor], width: 100) do
        10.times { text "Header" }
    end
    column_box([0, cursor], columns: 2, width: bounds.width, reflow_margins: true) do
        200.times { text "Content" }
    end
end

Note that this behavior is disabled by default, to preserve backwards compatibility. We may decide to make this the default behavior in a future release, but for now you will need to pass reflow_margins: true to enable this feature.

(#512, Patrick Hurley)

PrintScaling can now be disabled in PDFs

Most PDF clients automatically scales a document if it feels that the document won’t fit within the page margins. However, some clients (such as the PDF client in iOS) does not give the user a possibility to disable the print scaling.

This patch adds support to Prawn for disabling print_scaling by supplying the option :print_scaling => :none when initializing a Prawn::Document object.

(#448, Erik Flood)

Having multiple different colspans in a table no longer causes a CannotFit error to be raised.

This is yet another fix to table cell width calculations. The following test illustrates the edge case addressed by this patch:


it "should work with two different given colspans", :issue => 628 do 
  data = [
          [" ", " ", " "], 
          [{:content=>" ", :colspan=>3}], 
          [" ", {:content=>" ", :colspan=>2}]
        ]
  column_widths = [60, 240, 60]
  pdf = Prawn::Document.new
  #the next line raised an Prawn::Errors::CannotFit exception before issue 628 was fixed
  table = Prawn::Table.new data, pdf, :column_widths => column_widths
  table.column_widths.should == column_widths
end

(#629, Hartwig Brandl)

Graphic state is now deep copied (preventing some kinds of corruption)

This patch should fix some data corruption issues, particularly related to colorspace changes and dash settings. It is also a partial fix to a problem with dynamic repeater which is discussed in #473. As long as you define your repeaters before anything else in your document, you should be able to prevent graphics state corruption.

A more comprehensive fix will be done in a future release, but this should work as a stop-gap measure.

(#635, Dylan Markow)

Image handlers can now be unregistered

This small refinement to our extension API for images allows image handlers to be unregistered. A possible use case for this is when you want to add an extension that is meant to replace one of Prawn’s built-in image handlers, but not all of them. For example:

Prawn.image_handler.unregister(Prawn::Images::PNG)
Prawn.image_handler.register(SomeFancyReplacement)

(#636, Evan Sharp)

Work has begun on template extraction

We officially dropped support for templates in Prawn as of 0.13.0, and now work on extracting the template code has begun. Templates are now disabled by default, but you can enable an experimental extension that implements them by adding a require "prawn/templates" line to your code. This file is currently distributed with Prawn, but will be broken out into an (unsupported) gem in a future release.

Right now the Prawn::Templates extension is implemented as a module mixin that monkey patches Prawn::Document, which is pretty brittle. We will try to think about ways to build more stable extension points before we cut a prawn-templates gem, but suggestions from contributors are welcome!

This patch is a work-in-progress, so keep an eye on its pull request if you are a templates user.

(d426e1, Gregory Brown)

We’re now experimenting with using YARD to generate Prawn’s documentation

The hope is that this will make it easy for us to clearly draw the lines between our stable API, experimental API, internals, etc. We’re not necessarily committed to sticking with YARD for the long haul, but we’re going to use it and see how it goes.

To generate the documentation yourself, run rake yard in Prawn’s project directory. We will upload a snapshot of the docs to the web in a future release once we have a chance to review the output more thoroughly.

(#619, Alexander Mankuta)

Prawn 0.13.2 — 2014.01.06

Here are some of the important changes in version 0.13.2. You can see the full list with git log 0.13.1..0.13.2

Fixed several edge cases in table column width calculation with colspans

There is an extensive discussion about this problem on #407, which was partially fixed in earlier releases. This latest code deals with a few remaining edge cases, including tables with empty cells, and also with explicitly setting column widths. If you’ve been having issues with colspan in tables, try out this latest code and see if it fixes it for you.

(#620, Hartwig Brandl + Gregory Brown)

Prawn source files are no longer loaded multiple times.

This fix prevents Prawn from raising constant redefinition warnings every time you require it. We don’t expect that the old behavior was breaking anyone’s code, but we’re always happy to accept patches that fix warnings!

(#618, Shane Bonham + Gregory Brown)

Prawn 0.13.1 — 2013.12.23

Here are some of the important changes in version 0.13.1. You can see the full list with git log 0.13.0..0.13.1

PNG support has been optimized to be both faster and more memory efficient.

This should be a backwards-compatible change for most use cases, but note that if you have been comparing PDFs based on their raw binary contents, this change may break your tests — we changed the way we handle alpha channels internally.

Also note that if you’re running JRuby, you will want to use 1.7.9+, as there may be some performance regressions or bugs in 1.7.8 that can cause this code to run slower than our original PNG code.

(#600, Alexander Mankuta)

JPG support has been optimized to be both faster and more memory efficient

This should be a completely backwards compatible change, as only our internals have changed. This improvement should particularly help speed things up on JRuby.

(#610, Alexander Mankuta)

Width calculations for certain symbols (i.e. Euro and Minus) in built-in fonts have been corrected.

Some bugs were introduced by the AFM gem when we switched over to it about a year ago. We have now switched back to
our original implementation, which should fix a number of rendering issues with the built-in AFM fonts that Prawn uses by default.

(#607, Gregory Brown)

Fixed an awkward behavior in canvas.

Any canvas block that did not modify the cursor position caused the cursor to be set to the very top of the page, now the cursor is restored to wherever it was before canvas was called.

Blocks that do modify the cursor position will still leave the cursor wherever the user moved it to, as in previous releases.

(#523, Gregory Brown)

Ruby 1.8 compatibility shims and guards have been removed.

This is an internal code cleanup, and should not cause any external behavior changes.

(#605, Alexander Mankuta)

Prawn 0.13.0 — 2013.12.15

Here are some of the important changes in version 0.13.0. You can see the full list with git log 0.12.0..0.13.0

Important general notes

This is a huge release! Please see the blog post about it, as well as our Development roadmap for additional context on what to expect, and whether or not you should upgrade.

1) This release includes the features and fixes from the 1.0.0 RC1 and 1.0.0 RC2 pre-releases, along with a bunch of new stuff. The notes below list everything that has changed since 0.12.0, including the changes that were introduced in our pre-releases. Yes this is confusing, and we’re sorry for it. However, it would be even more confusing to release yet-another RC when so much has changed since our last release. Starting with this release, we’ll be going back to 0.x release numbering until we are really ready to ship 1.0.

2) We are having major problems with stabilizing our templates feature, and it should be considered unsupported at this point. The feature will be disabled by the 1.0 release, and possibly extracted into its own gem.

3) We have extracted most of Prawn::Core::* into a PDF::Core::* namespace. Our goal is to move all of this code into its own gem before 1.0, but for now we’re distributing it alongside Prawn’s source code as a way of testing the waters. The overarching goal is to shift the focus of Prawn towards “PDF document authoring”, while allowing PDF::Core to handle all the low-level manipulations of the PDF format itself.

4) We have updated our supported Ruby versions. As of this release we officially support MRI 1.9.3 and 2.0.0, as well as JRuby 1.7 (>= 1.7.8). We have dropped support for MRI 1.8.7 and 1.9.2. We may add support for later versions of MRI and JRuby by the time of the 1.0 final release, but we will make that decision later.

Features / Enhancements

  • Cell font style defaults to whatever the current font style is when not explicitly set. [Tim Vandecasteele]
  • Tables can have multi-row headers now [Mike Cochran, Wei-Meng Lee]
  • Any destination can now be a valid outline destination [Thomas Leitner]
  • Arbitrary dash/gap patterns in lines are now supported [Thomas Leitner]
  • The stroke_axis method can now be used to draw rulers on documents [Thomas Leitner]
  • Reduced gem file size by removing TTF fonts from gem package [Josef Stribny]
  • Linking to local files is now supported [Mike MacDonald]
  • Generally improved stream handling (see PR #446) [Alexander Mankuta]
  • Experimental support has been added for pluggable text parsers [Christoph Schiessl / Evan Sharp]
  • Experimental support has been added for pluggable image handlers [Evan Sharp / Gregory Brown]
  • Switch from test-spec to rspec [James Healy]
  • Soft mask support [Alexander Mankuta]
  • Add a travis config file and TravisCI badge [James Healy, Trung Lê]
  • Several manual improvements and updates [Felipe Doria]
  • Various performance optimizations [Alex Dowad]
  • Allow multiple embedded images [Brad Ediger]
  • Allow cells to have dashed and dotted borders, with documentation [Tommy Back]
  • Encrypt outline titles [Brad Ediger / Alexander Mankuta]
  • Allow importing a stream for page template [Wes Garrison]
  • Support for colspan and rowspan in tables [Brad Ediger]
  • Add Gemfile and manual/ to gem manifest (#305) [Brad Ediger]
  • Make indents consistent across columns [Giuseppe Bertini]
  • Add ability to scale background image [Nathan Colgate]
  • Tables now support image cells (#122) [Brad Ediger]
  • Add :inline_format option to text_box() [Brad Ediger]
  • Inline-formatted text accepts <br/> for newline [Brad Ediger]
  • Remove the old examples/ directory, replacing it with the self-documenting manual. (#187) [Michaël Witrant, Daniel Nelson, Brad Ediger]
  • Tables accept a :position argument (#150) [Brad Ediger]
  • text() accepts a :color argument (#145) [Gregory Brown / Brad Ediger]
  • Table rows() / columns() takes an array argument [Alexander Gitter / Brad Ediger]
  • Add even-odd winding rules option for fill / fill_and_stroke (#281) [Richard Fairhurst / Brad Ediger]

Bugfixes

  • The image method now properly accepts a Pathname object [Matt Patterson]
  • Calculate min_width properly for cells with colspan [Hartwig Brandl]
  • Render files directly to file on render_file to reduce memory footprint [Bas]
  • Allow fonts in the same family to be used together in a single table cell. [Brad Ediger]
  • Fix incorrect styling of colspan headers in multi-page tables [Jordan Byron]
  • Properly fill background color in colspan/rowspan cells [ Jordan Byron ]
  • Fix issue with font caching that was leading to memory leaks in tables [Kenneth Kalmer]
  • Ensure that graphics state exists before attempting to copy it when starting a new page [aayushkhandelwal11]
  • Fix various encryption-related bugs, including an issue with named destinations [Alexander Mankuta]
  • Fix TTF subsetting issue under JRuby [Brad Ediger]
  • Fix implicit flooring bug in PNG alpha channel unfiltering [Stephen Pike]
  • Ignore call to pdf.text(nil) [Luis Correa d’Almeida]
  • ColumnBox puts spacers only between columns (#302) [Brad Ediger]
  • Fix conversion of UTF-16 strings to hex on jruby in 1.9 mode (#283) [James Healy]
  • Fix documentation for formatted_text :styles option [Brad Ediger]
  • Dynamic repeaters respect page ranges (#279) [BJ Lawson / Brad Ediger]
  • Fix Document#width_of and sizing of table cells with styled text (#59, #167) [Johan Andersson / Brad Ediger]
  • Fix ColumnBox width within indent() [Brad Ediger]
  • Fix error when Text::Box#render is called multiple times [Brad Ediger]
  • Fix bug with TTF font metrics embedded in the font descriptor (#158) [Brad Ediger]
  • Tables with :row_colors now respect an explicit row background color [Brad Ediger]
  • Text boxes or table cells with :valign => :bottom now include room for the descender [Brad Ediger]
  • Fix exception when certain documents are snapshotted (#261) [Sean Russell / Brad Ediger]

Prawn 0.12.0:

We continue our trek to Prawn 1.0 with 0.12.0. This release fixes many bugs and adds some new features. A full list of changes is available via `git log 0.11.1..0.12.0`.

Features / Enhancements

  • Rewrite project README [Gregory Brown]
  • Speed improvements to text kerning [Jan De Poorter]
  • Snapshotting now preserves your bounding box [Brad Ediger]
  • Allow Document#float to teleport across pages and return to starting page [Brad Ediger]
  • number_pages now defaults to numbering every page [Matthew Rudy Jacobs]
  • Your bounding box is now reset when starting a new page with a different size or layout [Brad Ediger]

Major Bugfixes

  • Fix multi-page templates (#199) [Chase M. Gray / Jonathan Greenberg]
  • Make tables work in stretchy bounding boxes (#235) [Jan De Poorter / Brad Ediger]
  • Fix TTF font metrics when a TTF font has a nonzero width for newlines (#245) [daduke / Katsuya Hidaka / Brad Ediger]
  • Fix kerning bug on line width calculations (#251) [vspan / Brad Ediger]
  • Fix images in stretchy bounding boxes creating a new page (#241) [Brad Ediger]
  • Fix character_spacing to work based on character count, not byte length (#253) [Katsuya Hidaka / Brad Ediger]
  • Fix NoMethodError under $KCODE==“u” [Michael Klein]
  • Fix extra page break created when spans were used at the top of a page (#255) [Sean Russell / Brad Ediger]
  • Fix problem with table cell backgrounds overlapping other cell’s borders by drawing all backgrounds before any borders (#226) [Kenta Murata / Brad Ediger]
  • Remove old examples that were duplicated by our new manual (Michaël Witrant)
  • Tables: use an epsilon to compare floating-point values [Kenta Murata]

Prawn 0.11.1:

This is a major release that brings us very close to 1.0. There are API changes, many significant, new features, and even a manual. Besides what is listed here, there are dozens of bug fixes and other changes to make Prawn that much nicer.

The Manual

Changes

  • (may break existing code) Tables completely refactored (see the Table section of the manual; currently begins on page 73) (Brad Ediger)
  • (may break existing code) Removed the :ellipse overflow option (Daniel Nelson)
  • (may break existing code) More flexible number_pages now accepts an options hash as its second parameter. The options include any option understandable by Text::Box, as well as color and numbering options (Adam St. John)
  string = "page <page> of <total>"

  # Green page numbers 1 to 7
  options = { :at => [bounds.right - 150, 0],
              :width => 150,
              :align => :right,
              :page_filter => (1..7),
              :start_count_at => 1,
              :color => "007700" }
  number_pages string, options

  # Gray page numbers from 8 on up
  options[:page_filter] = lambda{ |pg| pg > 7}
  options[:start_count_at] = 8
  options[:color] = "333333"
  number_pages string, options
  • :align => :justify no longer justifies the last line in a paragraph (Daniel Nelson)
  • Omit line gap below the last line from Text::Box#height and when determining whether a line will fit (Daniel Nelson)
  • The ttfunk and pdf-reader submodules have been replaced with gem dependencies (James Healy)
  • Bundler support (Igor Bozato)
  • Gemfile used to specify dependencies, rather than gem() calls (James Healy)
  • group() return value indicates whether a new page was started (Brad Ediger)
  • GraphicStateStack object now reflects the state that will be maintained by PDF readers, thereby fixing a number of subtle bugs dealing with new pages, opening existing pages, and stamps (Jonathan Greenberg)
  • All transparency state changes must be transactional. The non-block form is no longer supported (Brad Ediger)
  • More consistent graphics API (circle and ellipse instead of circle_at and ellipse_at) (Daniel Nelson)
  circle [100,100], 25
  ellipse [100,100], 25, 50

Features

  • indent() can now optionally indent from the right, as well (Will Bryant)
  pdf.indent 20, 20 do
    pdf.text "This line is indented on both sides."
  end
  • M17n improvements (Daniel Nelson)
    • right-to-left text support (see text/right_to_left_text.rb in the manual)
    • fallback font support (see text/fallback_fonts.rb in the manual)
    • soft-hyphens, non-breaking spaces, and zero width spaces (for indicating word boundaries in written languages that don’t use spaces) (see text/line_wrapping.rb in the manual)
  • Pathname objects can be passed to image() (Brad Ediger)
  • CSS-like :border_…width and :border_…color (Brad Ediger). Table Border widths and colors can now be independently changed with:
    • border_top_width=
    • border_top_color=
    • border_right_width=
    • border_right_color=, etc.
    • There are shortcut accessor methods border_width= and border_color=, which set all properties at once given the same CSS-style arguments as padding=.
  • Page-by-page template support (see templates/page_template.rb in the manual) (Jonathan Greenberg)
  • Support for basic gradients (Wojciech Piekutowski)
  • Control over the text rendering mode, which enables outline text (see text/rendering_and_color.rb in the manual) (James Healy)
  • Implement hash arguments for table cells. You can now pass arbitrary options inline with table cells (Brad Ediger)
  table([[ {:content => 'hello', :font_style => :bold } ]])
  • Tables support row/column access by negative indices. You can now use syntax like table.row(0..-2), which selects all but the last row of your table (Brad Ediger)
  • Document outline support (see the Outline section of the manual; currently begins on page 100) (Jonathan Greenberg)
  • Character spacing for an entire block of text and on formatted text fragments (see text/kerning_and_character_spacing.rb in the manual) (Daniel Nelson)
  • Fragment level callbacks to enable extensible markup options (such as highlighting) (see text/formatted_callbacks.rb in the manual) (Daniel Nelson)

Prawn 0.10.2 : 2010-05-08

Added missing reference PDFs. See 0.10.1 for major changes

Prawn 0.10.1 : 2010-05-08

This is a major release that includes many new features, fixes, and overall changes.

  • James Healy’s templates have finally been merged. (see the Templates section in the manual; currently begins on page 108)
  • You can now use pretty much every option in table cells that you can use with ordinary text, including inline formatting
  • removed document-wide text_options in favor of specific global features (e.g. Document#default_kerning)
  • Text::Box refactored to be far more extensible

Prawn 0.9.1: 2010-03-28

This is a major release that includes many new features, fixes, and overall changes.

  • Prawn’s code has been unified into a single git repository, with prawn-security and prawn-layout merged into what was previously known as prawn-core. This means we’ve done away with the metagem, and you no longer need to require prawn/layout or prawn/security. (Brad Ediger)
  • We have created a new set of Prawn::Core::* tools that form the beginnings of our extension API. This will help make writing code that manipulates low level features in Prawn much better. (Daniel, Gregory, Brad)
  • We have reinstated our inline styling support, both in the form of an HTML-ish tag subset, and a lower level interface that lets you specify formatting explicitly for each segment of text. We have support for bold, italic, underline, strikethrough, internal and external links, subscripts, superscripts, font type, size and color, among other things. (Daniel Nelson)
  • Support for full justification of text and m17n-safe hyphenation. (Daniel Nelson)
  • New table generation API that provides a much greater deal of control over rows and columns and individual cell styling. We also now have support for nested tables. (Brad Ediger)

Prawn 0.8.4: 2010-02-24

(NOTE: 0.8.1-3 were gem packaging errors, please ignore these, as 0.8.4 is the first major 0.8 based release)

This is a major release that includes many new features, fixes, and overall changes. Prawn 0.7 users should look to upgrade to Prawn 0.8 as soon as possible, as Prawn <= 0.7 is no longer officially supported.

General Information

Prawn is currently under heavy flux due to our attempts to identify and lock down a suitable API and feature set for 1.0. Right now, most of the major changes are happening behind the scenes, but by 0.9, users will have a good sense of where we’re going with things and what to expect. For now, here are a few general things to note about 0.8:

  • We have not yet merged James Healy’s templates branch, but this is only because we haven’t had time to rebase it against all the core changes. So if you’ve been waiting on this feature, we will hopefully get it into 0.9 for you.
  • We had planned to write up the necessary steps for getting prawn-format back into the fold, but instead, we are working on a replacement that will be supported in core. More details to come soon.
  • This is the last release that will use Gregory’s legacy prawn-layout API (specifically tables). Brad Ediger has been hard at work on a refactored version with a significantly different API, and we will merge that upstream within the next couple weeks. When that happens, Brad will provide some notes on how to use the new code on the Prawn mailing list.
  • This is also the last release in which Prawn’s official extensions are split across gems. Since we only release versions in lockstep, we aren’t really benefiting from the split architecture. So, we plan to merge everything into the repository at http://github.com/sandal/prawn and also combine prawn-core, prawn-security, and prawn-layout into one gem.
  • If you’ve written low level extensions against Prawn 0.7, they will probably break with this release. We’re working on putting together a set of low level objects to form a core developer API. See release notes for details, and expect even more of this in 0.9.

Changed Since 0.7.2

In prawn-core:

  • We now omit /Encoding from font dict for AFM symbol fonts. [Fixes an issue w. ZapfDigbats font] (Brad Ediger)
  • Replaced most page related methods on Prawn::Document with the Prawn::Core::Page object (Gregory Brown)
  • Low level text methods moved from Prawn::Text to Prawn::Core::Text (Daniel Nelson)
  • Background images for documents are now positioned absolutely, so images should be the size of the document, not the size of the margin box. [#84] (Brian Jensen)
  • Line wrapping is no longer set by :wrap_block, but instead by :wrap_object. See documentation for Text::Box for details, and have a look at our DefaultLineWrap object. (Daniel Nelson)
  • PDF version is raised to 1.4 when PNG images are included w. alpha channels. (Brad Ediger)
  • You can no longer provide :at to the text() method. Instead, you will want to use draw_text() or text_box() if you need control over positioning. (Daniel Nelson) - This one will probably break your code, so pay attention!
  • Prawn::ObjectStore is now Prawn::Core::ObjectStore (Gregory Brown)
  • BoundingBox now requires :width to be set, raises an error otherwise (Gregory Brown)

No user facing changes to prawn-layout or prawn-security

Features / Fixes / Cleanup

In prawn-core:

  • We now have support for PDF outlines. This produces a nested index that appears alongside the PDF in supported viewers. (Jonathan Greenberg)
  Prawn::Document.generate(outlined document) do
    text "Page 1. This is the first Chapter. "
    start_new_page
    text "Page 2. More in the first Chapter. "
    start_new_page
    define_outline do
      section 'Chapter 1', :page => 1, :closed => true do
         page 1, :title => 'Page 1'
         page 2, :title => 'Page 2'
      end
   end
end

There are a number of ways to add sections and page indexes, so be sure to check out the rest of the examples as well as the documentation for Prawn::Outline.

  • Added matrix transformations for scaling, rotation, and translation of arbitrary content. (Michaël Witrant)
  • Added :origin option to scale and rotate. (Daniel Nelson)
 x      = 300
 y      = 300
 width  = 150
 height = 200
 angle  = 30

 pdf.rotate(angle, :origin => [x, y]) do
   pdf.stroke_rectangle([x, y], width, height)
 end

For those who understand matrix transformations at the PDF level, there is also a low level transformation_matrix() call that is a direct wrapper on the “cm” operator.

  • It is now possible to rotate text boxes. See the :rotate and :rotate_around options. (Daniel Nelson)
  • repeat() now works with dynamic content (Jonathan Greenberg)
repeat(:all, :dynamic => true) do
  draw_text page_number, :at => [500, 0]
end

Note that :dynamic => true should only be used when the content in the block changes from page to page. Static repeaters (the default) are far more efficient due to their use of PDF XObjects.

  • Added support for rounded_rectangle() and rounded_polygon() (Jonathan Greenberg)
  • Text::Box now supports a :skip_encoding option (Daniel Nelson)
  • Fixed yet another encoding issue with AFM fonts (Daniel Nelson)

No significant changes to prawn-layout or prawn-security

Prawn 0.7.2: 2010-01-31

General Information

Thanks again to our vigilant users for quickly spotting bugs in the 0.7 codebase

Fixes and cleanup since 0.7.1

In prawn-core:

  • Transaction rollback now properly sets page_number [#79] (Brad Ediger)
  • Raise an error rather than entering an infinite loop in Text::Box :shrink_to_fit (Brad Ediger)
  • Character wrapping should now work again on Ruby 1.8.6 (Daniel Nelson)
  • Resolved an encoding issue with character wrapping (Daniel Nelson)
  • /Encoding no longer included in font dict for AFM fonts (Brad Ediger)
  • Update fill_color, stroke_color, font, and font_families documentation (Simon Hürlimann)
  • Remove several prawn-format references in documentation (Gregory Brown)

In prawn-layout:

  • Tables should now work in column boxes [#7] (Brad Ediger)

No changes were made to prawn-security

Prawn 0.7.1: 2010-01-03

This is a major release that includes many new features, fixes, and overall changes. Prawn 0.6 users should look to upgrade to Prawn 0.7 as soon as possible, as Prawn <= 0.6 is no longer officially supported.

General Information

We have made a lot of decisions in this cycle, in the hopes that we can see a Prawn 1.0 in the near future. Specifically, these are the issues to be aware of:

  • Because we never used RubyForge for anything but gem hosting, and RubyForge’s gem index has been shut down in favor of Gemcutter, we will no longer be uploading files to RubyForge. Please see Prawn’s Gemcutter page for gem related stuff.
  • The prawn/format extension has been removed from the official prawn gem, and will not be supported at all until we have an active maintainer for it. We will provide a comprehensive list of issues that need to be resolved with the library soon, hopefully before the 0.8 release. But for now, if you need inline styling, you’ll need to either hack prawn/format yourself to get it working with Prawn 0.7, or stick to Prawn <= 0.6 for those needs.
  • The prawn/layout extension is currently feature frozen pending a major rewrite, to be conducted by Brad Ediger. We will be accepting patches for bugs in the old codebase, but any new featurework will need to wait until the rewrite happens. We hope to have a quick thaw on this, having the new prawn/layout codebase in place in time for the 0.8 release, but time will tell.
  • We are making our version numbering a bit more consistent across our sub-projects. You’ll notice in this release that prawn-core, prawn-layout, and prawn-security all carry the same version number: 0.7.1. If we do any maintenance releases, we’ll bump the third version number on any of the codebases we touch (and of course, the prawn metagem). When Prawn 0.8 is released, all sub-projects will ship with the version 0.8.1, whether or not they’ve had any API breaking changes. We are hoping this helps people easily see what versions are compatible with each other.
  • We have changed our documentation policy. All patches we merge into the master and stable branches of officially supported components of Prawn will have adequate API documentation for all public functions that aren’t explicitly marked with :nodoc:. So please help out by documenting your code before submitting a pull request. While it’s possible a core developer or someone else will do it for you, it definitely helps move things along to add any relevant docs yourself.
  • After conducting a vote amongst contributors and considering the options, we plan to stick with y=0 being at the bottom of the document for the foreseeable future. I understand that many folks would prefer things to be done the other way around, but we feel like making this change will create more problems than it solves. We will however, look at creating higher level APIs to solve some of the warts that result from this convention.
  • We plan to release Prawn 1.0 some time in Q2 2010. Soft feature freeze will happen no later than April 1st, 2010 with a hard freeze about 1 month before 1.0’s release. More details will come soon, but what this means is that if you have any major changes you want to introduce to Prawn, you should start that conversation as soon as possible on our mailing list.

Changed Since 0.6.3

In prawn/core:

  • Document#go_to_page now treats the first page as 1, not 0. [Brad Ediger]
  • start_new_page() now inserts after the current page rather than at the end of the document. [Brad Ediger]
  • Text wrapping now automatically uses character based wrapping if a word is too long to fit on a single line. The :wrap option has been removed in favor of a more flexible :wrap_block. See API docs for text_box() for details. [Daniel Nelson]
  • Fixed an issue where text descender could hang below the bottom of a bounding box (or margins). [Daniel Nelson]
  • Document#height_of signature now matches text() and text_box() [Daniel Nelson]
  • Document#transparent() now rounds negative values to 0.0, and values greater than 1 to 1.0.
  • Font#descender now returns a positive value, since it is only used as a magnitude throughout Prawn’s calculations. [Daniel Nelson]
  • The :kerning option for documents was previously only capable of disabling kerning. It is now possible to attempt to force kerning via :kerning => true [Daniel Nelson]

In prawn/layout:

  • removed header() and footer() methods, use Prawn::Document#repeat instead.

Version bumped as per new convention.

In prawn/security:

No changes. Version bumped as per new convention.

Features / Fixes / Cleanup

In prawn/core:

  • Added Document#page_number [Brad Ediger]
  • Added Document#float(), which executes a block and then restores the original y position. [Gregory Brown]
  • Vertical text alignment now supported via the :valign option [Daniel Nelson]
  • A much more powerful text_box API. See documentation and examples for details [Daniel Nelson]
  • Added a document option :optimize_objects, that reduces the amount of PDF objects in output at the expense of rendering time [Brad Ediger]
  • Added on_page_create() hook to document, see examples/general/context_sensitive_headers.rb for details [Lenny Marks]
  • Refactored color setting code [Wojciech Piekutowski]
  • Minor fixes to transaction support [Brad Ediger]

No user facing features or fixes in prawn-layout or prawn-security.

Prawn 0.6.3: 2009-11-17

General Information

Thanks again to our vigilant users for quickly spotting bugs in the 0.6 codebase.

Bug fixes since 0.6.2

In prawn-core:

  • Fixed a bug in annotations that prevented proper references from being generated [#58] (jlh)
  • Prawn::Reference on_encode() method removed, this should fix marshaling issue in transactions. [#56] (Brad Ediger)
  • Document extensions now work in inherited classes [#57] (Gregory Brown)

In prawn-layout:

  • Cursor is now placed directly at the bottom of a table after generation, as in Prawn 0.5.x (Gregory Brown)

In prawn-format:

  • Fixed internal links in basic formatting example [#11] (jlh)
  • width_of() and height_of() now should work as they did in 0.5.x [#12,#13] (Gregory Brown)

As a result of fixes in core, Prawn::Format should work in classes inherited from Prawn::Document, and links should now work again.

Prawn 0.6.2 : 2009-11-13

General Information

With this release, we welcome Daniel Nelson as a core committer to Prawn. Though most of the heavy lifting on Prawn is primarily done by our casual contributors, we need a couple people upstream to keep things organized and provide us with a bus-factor greater than 1. Based on his recent work and expected things to come, we’re glad to have Daniel join us.

Updated core committer list: Gregory Brown, Brad Ediger, James Healy, Daniel Nelson (Jamis Buck has retired)

This is a bug fix release that fixes issues with some of the new features in Prawn 0.6. It should not introduce any incompatibilities with Prawn 0.6.1, so please upgrade immediately.

Bugfixes since 0.6.1

All changes were to prawn-core

  • Stamped content no longer cut off when too close to document boundaries (Daniel Nelson)
  • Reopening pages no longer creates an invalid content length, so page numbering should now work (Brad Ediger)
  • Updated some copyright info (Brad Ediger)
  • Include procedure sets on every page for PDF <= 1.3 compatibility. (Brad Ediger)
  • Updated stamp example (Daniel Nelson)
  • create_stamp now is able to work prior to page creation (Daniel Nelson)

NOTE: There is still one known issue that is somewhat severe that we have not resolved. Currently transactions will not work when using TTF fonts in your document. We’re aware of the fact that this means that transactions are currently not m17n-friendly, and we will absolutely fix this before Prawn 0.7. If we get this issue fixed soon, we’ll get another 0.6 maintenance release out shortly after we get it resolved.

Prawn 0.6.1 : 2009-11-10

This is a major release that includes many new features, fixes, and overall changes. Prawn 0.6 users should look to upgrade to Prawn 0.6 as soon as possible, as Prawn 0.5 is no longer officially supported.

General Information

Brad Ediger’s prawn-security extension is now an official part of Prawn, and has been added as a dependency to the prawn metagem. This adds support for encryption, password protection, and permissions to Prawn.

Example:

require "prawn"
require "prawn/security"  

Prawn::Document.generate("hello_foo.pdf") do
  text "Hello, world!"
  encrypt_document :user_password => 'foo', :owner_password => 'bar',
    :permissions => { :print_document => false }
end

Changed since 0.5.1:

In prawn-core:

  • Improved low-level handling of PDF objects via ObjectStore. May break extensions that rely on certain low level features, see source for details. (Brad Ediger)
  • Using text() with both :at and :align now raises an error. These two options never worked together, but may cause unexpected errors in code that was previously failing silently. (Gregory Brown)
  • text_box() now returns the portion of the text that did not fit in the box. [#2] ( (Sam Livingston-Gray)
  • Stretchy bounding boxes now calculate height as the largest distance the box has been stretched to, rather than the last evaluated distance from the top of the box. See the bounding box examples for clarification. (Gregory Brown)
  • bounding_box() now returns the generated bounding box. This is only really useful for checking things like the final height of a stretchy box, and isn’t meant to be used as alternative API to the block form. (Gregory Brown)

No user facing API changes were made in prawn-format or prawn-layout.

Features / Fixes / Cleanup

In prawn-core:

Users will appreciate the following items:

  • Added support for transactional rendering via Document#transaction and Document#rollback (Brad Ediger)
  • Added Document#group() to group contents within the same column or page (Brad Ediger)
  • Added for stroke dashing. See the dash(), undash() and dashed?() methods on Document (Daniel Nelson)
  • Added a :margin option for Document#new and Document#start_new_page, can be specified as a single value or CSS shorthand. [#18] (Henrik Nyh)
  • Added transparency support for PDF Vector graphics, see Prawn::Graphics::Transparency. (Daniel Nelson)
  • Added “stamps” which allow for repeatable elements via XObjects. See Prawn::Stamp. (Daniel Nelson)
  • Added stroke cap and join styles, see Graphics::CapStyle and Graphics::JoinStyle (Daniel Nelson)
  • Added Document#move_cursor_to() to allow for moving the y position relative to the bottom boundary. (Gregory Brown)
  • Added Document#number_pages() for “Page k of n” style page numbering templates. (Gregory Brown)
  • Updated some outdated documentation

Those extending Prawn will want to know about these changes as well:

  • Fixed PDF format identifier to conform to spec (Brad Ediger)
  • Added a simple system for defining extensions to Prawn::Document via Document.extensions (James Edward Gray II)
  • Fixed a bug in NameTree insertion when nodes are already in insertion order [#48] (JeanLuc)
  • Added ByteString to denote literal byte streams (Brad Ediger)

In prawn-layout:

  • Cells should no longer have a gap between their border and background color (corny)
  • Added AndrewO’s prawn-grid examples to prawn-layout. (Brad Ediger)
  • Added :row_gutter and :column_gutter options to Grid. (Jordan Byron)

In prawn-format

  • Fixed an encoding bug (Jose Espinal)
  • Refactored to use new extension system in prawn-core (James Edward Gray II)

In prawn-security

  • Birthday!

Prawn 0.5.1 : 2009-09-22

This is a major release that includes many new features, fixes, and overall changes. Prawn 0.4 users should look to upgrade to Prawn 0.5 as soon as possible, as Prawn 0.4 is no longer officially supported. This also goes for Prawn 0.5.0.1, which was mainly released as an unstable developer preview.

General Information

Note that our bug trackers have moved from lighthouse, and are now on Github:
core: http://github.com/sandal/prawn/issues
layout: http://github.com/sandal/prawn-layout/issues
format: http://github.com/sandal/prawn-format/issues

Also note that Jamis Buck has retired as a Prawn core developer, so the new home for prawn-format is:
http://github.com/sandal/prawn-format

Prawn has been restructured so that the prawn gem is just a meta-gem that pulls in prawn-core, prawn-layout, and prawn-format. This change is backwards compatible, so unless you plan to mix and match gem versions for the various packages in a way other than what we recommend, you don’t need to make any changes to the way you load Prawn.

Changed since 0.4.1:

In prawn-core:

  • Document::Font#width_of becomes Document#width_of (Jamis Buck)
  • padded_box, lazy_bounding_box, header, and footer moved to prawn/layout
  • Raise Errors::NotOnPage if font is called without a current page (Brad Ediger)
  • Prawn::Document.text_options removed.
  • :spacing is now :leading for Document#text()
  • Font#normalize_encoding now non-destructive, use Font#normalize_encoding!() to modify in place.

In prawn-layout:

Note that this version is not compatible with Prawn 0.4.×. To use the new prawn-layout code you must upgrade to Prawn 0.5.1. However, the API should be mostly backwards compatible.

No user facing API changes were made in prawn-format

Features / Fixes / Cleanup

In prawn-core:

  • Unsupported image types now throw a better error [James Healy]
  • Added Document#min_version to internals, to allow extensions to set a minimum PDF version other than the one Prawn provides. (James Healy)
  • Added Document#column_box to allow flowing text from column to column (Paul Ostazeski)
  • Added Document#indent to allow temporary resetting x position to allow for indentation. (Jeremy Friesen)
  • Added support for document metadata properties (John Weathers)
  • Many improvements to documentation (Mikel Lindsaar)
  • Output a newline after %EOF to make Ghostscript and ImageMagick happy (Brad Ediger)
  • A whole bunch of refactorings and cleanup (Petrik de Heus)
  • Minor documentation fix (Brandon Hauff)

In prawn-layout:

  • As previously mentioned, prawn-layout now includes padded_box, lazy_bounding_box, header, and footer
  • Hash syntax for cells now supports any key that Cell.new supports.
  • Merged prawn-grid, a tool for doing grid based layouts. (Andrew O’Brien)
  • Fix a bug involving colspan width calculations (Jesús GS)
  • Allow font_style to be set on individual cells, and properly handle font size changes: (Sean Kirby)
  • Add License files to repository
  • Other minor cleanups (Łukasz Piestrzeniewicz)

In prawn-format

  • External links now supported (Phil Morris)
Something went wrong with that request. Please try again.