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
@@ -0,0 +1,43 @@
|
|
1
|
+
# Convert PDF file to another format using commom render parameters of the Engine
|
2
|
+
# A additional parameter for this method is :range. Below someone examples:
|
3
|
+
#
|
4
|
+
# ====Only cover page
|
5
|
+
# Convert.new("/dir/myfile.pdf").to :jpeg, :filename => "/tmp/test.jpg"
|
6
|
+
#
|
7
|
+
# ====One page per file
|
8
|
+
# It's generate file with pattern test_0001.png, test_0002.png, etc
|
9
|
+
# Convert.new("/dir/myfile.pdf").to :png, :multipage => true, :filename => "/tmp/test.png"
|
10
|
+
#
|
11
|
+
# ====One page per file with page range
|
12
|
+
# Convert.new("/dir/myfile.pdf").to :eps, :multipage => true, :filename => "/tmp/test.eps", :range => 1..5
|
13
|
+
#
|
14
|
+
# ====Getting files after convertion
|
15
|
+
# files=Convert.new("/dir/myfile.pdf").to :eps, :multipage => true, :filename => "/tmp/test.eps", :range => 1..5
|
16
|
+
# files.class # => Array because parameter multipage is true
|
17
|
+
#
|
18
|
+
# file=Convert.new("/dir/myfile.pdf").to :eps, :filename => "/tmp/test.eps"
|
19
|
+
# file.class # => File
|
20
|
+
#
|
21
|
+
class RGhost::Convert
|
22
|
+
attr_reader :error, :errors
|
23
|
+
|
24
|
+
|
25
|
+
def initialize(filename)
|
26
|
+
@filename=filename
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def to(device, options={})
|
33
|
+
rge=RGhost::Engine.new(@filename,{:convert=>true}.merge(options))
|
34
|
+
|
35
|
+
|
36
|
+
out=rge.render(device)
|
37
|
+
@error=rge.error
|
38
|
+
@errors=rge.errors
|
39
|
+
out
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require "rghost/point"
|
2
|
+
require 'rghost/ps_object'
|
3
|
+
require 'rghost/point_with_command'
|
4
|
+
#It resposible to cursor manipulate. Use it to position objects on the page.
|
5
|
+
class RGhost::Cursor < RGhost::PsObject
|
6
|
+
|
7
|
+
#The class method goto positioned the cursor based on page row number. Example:
|
8
|
+
# d=Document.new
|
9
|
+
# d.goto_row 15
|
10
|
+
# d.show " You're on row 15"
|
11
|
+
# d.goto_row 3
|
12
|
+
# d.show "Now you're on row 3"
|
13
|
+
#
|
14
|
+
# #or without facade(**it's valid for all methods on this class**)
|
15
|
+
#
|
16
|
+
# d=Document.new
|
17
|
+
# d.set Cursor.goto_row(15)
|
18
|
+
# d.set Show.new(" You're on row 15")
|
19
|
+
# d.set Cursor.goto_row(3)
|
20
|
+
# d.set Show.new("Now you're on row 3")
|
21
|
+
def self.goto_row(row)
|
22
|
+
g=RGhost::PsObject.new(row.to_i)
|
23
|
+
g.call :goto_row
|
24
|
+
g.call :default_point
|
25
|
+
g
|
26
|
+
end
|
27
|
+
#Jump n rows relative to the current row
|
28
|
+
# d=Document.new
|
29
|
+
# d.jump_row 4 # jump four rows below
|
30
|
+
# d.jump_row -5 # backing five rows to up
|
31
|
+
def self.jump_rows(row)
|
32
|
+
j=RGhost::PsObject.new(row.to_i)
|
33
|
+
j.call :jump_rows
|
34
|
+
j.call :default_point
|
35
|
+
j
|
36
|
+
end
|
37
|
+
#Rotate all objects after execution it, passing the angle as argument.
|
38
|
+
# d=Document.new
|
39
|
+
# d.rotate 90
|
40
|
+
# #do something
|
41
|
+
# d.rotate -90 # backing to source angle
|
42
|
+
def self.rotate(angle)
|
43
|
+
r=RGhost::PsObject.new(angle.to_i)
|
44
|
+
r.call :rotate
|
45
|
+
r
|
46
|
+
end
|
47
|
+
#Move cursor to absolute point relative from default source point x=0 and y=0 of the page. It no interferes to the rows positions.
|
48
|
+
# doc=Document.new
|
49
|
+
# doc.moveto :x=> 10, :y=> 5
|
50
|
+
# doc.show "Hello Girls!!!"
|
51
|
+
def self.moveto(point={})
|
52
|
+
RGhost::PointWithCommand.to(:moveto,point)
|
53
|
+
end
|
54
|
+
#It works the same way that moveto, the unique difference it's relative from current point.
|
55
|
+
# doc=Document.new
|
56
|
+
# doc.moveto :x=> 10, :y=> 5
|
57
|
+
# doc.show "Hello Girls!!!"
|
58
|
+
# doc.rmoveto :x => 5 # move to x=> 15 (10 plus 5) maintaining y => 5
|
59
|
+
def self.rmoveto(point={})
|
60
|
+
RGhost::PointWithCommand.to(:rmoveto,point)
|
61
|
+
end
|
62
|
+
#It changes the default pont to a new point(dislocate)
|
63
|
+
# doc=Document.new
|
64
|
+
# doc.translate :x=> 2, :y=> 1
|
65
|
+
# doc.moveto :x => 0,:y => 0 # if it was default point(0,0) would be :x=> 2, :y=> 1
|
66
|
+
# doc.translate :x=> -2, :y=> -1 # return to default source point
|
67
|
+
def self.translate(point={:x =>0 , :y => 0})
|
68
|
+
p={:x =>0 , :y => 0}.merge(point)
|
69
|
+
RGhost::PointWithCommand.to(:translate,p)
|
70
|
+
end
|
71
|
+
|
72
|
+
#Jump one next row. It's same that jump_row(1).
|
73
|
+
# doc=Document.new
|
74
|
+
# doc.show "Row 1"
|
75
|
+
# doc.next_row
|
76
|
+
# doc.show "Row 2"
|
77
|
+
# doc.next_row
|
78
|
+
# doc.show "Row 3"
|
79
|
+
def self.next_row
|
80
|
+
RGhost::PsObject.new(:nrdp)
|
81
|
+
end
|
82
|
+
#It go to next page resetting the cursors.
|
83
|
+
# doc=Document.new
|
84
|
+
# doc.show "Page 1 row 1"
|
85
|
+
# doc.next_page
|
86
|
+
# doc.show "Page 2 row 1"
|
87
|
+
# doc.next_page
|
88
|
+
# doc.show "Page 3 row 1"
|
89
|
+
def next_page
|
90
|
+
RGhost::PsObject.new :next_page
|
91
|
+
end
|
92
|
+
#It go to next page without resetting the cursors. Often used for single page document.
|
93
|
+
# doc=Document.new
|
94
|
+
# doc.show "Page 1 row 1"
|
95
|
+
# doc.showpage # page 2, but internally
|
96
|
+
# doc.show "Page 1 row 1"
|
97
|
+
# doc.showpage # page 3
|
98
|
+
# doc.show "Page 1 row 1"
|
99
|
+
def showpage
|
100
|
+
RGhost::PsObject.new :showpage
|
101
|
+
end
|
102
|
+
#(Class method) It go to next page resetting the cursors.
|
103
|
+
# doc=Document.new
|
104
|
+
# doc.show "Page 1 row 1"
|
105
|
+
# doc.next_page
|
106
|
+
# doc.show "Page 2 row 1"
|
107
|
+
# doc.next_page
|
108
|
+
# doc.show "Page 3 row 1"
|
109
|
+
def self.next_page
|
110
|
+
RGhost::PsObject.new :next_page
|
111
|
+
end
|
112
|
+
#(Class method) It go to next page without resetting the cursors. Often used for single page document.
|
113
|
+
# doc=Document.new
|
114
|
+
# doc.show "Page 1 row 1"
|
115
|
+
# doc.showpage # page 2, but internally
|
116
|
+
# doc.show "Page 1 row 1"
|
117
|
+
# doc.showpage # page 3
|
118
|
+
# doc.show "Page 1 row 1"
|
119
|
+
def self.showpage
|
120
|
+
RGhost::PsObject.new :showpage
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
data/lib/rghost/dash.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#Sets the dash pattern on border lines. It accepts an array of
|
2
|
+
#non-negative numbers with atleast one non-zero. Samples:
|
3
|
+
# [2,1] #=> 2 turn on and 1 off, 2 turn on and 1 off ...
|
4
|
+
# [3,1,2,5] #=> 3 on, 1 off, 2 on, 5 off ... repeating until end
|
5
|
+
#
|
6
|
+
#
|
7
|
+
#===Examples using dash as border parameter
|
8
|
+
# d=Document.new
|
9
|
+
# d.horizontal_line(:bottom, :border=>{:dash => 1, :width => 2 })
|
10
|
+
#link:images/dash01.png
|
11
|
+
#
|
12
|
+
# d=Document.new
|
13
|
+
# d.horizontal_line(:bottom, :border=>{:dash => [1,1], :width => 2 })
|
14
|
+
#link:images/dash01.png
|
15
|
+
#
|
16
|
+
# d=Document.new
|
17
|
+
# d.horizontal_line(:bottom, :border=>{:dash => [1,2,1], :width => 2 })
|
18
|
+
#link:images/dash03.png
|
19
|
+
#
|
20
|
+
# d=Document.new
|
21
|
+
# d.horizontal_line(:bottom, :border=>{:dash => [2,10,5], :width => 2 })
|
22
|
+
#link:images/dash04.png
|
23
|
+
#
|
24
|
+
# d=Document.new
|
25
|
+
# d.horizontal_line(:bottom, :border=>{:dash => [1,1,3,1,5,1,7,1,9,1,10], :width => 4 })
|
26
|
+
#link:images/dash05.png
|
27
|
+
#
|
28
|
+
#===Examples using Dash class
|
29
|
+
# d=Document.new
|
30
|
+
# d.scale(1,8)
|
31
|
+
# d.set Dash.new([1,1,2,1,2,1,3])
|
32
|
+
# d.line_width 3
|
33
|
+
# d.lineto :x => :limit_right, :y => :Y
|
34
|
+
#link:images/dash06.png
|
35
|
+
|
36
|
+
|
37
|
+
class RGhost::Dash < RGhost::PsObject
|
38
|
+
include RGhost::RubyToPs
|
39
|
+
DEFAULT_OPTIONS={
|
40
|
+
:style => [1,2,3],
|
41
|
+
:offset => 0
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
def initialize(options={})
|
46
|
+
super(""){}
|
47
|
+
if options.is_a?(Numeric) || options.is_a?(Array)
|
48
|
+
@options = DEFAULT_OPTIONS.dup.merge(:style => options)
|
49
|
+
else
|
50
|
+
@options = DEFAULT_OPTIONS.dup.merge(options)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def ps
|
55
|
+
ary=to_array( [@options[:style]].flatten)
|
56
|
+
"#{ary}#{@options[:offset]} setdash"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|