prawn 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/Rakefile +12 -0
  4. data/lib/prawn.rb +9 -21
  5. data/lib/prawn/document.rb +95 -68
  6. data/lib/prawn/document/bounding_box.rb +22 -4
  7. data/lib/prawn/document/column_box.rb +2 -0
  8. data/lib/prawn/document/graphics_state.rb +1 -1
  9. data/lib/prawn/document/internals.rb +2 -2
  10. data/lib/prawn/document/snapshot.rb +2 -1
  11. data/lib/prawn/document/span.rb +2 -0
  12. data/lib/prawn/encoding.rb +1 -1
  13. data/lib/prawn/font.rb +89 -75
  14. data/lib/prawn/font/afm.rb +3 -0
  15. data/lib/prawn/font/dfont.rb +1 -0
  16. data/lib/prawn/font/ttf.rb +2 -0
  17. data/lib/prawn/font_metric_cache.rb +3 -1
  18. data/lib/prawn/graphics.rb +2 -14
  19. data/lib/prawn/graphics/cap_style.rb +1 -0
  20. data/lib/prawn/graphics/color.rb +1 -0
  21. data/lib/prawn/graphics/dash.rb +3 -2
  22. data/lib/prawn/graphics/join_style.rb +2 -0
  23. data/lib/prawn/graphics/patterns.rb +1 -0
  24. data/lib/prawn/graphics/transformation.rb +1 -0
  25. data/lib/prawn/graphics/transparency.rb +2 -0
  26. data/lib/prawn/image_handler.rb +2 -0
  27. data/lib/prawn/images.rb +5 -0
  28. data/lib/prawn/images/image.rb +1 -0
  29. data/lib/prawn/images/jpg.rb +3 -0
  30. data/lib/prawn/images/png.rb +2 -0
  31. data/lib/prawn/layout.rb +8 -13
  32. data/lib/prawn/layout/grid.rb +15 -3
  33. data/lib/prawn/measurement_extensions.rb +4 -0
  34. data/lib/prawn/measurements.rb +2 -0
  35. data/lib/prawn/outline.rb +3 -1
  36. data/lib/prawn/repeater.rb +3 -1
  37. data/lib/prawn/security.rb +15 -7
  38. data/lib/prawn/security/arcfour.rb +52 -0
  39. data/lib/prawn/soft_mask.rb +3 -1
  40. data/lib/prawn/stamp.rb +2 -0
  41. data/lib/prawn/table.rb +2 -0
  42. data/lib/prawn/table/cell.rb +4 -1
  43. data/lib/prawn/table/cell/image.rb +1 -2
  44. data/lib/prawn/table/cell/in_table.rb +2 -0
  45. data/lib/prawn/table/cell/span_dummy.rb +1 -0
  46. data/lib/prawn/table/cells.rb +7 -2
  47. data/lib/prawn/table/column_width_calculator.rb +8 -2
  48. data/lib/prawn/text.rb +4 -2
  49. data/lib/prawn/text/box.rb +3 -0
  50. data/lib/prawn/text/formatted/arranger.rb +2 -0
  51. data/lib/prawn/text/formatted/box.rb +55 -50
  52. data/lib/prawn/text/formatted/fragment.rb +2 -0
  53. data/lib/prawn/text/formatted/line_wrap.rb +1 -0
  54. data/lib/prawn/text/formatted/parser.rb +2 -0
  55. data/lib/prawn/text/formatted/wrap.rb +2 -0
  56. data/lib/prawn/utilities.rb +5 -3
  57. data/manual/graphics/common_lines.rb +2 -0
  58. data/manual/text/group.rb +2 -0
  59. data/manual/text/text.rb +1 -1
  60. data/prawn.gemspec +4 -3
  61. data/spec/grid_spec.rb +11 -0
  62. data/spec/object_store_spec.rb +1 -96
  63. data/spec/reference_spec.rb +0 -57
  64. data/spec/spec_helper.rb +7 -0
  65. data/spec/table_spec.rb +26 -0
  66. metadata +172 -185
  67. data/lib/pdf/core.rb +0 -35
  68. data/lib/pdf/core/annotations.rb +0 -60
  69. data/lib/pdf/core/byte_string.rb +0 -9
  70. data/lib/pdf/core/destinations.rb +0 -90
  71. data/lib/pdf/core/document_state.rb +0 -79
  72. data/lib/pdf/core/filter_list.rb +0 -51
  73. data/lib/pdf/core/filters.rb +0 -36
  74. data/lib/pdf/core/graphics_state.rb +0 -89
  75. data/lib/pdf/core/literal_string.rb +0 -16
  76. data/lib/pdf/core/name_tree.rb +0 -177
  77. data/lib/pdf/core/object_store.rb +0 -311
  78. data/lib/pdf/core/outline.rb +0 -315
  79. data/lib/pdf/core/page.rb +0 -212
  80. data/lib/pdf/core/page_geometry.rb +0 -126
  81. data/lib/pdf/core/pdf_object.rb +0 -99
  82. data/lib/pdf/core/reference.rb +0 -103
  83. data/lib/pdf/core/stream.rb +0 -98
  84. data/lib/pdf/core/text.rb +0 -275
  85. data/lib/prawn/templates.rb +0 -75
  86. data/spec/filters_spec.rb +0 -34
  87. data/spec/name_tree_spec.rb +0 -112
  88. data/spec/pdf_object_spec.rb +0 -172
  89. data/spec/stream_spec.rb +0 -58
  90. data/spec/template_spec_obsolete.rb +0 -352
