lunks_rghost 0.8.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rghost/border.rb +44 -0
- data/lib/rghost/callback.rb +58 -0
- data/lib/rghost/circle.rb +102 -0
- data/lib/rghost/color.rb +175 -0
- data/lib/rghost/constants.rb +626 -0
- data/lib/rghost/convert.rb +43 -0
- data/lib/rghost/cursor.rb +124 -0
- data/lib/rghost/dash.rb +59 -0
- data/lib/rghost/document.rb +546 -0
- data/lib/rghost/document_callback_facade.rb +64 -0
- data/lib/rghost/dsc_entry.rb +20 -0
- data/lib/rghost/dynamic_document_callback.rb +15 -0
- data/lib/rghost/eps.rb +31 -0
- data/lib/rghost/font.rb +48 -0
- data/lib/rghost/font_map.rb +54 -0
- data/lib/rghost/frame.rb +105 -0
- data/lib/rghost/function.rb +38 -0
- data/lib/rghost/gif.rb +41 -0
- data/lib/rghost/graphic.rb +26 -0
- data/lib/rghost/grid/base_grid.rb +228 -0
- data/lib/rghost/grid/callback_facade.rb +136 -0
- data/lib/rghost/grid/csv_grid.rb +51 -0
- data/lib/rghost/grid/dynamic_callback.rb +12 -0
- data/lib/rghost/grid/field_format.rb +43 -0
- data/lib/rghost/grid/grid.rb +15 -0
- data/lib/rghost/grid/header.rb +120 -0
- data/lib/rghost/grid/matrix.rb +10 -0
- data/lib/rghost/grid/rails_grid.rb +74 -0
- data/lib/rghost/grid/static_callback.rb +13 -0
- data/lib/rghost/grid/style/border_lines.rb +44 -0
- data/lib/rghost/grid/style/bottom_lines.rb +28 -0
- data/lib/rghost/grid/style/old_forms.rb +28 -0
- data/lib/rghost/grid/style/style.rb +8 -0
- data/lib/rghost/gs_alone.rb +25 -0
- data/lib/rghost/helpers.rb +13 -0
- data/lib/rghost/horizontal_line.rb +45 -0
- data/lib/rghost/how_to.rb +75 -0
- data/lib/rghost/image.rb +29 -0
- data/lib/rghost/jpeg.rb +39 -0
- data/lib/rghost/line.rb +89 -0
- data/lib/rghost/line_width.rb +28 -0
- data/lib/rghost/load.rb +43 -0
- data/lib/rghost/newpath.rb +19 -0
- data/lib/rghost/paper.rb +147 -0
- data/lib/rghost/parse_text.rb +53 -0
- data/lib/rghost/pdf_security.rb +36 -0
- data/lib/rghost/point.rb +23 -0
- data/lib/rghost/point_with_command.rb +17 -0
- data/lib/rghost/polygon.rb +75 -0
- data/lib/rghost/ps/AdobeExpert.enc +258 -0
- data/lib/rghost/ps/AdobeLatinEncoding.enc +258 -0
- data/lib/rghost/ps/Bengali.enc +386 -0
- data/lib/rghost/ps/CodePage1250.enc +258 -0
- data/lib/rghost/ps/CodePage1251.enc +258 -0
- data/lib/rghost/ps/CodePage1252.enc +258 -0
- data/lib/rghost/ps/CodePage1253.enc +258 -0
- data/lib/rghost/ps/CodePage1254.enc +258 -0
- data/lib/rghost/ps/CodePage1256.enc +258 -0
- data/lib/rghost/ps/CodePage1257.enc +258 -0
- data/lib/rghost/ps/CodePage1258.enc +258 -0
- data/lib/rghost/ps/CodePage874.enc +258 -0
- data/lib/rghost/ps/Fontmap +5 -0
- data/lib/rghost/ps/IsoLatin.enc +352 -0
- data/lib/rghost/ps/MacCentralEuropean.enc +258 -0
- data/lib/rghost/ps/MacCyrillice.desnc +258 -0
- data/lib/rghost/ps/MacGreek.enc +258 -0
- data/lib/rghost/ps/MacHebrew.enc +258 -0
- data/lib/rghost/ps/TeX-CorkEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-LGR-Greek.enc +258 -0
- data/lib/rghost/ps/TeX-T2AModified2Encoding.enc +258 -0
- data/lib/rghost/ps/TeX-T2BAdobeEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-T2CAdobeEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-X2AdobeEncoding.enc +258 -0
- data/lib/rghost/ps/TeX-XL2encoding.enc +258 -0
- data/lib/rghost/ps/TeXMathExtensionEncoding.enc +258 -0
- data/lib/rghost/ps/TeXMathItalicEncoding.enc +258 -0
- data/lib/rghost/ps/TeXMathSymbolEncoding.enc +258 -0
- data/lib/rghost/ps/US-ASCII.enc +258 -0
- data/lib/rghost/ps/UTF-8.enc +3 -0
- data/lib/rghost/ps/_cusor.ps +46 -0
- data/lib/rghost/ps/basic.ps +25 -0
- data/lib/rghost/ps/begin_document.ps +8 -0
- data/lib/rghost/ps/callbacks.ps +175 -0
- data/lib/rghost/ps/code128.font +344 -0
- data/lib/rghost/ps/code39.font +195 -0
- data/lib/rghost/ps/cursor.ps +106 -0
- data/lib/rghost/ps/datagrid.ps +55 -0
- data/lib/rghost/ps/developer.ps +237 -0
- data/lib/rghost/ps/ean.font +150 -0
- data/lib/rghost/ps/eps.ps +42 -0
- data/lib/rghost/ps/font.ps +38 -0
- data/lib/rghost/ps/frame.ps +16 -0
- data/lib/rghost/ps/gif.ps +150 -0
- data/lib/rghost/ps/horizontal_line.ps +4 -0
- data/lib/rghost/ps/i25.font +103 -0
- data/lib/rghost/ps/jpeg.ps +122 -0
- data/lib/rghost/ps/link.ps +22 -0
- data/lib/rghost/ps/paper.ps +8 -0
- data/lib/rghost/ps/rect_link.ps +17 -0
- data/lib/rghost/ps/rectangle.ps +5 -0
- data/lib/rghost/ps/rghost_default_template.eps +1532 -0
- data/lib/rghost/ps/row.ps +4 -0
- data/lib/rghost/ps/show.ps +21 -0
- data/lib/rghost/ps/table_callbacks.ps +96 -0
- data/lib/rghost/ps/text.ps +63 -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 +12 -0
- data/lib/rghost/ps/virtual_pages.ps +55 -0
- data/lib/rghost/ps_facade.rb +253 -0
- data/lib/rghost/ps_object.rb +55 -0
- data/lib/rghost/rectangle_link.rb +65 -0
- data/lib/rghost/rgengine.so +0 -0
- data/lib/rghost/ruby_ghost_config.rb +252 -0
- data/lib/rghost/ruby_ghost_engine.rb +174 -0
- data/lib/rghost/ruby_ghost_version.rb +8 -0
- data/lib/rghost/ruby_to_ps.rb +78 -0
- data/lib/rghost/scale.rb +29 -0
- data/lib/rghost/shape_content.rb +23 -0
- data/lib/rghost/show.rb +88 -0
- data/lib/rghost/static_document_callback.rb +18 -0
- data/lib/rghost/text.rb +44 -0
- data/lib/rghost/text_in.rb +51 -0
- data/lib/rghost/text_link_in.rb +42 -0
- data/lib/rghost/textarea.rb +88 -0
- data/lib/rghost/units.rb +82 -0
- data/lib/rghost/variable.rb +12 -0
- data/lib/rghost/vertical_line.rb +37 -0
- data/lib/rghost/virtual_pages.rb +42 -0
- data/lib/rghost.rb +18 -0
- metadata +181 -0
data/lib/rghost/text.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require "rghost/ps_object"
|
2
|
+
require "rghost/units"
|
3
|
+
require "rghost/font"
|
4
|
+
require "rghost/ruby_to_ps"
|
5
|
+
#Wraps the text so as the it fits on the page(:area_x). Wrapping happens at whitespace characters without hyphenation.
|
6
|
+
#Additionally you can make use of predefined tag and the special tag <br/> to break row. You can disable the parse with second parameter tag_parse=false.
|
7
|
+
#===Examples
|
8
|
+
# doc=Document.new
|
9
|
+
# doc.define_tags do
|
10
|
+
# tag :font1, :name => 'Helvetica', :size => 10, :color => '#F34811'
|
11
|
+
# tag :font2, :name => 'Times', :size => 11, :color => '#A4297A'
|
12
|
+
# tag :font3, :name => 'TimesBold', :size => 12, :color => '#AA3903'
|
13
|
+
# end
|
14
|
+
# my_text="<font1>foo, bar, baz</font1>,<font2>qux, quux</font2>, corge, grault, garply, waldo, <font3>fred, plugh,</font3> xyzzy,<br/> thud, bing"
|
15
|
+
# doc.text my_text
|
16
|
+
#
|
17
|
+
#link:images/text01.png
|
18
|
+
#
|
19
|
+
#===Without parse
|
20
|
+
# text="<font1>foo, bar, baz</font1>,<font2>qux, quux</font2>, corge, grault, garply, waldo, <font3>fred, plugh,</font3> xyzzy,<br/> thud, bing"
|
21
|
+
# doc.text text,false
|
22
|
+
#
|
23
|
+
#link:images/text02.png
|
24
|
+
class RGhost::Text < RGhost::PsObject
|
25
|
+
include RGhost::RubyToPs
|
26
|
+
include RGhost::ParseText
|
27
|
+
attr_reader :rows
|
28
|
+
|
29
|
+
def initialize(text,tag_parse=true)
|
30
|
+
super("")
|
31
|
+
@text=text
|
32
|
+
@tag_parse=tag_parse
|
33
|
+
@options={:text_align => :left}
|
34
|
+
end
|
35
|
+
|
36
|
+
def ps
|
37
|
+
text_to_ps #from RGhost::ParseText
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "rghost/ps_object"
|
2
|
+
require "rghost/cursor"
|
3
|
+
require "rghost/ruby_to_ps"
|
4
|
+
#TextIn is a helper to combine the cursor positioning and text output into one step.
|
5
|
+
class RGhost::TextIn < RGhost::PsObject
|
6
|
+
include RGhost::RubyToPs
|
7
|
+
DEFAULT_OPTIONS={:x=> :limit_left,:y=> :current_row, :tag => :default_font, :write => "Ruby Ghost API - current_row = %row% "}
|
8
|
+
#===Options
|
9
|
+
#* <tt>:x and :y</tt> - Initial position.
|
10
|
+
#* <tt>:tag or :with</tt> - Use predefined tag.
|
11
|
+
#* <tt>:color</tt> - Override color of the tag.
|
12
|
+
#* <tt>:text or :write</tt> - The text.
|
13
|
+
#===Examples
|
14
|
+
# doc=RGhost::Document.new
|
15
|
+
# doc.text_in :x => 3, :y => 4, :write => "Foo Bar Baz", :tag => :h1
|
16
|
+
#====Rotating
|
17
|
+
# doc.newpath do
|
18
|
+
# translate :x => 3, :y=> 4
|
19
|
+
# rotate 45
|
20
|
+
# text_in :x => 0, :y => 0, :write => "Foo Bar Baz1", :tag => :font2
|
21
|
+
# end
|
22
|
+
#====Eval postscript internal
|
23
|
+
#TextIn will eval postscript internal variables you pass in between % signs. Sounds complex, huh? Let's see an example:
|
24
|
+
# doc.text_in :x=> 3.5, :y=> 5.5, :text => "this is %row% row and current page %current_page%"
|
25
|
+
def initialize(options={})
|
26
|
+
|
27
|
+
@options=DEFAULT_OPTIONS.dup.merge(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
def ps
|
31
|
+
text=RGhost::PsObject.new
|
32
|
+
text.set RGhost::Cursor.moveto(@options)
|
33
|
+
#text.raw "currentfont"
|
34
|
+
#text.raw "currentrgbcolor"
|
35
|
+
text.raw RGhost::Color.create(@options[:color]) if @options[:color]
|
36
|
+
f="_#{@options[:with] || @options[:tag] || :default_font}"
|
37
|
+
text.raw f
|
38
|
+
#text.call @options[:with] || @options[:tag] || :default_font
|
39
|
+
|
40
|
+
text.raw string_eval(@options[:text] || @options[:write] )
|
41
|
+
#text.raw "setrgbcolor"
|
42
|
+
#text.raw "setfont"
|
43
|
+
text.graphic_scope
|
44
|
+
#text.set PsObject.new(@options[:text])
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "rghost/ps_object"
|
2
|
+
require "rghost/cursor"
|
3
|
+
require "rghost/ruby_to_ps"
|
4
|
+
#TextLinkIn is a helper to combine the cursor positioning and text with hyperlink output into one step as TextIn.
|
5
|
+
#It works only PDF format
|
6
|
+
class RGhost::TextLinkIn < RGhost::PsObject
|
7
|
+
include RGhost::RubyToPs
|
8
|
+
DEFAULT_OPTIONS={:x=> :limit_left,:y=> :current_row, :tag => :default_font, :color => :blue,:label => "RGhost API", :url => 'http://rghost.rubyforge.org'}
|
9
|
+
#===Options
|
10
|
+
#* <tt>:x and :y</tt> - Initial position.
|
11
|
+
#* <tt>:tag or :with</tt> - Use predefined tag.
|
12
|
+
#* <tt>:color</tt> - Override color of the tag.
|
13
|
+
#* <tt>:label</tt> - The text.
|
14
|
+
#* <tt>:url</tt> - Hyperlink.
|
15
|
+
#===Examples
|
16
|
+
# doc=RGhost::Document.new
|
17
|
+
# doc.text_link "Shairon at Hashcode", :url => "http://www.hashcode.eti.br", :color => :blue, :x => 3, :y => 4, :tag => :h1
|
18
|
+
#====Rotating
|
19
|
+
# doc.newpath do
|
20
|
+
# translate :x => 3, :y=> 4
|
21
|
+
# rotate 45
|
22
|
+
# text_link "RGhost website", :url => "http://rghost.rubyforge.org", :x => 0, :y => 0, :tag => :font2
|
23
|
+
# end
|
24
|
+
def initialize(options={})
|
25
|
+
|
26
|
+
@options=DEFAULT_OPTIONS.dup.merge(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def ps
|
30
|
+
text=RGhost::PsObject.new
|
31
|
+
text.set RGhost::Cursor.moveto(@options)
|
32
|
+
text.raw RGhost::Color.create(@options[:color]) if @options[:color]
|
33
|
+
f="_#{@options[:with] || @options[:tag] || :default_font}"
|
34
|
+
text.raw f
|
35
|
+
text.raw "/:link_str #{to_string(@options[:label])} def /:link_uri #{to_string(@options[:url])} def :link_make "
|
36
|
+
text.ps
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require "rghost/ps_object"
|
2
|
+
require "rghost/units"
|
3
|
+
require "rghost/font"
|
4
|
+
require "rghost/ruby_to_ps"
|
5
|
+
require 'rghost/parse_text'
|
6
|
+
#TextArea wraps the text so as the it fits in a box of a given width. Wrapping happens at whitespace characters without hyphenation.
|
7
|
+
#Additionally you can make use of predefined tag and the special tag <br/> to break row.
|
8
|
+
#The alignment can be left, right and centered.
|
9
|
+
#
|
10
|
+
#PS: It not jumps pages.
|
11
|
+
|
12
|
+
class RGhost::TextArea < RGhost::PsObject
|
13
|
+
include RGhost::RubyToPs
|
14
|
+
include RGhost::ParseText
|
15
|
+
|
16
|
+
DEFAULT_OPTIONS={
|
17
|
+
:width => :area_x,
|
18
|
+
:row_height => :row_height,
|
19
|
+
:x=> :limit_left,
|
20
|
+
:y=> :current_row,
|
21
|
+
:text_align => :left
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
#===Options
|
26
|
+
#* <tt>:x and :y</tt> - Initial position.
|
27
|
+
#* <tt>:row_height</tt> - Row height :)
|
28
|
+
#* <tt>:with</tt> - Max wide of the text
|
29
|
+
#* <tt>:text_align</tt> - Align of the text in the virtual box using :left, :right and :center.
|
30
|
+
#===Examples
|
31
|
+
# doc=RGhost::Document.new
|
32
|
+
# my_text="<font1>foo, bar, baz</font1><font2>qux, quux</font2>, corge, grault, garply, waldo, <font3>fred, plugh,</font3> xyzzy,<br/> thud, bing"
|
33
|
+
# doc.text_area my_text
|
34
|
+
#
|
35
|
+
#link:images/text_area01.png
|
36
|
+
#
|
37
|
+
# doc.text_area my_text, :width =>3
|
38
|
+
#
|
39
|
+
#link:images/text_area02.png
|
40
|
+
#
|
41
|
+
# doc.text_area my_text, :width =>3, :text_align => :center
|
42
|
+
#
|
43
|
+
#link:images/text_area03.png
|
44
|
+
#
|
45
|
+
# doc.text_area my_text, :width =>3, :text_align => :right
|
46
|
+
#
|
47
|
+
#link:images/text_area04.png
|
48
|
+
#
|
49
|
+
# doc.text_area my_text, :width =>3, :text_align => :right, :x => 3
|
50
|
+
#
|
51
|
+
#link:images/text_area05.png
|
52
|
+
#
|
53
|
+
# doc.text_area my_text, :width =>3, :text_align => :right, :x => 3, :row_height => 0.6
|
54
|
+
#
|
55
|
+
#link:images/text_area06.png
|
56
|
+
|
57
|
+
def initialize(text,options={},tag_parse=true)
|
58
|
+
super("")
|
59
|
+
@text=text
|
60
|
+
@tag_parse=tag_parse
|
61
|
+
options||={}
|
62
|
+
@options=DEFAULT_OPTIONS.dup.merge(options)
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
def ps
|
67
|
+
bw=RGhost::Units::parse(@options[:width])
|
68
|
+
ta=@options[:text_align]
|
69
|
+
rh=RGhost::Units::parse(@options[:row_height])
|
70
|
+
|
71
|
+
graph=RGhost::Graphic.new do
|
72
|
+
set RGhost::Variable.new(':bw',bw)
|
73
|
+
set RGhost::Variable.new('text_align',"/#{ta}")
|
74
|
+
# set Variable.new(':rp',rp)
|
75
|
+
set RGhost::Variable.new(':rh',rh)
|
76
|
+
end
|
77
|
+
graph.set RGhost::Cursor.translate(@options)
|
78
|
+
graph.set RGhost::Cursor.moveto(:x => 0, :y =>0)
|
79
|
+
#graph.raw ":text_area #{text_to_ps} :text_proc"
|
80
|
+
graph.raw text_to_ps
|
81
|
+
graph
|
82
|
+
#final_text=text_to_ps
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
end
|
88
|
+
|
data/lib/rghost/units.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require "rghost/function"
|
2
|
+
require "rghost/ps_object"
|
3
|
+
#The postscript default unit is the 1/72th inch. RGhost uses the centimeters (cm) as it's default, mainly for positioning coordinates and numeric object sizes (if the size is a String, it won't be parsed to the default unit). This setting can be changed setting the value of RGhost::Config::GS[:unit] before the document is created using any of the Units child classes.
|
4
|
+
#===Example:
|
5
|
+
#
|
6
|
+
#====Setting to inches.
|
7
|
+
# RGhost::Config::GS[:unit]=Units::Inch
|
8
|
+
# doc.moveto :x => 1, :y => 2 #=> 1 inch x 2 inches
|
9
|
+
#====Explicitly setting to Cm.
|
10
|
+
# doc.moveto :x => '1 cm' , :y => '2 cm'
|
11
|
+
#====Using the Postscript unit
|
12
|
+
# doc.moveto :x => '100' , :y => '200'
|
13
|
+
module RGhost::Units
|
14
|
+
|
15
|
+
class Unit < RGhost::PsObject
|
16
|
+
|
17
|
+
attr_accessor :value
|
18
|
+
|
19
|
+
def initialize(value=0)
|
20
|
+
@value=value
|
21
|
+
end
|
22
|
+
|
23
|
+
def ps
|
24
|
+
|
25
|
+
"#{@value} #{self.class.to_s.gsub('RGhost::Units::','').downcase} "
|
26
|
+
end
|
27
|
+
|
28
|
+
def Unit.define
|
29
|
+
""
|
30
|
+
end
|
31
|
+
end
|
32
|
+
#n/72 * 2.545
|
33
|
+
class Cm < Unit
|
34
|
+
|
35
|
+
def Cm.define
|
36
|
+
Function.new("cm","72 div 2.545 mul")
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
#n*72
|
42
|
+
class Inch < Unit
|
43
|
+
|
44
|
+
def Inch.define
|
45
|
+
RGhost::Function.new("inch","72 mul")
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
class PSUnit < Unit
|
51
|
+
|
52
|
+
def ps
|
53
|
+
"#{@value} "
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
#Parses units
|
61
|
+
# Units::DEFAULT=Utits::Cm
|
62
|
+
# Units.parse(2) #=> "2 cm"
|
63
|
+
# Units.parse(:current_row) #=> "current_row"
|
64
|
+
# Units.parse("3 inch") #=> "3 inch"
|
65
|
+
# Units.parse("2") #=> "2"
|
66
|
+
#
|
67
|
+
#Using US metric
|
68
|
+
# Units::DEFAULT=Utits::Inch
|
69
|
+
# Units.parse(2) #=> "2 inch"
|
70
|
+
# Units.parse(:current_row) #=> "current_row"
|
71
|
+
# Units.parse("3 cm") #=> "3 cm"
|
72
|
+
# Units.parse("5") #=> "5"
|
73
|
+
def self.parse(value)
|
74
|
+
if value.is_a? Numeric
|
75
|
+
RGhost::Config::GS[:unit].new(value)
|
76
|
+
else
|
77
|
+
RGhost::PsObject.new(value)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "rghost/ps_object"
|
2
|
+
#Creates Postscript variable
|
3
|
+
class RGhost::Variable < RGhost::PsObject
|
4
|
+
|
5
|
+
#===Example
|
6
|
+
# v=Variable.new(:mytext, Show.new("Fooo Barrr") )
|
7
|
+
# doc.set v
|
8
|
+
def initialize(name,value)
|
9
|
+
super("/#{name} #{value} def")
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "rghost/ps_object"
|
2
|
+
require "rghost/units"
|
3
|
+
require "rghost/load"
|
4
|
+
|
5
|
+
#Creates vertical line starting from current row.
|
6
|
+
class RGhost::VerticalLine < RGhost::PsObject
|
7
|
+
DEFAULT_OPTIONS={
|
8
|
+
:start_in=>:limit_left,:size=>:area_y,
|
9
|
+
:border => RGhost::Border::DEFAULT_OPTIONS
|
10
|
+
}
|
11
|
+
#Draws a vertical line where :start_in => y position and :size => size of line.
|
12
|
+
#===Example
|
13
|
+
# doc=Document.new
|
14
|
+
# doc.vertical_line :start_in => 1, :size => 2, :border => {:color => :red}
|
15
|
+
def initialize(options=RGhost::Border::DEFAULT_OPTIONS)
|
16
|
+
super(""){}
|
17
|
+
options=DEFAULT_OPTIONS.dup.merge(options)
|
18
|
+
start_in= RGhost::Units::parse(options[:start_in] || :limit_left)
|
19
|
+
size= RGhost::Units::parse(options[:size]|| :area_y)
|
20
|
+
g=RGhost::Graphic.new
|
21
|
+
g.set RGhost::Border.new(options[:border]) if options[:border]
|
22
|
+
g.raw "#{start_in} #{size} vertical_line "
|
23
|
+
set g
|
24
|
+
end
|
25
|
+
#Draws a vertical line with size or :row_height of the document.
|
26
|
+
# doc=Document.new
|
27
|
+
# doc.vertical_line_row
|
28
|
+
def self.row(border=RGhost::Border::DEFAULT_OPTIONS)
|
29
|
+
|
30
|
+
g=RGhost::Graphic.new
|
31
|
+
g.set RGhost::Border.new(border)
|
32
|
+
g.raw :vlrf
|
33
|
+
g
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#Defines virtual pages for the Document by method virtual_pages
|
2
|
+
class RGhost::VirtualPages < RGhost::PsObject
|
3
|
+
|
4
|
+
DEFAULT_OPTIONS={:width => 5, :margin_left => 0}
|
5
|
+
include RGhost::RubyToPs
|
6
|
+
def initialize(&block)
|
7
|
+
super(''){}
|
8
|
+
@pages=[]
|
9
|
+
instance_eval(&block) if block
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def new_page(options=RGhost::VirtualPages::DEFAULT_OPTIONS)
|
14
|
+
options.merge(RGhost::VirtualPages::DEFAULT_OPTIONS)
|
15
|
+
|
16
|
+
@pages << options
|
17
|
+
end
|
18
|
+
|
19
|
+
def ps
|
20
|
+
first=true
|
21
|
+
all_pages=@pages.map do |p|
|
22
|
+
w=RGhost::Units::parse(p[:width])
|
23
|
+
if first
|
24
|
+
first=false
|
25
|
+
"[#{w}]"
|
26
|
+
else
|
27
|
+
m=RGhost::Units::parse(p[:margin_left])
|
28
|
+
|
29
|
+
"[#{w} #{m}]"
|
30
|
+
|
31
|
+
end
|
32
|
+
#"[#{m} #{w}]"
|
33
|
+
end
|
34
|
+
o=RGhost::PsObject.new
|
35
|
+
o.set RGhost::Variable.new(:has_vp?, true)
|
36
|
+
o.raw "/vp_params [ #{all_pages.join('')} ] def "
|
37
|
+
o.call :vp_proc
|
38
|
+
o
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/lib/rghost.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__)+File::SEPARATOR+"rghost"
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
|
5
|
+
module RGhost
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rghost/ruby_ghost_version'
|
10
|
+
require 'rghost/ps_object'
|
11
|
+
require 'rghost/variable'
|
12
|
+
require 'rghost/ps_facade'
|
13
|
+
require 'rghost/function'
|
14
|
+
require 'rghost/document'
|
15
|
+
require 'rghost/grid/grid'
|
16
|
+
RGhost::Config::GS[:PATH]="/opt/local/bin/gs"
|
17
|
+
|
18
|
+
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lunks_rghost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.7.6
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Shairon Toledo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-20 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Ruby Ghostscript Engine is a document creation and conversion API, support(PDF,PS,GIF,TIF,PNG,JPG...).
|
15
|
+
It uses the GhostScript framework for the format conversion, utilizes EPS templates
|
16
|
+
and is optimized to work with larger documents.
|
17
|
+
email: shairon.toledo@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/rghost/border.rb
|
23
|
+
- lib/rghost/callback.rb
|
24
|
+
- lib/rghost/circle.rb
|
25
|
+
- lib/rghost/color.rb
|
26
|
+
- lib/rghost/constants.rb
|
27
|
+
- lib/rghost/convert.rb
|
28
|
+
- lib/rghost/cursor.rb
|
29
|
+
- lib/rghost/dash.rb
|
30
|
+
- lib/rghost/document.rb
|
31
|
+
- lib/rghost/document_callback_facade.rb
|
32
|
+
- lib/rghost/dsc_entry.rb
|
33
|
+
- lib/rghost/dynamic_document_callback.rb
|
34
|
+
- lib/rghost/eps.rb
|
35
|
+
- lib/rghost/font.rb
|
36
|
+
- lib/rghost/font_map.rb
|
37
|
+
- lib/rghost/frame.rb
|
38
|
+
- lib/rghost/function.rb
|
39
|
+
- lib/rghost/gif.rb
|
40
|
+
- lib/rghost/graphic.rb
|
41
|
+
- lib/rghost/grid/base_grid.rb
|
42
|
+
- lib/rghost/grid/callback_facade.rb
|
43
|
+
- lib/rghost/grid/csv_grid.rb
|
44
|
+
- lib/rghost/grid/dynamic_callback.rb
|
45
|
+
- lib/rghost/grid/field_format.rb
|
46
|
+
- lib/rghost/grid/grid.rb
|
47
|
+
- lib/rghost/grid/header.rb
|
48
|
+
- lib/rghost/grid/matrix.rb
|
49
|
+
- lib/rghost/grid/rails_grid.rb
|
50
|
+
- lib/rghost/grid/static_callback.rb
|
51
|
+
- lib/rghost/grid/style/border_lines.rb
|
52
|
+
- lib/rghost/grid/style/bottom_lines.rb
|
53
|
+
- lib/rghost/grid/style/old_forms.rb
|
54
|
+
- lib/rghost/grid/style/style.rb
|
55
|
+
- lib/rghost/gs_alone.rb
|
56
|
+
- lib/rghost/helpers.rb
|
57
|
+
- lib/rghost/horizontal_line.rb
|
58
|
+
- lib/rghost/how_to.rb
|
59
|
+
- lib/rghost/image.rb
|
60
|
+
- lib/rghost/jpeg.rb
|
61
|
+
- lib/rghost/line.rb
|
62
|
+
- lib/rghost/line_width.rb
|
63
|
+
- lib/rghost/load.rb
|
64
|
+
- lib/rghost/newpath.rb
|
65
|
+
- lib/rghost/paper.rb
|
66
|
+
- lib/rghost/parse_text.rb
|
67
|
+
- lib/rghost/pdf_security.rb
|
68
|
+
- lib/rghost/point.rb
|
69
|
+
- lib/rghost/point_with_command.rb
|
70
|
+
- lib/rghost/polygon.rb
|
71
|
+
- lib/rghost/ps/_cusor.ps
|
72
|
+
- lib/rghost/ps/AdobeExpert.enc
|
73
|
+
- lib/rghost/ps/AdobeLatinEncoding.enc
|
74
|
+
- lib/rghost/ps/basic.ps
|
75
|
+
- lib/rghost/ps/begin_document.ps
|
76
|
+
- lib/rghost/ps/Bengali.enc
|
77
|
+
- lib/rghost/ps/callbacks.ps
|
78
|
+
- lib/rghost/ps/code128.font
|
79
|
+
- lib/rghost/ps/code39.font
|
80
|
+
- lib/rghost/ps/CodePage1250.enc
|
81
|
+
- lib/rghost/ps/CodePage1251.enc
|
82
|
+
- lib/rghost/ps/CodePage1252.enc
|
83
|
+
- lib/rghost/ps/CodePage1253.enc
|
84
|
+
- lib/rghost/ps/CodePage1254.enc
|
85
|
+
- lib/rghost/ps/CodePage1256.enc
|
86
|
+
- lib/rghost/ps/CodePage1257.enc
|
87
|
+
- lib/rghost/ps/CodePage1258.enc
|
88
|
+
- lib/rghost/ps/CodePage874.enc
|
89
|
+
- lib/rghost/ps/cursor.ps
|
90
|
+
- lib/rghost/ps/datagrid.ps
|
91
|
+
- lib/rghost/ps/developer.ps
|
92
|
+
- lib/rghost/ps/ean.font
|
93
|
+
- lib/rghost/ps/eps.ps
|
94
|
+
- lib/rghost/ps/font.ps
|
95
|
+
- lib/rghost/ps/Fontmap
|
96
|
+
- lib/rghost/ps/frame.ps
|
97
|
+
- lib/rghost/ps/gif.ps
|
98
|
+
- lib/rghost/ps/horizontal_line.ps
|
99
|
+
- lib/rghost/ps/i25.font
|
100
|
+
- lib/rghost/ps/IsoLatin.enc
|
101
|
+
- lib/rghost/ps/jpeg.ps
|
102
|
+
- lib/rghost/ps/link.ps
|
103
|
+
- lib/rghost/ps/MacCentralEuropean.enc
|
104
|
+
- lib/rghost/ps/MacCyrillice.desnc
|
105
|
+
- lib/rghost/ps/MacGreek.enc
|
106
|
+
- lib/rghost/ps/MacHebrew.enc
|
107
|
+
- lib/rghost/ps/paper.ps
|
108
|
+
- lib/rghost/ps/rect_link.ps
|
109
|
+
- lib/rghost/ps/rectangle.ps
|
110
|
+
- lib/rghost/ps/rghost_default_template.eps
|
111
|
+
- lib/rghost/ps/row.ps
|
112
|
+
- lib/rghost/ps/show.ps
|
113
|
+
- lib/rghost/ps/table_callbacks.ps
|
114
|
+
- lib/rghost/ps/TeX-CorkEncoding.enc
|
115
|
+
- lib/rghost/ps/TeX-LGR-Greek.enc
|
116
|
+
- lib/rghost/ps/TeX-T2AModified2Encoding.enc
|
117
|
+
- lib/rghost/ps/TeX-T2BAdobeEncoding.enc
|
118
|
+
- lib/rghost/ps/TeX-T2CAdobeEncoding.enc
|
119
|
+
- lib/rghost/ps/TeX-X2AdobeEncoding.enc
|
120
|
+
- lib/rghost/ps/TeX-XL2encoding.enc
|
121
|
+
- lib/rghost/ps/TeXMathExtensionEncoding.enc
|
122
|
+
- lib/rghost/ps/TeXMathItalicEncoding.enc
|
123
|
+
- lib/rghost/ps/TeXMathSymbolEncoding.enc
|
124
|
+
- lib/rghost/ps/text.ps
|
125
|
+
- lib/rghost/ps/textarea.ps
|
126
|
+
- lib/rghost/ps/type.ps
|
127
|
+
- lib/rghost/ps/unit.ps
|
128
|
+
- lib/rghost/ps/US-ASCII.enc
|
129
|
+
- lib/rghost/ps/UTF-8.enc
|
130
|
+
- lib/rghost/ps/vertical_line.ps
|
131
|
+
- lib/rghost/ps/virtual_pages.ps
|
132
|
+
- lib/rghost/ps_facade.rb
|
133
|
+
- lib/rghost/ps_object.rb
|
134
|
+
- lib/rghost/rectangle_link.rb
|
135
|
+
- lib/rghost/rgengine.so
|
136
|
+
- lib/rghost/ruby_ghost_config.rb
|
137
|
+
- lib/rghost/ruby_ghost_engine.rb
|
138
|
+
- lib/rghost/ruby_ghost_version.rb
|
139
|
+
- lib/rghost/ruby_to_ps.rb
|
140
|
+
- lib/rghost/scale.rb
|
141
|
+
- lib/rghost/shape_content.rb
|
142
|
+
- lib/rghost/show.rb
|
143
|
+
- lib/rghost/static_document_callback.rb
|
144
|
+
- lib/rghost/text.rb
|
145
|
+
- lib/rghost/text_in.rb
|
146
|
+
- lib/rghost/text_link_in.rb
|
147
|
+
- lib/rghost/textarea.rb
|
148
|
+
- lib/rghost/units.rb
|
149
|
+
- lib/rghost/variable.rb
|
150
|
+
- lib/rghost/vertical_line.rb
|
151
|
+
- lib/rghost/virtual_pages.rb
|
152
|
+
- lib/rghost.rb
|
153
|
+
homepage: http://rghost.rubyforge.org
|
154
|
+
licenses: []
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
167
|
+
requirements:
|
168
|
+
- - ! '>='
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project: Ruby Ghostscript Engine is a document creation and conversion API,
|
173
|
+
support(PDF,PS,GIF,TIF,PNG,JPG...). It uses the GhostScript framework for the format
|
174
|
+
conversion, utilizes EPS templates and is optimized to work with larger documents.
|
175
|
+
rubygems_version: 1.8.17
|
176
|
+
signing_key:
|
177
|
+
specification_version: 3
|
178
|
+
summary: Ruby Ghostscript Engine is a document creation and conversion API, support(PDF,PS,GIF,TIF,PNG,JPG...).
|
179
|
+
It uses the GhostScript framework for the format conversion, utilizes EPS templates
|
180
|
+
and is optimized to work with larger documents.
|
181
|
+
test_files: []
|