rghost 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +101 -0
- data/README.txt +3 -0
- data/Rakefile +93 -0
- data/lib/rghost.rb +3 -0
- data/lib/rghost/arc.rb +39 -0
- data/lib/rghost/barcode.rb +40 -0
- data/lib/rghost/callback.rb +55 -0
- data/lib/rghost/color.rb +118 -0
- data/lib/rghost/constants.rb +616 -0
- data/lib/rghost/convert.rb +24 -0
- data/lib/rghost/cursor.rb +82 -0
- data/lib/rghost/data_grid/basic_grid.rb +136 -0
- data/lib/rghost/data_grid/csv_grid.rb +27 -0
- data/lib/rghost/data_grid/data_grid.rb +14 -0
- data/lib/rghost/data_grid/dynamic_callback.rb +12 -0
- data/lib/rghost/data_grid/field_format.rb +60 -0
- data/lib/rghost/data_grid/grid.rb +18 -0
- data/lib/rghost/data_grid/header.rb +111 -0
- data/lib/rghost/data_grid/rails_grid.rb +37 -0
- data/lib/rghost/data_grid/static_callback.rb +13 -0
- data/lib/rghost/data_grid/style/border_lines.rb +47 -0
- data/lib/rghost/data_grid/style/bottom_lines.rb +30 -0
- data/lib/rghost/data_grid/style/old_forms.rb +30 -0
- data/lib/rghost/data_grid/style/style.rb +8 -0
- data/lib/rghost/document.rb +380 -0
- data/lib/rghost/dsc_entry.rb +20 -0
- data/lib/rghost/dynamic_document_callback.rb +27 -0
- data/lib/rghost/eps.rb +22 -0
- data/lib/rghost/font.rb +52 -0
- data/lib/rghost/function.rb +36 -0
- data/lib/rghost/gif.rb +28 -0
- data/lib/rghost/graphic.rb +28 -0
- data/lib/rghost/gs_alone.rb +17 -0
- data/lib/rghost/helpers.rb +13 -0
- data/lib/rghost/horizontal_line.rb +29 -0
- data/lib/rghost/image.rb +26 -0
- data/lib/rghost/jpeg.rb +26 -0
- data/lib/rghost/line.rb +40 -0
- data/lib/rghost/line_width.rb +17 -0
- data/lib/rghost/load.rb +37 -0
- data/lib/rghost/newpath.rb +20 -0
- data/lib/rghost/paper.rb +88 -0
- data/lib/rghost/point.rb +22 -0
- data/lib/rghost/point_with_command.rb +17 -0
- data/lib/rghost/ps/basic.ps +14 -0
- data/lib/rghost/ps/begin_document.ps +7 -0
- data/lib/rghost/ps/callbacks.ps +146 -0
- data/lib/rghost/ps/code128.font +344 -0
- data/lib/rghost/ps/code39.font +195 -0
- data/lib/rghost/ps/cursor.ps +41 -0
- data/lib/rghost/ps/datagrid.ps +52 -0
- data/lib/rghost/ps/ean.font +150 -0
- data/lib/rghost/ps/eps.ps +42 -0
- data/lib/rghost/ps/font.ps +31 -0
- data/lib/rghost/ps/functions.ps +646 -0
- data/lib/rghost/ps/gif.ps +150 -0
- data/lib/rghost/ps/horizontal_line.ps +3 -0
- data/lib/rghost/ps/i25.font +103 -0
- data/lib/rghost/ps/jpeg.ps +122 -0
- data/lib/rghost/ps/paper.ps +8 -0
- data/lib/rghost/ps/rectangle.ps +5 -0
- data/lib/rghost/ps/row.ps +4 -0
- data/lib/rghost/ps/show.ps +20 -0
- data/lib/rghost/ps/table_callbacks.ps +96 -0
- data/lib/rghost/ps/textarea.ps +11 -0
- data/lib/rghost/ps/type.ps +1 -0
- data/lib/rghost/ps/unit.ps +3 -0
- data/lib/rghost/ps/vertical_line.ps +14 -0
- data/lib/rghost/ps_object.rb +51 -0
- data/lib/rghost/rectangle.rb +39 -0
- data/lib/rghost/rgengine.so +0 -0
- data/lib/rghost/rghost.rb +3 -0
- data/lib/rghost/ruby_ghost_config.rb +25 -0
- data/lib/rghost/ruby_ghost_engine.rb +175 -0
- data/lib/rghost/ruby_to_ps.rb +92 -0
- data/lib/rghost/scale.rb +14 -0
- data/lib/rghost/show.rb +31 -0
- data/lib/rghost/static_document_callback.rb +22 -0
- data/lib/rghost/text_in.rb +29 -0
- data/lib/rghost/textarea.rb +115 -0
- data/lib/rghost/units.rb +81 -0
- data/lib/rghost/variable.rb +12 -0
- data/lib/rghost/version.rb +9 -0
- data/lib/rghost/vertical_line.rb +29 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/test/test_helper.rb +2 -0
- data/test/test_rghost.rb +11 -0
- data/website/index.html +11 -0
- data/website/index.txt +30 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +129 -0
- data/website/template.rhtml +48 -0
- metadata +145 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'ps_object'
|
2
|
+
#Cria uma Grid para ActiveRecord::Base obtendo o valor de @attributes atraves do nome.
|
3
|
+
class DataGrid::RailsGrid < DataGrid::BasicGrid
|
4
|
+
#Adiciona um Array de objetos ActiveRecord::Base
|
5
|
+
def data(_data)
|
6
|
+
_data.collect do |d|
|
7
|
+
line=@rails_cols.collect{|c| d[c[:field_name]] }
|
8
|
+
proc_line(line)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
#Adiciona colunas associando :field_name ao t�tulo da coluna
|
12
|
+
#Exemplo:
|
13
|
+
#Para o exemplo abaixo a classe Calls � uma heran�a de ActiveRecord::Base. Constru��o normal.
|
14
|
+
# rails_grid=DataGrid::RailsGrid.new(:align => :center, :width => 3)
|
15
|
+
#Mapeamento, primeiro o nome do atributo, depois as op��es j� conhecidas
|
16
|
+
#
|
17
|
+
# rails_grid.col :mobile, :title => "Mobile", :align => :right
|
18
|
+
# rails_grid.col :duration, :title => "Dura��o",:width => 3
|
19
|
+
# rails_grid.col :start, :title => "Inicio", :format => :eurodate
|
20
|
+
# rails_grid.col :called, :title => "N�mero", :align => :right, :title_align => :center
|
21
|
+
# Carregamento dos dados
|
22
|
+
# calls = Calls.find(:all, :limit => 5000)
|
23
|
+
# rails_grid.data(calls)
|
24
|
+
def col(field_name, options={})
|
25
|
+
super(options[:title],options)
|
26
|
+
@rails_cols||=[]
|
27
|
+
owf=options.dup #from options with field
|
28
|
+
owf[:field_name]||=field_name
|
29
|
+
@rails_cols << owf
|
30
|
+
|
31
|
+
end
|
32
|
+
# Alias col
|
33
|
+
def column(field_name, options={})
|
34
|
+
col(field_name,options)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "ps_object"
|
2
|
+
require "function"
|
3
|
+
#Callbacks est�ticos a n�vel de Grid
|
4
|
+
class DataGrid::StaticCallback < Function
|
5
|
+
ACCEPT=[:before_table_create, :after_table_create]
|
6
|
+
|
7
|
+
def initialize(name,&block)
|
8
|
+
raise NameError.new("#{name} no accept in #{self.class}") unless ACCEPT.include? name
|
9
|
+
super(name,&block)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class DataGrid::Style::BorderLines
|
4
|
+
|
5
|
+
def set_style(grid)
|
6
|
+
|
7
|
+
grid.before_row do
|
8
|
+
|
9
|
+
set HorizontalLine.new(:top, :size => grid.header.size)
|
10
|
+
set HorizontalLine.new(:bottom,:size => grid.header.size)
|
11
|
+
end
|
12
|
+
|
13
|
+
grid.before_column :only => 0 do
|
14
|
+
set VerticalLine.row
|
15
|
+
end
|
16
|
+
|
17
|
+
grid.after_column do
|
18
|
+
set VerticalLine.row
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
grid.header.before_create do
|
23
|
+
set LineWidth.new(0)
|
24
|
+
call :font_bold
|
25
|
+
set HorizontalLine.new(:top, :size => grid.header.size)
|
26
|
+
set HorizontalLine.new(:bottom,:size => grid.header.size)
|
27
|
+
end
|
28
|
+
|
29
|
+
grid.header.after_create { call :font_normal }
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
grid.header.before_column :only => 0 do
|
34
|
+
set VerticalLine.row
|
35
|
+
end
|
36
|
+
|
37
|
+
grid.header.after_column do
|
38
|
+
set VerticalLine.row
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class DataGrid::Style::BottomLines
|
4
|
+
|
5
|
+
def set_style(grid)
|
6
|
+
|
7
|
+
size=grid.header.size
|
8
|
+
grid.before_row do
|
9
|
+
set HorizontalLine.new(:bottom,:size => grid.header.size)
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
grid.header.before_create do
|
14
|
+
set LineWidth.new(0)
|
15
|
+
set HorizontalLine.new(:bottom,:size => grid.header.size)
|
16
|
+
call :font_bold
|
17
|
+
end
|
18
|
+
|
19
|
+
grid.header.after_create { call :font_normal }
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class DataGrid::Style::OldForms
|
4
|
+
|
5
|
+
def set_style(grid)
|
6
|
+
|
7
|
+
size=grid.header.size
|
8
|
+
grid.odd_row do
|
9
|
+
set Rectangle.background_row(:size => size)
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
grid.header.before_create do
|
14
|
+
set LineWidth.new(0)
|
15
|
+
set Rectangle.background_row(:size => size, :color => Gray.new(0.9) )
|
16
|
+
call :font_bold
|
17
|
+
end
|
18
|
+
|
19
|
+
grid.header.after_create { call :font_normal }
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,380 @@
|
|
1
|
+
##
|
2
|
+
# Ruby Ghost Engine - Document Builder.
|
3
|
+
# http://rubyforge.org/projects/rghost/
|
4
|
+
# Author Shairon Toledo <shairon.toledo at gmail.com> http://www.hashcode.eti.br
|
5
|
+
# Brazil Jun/2007
|
6
|
+
#
|
7
|
+
# Licensed under a Creative Commons licence.
|
8
|
+
# http://creativecommons.org/licenses/by-sa/2.5/br/
|
9
|
+
##
|
10
|
+
|
11
|
+
require "ps_object"
|
12
|
+
require "dynamic_document_callback"
|
13
|
+
require "static_document_callback"
|
14
|
+
require "paper"
|
15
|
+
require "load"
|
16
|
+
require "horizontal_line"
|
17
|
+
require "vertical_line"
|
18
|
+
require "function"
|
19
|
+
require "font"
|
20
|
+
require "cursor"
|
21
|
+
require "show"
|
22
|
+
require "rectangle"
|
23
|
+
require "color"
|
24
|
+
require "graphic"
|
25
|
+
require "arc"
|
26
|
+
require "newpath"
|
27
|
+
require "line"
|
28
|
+
require "line_width"
|
29
|
+
require "textarea"
|
30
|
+
require "variable"
|
31
|
+
require "eps"
|
32
|
+
require "jpeg"
|
33
|
+
require "gif"
|
34
|
+
require "text_in"
|
35
|
+
require "ruby_ghost_engine"
|
36
|
+
require "barcode"
|
37
|
+
require "convert"
|
38
|
+
|
39
|
+
|
40
|
+
#Document � a classe que centraliza a estrutura do documento
|
41
|
+
class Document < PsObject
|
42
|
+
DEFAULT_OPTIONS={
|
43
|
+
:rows_per_page => 80 ,
|
44
|
+
:count_pages => 10,
|
45
|
+
:row_height => 0.4,
|
46
|
+
:row_padding => 0.1,
|
47
|
+
:fontsize=> 8
|
48
|
+
}
|
49
|
+
#Nova inst�ncia de Document com proxy da classe Paper.
|
50
|
+
# Responde as op��es
|
51
|
+
#Document
|
52
|
+
# :rows_per_page => 80 , # M�ximo de linhas por p�gina
|
53
|
+
# :count_pages => 10, # Total de p�ginas do documento
|
54
|
+
# :row_height => 0.4, # Altura da faixa
|
55
|
+
# :row_padding => 0.1, # Espa�o entre cada faixa
|
56
|
+
# :fontsize=> 8 # Tamanho da fonte padr�o
|
57
|
+
#Paper
|
58
|
+
# :paper => :A4 # Tamanho do papel, personalizavel com array width X height(em pontos). Exmp: :paper => [400,300]
|
59
|
+
# :landscape => false # Disposi��o do papel em 90�
|
60
|
+
# :margin_top => 1, # Margin de topo
|
61
|
+
# :margin_right => 1, # Margin direita
|
62
|
+
# :margin_bottom => 1, # Margin da base
|
63
|
+
# :margin_left => 1, # Margin esquerda
|
64
|
+
# :duplex => false, # true - duas faces(para impress�o)
|
65
|
+
# :tumble => false # true - tipo do duplex(para impress�o)
|
66
|
+
#
|
67
|
+
#
|
68
|
+
def initialize(options={},&block)
|
69
|
+
super("%!RubyGhostEngine")
|
70
|
+
@head,@callbacks=PsObject.new,PsObject.new
|
71
|
+
@head.set Load.library(:type)
|
72
|
+
@head.set Load.library(:unit)
|
73
|
+
@paper=Paper.new(options[:paper] || :A4, options)
|
74
|
+
@head.set @paper
|
75
|
+
|
76
|
+
@variables=DEFAULT_OPTIONS.dup.merge(options)
|
77
|
+
@defines=[]
|
78
|
+
|
79
|
+
default_variables
|
80
|
+
instance_eval(&block) if block
|
81
|
+
end
|
82
|
+
#Facade Paper.gs_paper
|
83
|
+
#Obtem o valor no formato esperado pelo GS.
|
84
|
+
def gs_paper
|
85
|
+
@paper.gs_paper
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
#Aceita StaticDocumentCallback::ACCEPT e DynamicDocumentCallback::ACCEPT
|
90
|
+
# doc=Document.new
|
91
|
+
# doc.before_page_create :only => [1,2] do
|
92
|
+
# set HorizontalLine.new
|
93
|
+
# end
|
94
|
+
# doc.even_pages :except => [1] do
|
95
|
+
# set Show.new("ET say: Hello Humans!!")
|
96
|
+
# end
|
97
|
+
# doc.last_page do
|
98
|
+
# set Cursor.jump_rows(3)
|
99
|
+
# set TextIn.new(:x=> 4, :y => 15.5, :text => "Total: %current_page%")
|
100
|
+
# end
|
101
|
+
def method_missing(name,*args,&block)
|
102
|
+
case name
|
103
|
+
when *DynamicDocumentCallback::ACCEPT:
|
104
|
+
|
105
|
+
@callbacks.set DynamicDocumentCallback.new(name,args.shift || {},&block) #args.shift || {} without args
|
106
|
+
|
107
|
+
when *StaticDocumentCallback::ACCEPT:
|
108
|
+
|
109
|
+
@callbacks.set StaticDocumentCallback.new(name,&block)
|
110
|
+
|
111
|
+
else
|
112
|
+
raise NameError.new(name.to_s)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def ps
|
117
|
+
out=PsObject.new
|
118
|
+
out.set @head
|
119
|
+
out.set @default_variables
|
120
|
+
out.set Load.rg_enviroment
|
121
|
+
out.raw @defines.join
|
122
|
+
out.set @callbacks
|
123
|
+
out.set Variable.new(:fontsize,@variables[:fontsize])
|
124
|
+
out.call :font_normal
|
125
|
+
out.set Load.library(:begin_document)
|
126
|
+
out.set Cursor.moveto
|
127
|
+
|
128
|
+
"#{out} #{super}"
|
129
|
+
|
130
|
+
#"#{@head} \n%%endhead\n#{@default_variables}\n\n #{Load.rg_enviroment} #{@defines.join} #{@callbacks} #{Load.library(:begin_document)}\n #{Cursor.moveto}#{super}"
|
131
|
+
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
#Facade RubyGhostEngine.render
|
136
|
+
#Renderiza o documento.
|
137
|
+
# Valores v�lidos para options.
|
138
|
+
#
|
139
|
+
# :tmpdir => File::SEPARATOR + "tmp", # Diret�rio tempor�rio
|
140
|
+
# :logfile => File::SEPARATOR + "tmp" +File::SEPARATOR + "ruby_ghost.log" # Arquivo de log
|
141
|
+
# :multipage=> true # Para imagens em v�rios arquivos
|
142
|
+
# :resolution => 72 # Resolu��o
|
143
|
+
# :size => "200x180" # Para crop da imagem de sa�da
|
144
|
+
# :range =>2..3 # Range de p�ginas (PDF Only)
|
145
|
+
# Array contendo um Hash para op��es em modo raw do Ghostscript :d ou :s
|
146
|
+
# :s => [{:GenericResourceDir => /dir, :DEFAULTPAPERSIZE=> "a3"}]
|
147
|
+
# :d => [ {:TextAlphaBits => 2} ]
|
148
|
+
#Ou usando string
|
149
|
+
# :raw => "-sGenericResourceDir=/test -dTextAlphaBits=2"
|
150
|
+
#
|
151
|
+
#Exemplo:
|
152
|
+
# d=Document.new
|
153
|
+
# #fa�a o documento ....
|
154
|
+
#
|
155
|
+
# d.render :pdf # Sa�da em pdf
|
156
|
+
# d.render :jpeg # Sa�da em jpeg
|
157
|
+
# d.render :png, :multipage => true # Uma imagem por arquivo
|
158
|
+
# d.render :tiff, :resolution => 300 # Imagem com resolu��o de 300 dpi
|
159
|
+
def render(device,options={})
|
160
|
+
rg=RubyGhostEngine.new(self,options)
|
161
|
+
rg.render(device)
|
162
|
+
rg
|
163
|
+
end
|
164
|
+
#Renderiza, abre o stream e deleta o arquivo de sa�da. N�o aceita multipage=>true
|
165
|
+
def render_stream(device,options={})
|
166
|
+
rg=render(device,options)
|
167
|
+
out=rg.output.readlines.join
|
168
|
+
rg.clear_output
|
169
|
+
out
|
170
|
+
end
|
171
|
+
#Facade Function.new
|
172
|
+
#Define uma fun��o.
|
173
|
+
#Exemplo:
|
174
|
+
# doc=Document.new
|
175
|
+
# doc.define :myfont do
|
176
|
+
# set Font.new(:name => "ZapfChancery-MediumItalic", :size => 10)
|
177
|
+
# end
|
178
|
+
def define(name,&block)
|
179
|
+
@defines << Function.new(name,&block)
|
180
|
+
end
|
181
|
+
#Define e chama uma fun��o.
|
182
|
+
# doc=Document.new
|
183
|
+
# doc.define_and_call :my_photo do
|
184
|
+
# set Jpeg.new("/local/img/my_photo.jpg", :y=> 5,:x => 8, :zoom=> 50)
|
185
|
+
# end
|
186
|
+
def define_and_call(name,&block)
|
187
|
+
define(name,&block)
|
188
|
+
call(name)
|
189
|
+
end
|
190
|
+
#Salta uma faixa e usa a faixa corrente.
|
191
|
+
# d=Document.new
|
192
|
+
# doc.next_line do
|
193
|
+
# set Show.new("single text in page center", :align => :page_center)
|
194
|
+
# end
|
195
|
+
#Para cada linha de um arquivo.
|
196
|
+
# d=Document.new
|
197
|
+
# File.open(__FILE__).each { |line| doc.next_row{ set Show.new(line) } }
|
198
|
+
# d.done
|
199
|
+
# d.render :pdf
|
200
|
+
#Uma linha separando cada faixa
|
201
|
+
#File.open(__FILE__).each do |line|
|
202
|
+
# doc.next_row do
|
203
|
+
# set HorizontalLine.new(:top)
|
204
|
+
# set Show.new(line)
|
205
|
+
# end
|
206
|
+
#end
|
207
|
+
def next_row(&block)
|
208
|
+
set PsObject.new(&block)
|
209
|
+
set Cursor.next_row
|
210
|
+
|
211
|
+
|
212
|
+
end
|
213
|
+
#Carrega o texto do arquivo em uma itera��o de linhas.
|
214
|
+
def print_file(file)
|
215
|
+
File.open(file).each do |line|
|
216
|
+
next_row do
|
217
|
+
set Show.new(line)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
#Salta a p�gina com controlando o documento.
|
223
|
+
def next_page
|
224
|
+
call :next_page
|
225
|
+
end
|
226
|
+
#Facade Graphic
|
227
|
+
#Condiciona em um bloco gr�fico. Defini��es gr�ficas v�lidas apenas para o escopo do bloco n�o interferindo nos demais gr�ficos.
|
228
|
+
# doc=Document.new
|
229
|
+
# doc.graphic do
|
230
|
+
# set LineWidth.new(0)
|
231
|
+
# set Line.lineto(5,7)
|
232
|
+
# end
|
233
|
+
def graphic(ps_obj=PsObject.new,&block)
|
234
|
+
set Graphic.new(ps_obj,&block)
|
235
|
+
end
|
236
|
+
#Facade Newpath
|
237
|
+
#Cria um bloco que cria um novo path sem alterar o path corrente. O path v�lido apenas para o escopo do bloco. Contudo fecha o path(closepath) ao fim do bloco.
|
238
|
+
# doc=Document.new
|
239
|
+
# doc.newpath do
|
240
|
+
# set Arc.new(:x => 10, :y => 10, :radius => 100)
|
241
|
+
# end
|
242
|
+
def newpath(ps_obj=PsObject.new,&block)
|
243
|
+
set NewPath.new(ps_obj,&block)
|
244
|
+
end
|
245
|
+
#Facade Variable.new
|
246
|
+
#Define uma vari�vel global em Postscript.
|
247
|
+
# d=Document.new
|
248
|
+
# d.define_variable(:my_var,[3,4,5,6])
|
249
|
+
#
|
250
|
+
def define_variable(name,value)
|
251
|
+
@defines << Variable.new(name,value)
|
252
|
+
end
|
253
|
+
#Use showpage para o fim do documento ou para saltar p�ginas.
|
254
|
+
# Obs.: showpage n�o reseta os contadores de p�ginas,faixas, etc.
|
255
|
+
def showpage
|
256
|
+
call :stroke
|
257
|
+
call :showpage
|
258
|
+
end
|
259
|
+
|
260
|
+
#Facade Cursor.goto_row
|
261
|
+
def goto_row(row)
|
262
|
+
set Cursor.goto_row(row)
|
263
|
+
end
|
264
|
+
#Facade Cursor.jump_rows
|
265
|
+
def jump_rows(row)
|
266
|
+
set Cursor.jump_rows(row)
|
267
|
+
end
|
268
|
+
#Facade Cursor.rotate
|
269
|
+
def rotate(angle)
|
270
|
+
set Cursor.rotate(angle)
|
271
|
+
end
|
272
|
+
#Facade Cursor.moveto
|
273
|
+
def moveto(point={})
|
274
|
+
set Cursor.moveto(point)
|
275
|
+
end
|
276
|
+
#Facade Cursor.rmoveto
|
277
|
+
def rmoveto(point={})
|
278
|
+
set Cursor.rmoveto(point)
|
279
|
+
end
|
280
|
+
#Facade Cursor.translate
|
281
|
+
def translate(point={})
|
282
|
+
set Cursor.translate(point)
|
283
|
+
end
|
284
|
+
#Facade DSCEntry.new
|
285
|
+
def dsc_entry(&block)
|
286
|
+
set DSCEntry.new(&block)
|
287
|
+
end
|
288
|
+
#Facade EPS.new
|
289
|
+
def template(file_path,options={})
|
290
|
+
set EPS.new(file_path,options)
|
291
|
+
end
|
292
|
+
#Define um template/eps
|
293
|
+
# dt=Document.new
|
294
|
+
# dt.define_template(:myform, '/local/template/form1.eps', :x=> 3, :y => 5)
|
295
|
+
# dt.call :myform # Executa o template
|
296
|
+
def define_template(name,file_path,options)
|
297
|
+
set Function.new(name,EPS.new(file_path,options))
|
298
|
+
end
|
299
|
+
#Facade Font.new
|
300
|
+
def font(options)
|
301
|
+
set Font.new(options)
|
302
|
+
end
|
303
|
+
#Facade Image.for
|
304
|
+
def image(path,options={})
|
305
|
+
set Image.for(path,options)
|
306
|
+
end
|
307
|
+
#Idem horizontal_line
|
308
|
+
def hl(valign=:middle,options={})
|
309
|
+
set HorizontalLine.new(valign,options)
|
310
|
+
end
|
311
|
+
#Facade HorizontalLine.new
|
312
|
+
def horizontal_line(valign=:middle,options={})
|
313
|
+
hl(valign,options)
|
314
|
+
end
|
315
|
+
#Facade Rectangle.new
|
316
|
+
def rectangle(options={})
|
317
|
+
set Rectangle.new(options)
|
318
|
+
end
|
319
|
+
#Facade Rectangle.background_row
|
320
|
+
def background_row(options={})
|
321
|
+
set Rectangle.background_row(options={})
|
322
|
+
end
|
323
|
+
#Facade Scale.new
|
324
|
+
def scale(sx,sy)
|
325
|
+
set Scale.new(sx,sy)
|
326
|
+
end
|
327
|
+
#Facade TextIn.new
|
328
|
+
def text_in(options={})
|
329
|
+
set TextIn.new(options)
|
330
|
+
end
|
331
|
+
#Facade Show.new
|
332
|
+
def text(text,align={ :align=>:show_left })
|
333
|
+
set Show.new(text,align)
|
334
|
+
end
|
335
|
+
#Facade Show.new
|
336
|
+
def show(text,align={ :align=>:show_left })
|
337
|
+
set Show.new(text,align)
|
338
|
+
end
|
339
|
+
#Facade TextArea.new
|
340
|
+
def text_area(text,options={})
|
341
|
+
set TextArea.new(text,options)
|
342
|
+
end
|
343
|
+
#Facade VerticalLine.new
|
344
|
+
def vertical_line(start_in=:limit_left,size=:area_y)
|
345
|
+
set TextArea.new(start_in, size)
|
346
|
+
end
|
347
|
+
#Carrega de c�digo de barras(GNU Barcodes) da API
|
348
|
+
def load_font(name=:CODE39)
|
349
|
+
|
350
|
+
raw Load.library(name,:font)
|
351
|
+
|
352
|
+
end
|
353
|
+
#Executa o comando stoke para desenho de vertores
|
354
|
+
def stroke
|
355
|
+
|
356
|
+
call :stroke
|
357
|
+
end
|
358
|
+
#Informa que o documento est� pronto para ser convertido/impresso
|
359
|
+
def done
|
360
|
+
showpage
|
361
|
+
raw "\n%%EOF"
|
362
|
+
end
|
363
|
+
|
364
|
+
private
|
365
|
+
def default_variables
|
366
|
+
ps=PsObject.new
|
367
|
+
ps.set Variable.new(:rows_per_page,@variables[:rows_per_page])
|
368
|
+
ps.set Variable.new(:count_pages,@variables[:count_pages])
|
369
|
+
ps.set Variable.new(:row_height,Units::parse(@variables[:row_height]))
|
370
|
+
ps.set Variable.new(:row_padding,Units::parse(@variables[:row_padding]))
|
371
|
+
|
372
|
+
|
373
|
+
@default_variables=ps
|
374
|
+
|
375
|
+
|
376
|
+
end
|
377
|
+
|
378
|
+
end
|
379
|
+
|
380
|
+
|