@@ -1,75 +0,0 @@
1
- warn "Templates are no longer supported in Prawn!\n" +
2
- "This code is for experimental testing only, and\n" +
3
- "will extracted into its own gem in a future Prawn release"
4
-
5
- module Prawn
6
- module Templates
7
- def initialize_first_page(options)
8
- return super unless options[:template]
9
-
10
- fresh_content_streams(options)
11
- go_to_page(1)
12
- end
13
-
14
- ## FIXME: This is going to be terribly brittle because
15
- # it copy-pastes the start_new_page method. But at least
16
- # it should only run when templates are used.
17
-
18
- def start_new_page(options = {})
19
- return super unless options[:template]
20
-
21
- if last_page = state.page
22
- last_page_size = last_page.size
23
- last_page_layout = last_page.layout
24
- last_page_margins = last_page.margins
25
- end
26
-
27
- page_options = {:size => options[:size] || last_page_size,
28
- :layout => options[:layout] || last_page_layout,
29
- :margins => last_page_margins}
30
- if last_page
31
- new_graphic_state = last_page.graphic_state.dup if last_page.graphic_state
32
- #erase the color space so that it gets reset on new page for fussy pdf-readers
33
- new_graphic_state.color_space = {} if new_graphic_state
34
- page_options.merge!(:graphic_state => new_graphic_state)
35
- end
36
-
37
- merge_template_options(page_options, options)
38
-
39
- state.page = PDF::Core::Page.new(self, page_options)
40
-
41
- apply_margin_options(options)
42
- generate_margin_box
43
-
44
- # Reset the bounding box if the new page has different size or layout
45
- if last_page && (last_page.size != state.page.size ||
46
- last_page.layout != state.page.layout)
47
- @bounding_box = @margin_box
48
- end
49
-
50
- state.page.new_content_stream
51
- use_graphic_settings(true)
52
- forget_text_rendering_mode!
53
-
54
- unless options[:orphan]
55
- state.insert_page(state.page, @page_number)
56
- @page_number += 1
57
-
58
- canvas { image(@background, :scale => @background_scale, :at => bounds.top_left) } if @background
59
- @y = @bounding_box.absolute_top
60
-
61
- float do
62
- state.on_page_create_action(self)
63
- end
64
- end
65
- end
66
-
67
- def merge_template_options(page_options, options)
68
- object_id = state.store.import_page(options[:template], options[:template_page] || 1)
69
- page_options.merge!(:object_id => object_id, :page_template => true)
70
- end
71
- end
72
- end
73
-
74
- Prawn::Document::VALID_OPTIONS << :template
75
- Prawn::Document.extensions << Prawn::Templates
@@ -1,34 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- FILTERS = {
6
- :FlateDecode => {'test' => "x\x9C+I-.\x01\x00\x04]\x01\xC1".force_encoding(Encoding::ASCII_8BIT) },
7
- :DCTDecode => {'test' => "test"}
8
- }
9
-
10
- FILTERS.each do |filter_name, examples|
11
- filter = PDF::Core::Filters.const_get(filter_name)
12
-
13
- describe "#{filter_name} filter" do
14
- it "should encode stream" do
15
- examples.each do |in_stream, out_stream|
16
- filter.encode(in_stream).should == out_stream
17
- end
18
- end
19
-
20
- it "should decode stream" do
21
- examples.each do |in_stream, out_stream|
22
- filter.decode(out_stream).should == in_stream
23
- end
24
- end
25
-
26
- it "should be symmetric" do
27
- examples.each do |in_stream, out_stream|
28
- filter.decode(filter.encode(in_stream)).should == in_stream
29
-
30
- filter.encode(filter.decode(out_stream)).should == out_stream
31
- end
32
- end
33
- end
34
- end
@@ -1,112 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
2
-
3
- def tree_dump(tree)
4
- if tree.is_a?(PDF::Core::NameTree::Node)
5
- "[" + tree.children.map { |child| tree_dump(child) }.join(",") + "]"
6
- else
7
- "#{tree.name}=#{tree.value}"
8
- end
9
- end
10
-
11
- def tree_add(tree, *args)
12
- args.each do |(name, value)|
13
- tree.add(name, value)
14
- end
15
- end
16
-
17
- def tree_value(name, value)
18
- PDF::Core::NameTree::Value.new(name, value)
19
- end
20
-
21
- class RefExposingDocument < Prawn::Document
22
- def object_store
23
- state.store
24
- end
25
- end
26
-
27
- describe "Name Tree" do
28
- before(:each) { create_pdf(RefExposingDocument) }
29
-
30
- it "should have no children when first initialized" do
31
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
32
- node.children.length.should == 0
33
- end
34
-
35
- it "should have no subtrees while child limit is not reached" do
36
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
37
- tree_add(node, ["one", 1], ["two", 2], ["three", 3])
38
- tree_dump(node).should == "[one=1,three=3,two=2]"
39
- end
40
-
41
- it "should split into subtrees when limit is exceeded" do
42
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
43
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
44
- tree_dump(node).should == "[[four=4,one=1],[three=3,two=2]]"
45
- end
46
-
47
- it "should create a two new references when root is split" do
48
- ref_count = @pdf.object_store.length
49
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
50
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
51
- @pdf.object_store.length.should == ref_count+2
52
- end
53
-
54
- it "should create a one new reference when subtree is split" do
55
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
56
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
57
-
58
- ref_count = @pdf.object_store.length # save when root is split
59
- tree_add(node, ["five", 5], ["six", 6], ["seven", 7])
60
- tree_dump(node).should == "[[five=5,four=4,one=1],[seven=7,six=6],[three=3,two=2]]"
61
- @pdf.object_store.length.should == ref_count+1
62
- end
63
-
64
- it "should keep tree balanced when subtree split cascades to root" do
65
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
66
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
67
- tree_add(node, ["five", 5], ["six", 6], ["seven", 7], ["eight", 8])
68
- tree_dump(node).should == "[[[eight=8,five=5],[four=4,one=1]],[[seven=7,six=6],[three=3,two=2]]]"
69
- end
70
-
71
- it "should maintain order of already properly ordered nodes" do
72
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
73
- tree_add(node, ["eight", 8], ["five", 5], ["four", 4], ["one", 1])
74
- tree_add(node, ['seven', 7], ['six', 6], ['three', 3], ['two', 2])
75
- tree_dump(node).should == "[[[eight=8,five=5],[four=4,one=1]],[[seven=7,six=6],[three=3,two=2]]]"
76
- end
77
-
78
- it "should emit only :Names key with to_hash if root is only node" do
79
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
80
- tree_add(node, ["one", 1], ["two", 2], ["three", 3])
81
- node.to_hash.should ==(
82
- { :Names => [tree_value("one", 1), tree_value("three", 3), tree_value("two", 2)] }
83
- )
84
- end
85
-
86
- it "should emit only :Kids key with to_hash if root has children" do
87
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
88
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
89
- node.to_hash.should ==({ :Kids => node.children.map { |child| child.ref } })
90
- end
91
-
92
- it "should emit :Limits and :Names keys with to_hash for leaf node" do
93
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
94
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
95
- node.children.first.to_hash.should ==(
96
- { :Limits => %w(four one),
97
- :Names => [tree_value("four", 4), tree_value("one", 1)] }
98
- )
99
- end
100
-
101
- it "should emit :Limits and :Kids keys with to_hash for inner node" do
102
- node = PDF::Core::NameTree::Node.new(@pdf, 3)
103
- tree_add(node, ["one", 1], ["two", 2], ["three", 3], ["four", 4])
104
- tree_add(node, ["five", 5], ["six", 6], ["seven", 7], ["eight", 8])
105
- tree_add(node, ["nine", 9], ["ten", 10], ["eleven", 11], ["twelve", 12])
106
- tree_add(node, ["thirteen", 13], ["fourteen", 14], ["fifteen", 15], ["sixteen", 16])
107
- node.children.first.to_hash.should ==(
108
- { :Limits => %w(eight one),
109
- :Kids => node.children.first.children.map { |child| child.ref } }
110
- )
111
- end
112
- end
@@ -1,172 +0,0 @@
1
- # encoding: ASCII-8BIT
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- # See PDF Reference, Sixth Edition (1.7) pp51-60 for details
6
- describe "PDF Object Serialization" do
7
-
8
- it "should convert Ruby's nil to PDF null" do
9
- PDF::Core::PdfObject(nil).should == "null"
10
- end
11
-
12
- it "should convert Ruby booleans to PDF booleans" do
13
- PDF::Core::PdfObject(true).should == "true"
14
- PDF::Core::PdfObject(false).should == "false"
15
- end
16
-
17
- it "should convert a Ruby number to PDF number" do
18
- PDF::Core::PdfObject(1).should == "1"
19
- PDF::Core::PdfObject(1.214112421).should == "1.214112421"
20
- # scientific notation is not valid in PDF
21
- PDF::Core::PdfObject(0.000005).should == "0.000005"
22
- end
23
-
24
- it "should convert a Ruby time object to a PDF timestamp" do
25
- t = Time.now
26
- PDF::Core::PdfObject(t).should == t.strftime("(D:%Y%m%d%H%M%S%z").chop.chop + "'00')"
27
- end
28
-
29
- it "should convert a Ruby string to PDF string when inside a content stream" do
30
- s = "I can has a string"
31
- PDF::Inspector.parse(PDF::Core::PdfObject(s, true)).should == s
32
- end
33
-
34
- it "should convert a Ruby string to a UTF-16 PDF string when outside a content stream" do
35
- s = "I can has a string"
36
- s_utf16 = "\xFE\xFF" + s.unpack("U*").pack("n*")
37
- PDF::Inspector.parse(PDF::Core::PdfObject(s, false)).should == s_utf16
38
- end
39
-
40
- it "should convert a Ruby string with characters outside the BMP to its " +
41
- "UTF-16 representation with a BOM" do
42
- # U+10192 ROMAN SEMUNCIA SIGN
43
- semuncia = [65938].pack("U")
44
- PDF::Core::PdfObject(semuncia, false).upcase.should == "<FEFFD800DD92>"
45
- end
46
-
47
- it "should pass through bytes regardless of content stream status for ByteString" do
48
- PDF::Core::PdfObject(PDF::Core::ByteString.new("\xDE\xAD\xBE\xEF")).upcase.
49
- should == "<DEADBEEF>"
50
- end
51
-
52
- it "should escape parens when converting from Ruby string to PDF" do
53
- s = 'I )(can has a string'
54
- PDF::Inspector.parse(PDF::Core::PdfObject(s, true)).should == s
55
- end
56
-
57
- it "should handle ruby escaped parens when converting to PDF string" do
58
- s = 'I can \\)( has string'
59
- PDF::Inspector.parse(PDF::Core::PdfObject(s, true)).should == s
60
- end
61
-
62
- it "should escape various strings correctly when converting a LiteralString" do
63
- ls = PDF::Core::LiteralString.new("abc")
64
- PDF::Core::PdfObject(ls).should == "(abc)"
65
-
66
- ls = PDF::Core::LiteralString.new("abc\x0Ade") # should escape \n
67
- PDF::Core::PdfObject(ls).should == "(abc\x5C\x0Ade)"
68
-
69
- ls = PDF::Core::LiteralString.new("abc\x0Dde") # should escape \r
70
- PDF::Core::PdfObject(ls).should == "(abc\x5C\x0Dde)"
71
-
72
- ls = PDF::Core::LiteralString.new("abc\x09de") # should escape \t
73
- PDF::Core::PdfObject(ls).should == "(abc\x5C\x09de)"
74
-
75
- ls = PDF::Core::LiteralString.new("abc\x08de") # should escape \b
76
- PDF::Core::PdfObject(ls).should == "(abc\x5C\x08de)"
77
-
78
- ls = PDF::Core::LiteralString.new("abc\x0Cde") # should escape \f
79
- PDF::Core::PdfObject(ls).should == "(abc\x5C\x0Cde)"
80
-
81
- ls = PDF::Core::LiteralString.new("abc(de") # should escape \(
82
- PDF::Core::PdfObject(ls).should == "(abc\x5C(de)"
83
-
84
- ls = PDF::Core::LiteralString.new("abc)de") # should escape \)
85
- PDF::Core::PdfObject(ls).should == "(abc\x5C)de)"
86
-
87
- ls = PDF::Core::LiteralString.new("abc\x5Cde") # should escape \\
88
- PDF::Core::PdfObject(ls).should == "(abc\x5C\x5Cde)"
89
- PDF::Core::PdfObject(ls).size.should == 9
90
- end
91
-
92
- it "should escape strings correctly when converting a LiteralString that is not utf-8" do
93
- data = "\x43\xaf\xc9\x7f\xef\xf\xe6\xa8\xcb\x5c\xaf\xd0"
94
- ls = PDF::Core::LiteralString.new(data)
95
- PDF::Core::PdfObject(ls).should == "(\x43\xaf\xc9\x7f\xef\xf\xe6\xa8\xcb\x5c\x5c\xaf\xd0)"
96
- end
97
-
98
- it "should convert a Ruby symbol to PDF name" do
99
- PDF::Core::PdfObject(:my_symbol).should == "/my_symbol"
100
- PDF::Core::PdfObject(:"A;Name_With-Various***Characters?").should ==
101
- "/A;Name_With-Various***Characters?"
102
- end
103
-
104
- it "should convert a whitespace or delimiter containing Ruby symbol to a PDF name" do
105
- PDF::Core::PdfObject(:"my symbol").should == "/my#20symbol"
106
- PDF::Core::PdfObject(:"my#symbol").should == "/my#23symbol"
107
- PDF::Core::PdfObject(:"my/symbol").should == "/my#2Fsymbol"
108
- PDF::Core::PdfObject(:"my(symbol").should == "/my#28symbol"
109
- PDF::Core::PdfObject(:"my)symbol").should == "/my#29symbol"
110
- PDF::Core::PdfObject(:"my<symbol").should == "/my#3Csymbol"
111
- PDF::Core::PdfObject(:"my>symbol").should == "/my#3Esymbol"
112
- end
113
-
114
- it "should convert a Ruby array to PDF Array when inside a content stream" do
115
- PDF::Core::PdfObject([1,2,3]).should == "[1 2 3]"
116
- PDF::Inspector.parse(PDF::Core::PdfObject([[1,2],:foo,"Bar"], true)).should ==
117
- [[1,2],:foo, "Bar"]
118
- end
119
-
120
- it "should convert a Ruby array to PDF Array when outside a content stream" do
121
- bar = "\xFE\xFF" + "Bar".unpack("U*").pack("n*")
122
- PDF::Core::PdfObject([1,2,3]).should == "[1 2 3]"
123
- PDF::Inspector.parse(PDF::Core::PdfObject([[1,2],:foo,"Bar"], false)).should ==
124
- [[1,2],:foo, bar]
125
- end
126
-
127
- it "should convert a Ruby hash to a PDF Dictionary when inside a content stream" do
128
- dict = PDF::Core::PdfObject( {:foo => :bar,
129
- "baz" => [1,2,3],
130
- :bang => {:a => "what", :b => [:you, :say] }}, true )
131
-
132
- res = PDF::Inspector.parse(dict)
133
-
134
- res[:foo].should == :bar
135
- res[:baz].should == [1,2,3]
136
- res[:bang].should == { :a => "what", :b => [:you, :say] }
137
-
138
- end
139
-
140
- it "should convert a Ruby hash to a PDF Dictionary when outside a content stream" do
141
- what = "\xFE\xFF" + "what".unpack("U*").pack("n*")
142
- dict = PDF::Core::PdfObject( {:foo => :bar,
143
- "baz" => [1,2,3],
144
- :bang => {:a => "what", :b => [:you, :say] }}, false )
145
-
146
- res = PDF::Inspector.parse(dict)
147
-
148
- res[:foo].should == :bar
149
- res[:baz].should == [1,2,3]
150
- res[:bang].should == { :a => what, :b => [:you, :say] }
151
-
152
- end
153
-
154
- it "should not allow keys other than strings or symbols for PDF dicts" do
155
- lambda { PDF::Core::PdfObject(:foo => :bar, :baz => :bang, 1 => 4) }.
156
- should raise_error(PDF::Core::Errors::FailedObjectConversion)
157
- end
158
-
159
- it "should convert a Prawn::Reference to a PDF indirect object reference" do
160
- ref = PDF::Core::Reference(1,true)
161
- PDF::Core::PdfObject(ref).should == ref.to_s
162
- end
163
-
164
- it "should convert a NameTree::Node to a PDF hash" do
165
- node = PDF::Core::NameTree::Node.new(Prawn::Document.new, 10)
166
- node.add "hello", 1.0
167
- node.add "world", 2.0
168
- data = PDF::Core::PdfObject(node)
169
- res = PDF::Inspector.parse(data)
170
- res.should == {:Names => ["hello", 1.0, "world", 2.0]}
171
- end
172
- end
@@ -1,58 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- describe "Stream object" do
6
- it "should compress a stream upon request" do
7
- stream = PDF::Core::Stream.new
8
- stream << "Hi There " * 20
9
-
10
- cstream = PDF::Core::Stream.new
11
- cstream << "Hi There " * 20
12
- cstream.compress!
13
-
14
- cstream.filtered_stream.length.should be < stream.length,
15
- "compressed stream expected to be smaller than source but wasn't"
16
- cstream.data[:Filter].should == [:FlateDecode]
17
- end
18
-
19
- it "should expose sompression state" do
20
- stream = PDF::Core::Stream.new
21
- stream << "Hello"
22
- stream.compress!
23
-
24
- stream.should be_compressed
25
- end
26
-
27
- it "should detect from filters if stream is compressed" do
28
- stream = PDF::Core::Stream.new
29
- stream << "Hello"
30
- stream.filters << :FlateDecode
31
-
32
- stream.should be_compressed
33
- end
34
-
35
- it "should have Length if in data" do
36
- stream = PDF::Core::Stream.new
37
- stream << "hello"
38
-
39
- stream.data[:Length].should == 5
40
- end
41
-
42
- it "should update Length when updated" do
43
- stream = PDF::Core::Stream.new
44
- stream << "hello"
45
- stream.data[:Length].should == 5
46
-
47
- stream << " world"
48
- stream.data[:Length].should == 11
49
- end
50
-
51
- it "should corecly handle decode params" do
52
- stream = PDF::Core::Stream.new
53
- stream << "Hello"
54
- stream.filters << { :FlateDecode => { :Predictor => 15 } }
55
-
56
- stream.data[:DecodeParms].should == [{ :Predictor => 15 }]
57
- end
58
- end