pdf-core 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/Rakefile +9 -5
- data/lib/pdf/core.rb +20 -19
- data/lib/pdf/core/annotations.rb +16 -17
- data/lib/pdf/core/byte_string.rb +1 -1
- data/lib/pdf/core/destinations.rb +17 -14
- data/lib/pdf/core/document_state.rb +21 -16
- data/lib/pdf/core/filter_list.rb +4 -4
- data/lib/pdf/core/filters.rb +4 -4
- data/lib/pdf/core/graphics_state.rb +15 -19
- data/lib/pdf/core/name_tree.rb +44 -40
- data/lib/pdf/core/object_store.rb +13 -18
- data/lib/pdf/core/outline_item.rb +11 -6
- data/lib/pdf/core/outline_root.rb +1 -1
- data/lib/pdf/core/page.rb +93 -64
- data/lib/pdf/core/page_geometry.rb +52 -56
- data/lib/pdf/core/pdf_object.rb +41 -41
- data/lib/pdf/core/reference.rb +12 -17
- data/lib/pdf/core/renderer.rb +41 -32
- data/lib/pdf/core/stream.rb +6 -8
- data/lib/pdf/core/text.rb +83 -47
- data/lib/pdf/core/utils.rb +12 -0
- data/pdf-core.gemspec +33 -20
- metadata +79 -24
- metadata.gz.sig +0 -0
- data/spec/decimal_rounding_spec.rb +0 -12
- data/spec/document_state_spec.rb +0 -30
- data/spec/filters_spec.rb +0 -34
- data/spec/name_tree_spec.rb +0 -122
- data/spec/object_store_spec.rb +0 -49
- data/spec/pdf_object_spec.rb +0 -172
- data/spec/reference_spec.rb +0 -62
- data/spec/spec_helper.rb +0 -32
- data/spec/stream_spec.rb +0 -59
data/spec/spec_helper.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
puts "PDF::Core specs: Running on Ruby Version: #{RUBY_VERSION}"
|
4
|
-
|
5
|
-
require "bundler"
|
6
|
-
Bundler.setup
|
7
|
-
|
8
|
-
if ENV["COVERAGE"]
|
9
|
-
require "simplecov"
|
10
|
-
SimpleCov.start
|
11
|
-
end
|
12
|
-
|
13
|
-
require_relative "../lib/pdf/core"
|
14
|
-
|
15
|
-
|
16
|
-
require "rspec"
|
17
|
-
require "pdf/reader"
|
18
|
-
require "pdf/inspector"
|
19
|
-
|
20
|
-
RSpec.configure do |config|
|
21
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
22
|
-
end
|
23
|
-
|
24
|
-
RSpec::Matchers.define :have_parseable_xobjects do
|
25
|
-
match do |actual|
|
26
|
-
expect { PDF::Inspector::XObject.analyze(actual.render) }.not_to raise_error
|
27
|
-
true
|
28
|
-
end
|
29
|
-
failure_message_for_should do |actual|
|
30
|
-
"expected that #{actual}'s XObjects could be successfully parsed"
|
31
|
-
end
|
32
|
-
end
|
data/spec/stream_spec.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "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
|
59
|
-
|