# HG changeset patch # User Sean Russell # Date 1322062572 18000 # Wed Nov 23 10:36:12 2011 -0500 # Node ID 244df895c3ede1ac3ca0ab3e68ee36bd8dffe9ff # Parent 60d4b98eee7a36c717d187a4fe4939014c9bafde Fixes #291 ... again. diff --git a/pdf.rb b/pdf.rb --- a/pdf.rb +++ b/pdf.rb @@ -177,11 +177,13 @@ (l+1).upto(6) { |k| @heading_numbers[k] = 0 } end n = "" - l.downto( 2 ) { |k| n = "#{@heading_numbers[k]}.#{n}" } + l.downto( 2 ) { |k| + n = "#{@heading_numbers[k]}.#{n}" if @heading_numbers[k] + } n.chop! align = attrs[:alignment] - size = 10 + ((7 - attrs[:level]) * 2) + size = 4 + ((7 - attrs[:level]) * 3) style = attrs[:level] > 3 ? :italic : :normal style_attrs = {:size=>size, :style=>style} yield @@ -198,7 +200,7 @@ @first_heading = false @pdf.move_down 5 align = attrs[:alignment] - size = 10 + ((7 - attrs[:level]) * 2) + size = 4 + ((7 - attrs[:level]) * 3) style = attrs[:level] > 3 ? :italic : :normal #@pdf.add_dest(attrs[:id], @pdf.dest_fit_horizontally(@pdf.cursor, @pdf.page.dictionary)) @pdf.font("Helvetica", {:size=>size, :style=>style}) { @@ -211,7 +213,7 @@ end def image(attrs) - @pdf.image(attrs[:image], :fit => [@pdf.bounds.width, @pdf.bounds.height]) + @pdf.image(attrs[:image], :fit => [@pdf.bounds.width, @pdf.cursor]) end def quote(attrs)