rghost-ruby1.9-beta 0.8.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/lib/rghost.rb +18 -0
  2. data/lib/rghost/border.rb +44 -0
  3. data/lib/rghost/callback.rb +58 -0
  4. data/lib/rghost/circle.rb +102 -0
  5. data/lib/rghost/color.rb +175 -0
  6. data/lib/rghost/constants.rb +626 -0
  7. data/lib/rghost/convert.rb +43 -0
  8. data/lib/rghost/cursor.rb +124 -0
  9. data/lib/rghost/dash.rb +59 -0
  10. data/lib/rghost/document.rb +546 -0
  11. data/lib/rghost/document_callback_facade.rb +64 -0
  12. data/lib/rghost/dsc_entry.rb +20 -0
  13. data/lib/rghost/dynamic_document_callback.rb +15 -0
  14. data/lib/rghost/eps.rb +31 -0
  15. data/lib/rghost/font.rb +48 -0
  16. data/lib/rghost/font_map.rb +54 -0
  17. data/lib/rghost/frame.rb +105 -0
  18. data/lib/rghost/function.rb +38 -0
  19. data/lib/rghost/gif.rb +41 -0
  20. data/lib/rghost/graphic.rb +26 -0
  21. data/lib/rghost/grid/base_grid.rb +228 -0
  22. data/lib/rghost/grid/callback_facade.rb +136 -0
  23. data/lib/rghost/grid/csv_grid.rb +51 -0
  24. data/lib/rghost/grid/dynamic_callback.rb +12 -0
  25. data/lib/rghost/grid/field_format.rb +43 -0
  26. data/lib/rghost/grid/grid.rb +15 -0
  27. data/lib/rghost/grid/header.rb +120 -0
  28. data/lib/rghost/grid/matrix.rb +10 -0
  29. data/lib/rghost/grid/rails_grid.rb +74 -0
  30. data/lib/rghost/grid/static_callback.rb +13 -0
  31. data/lib/rghost/grid/style/border_lines.rb +44 -0
  32. data/lib/rghost/grid/style/bottom_lines.rb +28 -0
  33. data/lib/rghost/grid/style/old_forms.rb +28 -0
  34. data/lib/rghost/grid/style/style.rb +8 -0
  35. data/lib/rghost/gs_alone.rb +25 -0
  36. data/lib/rghost/helpers.rb +13 -0
  37. data/lib/rghost/horizontal_line.rb +45 -0
  38. data/lib/rghost/how_to.rb +75 -0
  39. data/lib/rghost/image.rb +26 -0
  40. data/lib/rghost/jpeg.rb +39 -0
  41. data/lib/rghost/line.rb +89 -0
  42. data/lib/rghost/line_width.rb +28 -0
  43. data/lib/rghost/load.rb +43 -0
  44. data/lib/rghost/newpath.rb +19 -0
  45. data/lib/rghost/paper.rb +147 -0
  46. data/lib/rghost/parse_text.rb +53 -0
  47. data/lib/rghost/pdf_security.rb +36 -0
  48. data/lib/rghost/point.rb +23 -0
  49. data/lib/rghost/point_with_command.rb +17 -0
  50. data/lib/rghost/polygon.rb +75 -0
  51. data/lib/rghost/ps/AdobeExpert.enc +258 -0
  52. data/lib/rghost/ps/AdobeLatinEncoding.enc +258 -0
  53. data/lib/rghost/ps/Bengali.enc +386 -0
  54. data/lib/rghost/ps/CodePage1250.enc +258 -0
  55. data/lib/rghost/ps/CodePage1251.enc +258 -0
  56. data/lib/rghost/ps/CodePage1252.enc +258 -0
  57. data/lib/rghost/ps/CodePage1253.enc +258 -0
  58. data/lib/rghost/ps/CodePage1254.enc +258 -0
  59. data/lib/rghost/ps/CodePage1256.enc +258 -0
  60. data/lib/rghost/ps/CodePage1257.enc +258 -0
  61. data/lib/rghost/ps/CodePage1258.enc +258 -0
  62. data/lib/rghost/ps/CodePage874.enc +258 -0
  63. data/lib/rghost/ps/Fontmap +5 -0
  64. data/lib/rghost/ps/IsoLatin.enc +352 -0
  65. data/lib/rghost/ps/MacCentralEuropean.enc +258 -0
  66. data/lib/rghost/ps/MacCyrillice.desnc +258 -0
  67. data/lib/rghost/ps/MacGreek.enc +258 -0
  68. data/lib/rghost/ps/MacHebrew.enc +258 -0
  69. data/lib/rghost/ps/TeX-CorkEncoding.enc +258 -0
  70. data/lib/rghost/ps/TeX-LGR-Greek.enc +258 -0
  71. data/lib/rghost/ps/TeX-T2AModified2Encoding.enc +258 -0
  72. data/lib/rghost/ps/TeX-T2BAdobeEncoding.enc +258 -0
  73. data/lib/rghost/ps/TeX-T2CAdobeEncoding.enc +258 -0
  74. data/lib/rghost/ps/TeX-X2AdobeEncoding.enc +258 -0
  75. data/lib/rghost/ps/TeX-XL2encoding.enc +258 -0
  76. data/lib/rghost/ps/TeXMathExtensionEncoding.enc +258 -0
  77. data/lib/rghost/ps/TeXMathItalicEncoding.enc +258 -0
  78. data/lib/rghost/ps/TeXMathSymbolEncoding.enc +258 -0
  79. data/lib/rghost/ps/US-ASCII.enc +258 -0
  80. data/lib/rghost/ps/UTF-8.enc +3 -0
  81. data/lib/rghost/ps/_cusor.ps +46 -0
  82. data/lib/rghost/ps/basic.ps +25 -0
  83. data/lib/rghost/ps/begin_document.ps +8 -0
  84. data/lib/rghost/ps/callbacks.ps +175 -0
  85. data/lib/rghost/ps/code128.font +344 -0
  86. data/lib/rghost/ps/code39.font +195 -0
  87. data/lib/rghost/ps/cursor.ps +106 -0
  88. data/lib/rghost/ps/datagrid.ps +55 -0
  89. data/lib/rghost/ps/developer.ps +237 -0
  90. data/lib/rghost/ps/ean.font +150 -0
  91. data/lib/rghost/ps/eps.ps +42 -0
  92. data/lib/rghost/ps/font.ps +38 -0
  93. data/lib/rghost/ps/frame.ps +16 -0
  94. data/lib/rghost/ps/gif.ps +150 -0
  95. data/lib/rghost/ps/horizontal_line.ps +4 -0
  96. data/lib/rghost/ps/i25.font +103 -0
  97. data/lib/rghost/ps/jpeg.ps +122 -0
  98. data/lib/rghost/ps/link.ps +22 -0
  99. data/lib/rghost/ps/paper.ps +8 -0
  100. data/lib/rghost/ps/rect_link.ps +17 -0
  101. data/lib/rghost/ps/rectangle.ps +5 -0
  102. data/lib/rghost/ps/rghost_default_template.eps +1532 -0
  103. data/lib/rghost/ps/row.ps +4 -0
  104. data/lib/rghost/ps/show.ps +21 -0
  105. data/lib/rghost/ps/table_callbacks.ps +96 -0
  106. data/lib/rghost/ps/text.ps +63 -0
  107. data/lib/rghost/ps/textarea.ps +11 -0
  108. data/lib/rghost/ps/type.ps +1 -0
  109. data/lib/rghost/ps/unit.ps +3 -0
  110. data/lib/rghost/ps/vertical_line.ps +12 -0
  111. data/lib/rghost/ps/virtual_pages.ps +55 -0
  112. data/lib/rghost/ps_facade.rb +253 -0
  113. data/lib/rghost/ps_object.rb +55 -0
  114. data/lib/rghost/rectangle_link.rb +65 -0
  115. data/lib/rghost/rgengine.so +0 -0
  116. data/lib/rghost/ruby_ghost_config.rb +243 -0
  117. data/lib/rghost/ruby_ghost_engine.rb +156 -0
  118. data/lib/rghost/ruby_ghost_version.rb +8 -0
  119. data/lib/rghost/ruby_to_ps.rb +78 -0
  120. data/lib/rghost/scale.rb +29 -0
  121. data/lib/rghost/shape_content.rb +23 -0
  122. data/lib/rghost/show.rb +88 -0
  123. data/lib/rghost/static_document_callback.rb +18 -0
  124. data/lib/rghost/text.rb +44 -0
  125. data/lib/rghost/text_in.rb +51 -0
  126. data/lib/rghost/text_link_in.rb +42 -0
  127. data/lib/rghost/textarea.rb +88 -0
  128. data/lib/rghost/units.rb +82 -0
  129. data/lib/rghost/variable.rb +12 -0
  130. data/lib/rghost/vertical_line.rb +37 -0
  131. data/lib/rghost/virtual_pages.rb +42 -0
  132. metadata +185 -0
