pdf-reader 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -1
- data/examples/rspec.rb +1 -0
- data/lib/pdf/reader/buffer.rb +1 -0
- data/lib/pdf/reader/cid_widths.rb +1 -0
- data/lib/pdf/reader/cmap.rb +5 -3
- data/lib/pdf/reader/encoding.rb +2 -1
- data/lib/pdf/reader/error.rb +8 -0
- data/lib/pdf/reader/filter/ascii85.rb +2 -0
- data/lib/pdf/reader/filter/ascii_hex.rb +6 -1
- data/lib/pdf/reader/filter/depredict.rb +7 -5
- data/lib/pdf/reader/filter/flate.rb +2 -0
- data/lib/pdf/reader/filter/lzw.rb +2 -0
- data/lib/pdf/reader/filter/null.rb +1 -0
- data/lib/pdf/reader/filter/run_length.rb +19 -13
- data/lib/pdf/reader/filter.rb +1 -0
- data/lib/pdf/reader/font.rb +1 -0
- data/lib/pdf/reader/font_descriptor.rb +1 -0
- data/lib/pdf/reader/form_xobject.rb +1 -0
- data/lib/pdf/reader/glyph_hash.rb +1 -0
- data/lib/pdf/reader/lzw.rb +4 -2
- data/lib/pdf/reader/null_security_handler.rb +1 -0
- data/lib/pdf/reader/object_cache.rb +1 -0
- data/lib/pdf/reader/object_hash.rb +5 -2
- data/lib/pdf/reader/object_stream.rb +1 -0
- data/lib/pdf/reader/overlapping_runs_filter.rb +11 -4
- data/lib/pdf/reader/page.rb +60 -9
- data/lib/pdf/reader/page_layout.rb +24 -14
- data/lib/pdf/reader/page_state.rb +11 -10
- data/lib/pdf/reader/page_text_receiver.rb +13 -8
- data/lib/pdf/reader/pages_strategy.rb +1 -0
- data/lib/pdf/reader/parser.rb +4 -1
- data/lib/pdf/reader/point.rb +25 -0
- data/lib/pdf/reader/print_receiver.rb +1 -0
- data/lib/pdf/reader/rectangle.rb +95 -0
- data/lib/pdf/reader/reference.rb +1 -0
- data/lib/pdf/reader/register_receiver.rb +1 -0
- data/lib/pdf/reader/resource_methods.rb +5 -0
- data/lib/pdf/reader/standard_security_handler.rb +1 -0
- data/lib/pdf/reader/standard_security_handler_v5.rb +1 -0
- data/lib/pdf/reader/stream.rb +1 -0
- data/lib/pdf/reader/synchronized_cache.rb +1 -0
- data/lib/pdf/reader/text_run.rb +1 -0
- data/lib/pdf/reader/token.rb +1 -0
- data/lib/pdf/reader/transformation_matrix.rb +1 -0
- data/lib/pdf/reader/unimplemented_security_handler.rb +1 -0
- data/lib/pdf/reader/width_calculator/built_in.rb +1 -0
- data/lib/pdf/reader/width_calculator/composite.rb +1 -0
- data/lib/pdf/reader/width_calculator/true_type.rb +1 -0
- data/lib/pdf/reader/width_calculator/type_one_or_three.rb +1 -0
- data/lib/pdf/reader/width_calculator/type_zero.rb +1 -0
- data/lib/pdf/reader/width_calculator.rb +1 -0
- data/lib/pdf/reader/xref.rb +1 -0
- data/lib/pdf/reader/zero_width_runs_filter.rb +2 -0
- data/lib/pdf/reader.rb +14 -4
- data/lib/pdf-reader.rb +1 -0
- data/rbi/pdf-reader.rbi +1744 -0
- metadata +12 -10
- data/lib/pdf/reader/orientation_detector.rb +0 -34
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf-reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -246,7 +246,6 @@ files:
|
|
246
246
|
- lib/pdf/reader/object_cache.rb
|
247
247
|
- lib/pdf/reader/object_hash.rb
|
248
248
|
- lib/pdf/reader/object_stream.rb
|
249
|
-
- lib/pdf/reader/orientation_detector.rb
|
250
249
|
- lib/pdf/reader/overlapping_runs_filter.rb
|
251
250
|
- lib/pdf/reader/page.rb
|
252
251
|
- lib/pdf/reader/page_layout.rb
|
@@ -254,7 +253,9 @@ files:
|
|
254
253
|
- lib/pdf/reader/page_text_receiver.rb
|
255
254
|
- lib/pdf/reader/pages_strategy.rb
|
256
255
|
- lib/pdf/reader/parser.rb
|
256
|
+
- lib/pdf/reader/point.rb
|
257
257
|
- lib/pdf/reader/print_receiver.rb
|
258
|
+
- lib/pdf/reader/rectangle.rb
|
258
259
|
- lib/pdf/reader/reference.rb
|
259
260
|
- lib/pdf/reader/register_receiver.rb
|
260
261
|
- lib/pdf/reader/resource_methods.rb
|
@@ -274,15 +275,16 @@ files:
|
|
274
275
|
- lib/pdf/reader/width_calculator/type_zero.rb
|
275
276
|
- lib/pdf/reader/xref.rb
|
276
277
|
- lib/pdf/reader/zero_width_runs_filter.rb
|
278
|
+
- rbi/pdf-reader.rbi
|
277
279
|
homepage: https://github.com/yob/pdf-reader
|
278
280
|
licenses:
|
279
281
|
- MIT
|
280
282
|
metadata:
|
281
283
|
bug_tracker_uri: https://github.com/yob/pdf-reader/issues
|
282
|
-
changelog_uri: https://github.com/yob/pdf-reader/blob/v2.
|
283
|
-
documentation_uri: https://www.rubydoc.info/gems/pdf-reader/2.
|
284
|
-
source_code_uri: https://github.com/yob/pdf-reader/tree/v2.
|
285
|
-
post_install_message:
|
284
|
+
changelog_uri: https://github.com/yob/pdf-reader/blob/v2.7.0/CHANGELOG
|
285
|
+
documentation_uri: https://www.rubydoc.info/gems/pdf-reader/2.7.0
|
286
|
+
source_code_uri: https://github.com/yob/pdf-reader/tree/v2.7.0
|
287
|
+
post_install_message:
|
286
288
|
rdoc_options:
|
287
289
|
- "--title"
|
288
290
|
- PDF::Reader Documentation
|
@@ -302,8 +304,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
304
|
- !ruby/object:Gem::Version
|
303
305
|
version: '0'
|
304
306
|
requirements: []
|
305
|
-
rubygems_version: 3.
|
306
|
-
signing_key:
|
307
|
+
rubygems_version: 3.2.3
|
308
|
+
signing_key:
|
307
309
|
specification_version: 4
|
308
310
|
summary: A library for accessing the content of PDF files
|
309
311
|
test_files: []
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
class PDF::Reader
|
5
|
-
# Small util class for detecting the orientation of a single PDF page. Accounts
|
6
|
-
# for any page rotation that is in place.
|
7
|
-
#
|
8
|
-
# OrientationDetector.new(:MediaBox => [0,0,612,792]).orientation
|
9
|
-
# => "portrait"
|
10
|
-
#
|
11
|
-
class OrientationDetector
|
12
|
-
def initialize(attributes)
|
13
|
-
@attributes = attributes
|
14
|
-
end
|
15
|
-
|
16
|
-
def orientation
|
17
|
-
@orientation ||= detect_orientation
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def detect_orientation
|
23
|
-
llx,lly,urx,ury = @attributes[:MediaBox]
|
24
|
-
rotation = @attributes[:Rotate].to_i
|
25
|
-
width = (urx.to_i - llx.to_i).abs
|
26
|
-
height = (ury.to_i - lly.to_i).abs
|
27
|
-
if width > height
|
28
|
-
(rotation % 180).zero? ? 'landscape' : 'portrait'
|
29
|
-
else
|
30
|
-
(rotation % 180).zero? ? 'portrait' : 'landscape'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|