prawn-core 0.5.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HACKING +46 -0
- data/README +9 -3
- data/Rakefile +7 -6
- data/examples/bounding_box/stretched_nesting.rb +67 -0
- data/examples/general/margin.rb +36 -0
- data/examples/general/multi_page_layout.rb +3 -1
- data/examples/general/page_numbering.rb +15 -0
- data/examples/general/stamp.rb +45 -0
- data/examples/graphics/stroke_cap_and_join.rb +45 -0
- data/examples/graphics/stroke_dash.rb +42 -0
- data/examples/graphics/transparency.rb +26 -0
- data/examples/text/text_box_returning_excess.rb +51 -0
- data/lib/prawn/byte_string.rb +7 -0
- data/lib/prawn/core.rb +7 -8
- data/lib/prawn/document/annotations.rb +3 -2
- data/lib/prawn/document/bounding_box.rb +15 -10
- data/lib/prawn/document/column_box.rb +1 -3
- data/lib/prawn/document/destinations.rb +11 -10
- data/lib/prawn/document/internals.rb +62 -19
- data/lib/prawn/document/snapshot.rb +71 -0
- data/lib/prawn/document/text/box.rb +7 -0
- data/lib/prawn/document/text/wrapping.rb +3 -0
- data/lib/prawn/document/text.rb +9 -2
- data/lib/prawn/document.rb +141 -25
- data/lib/prawn/errors.rb +12 -0
- data/lib/prawn/font/afm.rb +1 -1
- data/lib/prawn/font/ttf.rb +5 -5
- data/lib/prawn/font.rb +8 -5
- data/lib/prawn/graphics/cap_style.rb +35 -0
- data/lib/prawn/graphics/dash.rb +69 -0
- data/lib/prawn/graphics/join_style.rb +35 -0
- data/lib/prawn/graphics/transparency.rb +56 -0
- data/lib/prawn/graphics.rb +9 -1
- data/lib/prawn/images.rb +4 -4
- data/lib/prawn/name_tree.rb +2 -1
- data/lib/prawn/object_store.rb +63 -0
- data/lib/prawn/pdf_object.rb +4 -0
- data/lib/prawn/reference.rb +18 -5
- data/lib/prawn/stamp.rb +87 -0
- data/spec/bounding_box_spec.rb +9 -0
- data/spec/document_spec.rb +58 -5
- data/spec/images_spec.rb +1 -1
- data/spec/name_tree_spec.rb +14 -5
- data/spec/object_store_spec.rb +42 -0
- data/spec/pdf_object_spec.rb +5 -0
- data/spec/reference_spec.rb +40 -0
- data/spec/snapshot_spec.rb +115 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/stamp_spec.rb +98 -0
- data/spec/stroke_styles_spec.rb +152 -0
- data/spec/text_box_spec.rb +26 -0
- data/spec/text_spec.rb +8 -1
- data/spec/transparency_spec.rb +61 -0
- data/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +18 -0
- data/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +40 -1
- data/vendor/pdf-inspector/lib/pdf/inspector/page.rb +12 -3
- data/vendor/pdf-inspector/lib/pdf/inspector.rb +2 -1
- metadata +26 -2
@@ -75,6 +75,45 @@ module PDF
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
class Dash < Inspector
|
79
|
+
attr_reader :stroke_dash, :stroke_dash_count
|
80
|
+
|
81
|
+
def initialize
|
82
|
+
@stroke_dash_count = 0
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_line_dash(*params)
|
86
|
+
@stroke_dash_count += 1
|
87
|
+
@stroke_dash = params
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
class CapStyle < Inspector
|
92
|
+
attr_reader :cap_style, :cap_style_count
|
93
|
+
|
94
|
+
def initialize
|
95
|
+
@cap_style_count = 0
|
96
|
+
end
|
97
|
+
|
98
|
+
def set_line_cap_style(*params)
|
99
|
+
@cap_style_count += 1
|
100
|
+
@cap_style = params[0]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class JoinStyle < Inspector
|
105
|
+
attr_reader :join_style, :join_style_count
|
106
|
+
|
107
|
+
def initialize
|
108
|
+
@join_style_count = 0
|
109
|
+
end
|
110
|
+
|
111
|
+
def set_line_join_style(*params)
|
112
|
+
@join_style_count += 1
|
113
|
+
@join_style = params[0]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
78
117
|
end
|
79
118
|
end
|
80
|
-
end
|
119
|
+
end
|
@@ -1,16 +1,25 @@
|
|
1
1
|
module PDF
|
2
2
|
class Inspector
|
3
3
|
class Page < Inspector
|
4
|
-
attr_reader :pages
|
4
|
+
attr_reader :pages
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@pages = []
|
8
8
|
end
|
9
9
|
|
10
10
|
def begin_page(params)
|
11
|
-
@pages << {:size => params[:MediaBox][-2..-1]}
|
11
|
+
@pages << {:size => params[:MediaBox][-2..-1], :strings => []}
|
12
12
|
end
|
13
|
+
|
14
|
+
def show_text(*params)
|
15
|
+
@pages.last[:strings] << params[0]
|
16
|
+
end
|
17
|
+
|
18
|
+
def show_text_with_positioning(*params)
|
19
|
+
# ignore kerning information
|
20
|
+
@pages.last[:strings] << params[0].reject { |e| Numeric === e }.join
|
21
|
+
end
|
13
22
|
|
14
23
|
end
|
15
24
|
end
|
16
|
-
end
|
25
|
+
end
|
@@ -2,6 +2,7 @@ require "rubygems"
|
|
2
2
|
require "pdf/reader"
|
3
3
|
require "pdf/inspector/text"
|
4
4
|
require "pdf/inspector/xobject"
|
5
|
+
require "pdf/inspector/extgstate"
|
5
6
|
require "pdf/inspector/graphics"
|
6
7
|
require "pdf/inspector/page"
|
7
8
|
|
@@ -22,4 +23,4 @@ module PDF
|
|
22
23
|
PDF::Reader::Buffer.new(StringIO.new(obj)), nil).parse_token
|
23
24
|
end
|
24
25
|
end
|
25
|
-
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -20,6 +20,7 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
+
- HACKING
|
23
24
|
- README
|
24
25
|
- LICENSE
|
25
26
|
- COPYING
|
@@ -27,14 +28,18 @@ files:
|
|
27
28
|
- examples/bounding_box/bounding_boxes.rb
|
28
29
|
- examples/bounding_box/indentation.rb
|
29
30
|
- examples/bounding_box/russian_boxes.rb
|
31
|
+
- examples/bounding_box/stretched_nesting.rb
|
30
32
|
- examples/column_box/column_box_example.rb
|
31
33
|
- examples/example_helper.rb
|
32
34
|
- examples/general/background.rb
|
33
35
|
- examples/general/canvas.rb
|
36
|
+
- examples/general/margin.rb
|
34
37
|
- examples/general/measurement_units.rb
|
35
38
|
- examples/general/metadata-info.rb
|
36
39
|
- examples/general/multi_page_layout.rb
|
37
40
|
- examples/general/page_geometry.rb
|
41
|
+
- examples/general/page_numbering.rb
|
42
|
+
- examples/general/stamp.rb
|
38
43
|
- examples/graphics/basic_images.rb
|
39
44
|
- examples/graphics/cmyk.rb
|
40
45
|
- examples/graphics/curves.rb
|
@@ -48,6 +53,9 @@ files:
|
|
48
53
|
- examples/graphics/remote_images.rb
|
49
54
|
- examples/graphics/ruport_style_helpers.rb
|
50
55
|
- examples/graphics/stroke_bounds.rb
|
56
|
+
- examples/graphics/stroke_cap_and_join.rb
|
57
|
+
- examples/graphics/stroke_dash.rb
|
58
|
+
- examples/graphics/transparency.rb
|
51
59
|
- examples/m17n/chinese_text_wrapping.rb
|
52
60
|
- examples/m17n/euro.rb
|
53
61
|
- examples/m17n/sjis.rb
|
@@ -63,7 +71,9 @@ files:
|
|
63
71
|
- examples/text/simple_text_ttf.rb
|
64
72
|
- examples/text/span.rb
|
65
73
|
- examples/text/text_box.rb
|
74
|
+
- examples/text/text_box_returning_excess.rb
|
66
75
|
- examples/text/text_flow.rb
|
76
|
+
- lib/prawn/byte_string.rb
|
67
77
|
- lib/prawn/compatibility.rb
|
68
78
|
- lib/prawn/core.rb
|
69
79
|
- lib/prawn/document/annotations.rb
|
@@ -72,6 +82,7 @@ files:
|
|
72
82
|
- lib/prawn/document/destinations.rb
|
73
83
|
- lib/prawn/document/internals.rb
|
74
84
|
- lib/prawn/document/page_geometry.rb
|
85
|
+
- lib/prawn/document/snapshot.rb
|
75
86
|
- lib/prawn/document/span.rb
|
76
87
|
- lib/prawn/document/text/box.rb
|
77
88
|
- lib/prawn/document/text/wrapping.rb
|
@@ -83,7 +94,11 @@ files:
|
|
83
94
|
- lib/prawn/font/dfont.rb
|
84
95
|
- lib/prawn/font/ttf.rb
|
85
96
|
- lib/prawn/font.rb
|
97
|
+
- lib/prawn/graphics/cap_style.rb
|
86
98
|
- lib/prawn/graphics/color.rb
|
99
|
+
- lib/prawn/graphics/dash.rb
|
100
|
+
- lib/prawn/graphics/join_style.rb
|
101
|
+
- lib/prawn/graphics/transparency.rb
|
87
102
|
- lib/prawn/graphics.rb
|
88
103
|
- lib/prawn/images/jpg.rb
|
89
104
|
- lib/prawn/images/png.rb
|
@@ -92,8 +107,10 @@ files:
|
|
92
107
|
- lib/prawn/measurement_extensions.rb
|
93
108
|
- lib/prawn/measurements.rb
|
94
109
|
- lib/prawn/name_tree.rb
|
110
|
+
- lib/prawn/object_store.rb
|
95
111
|
- lib/prawn/pdf_object.rb
|
96
112
|
- lib/prawn/reference.rb
|
113
|
+
- lib/prawn/stamp.rb
|
97
114
|
- spec/annotations_spec.rb
|
98
115
|
- spec/bounding_box_spec.rb
|
99
116
|
- spec/destinations_spec.rb
|
@@ -104,13 +121,19 @@ files:
|
|
104
121
|
- spec/jpg_spec.rb
|
105
122
|
- spec/measurement_units_spec.rb
|
106
123
|
- spec/name_tree_spec.rb
|
124
|
+
- spec/object_store_spec.rb
|
107
125
|
- spec/pdf_object_spec.rb
|
108
126
|
- spec/png_spec.rb
|
109
127
|
- spec/reference_spec.rb
|
128
|
+
- spec/snapshot_spec.rb
|
110
129
|
- spec/span_spec.rb
|
111
130
|
- spec/spec_helper.rb
|
131
|
+
- spec/stamp_spec.rb
|
132
|
+
- spec/stroke_styles_spec.rb
|
112
133
|
- spec/text_box_spec.rb
|
113
134
|
- spec/text_spec.rb
|
135
|
+
- spec/transparency_spec.rb
|
136
|
+
- vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb
|
114
137
|
- vendor/pdf-inspector/lib/pdf/inspector/graphics.rb
|
115
138
|
- vendor/pdf-inspector/lib/pdf/inspector/page.rb
|
116
139
|
- vendor/pdf-inspector/lib/pdf/inspector/text.rb
|
@@ -208,6 +231,7 @@ files:
|
|
208
231
|
- data/images/web-links.png
|
209
232
|
- data/shift_jis_text.txt
|
210
233
|
- Rakefile
|
234
|
+
- HACKING
|
211
235
|
- README
|
212
236
|
- LICENSE
|
213
237
|
- COPYING
|