pdf-wrapper 0.4.1 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/README.rdoc +8 -14
- data/Rakefile +6 -67
- data/lib/pdf/wrapper.rb +12 -1
- data/lib/pdf/wrapper/images.rb +0 -6
- data/lib/pdf/wrapper/text.rb +0 -3
- data/{specs → spec}/data/google.png +0 -0
- data/{specs → spec}/data/iso-2022-jp.txt +0 -0
- data/{specs → spec}/data/orc.svg +0 -0
- data/{specs → spec}/data/shift_jis.txt +0 -0
- data/{specs → spec}/data/shipsail.jpg +0 -0
- data/{specs → spec}/data/stef.jpg +0 -0
- data/{specs → spec}/data/utf8-long.pdf +0 -0
- data/{specs → spec}/data/utf8-long.txt +0 -0
- data/{specs → spec}/data/utf8.txt +0 -0
- data/{specs → spec}/data/windmill.jpg +0 -0
- data/{specs → spec}/data/zits.gif +0 -0
- data/{specs → spec}/graphics_spec.rb +13 -13
- data/{specs → spec}/image_spec.rb +6 -6
- data/{specs → spec}/spec_helper.rb +4 -10
- data/{specs → spec}/tables_spec.rb +32 -32
- data/{specs → spec}/text_spec.rb +23 -23
- data/{specs → spec}/wrapper_spec.rb +39 -39
- metadata +198 -29
- data/lib/pdf/wrapper/loading.rb +0 -64
- data/specs/load_spec.rb +0 -33
data/{specs → spec}/text_spec.rb
RENAMED
@@ -6,12 +6,12 @@ describe PDF::Wrapper do
|
|
6
6
|
|
7
7
|
before(:each) { create_pdf }
|
8
8
|
|
9
|
-
|
9
|
+
it "should be able to permanantly change the font size" do
|
10
10
|
@pdf.font_size 20
|
11
11
|
@pdf.instance_variable_get("@default_font_size").should eql(20)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should be able to temporarily change the font size" do
|
15
15
|
@pdf.font_size 20
|
16
16
|
@pdf.instance_variable_get("@default_font_size").should eql(20)
|
17
17
|
@pdf.font_size(10) do
|
@@ -20,7 +20,7 @@ describe PDF::Wrapper do
|
|
20
20
|
@pdf.instance_variable_get("@default_font_size").should eql(20)
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
it "should be able to add ascii text to the canvas" do
|
24
24
|
msg = "Chunky Bacon"
|
25
25
|
@pdf.text msg
|
26
26
|
@pdf.finish
|
@@ -32,7 +32,7 @@ describe PDF::Wrapper do
|
|
32
32
|
receiver.content.first.should eql(msg)
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
it "should be able to add unicode text to the canvas" do
|
36
36
|
msg = "Alex Čihař"
|
37
37
|
@pdf.text msg
|
38
38
|
@pdf.finish
|
@@ -44,7 +44,7 @@ describe PDF::Wrapper do
|
|
44
44
|
receiver.content.first.should eql(msg)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
it "should be able to add unicode text that spans multiple pages to the canvas" do
|
48
48
|
msg = "James\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHealy"
|
49
49
|
@pdf.text msg
|
50
50
|
@pdf.finish
|
@@ -57,7 +57,7 @@ describe PDF::Wrapper do
|
|
57
57
|
receiver.content[1].should eql("Healy")
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
it "should be align text on the left when using the text method" do
|
61
61
|
msg = "Chunky Bacon"
|
62
62
|
@pdf.text msg, :alignment => :left
|
63
63
|
@pdf.finish
|
@@ -70,7 +70,7 @@ describe PDF::Wrapper do
|
|
70
70
|
params[4].should eql(@pdf.margin_left)
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
it "should be able to align text on the left when using the text method" do
|
74
74
|
msg = "Chunky Bacon"
|
75
75
|
@pdf.text msg, :alignment => :left
|
76
76
|
@pdf.finish
|
@@ -83,7 +83,7 @@ describe PDF::Wrapper do
|
|
83
83
|
params[4].should eql(@pdf.margin_left)
|
84
84
|
end
|
85
85
|
|
86
|
-
|
86
|
+
it "should be able to align text in the centre when using the text method" do
|
87
87
|
msg = "Chunky Bacon"
|
88
88
|
@pdf.text msg, :alignment => :center
|
89
89
|
@pdf.finish
|
@@ -98,7 +98,7 @@ describe PDF::Wrapper do
|
|
98
98
|
(params[4] > @pdf.absolute_x_middle - 100).should be_true
|
99
99
|
end
|
100
100
|
|
101
|
-
|
101
|
+
it "should be able to align text on the right when using the text method" do
|
102
102
|
msg = "Chunky Bacon"
|
103
103
|
@pdf.text msg, :alignment => :right
|
104
104
|
@pdf.finish
|
@@ -113,12 +113,12 @@ describe PDF::Wrapper do
|
|
113
113
|
(params[4] < @pdf.absolute_right_margin).should be_true
|
114
114
|
end
|
115
115
|
|
116
|
-
|
116
|
+
it "should raise an error when an invalid alignment is specified" do
|
117
117
|
msg = "James Healy"
|
118
118
|
lambda { @pdf.text msg, :alignment => :ponies }.should raise_error(ArgumentError)
|
119
119
|
end
|
120
120
|
|
121
|
-
|
121
|
+
it "should be able to add text to the canvas in a bounding box using the cell method" do
|
122
122
|
msg = "Alex Čihař"
|
123
123
|
@pdf.cell msg, 100, 100, 200, 200
|
124
124
|
@pdf.finish
|
@@ -130,7 +130,7 @@ describe PDF::Wrapper do
|
|
130
130
|
receiver.content.first.should eql(msg)
|
131
131
|
end
|
132
132
|
|
133
|
-
|
133
|
+
it "should keep all text for a cell inside the cell boundaries" do
|
134
134
|
msg = "This is a text cell, added by James"
|
135
135
|
x = y = 100
|
136
136
|
w = h = 200
|
@@ -156,13 +156,13 @@ describe PDF::Wrapper do
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
|
159
|
+
it "should be able to calculate the height of a string of text" do
|
160
160
|
str = "This is a medium length string\nthat is also multi line. one two three four."
|
161
161
|
opts = {:font_size => 16, :font => "Sans Serif", :alignment => :left, :justify => false }
|
162
162
|
@pdf.text_height(str, @pdf.body_width, opts).should eql(49)
|
163
163
|
end
|
164
164
|
|
165
|
-
|
165
|
+
it "should be able to calculate the width of a string of text" do
|
166
166
|
str = "James Healy"
|
167
167
|
str2 = "James Healy is a Ruby dev that lives in Melbourne, Australia. His day job mostly involved Ruby on Rails."
|
168
168
|
opts = {:font_size => 16, :font => "Sans Serif"}
|
@@ -172,12 +172,12 @@ describe PDF::Wrapper do
|
|
172
172
|
(@pdf.text_width(str2, opts) <= 1107).should be_true
|
173
173
|
end
|
174
174
|
|
175
|
-
|
175
|
+
it "should raise an exception if build_pango_layout is passed anything other than a string" do
|
176
176
|
lambda { @pdf.build_pango_layout(10) }.should raise_error(ArgumentError)
|
177
177
|
end
|
178
178
|
|
179
179
|
if RUBY_VERSION >= "1.9"
|
180
|
-
|
180
|
+
it "should accept non UTF-8 strings to build_pango_layout and convert them on the fly" do
|
181
181
|
|
182
182
|
# all three of these files have the same content, but in different encodings
|
183
183
|
iso2022_str = File.open(File.dirname(__FILE__) + "/data/shift_jis.txt", "r:ISO-2022-JP") { |f| f.read }.strip!
|
@@ -191,10 +191,10 @@ describe PDF::Wrapper do
|
|
191
191
|
# passed in the non UTF-8 strings, then all worked fine. yuck.
|
192
192
|
end
|
193
193
|
|
194
|
-
|
194
|
+
it "should raise an error when a string that isn't convertable to UTF-8 is passed into build_pango_layout()"
|
195
195
|
end
|
196
196
|
|
197
|
-
|
197
|
+
it "should accept and render pango markup correctly" do
|
198
198
|
msg = "<b>James</b>"
|
199
199
|
@pdf.text msg, :markup => :pango
|
200
200
|
@pdf.finish
|
@@ -206,7 +206,7 @@ describe PDF::Wrapper do
|
|
206
206
|
page_one.should eql("James")
|
207
207
|
end
|
208
208
|
|
209
|
-
|
209
|
+
it "should be able to alle to wrap text on word boundaries" do
|
210
210
|
msg = "James Healy"
|
211
211
|
@pdf.text msg, :wrap => :word
|
212
212
|
@pdf.finish
|
@@ -218,7 +218,7 @@ describe PDF::Wrapper do
|
|
218
218
|
receiver.content.first.should eql(msg)
|
219
219
|
end
|
220
220
|
|
221
|
-
|
221
|
+
it "should be able to able to wrap text on char boundaries" do
|
222
222
|
msg = "James Healy"
|
223
223
|
@pdf.text msg, :wrap => :char
|
224
224
|
@pdf.finish
|
@@ -230,7 +230,7 @@ describe PDF::Wrapper do
|
|
230
230
|
receiver.content.first.should eql(msg)
|
231
231
|
end
|
232
232
|
|
233
|
-
|
233
|
+
it "should be able to wrap text on word and char boundaries" do
|
234
234
|
msg = "James Healy"
|
235
235
|
@pdf.text msg, :wrap => :wordchar
|
236
236
|
@pdf.finish
|
@@ -242,12 +242,12 @@ describe PDF::Wrapper do
|
|
242
242
|
receiver.content.first.should eql(msg)
|
243
243
|
end
|
244
244
|
|
245
|
-
|
245
|
+
it "should raise an error when an invalid wrapping technique is specified" do
|
246
246
|
msg = "James Healy"
|
247
247
|
lambda { @pdf.text msg, :wrap => :ponies }.should raise_error(ArgumentError)
|
248
248
|
end
|
249
249
|
|
250
|
-
|
250
|
+
it "should determine the largest font size possible that will fit some text in a cell" do
|
251
251
|
@pdf.__send__(:best_font_size, "Hello There", 34, 50, 5..9).should eql(9)
|
252
252
|
@pdf.__send__(:best_font_size, "<b>Hello There</b>", 34, 50, 5..9, :markup => :pango).should eql(8)
|
253
253
|
@pdf.__send__(:best_font_size, "Hello There", 5, 50, 5..9).should eql(5)
|
@@ -2,81 +2,81 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
describe "The PDF::Wrapper class" do
|
6
6
|
|
7
7
|
before(:each) { create_pdf }
|
8
8
|
|
9
|
-
|
9
|
+
it "should initilize with the correct default paper size and orientation" do
|
10
10
|
@pdf.page_width.should eql(PDF::Wrapper::PAGE_SIZES[:A4].first)
|
11
11
|
@pdf.page_height.should eql(PDF::Wrapper::PAGE_SIZES[:A4].last)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should initilize with the correct custom paper size" do
|
15
15
|
output = StringIO.new
|
16
16
|
pdf = PDF::Wrapper.new(output, :paper => :A0)
|
17
17
|
pdf.page_width.should eql(PDF::Wrapper::PAGE_SIZES[:A0].first)
|
18
18
|
pdf.page_height.should eql(PDF::Wrapper::PAGE_SIZES[:A0].last)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
it "should initilize with the correct manual paper size" do
|
22
22
|
output = StringIO.new
|
23
23
|
pdf = PDF::Wrapper.new(output, :paper => [100, 1000])
|
24
24
|
pdf.page_width.to_i.should eql(100)
|
25
25
|
pdf.page_height.to_i.should eql(1000)
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
it "should initilize with the correct custom orientation" do
|
29
29
|
output = StringIO.new
|
30
30
|
pdf = PDF::Wrapper.new(output, :paper => :A4, :orientation => :landscape)
|
31
31
|
pdf.page_width.should eql(PDF::Wrapper::PAGE_SIZES[:A4].last)
|
32
32
|
pdf.page_height.should eql(PDF::Wrapper::PAGE_SIZES[:A4].first)
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
it "should raise an exception if an invalid orientation is requested" do
|
36
36
|
output = StringIO.new
|
37
37
|
lambda {pdf = PDF::Wrapper.new(output, :paper => :A4, :orientation => :fake)}.should raise_error(ArgumentError)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
it "should store sensible default text options" do
|
41
41
|
@pdf.default_text_options.should be_a_kind_of(Hash)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
it "should initilize with the correct default margins (5% of the page)" do
|
45
45
|
@pdf.margin_left.should eql((PDF::Wrapper::PAGE_SIZES[:A4].first * 0.05).ceil)
|
46
46
|
@pdf.margin_right.should eql((PDF::Wrapper::PAGE_SIZES[:A4].first * 0.05).ceil)
|
47
47
|
@pdf.margin_top.should eql((PDF::Wrapper::PAGE_SIZES[:A4].last * 0.05).ceil)
|
48
48
|
@pdf.margin_bottom.should eql((PDF::Wrapper::PAGE_SIZES[:A4].last * 0.05).ceil)
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
it "should initilize with the correct default text and colour settings" do
|
52
52
|
@pdf.instance_variable_get("@default_font").should eql("Sans Serif")
|
53
53
|
@pdf.instance_variable_get("@default_font_size").should eql(16)
|
54
54
|
end
|
55
55
|
|
56
|
-
|
56
|
+
it "should be able to change the default font" do
|
57
57
|
@pdf.font("Arial")
|
58
58
|
@pdf.instance_variable_get("@default_font").should eql("Arial")
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
it "should be able to change the default font size" do
|
62
62
|
@pdf.font_size(24)
|
63
63
|
@pdf.instance_variable_get("@default_font_size").should eql(24)
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
it "should initialize with the cursor at the top left of the body of the page" do
|
67
67
|
x,y = @pdf.current_point
|
68
68
|
x.to_i.should eql(@pdf.margin_left)
|
69
69
|
y.to_i.should eql(@pdf.margin_top)
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
it "should calculate the absolute coordinates for the margins correctly" do
|
73
73
|
@pdf.absolute_left_margin.should eql(@pdf.margin_left)
|
74
74
|
@pdf.absolute_right_margin.should eql(@pdf.page_width - @pdf.margin_right)
|
75
75
|
@pdf.absolute_top_margin.should eql(@pdf.margin_top)
|
76
76
|
@pdf.absolute_bottom_margin.should eql(@pdf.page_height - @pdf.margin_bottom)
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
it "should calculate various useful page coordinates correctly" do
|
80
80
|
@pdf.absolute_x_middle.should eql(PDF::Wrapper::PAGE_SIZES[:A4].first / 2)
|
81
81
|
@pdf.absolute_y_middle.should eql(PDF::Wrapper::PAGE_SIZES[:A4].last / 2)
|
82
82
|
@pdf.body_width.should eql(@pdf.page_width - @pdf.margin_left - @pdf.margin_right)
|
@@ -87,14 +87,14 @@ context "The PDF::Wrapper class" do
|
|
87
87
|
@pdf.points_to_right_margin(300).should eql(@pdf.absolute_right_margin - 300)
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
it "should be able to move the cursor to any arbitary point on the canvas" do
|
91
91
|
@pdf.move_to(100,100)
|
92
92
|
x,y = @pdf.current_point
|
93
93
|
x.to_i.should eql(100)
|
94
94
|
y.to_i.should eql(100)
|
95
95
|
end
|
96
96
|
|
97
|
-
|
97
|
+
it "should be able to shift the y position of the cursor using pad" do
|
98
98
|
@pdf.move_to(100,100)
|
99
99
|
newy = @pdf.pad(25)
|
100
100
|
x,y = @pdf.current_point
|
@@ -103,7 +103,7 @@ context "The PDF::Wrapper class" do
|
|
103
103
|
newy.should eql(125.0)
|
104
104
|
end
|
105
105
|
|
106
|
-
|
106
|
+
it "should add additional pages at the users request" do
|
107
107
|
@pdf.move_to(100,100)
|
108
108
|
@pdf.start_new_page
|
109
109
|
x,y = @pdf.current_point
|
@@ -118,7 +118,7 @@ context "The PDF::Wrapper class" do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
|
121
|
-
|
121
|
+
it "should leave the cursor in the bottom left of a layout when new text is added" do
|
122
122
|
x, y = @pdf.current_point
|
123
123
|
str = "Chunky Bacon!!"
|
124
124
|
opts = {:font_size => 16, :font => "Sans Serif", :alignment => :left, :justify => false }
|
@@ -131,7 +131,7 @@ context "The PDF::Wrapper class" do
|
|
131
131
|
newy.should eql(y + height)
|
132
132
|
end
|
133
133
|
|
134
|
-
|
134
|
+
it "should be able to render to a file" do
|
135
135
|
# generate a PDF
|
136
136
|
msg = "Chunky Bacon"
|
137
137
|
|
@@ -152,7 +152,7 @@ context "The PDF::Wrapper class" do
|
|
152
152
|
tmp.unlink
|
153
153
|
end
|
154
154
|
|
155
|
-
|
155
|
+
it "should be able to determine if a requested colour is valid or not" do
|
156
156
|
@pdf.validate_color(:black).should be_true
|
157
157
|
@pdf.validate_color([1,0,0]).should be_true
|
158
158
|
@pdf.validate_color([1,0,0,0.5]).should be_true
|
@@ -161,7 +161,7 @@ context "The PDF::Wrapper class" do
|
|
161
161
|
lambda { @pdf.validate_color([1000, 255, 0])}.should raise_error(ArgumentError)
|
162
162
|
end
|
163
163
|
|
164
|
-
|
164
|
+
it "should be able to add repeating elements to :all pages" do
|
165
165
|
test_str = "repeating"
|
166
166
|
|
167
167
|
@pdf.repeating_element(:all) { |page| page.text test_str }
|
@@ -181,7 +181,7 @@ context "The PDF::Wrapper class" do
|
|
181
181
|
receiver.content[3].should eql(test_str)
|
182
182
|
end
|
183
183
|
|
184
|
-
|
184
|
+
it "should be able to add repeating elements to :odd pages" do
|
185
185
|
test_str = "repeating"
|
186
186
|
|
187
187
|
@pdf.repeating_element(:odd) { |page| page.text test_str }
|
@@ -201,7 +201,7 @@ context "The PDF::Wrapper class" do
|
|
201
201
|
receiver.content[3].should eql("")
|
202
202
|
end
|
203
203
|
|
204
|
-
|
204
|
+
it "should be able to add repeating elements to :even pages" do
|
205
205
|
test_str = "repeating"
|
206
206
|
|
207
207
|
@pdf.repeating_element(:even) { |page| page.text test_str }
|
@@ -221,7 +221,7 @@ context "The PDF::Wrapper class" do
|
|
221
221
|
receiver.content[3].should eql(test_str)
|
222
222
|
end
|
223
223
|
|
224
|
-
|
224
|
+
it "should be able to add repeating elements to a range of pages" do
|
225
225
|
test_str = "repeating"
|
226
226
|
|
227
227
|
@pdf.repeating_element((2..3)) { |page| page.text test_str }
|
@@ -241,7 +241,7 @@ context "The PDF::Wrapper class" do
|
|
241
241
|
receiver.content[3].should eql("")
|
242
242
|
end
|
243
243
|
|
244
|
-
|
244
|
+
it "should be able to add repeating elements to a single page" do
|
245
245
|
test_str = "repeating"
|
246
246
|
|
247
247
|
@pdf.repeating_element(2) { |page| page.text test_str }
|
@@ -261,7 +261,7 @@ context "The PDF::Wrapper class" do
|
|
261
261
|
receiver.content[3].should eql("")
|
262
262
|
end
|
263
263
|
|
264
|
-
|
264
|
+
it "should be able to add repeating elements to an array of pages" do
|
265
265
|
test_str = "repeating"
|
266
266
|
|
267
267
|
@pdf.repeating_element([1,3,4]) { |page| page.text test_str }
|
@@ -281,9 +281,9 @@ context "The PDF::Wrapper class" do
|
|
281
281
|
receiver.content[3].should eql(test_str)
|
282
282
|
end
|
283
283
|
|
284
|
-
|
284
|
+
it "should not change the state of the cairo canvas or PDF::Writer defaults (fonts, colors, etc) when adding repeating elements"
|
285
285
|
|
286
|
-
|
286
|
+
it "should not allow a new page to be started while adding repeating elements" do
|
287
287
|
test_str = "repeating"
|
288
288
|
|
289
289
|
lambda do
|
@@ -295,7 +295,7 @@ context "The PDF::Wrapper class" do
|
|
295
295
|
|
296
296
|
end
|
297
297
|
|
298
|
-
|
298
|
+
it "should leave the cursor on the bottom left corner of an object when using functions with optional positioning [func(data, opts)]" do
|
299
299
|
origx, origy = @pdf.current_point
|
300
300
|
|
301
301
|
# text()
|
@@ -332,7 +332,7 @@ context "The PDF::Wrapper class" do
|
|
332
332
|
y.should eql(origy + 100)
|
333
333
|
end
|
334
334
|
|
335
|
-
|
335
|
+
it "should leave the cursor unmodified when using functions with compulsory positioning [func(data, x, y, w, h, opts)]" do
|
336
336
|
origx, origy = @pdf.current_point
|
337
337
|
|
338
338
|
# cell()
|
@@ -360,7 +360,7 @@ context "The PDF::Wrapper class" do
|
|
360
360
|
y.should eql(origy)
|
361
361
|
end
|
362
362
|
|
363
|
-
|
363
|
+
it "should maintain an internal counter of pages" do
|
364
364
|
@pdf.page.should eql(1)
|
365
365
|
@pdf.start_new_page
|
366
366
|
@pdf.page.should eql(2)
|
@@ -368,7 +368,7 @@ context "The PDF::Wrapper class" do
|
|
368
368
|
@pdf.page.should eql(50)
|
369
369
|
end
|
370
370
|
|
371
|
-
|
371
|
+
it "should raise an ArgumentError when a function that accepts an options hash is passed an unrecognised option" do
|
372
372
|
output = StringIO.new
|
373
373
|
lambda { PDF::Wrapper.new(output, :ponies => true)}.should raise_error(ArgumentError)
|
374
374
|
lambda { @pdf.cell("test",100,100,100,100, :ponies => true)}.should raise_error(ArgumentError)
|
@@ -383,7 +383,7 @@ context "The PDF::Wrapper class" do
|
|
383
383
|
lambda { @pdf.image(File.dirname(__FILE__) + "/data/orc.svg", :ponies => true)}.should raise_error(ArgumentError)
|
384
384
|
end
|
385
385
|
|
386
|
-
|
386
|
+
it "should allow an existing file to be used as a template for page 1" do
|
387
387
|
output = StringIO.new
|
388
388
|
pdf = PDF::Wrapper.new(output, :paper => :A4, :template => File.dirname(__FILE__) + "/data/orc.svg")
|
389
389
|
pdf.start_new_page
|
@@ -396,7 +396,7 @@ context "The PDF::Wrapper class" do
|
|
396
396
|
receiver.pages[1].should eql([0, 0, 595.28, 841.89])
|
397
397
|
end
|
398
398
|
|
399
|
-
|
399
|
+
it "should allow an existing file to be used as a template for page 2" do
|
400
400
|
@pdf.start_new_page(:template => File.dirname(__FILE__) + "/data/orc.svg")
|
401
401
|
@pdf.finish
|
402
402
|
|
@@ -407,7 +407,7 @@ context "The PDF::Wrapper class" do
|
|
407
407
|
receiver.pages[1].should eql([0, 0, 734, 772])
|
408
408
|
end
|
409
409
|
|
410
|
-
|
410
|
+
it "should correctly convert a user x co-ordinate to device" do
|
411
411
|
output = StringIO.new
|
412
412
|
pdf = PDF::Wrapper.new(output, :paper => :A4, :margin_left => 40)
|
413
413
|
|
@@ -420,7 +420,7 @@ context "The PDF::Wrapper class" do
|
|
420
420
|
end
|
421
421
|
end
|
422
422
|
|
423
|
-
|
423
|
+
it "should correctly convert a user y co-ordinate to device" do
|
424
424
|
output = StringIO.new
|
425
425
|
pdf = PDF::Wrapper.new(output, :paper => :A4, :margin_top => 40)
|
426
426
|
|
@@ -433,7 +433,7 @@ context "The PDF::Wrapper class" do
|
|
433
433
|
end
|
434
434
|
end
|
435
435
|
|
436
|
-
|
436
|
+
it "should correctly convert a device x co-ordinate to user" do
|
437
437
|
output = StringIO.new
|
438
438
|
pdf = PDF::Wrapper.new(output, :paper => :A4, :margin_left => 40)
|
439
439
|
|
@@ -445,7 +445,7 @@ context "The PDF::Wrapper class" do
|
|
445
445
|
end
|
446
446
|
end
|
447
447
|
|
448
|
-
|
448
|
+
it "should correctly convert a device y co-ordinate to user" do
|
449
449
|
output = StringIO.new
|
450
450
|
pdf = PDF::Wrapper.new(output, :paper => :A4, :margin_top => 40)
|
451
451
|
|
@@ -457,7 +457,7 @@ context "The PDF::Wrapper class" do
|
|
457
457
|
end
|
458
458
|
end
|
459
459
|
|
460
|
-
|
460
|
+
it "should be aware of when the underlying PDFSurface has been finished" do
|
461
461
|
@pdf.text "Hi!"
|
462
462
|
@pdf.finished?.should be_false
|
463
463
|
@pdf.finish
|