# HG changeset patch # User Sean Russell # Date 1322058851 18000 # Wed Nov 23 09:34:11 2011 -0500 # Branch pdf_footnote # Node ID 796e927e01c8d7804ed18f58f383edb06791caa6 # Parent 672815836e30cd2c8e6867fdd896b50e8398fd03 Working on footnotes diff --git a/pdf.rb b/pdf.rb --- a/pdf.rb +++ b/pdf.rb @@ -512,8 +512,8 @@ if ref.size > 0 # TODO: Insert a footnote here when footnotes are done, rather than # a hover-over - STDERR.puts "1. Unsupported annotation #{ref.inspect}" - #text = @text.join, footnote = ref + #STDERR.puts "1. Unsupported annotation #{ref.inspect}" + text = @text.join, footnote = ref else old_text << "#{@text.join}" end @@ -524,23 +524,27 @@ @link_refs_pages[ attrs[:acronym] ] = @pdf.page_count old_text << attrs[:acronym] when :footnote - STDERR.puts "Unsupported :footnote" + #STDERR.puts "Unsupported :footnote" # FIXME # - # # header - # bounding_box [bounds.left, bounds.top], :width => bounds.width do - # font "Helvetica" - # text "Here's My Fancy Header", :align => :center, :size => 25 - # stroke_horizontal_rule - # end + # header + #@pdf.bounding_box [bounds.left, bounds.top], :width => bounds.width do + # @pdf.font "Helvetica" + # @pdf.text "Here's My Fancy Header", :align => :center, :size => 25 + # @pdf.stroke_horizontal_rule + #end # - # # footer - # bounding_box [bounds.left, bounds.bottom + 25], :width => bounds.width do - # font "Helvetica" - # stroke_horizontal_rule - # move_down(5) - # text "And here's a sexy footer", :size => 16 - # end + # footer + old = @pdf.cursor + k = [@pdf.bounds.left, @pdf.bounds.bottom + 19] + w = @pdf.bounds.width + @pdf.bounding_box k, :width => w do + @pdf.font "Helvetica" + @pdf.stroke_horizontal_rule + @pdf.move_down(5) + @pdf.text @footnotes[attrs[:footnote]], :size => 10 + end + @pdf.move_cursor_to old when :citation old_text << "[#{@text.join}]" when :underscore diff --git a/test/ident b/test/ident --- a/test/ident +++ b/test/ident @@ -1,4 +1,4 @@ becomes: -:Author: Sean Russell +:Author: {Sean Russell mailto:sean.russell@gmail.com} :Date: 2011-06-29