@@ -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
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rghost-ruby1.9-beta
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.7.2
5
+ platform: ruby
6
+ authors:
7
+ - Shairon Toledo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-31 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Ruby Ghostscript Engine is a document creation and conversion API, support(PDF,PS,GIF,TIF,PNG,JPG...). It uses the GhostScript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents.
17
+ email: shairon.toledo@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/rghost/border.rb
26
+ - lib/rghost/callback.rb
27
+ - lib/rghost/circle.rb
28
+ - lib/rghost/color.rb
29
+ - lib/rghost/constants.rb
30
+ - lib/rghost/convert.rb
31
+ - lib/rghost/cursor.rb
32
+ - lib/rghost/dash.rb
33
+ - lib/rghost/document.rb
34
+ - lib/rghost/document_callback_facade.rb
35
+ - lib/rghost/dsc_entry.rb
36
+ - lib/rghost/dynamic_document_callback.rb
37
+ - lib/rghost/eps.rb
38
+ - lib/rghost/font.rb
39
+ - lib/rghost/font_map.rb
40
+ - lib/rghost/frame.rb
41
+ - lib/rghost/function.rb
42
+ - lib/rghost/gif.rb
43
+ - lib/rghost/graphic.rb
44
+ - lib/rghost/grid/base_grid.rb
45
+ - lib/rghost/grid/callback_facade.rb
46
+ - lib/rghost/grid/csv_grid.rb
47
+ - lib/rghost/grid/dynamic_callback.rb
48
+ - lib/rghost/grid/field_format.rb
49
+ - lib/rghost/grid/grid.rb
50
+ - lib/rghost/grid/header.rb
51
+ - lib/rghost/grid/matrix.rb
52
+ - lib/rghost/grid/rails_grid.rb
53
+ - lib/rghost/grid/static_callback.rb
54
+ - lib/rghost/grid/style/border_lines.rb
55
+ - lib/rghost/grid/style/bottom_lines.rb
56
+ - lib/rghost/grid/style/old_forms.rb
57
+ - lib/rghost/grid/style/style.rb
58
+ - lib/rghost/gs_alone.rb
59
+ - lib/rghost/helpers.rb
60
+ - lib/rghost/horizontal_line.rb
61
+ - lib/rghost/how_to.rb
62
+ - lib/rghost/image.rb
63
+ - lib/rghost/jpeg.rb
64
+ - lib/rghost/line.rb
65
+ - lib/rghost/line_width.rb
66
+ - lib/rghost/load.rb
67
+ - lib/rghost/newpath.rb
68
+ - lib/rghost/paper.rb
69
+ - lib/rghost/parse_text.rb
70
+ - lib/rghost/pdf_security.rb
71
+ - lib/rghost/point.rb
72
+ - lib/rghost/point_with_command.rb
73
+ - lib/rghost/polygon.rb
74
+ - lib/rghost/ps/_cusor.ps
75
+ - lib/rghost/ps/AdobeExpert.enc
76
+ - lib/rghost/ps/AdobeLatinEncoding.enc
77
+ - lib/rghost/ps/basic.ps
78
+ - lib/rghost/ps/begin_document.ps
79
+ - lib/rghost/ps/Bengali.enc
80
+ - lib/rghost/ps/callbacks.ps
81
+ - lib/rghost/ps/code128.font
82
+ - lib/rghost/ps/code39.font
83
+ - lib/rghost/ps/CodePage1250.enc
84
+ - lib/rghost/ps/CodePage1251.enc
85
+ - lib/rghost/ps/CodePage1252.enc
86
+ - lib/rghost/ps/CodePage1253.enc
87
+ - lib/rghost/ps/CodePage1254.enc
88
+ - lib/rghost/ps/CodePage1256.enc
89
+ - lib/rghost/ps/CodePage1257.enc
90
+ - lib/rghost/ps/CodePage1258.enc
91
+ - lib/rghost/ps/CodePage874.enc
92
+ - lib/rghost/ps/cursor.ps
93
+ - lib/rghost/ps/datagrid.ps
94
+ - lib/rghost/ps/developer.ps
95
+ - lib/rghost/ps/ean.font
96
+ - lib/rghost/ps/eps.ps
97
+ - lib/rghost/ps/font.ps
98
+ - lib/rghost/ps/Fontmap
99
+ - lib/rghost/ps/frame.ps
100
+ - lib/rghost/ps/gif.ps
101
+ - lib/rghost/ps/horizontal_line.ps
102
+ - lib/rghost/ps/i25.font
103
+ - lib/rghost/ps/IsoLatin.enc
104
+ - lib/rghost/ps/jpeg.ps
105
+ - lib/rghost/ps/link.ps
106
+ - lib/rghost/ps/MacCentralEuropean.enc
107
+ - lib/rghost/ps/MacCyrillice.desnc
108
+ - lib/rghost/ps/MacGreek.enc
109
+ - lib/rghost/ps/MacHebrew.enc
110
+ - lib/rghost/ps/paper.ps
111
+ - lib/rghost/ps/rect_link.ps
112
+ - lib/rghost/ps/rectangle.ps
113
+ - lib/rghost/ps/rghost_default_template.eps
114
+ - lib/rghost/ps/row.ps
115
+ - lib/rghost/ps/show.ps
116
+ - lib/rghost/ps/table_callbacks.ps
117
+ - lib/rghost/ps/TeX-CorkEncoding.enc
118
+ - lib/rghost/ps/TeX-LGR-Greek.enc
119
+ - lib/rghost/ps/TeX-T2AModified2Encoding.enc
120
+ - lib/rghost/ps/TeX-T2BAdobeEncoding.enc
121
+ - lib/rghost/ps/TeX-T2CAdobeEncoding.enc
122
+ - lib/rghost/ps/TeX-X2AdobeEncoding.enc
123
+ - lib/rghost/ps/TeX-XL2encoding.enc
124
+ - lib/rghost/ps/TeXMathExtensionEncoding.enc
125
+ - lib/rghost/ps/TeXMathItalicEncoding.enc
126
+ - lib/rghost/ps/TeXMathSymbolEncoding.enc
127
+ - lib/rghost/ps/text.ps
128
+ - lib/rghost/ps/textarea.ps
129
+ - lib/rghost/ps/type.ps
130
+ - lib/rghost/ps/unit.ps
131
+ - lib/rghost/ps/US-ASCII.enc
132
+ - lib/rghost/ps/UTF-8.enc
133
+ - lib/rghost/ps/vertical_line.ps
134
+ - lib/rghost/ps/virtual_pages.ps
135
+ - lib/rghost/ps_facade.rb
136
+ - lib/rghost/ps_object.rb
137
+ - lib/rghost/rectangle_link.rb
138
+ - lib/rghost/rgengine.so
139
+ - lib/rghost/ruby_ghost_config.rb
140
+ - lib/rghost/ruby_ghost_engine.rb
141
+ - lib/rghost/ruby_ghost_version.rb
142
+ - lib/rghost/ruby_to_ps.rb
143
+ - lib/rghost/scale.rb
144
+ - lib/rghost/shape_content.rb
145
+ - lib/rghost/show.rb
146
+ - lib/rghost/static_document_callback.rb
147
+ - lib/rghost/text.rb
148
+ - lib/rghost/text_in.rb
149
+ - lib/rghost/text_link_in.rb
150
+ - lib/rghost/textarea.rb
151
+ - lib/rghost/units.rb
152
+ - lib/rghost/variable.rb
153
+ - lib/rghost/vertical_line.rb
154
+ - lib/rghost/virtual_pages.rb
155
+ - lib/rghost.rb
156
+ has_rdoc: true
157
+ homepage: http://rghost.rubyforge.org
158
+ licenses: []
159
+
160
+ post_install_message:
161
+ rdoc_options: []
162
+
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: "0"
170
+ version:
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: "0"
176
+ version:
177
+ requirements: []
178
+
179
+ rubyforge_project: Ruby Ghostscript Engine is a document creation and conversion API, support(PDF,PS,GIF,TIF,PNG,JPG...). It uses the GhostScript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents.
180
+ rubygems_version: 1.3.4
181
+ signing_key:
182
+ specification_version: 3
183
+ summary: Ruby Ghostscript Engine is a document creation and conversion API, support(PDF,PS,GIF,TIF,PNG,JPG...). It uses the GhostScript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents.
184
+ test_files: []
185
+