--- rfpdf.orig/lib/rfpdf/fpdf.rb 2009-03-19 01:26:27.437500000 +0900 +++ rfpdf/lib/rfpdf/fpdf.rb 2009-03-19 12:03:28.468750000 +0900 @@ -22,6 +22,7 @@ require 'date' require 'zlib' +require 'stringio' class FPDF FPDF_VERSION = '1.53d' @@ -60,7 +61,7 @@ class FPDF # Initialization of properties @page=0 @n=2 - @buffer='' + @buffer = StringIO::new @pages=[] @OrientationChanges=[] @state=0 @@ -401,7 +402,9 @@ class FPDF end def Circle(mid_x, mid_y, radius, style='') + mid_x *= @k mid_y = (@h-mid_y)*@k + radius *= @k out(sprintf("q\n")) # postscript content in pdf # init line type etc. with /GSD gs G g (grey) RG rg (RGB) w=line witdh etc. out(sprintf("1 j\n")) # line join @@ -990,11 +993,11 @@ class FPDF if file.nil? # Return as a string - return @buffer + return @buffer.string else # Save file locally open(file,'wb') do |f| - f.write(@buffer) + f.write(@buffer.string) end end end @@ -1006,7 +1009,7 @@ class FPDF unless @AliasNbPages.nil? or @AliasNbPages=='' # Replace number of pages 1.upto(nb) do |n| - @pages[n].gsub!(@AliasNbPages,nb.to_s) + @pages[n].string.gsub!(@AliasNbPages,nb.to_s) end end if @DefOrientation=='P' @@ -1050,7 +1053,7 @@ class FPDF out('/Contents '+(@n+1).to_s+' 0 R>>') out('endobj') # Page content - p=(@compress) ? Zlib::Deflate.deflate(@pages[n]) : @pages[n] + p=(@compress) ? Zlib::Deflate.deflate(@pages[n].string) : @pages[n].string newobj out('<<'+filter+'/Length '+p.length.to_s+'>>') putstream(p) @@ -1344,7 +1347,7 @@ class FPDF def beginpage(orientation) @page=@page+1 - @pages[@page]='' + @pages[@page]=StringIO::new @state=2 @x=@lMargin @y=@tMargin @@ -1536,9 +1539,9 @@ class FPDF def out(s) # Add a line to the document if @state==2 - @pages[@page]=@pages[@page]+s+"\n" + @pages[@page] << s.to_s << "\n" else - @buffer=@buffer+s.to_s+"\n" + @buffer << s.to_s << "\n" end end