Class SimplePDF
In: lib/simple_pdf.rb
Parent: FPDF

PDF 文書のモデル。

Methods

Classes and Modules

Class SimplePDF::TextBox

External Aliases

Output -> output

Public Class methods

[Source]

     # File lib/simple_pdf.rb, line 68
 68:   def initialize(options={})
 69:     orientation = options[:orientation] ? options[:orientation] : "Portrait"
 70:     unit = "mm" # The unit of measure is fixed for simple implementation.
 71:     format = options[:format] ? options[:format] : "A4"
 72:     super(orientation, unit, format)
 73: 
 74:     set_default(options[:language])
 75:     
 76:     options.each do |key,val|
 77:       case(key)
 78:       when :title
 79:         SetTitle(val)
 80:       when :author
 81:         SetAuthor(val)
 82:       when :creator
 83:         SetCreator(val)
 84:       when :keywords
 85:         SetKeywords(val.join(' '))
 86:       when :subject
 87:         SetSubject(val)
 88:       when :top_margin
 89:         SetTopMargin(val) # mm
 90:       when :left_margin
 91:         SetLeftMargin(val) # mm
 92:       when :right_margin
 93:         SetRightMargin(val) # mm
 94:       when :zoom
 95:         case(val)
 96:         when "fullpage", "fullwidth", "real"
 97:           SetDisplayMode(val)
 98:         else
 99:           SetDisplayMode("default")
100:         end
101:       when :header
102:         @header = val.dup
103:       when :footer
104:         @footer = val.dup
105:       end
106:     end
107: 
108:     AliasNbPages("%P")
109:   end

Public Instance methods

overrided method that is called automatically

[Source]

    # File lib/simple_pdf.rb, line 47
47:   def Footer
48:     unless @footer.text.empty?
49:       SetXY(@footer.margin[:left], @footer.margin[:top])
50:       SetFontSize(@footer.font_size)
51:       Cell(page_width - @footer.margin[:left] - @footer.margin[:right],
52:            @footer.font_size / @k,
53:            extract_fields(@footer.text),
54:            0, 0,
55:            @footer.align_expr)
56:     end
57:   end

overrided method that is called automatically

[Source]

    # File lib/simple_pdf.rb, line 33
33:   def Header
34:     unless @header.text.empty?
35:       SetXY(@header.margin[:left], @header.margin[:top])
36:       SetFontSize(@header.font_size)
37:       Cell(page_width - @header.margin[:left] - @header.margin[:right],
38:            @footer.font_size / @k,
39:            extract_fields(@header.text),
40:            0, 0,
41:            @header.align_expr)
42:       SetXY(left_margin, right_margin)
43:     end
44:   end

overrided the original method because of the case sensitive fault (@Page => @page)

[Source]

    # File lib/simple_pdf.rb, line 60
60:   def Link(x, y, w, h, link)
61:     # Put a link on the page
62:     @PageLinks[@page]=Array.new unless @PageLinks.has_key?(@page)
63:     @PageLinks[@page].push([x*@k,@hPt-y*@k,w*@k,h*@k,link])
64:   end

[Source]

     # File lib/simple_pdf.rb, line 116
116:   def cell(w,h=0,utf8_txt='',border=0,ln=0,align='',fill=0,link='')
117:     Cell(w, h, encode_text(utf8_txt), border, ln, align, fill, link)
118:   end

[Source]

     # File lib/simple_pdf.rb, line 120
120:   def multi_cell(w,h,utf8_txt,border=0,align='J',fill=0)
121:     MultiCell(w, h, encode_text(utf8_txt), border, align, fill)
122:   end

color setting methods

[Source]

     # File lib/simple_pdf.rb, line 125
125:   def set_draw_color(rgb)
126:     set_color(:SetDrawColor, rgb)
127:   end

[Source]

     # File lib/simple_pdf.rb, line 133
133:   def set_fill_color(rgb)
134:     set_color(:SetFillColor, rgb)
135:   end

[Source]

     # File lib/simple_pdf.rb, line 129
129:   def set_text_color(rgb)
130:     set_color(:SetTextColor, rgb)
131:   end

alternative methods

[Source]

     # File lib/simple_pdf.rb, line 112
112:   def write(h, utf8_txt)
113:     Write(h, encode_text(utf8_txt))
114:   end

[Validate]