mupdf 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33eaf76d7941cd48249d245e79852baac44e1735a6ed41b55c57b000c22637b4
4
- data.tar.gz: ec7b80abfd826b1ae5fd5745e8da85e92da20288989f76552f1e92e8099dcc42
3
+ metadata.gz: 3608937cd01b6b8c0d1fca5b0c6be8752f759c88401ed981759d22fce2f2bfa2
4
+ data.tar.gz: bc2f3f9fe2be26b9c141a865566ca8a264cd563cb30922bd418a8eae1706deb6
5
5
  SHA512:
6
- metadata.gz: 980c614f227fddaba6e878ccab9896c9a517b39bed56334c415061e5968c8cf38ce667080501359ff603b8f996f86f0a441b947b39e5e9a397cf9195815cae32
7
- data.tar.gz: 6b145288f55da2f363f468126c1d67e0b90d477e69bd56cec0bb3884e56aacd3d1733617e49f68ff50a51370f424d1ffeeab58522abb733e52fde726027f1daf
6
+ metadata.gz: f7ad8f8b720cd13d53c1bdc1ec70e9c67a6cb3bdeedd7d999004bb379ca2de732aa6ced8c7d96bb1b7d232c32aa45593a478090c2ef07a181f8df0319dcaf33e
7
+ data.tar.gz: b6296bb3c59ae8a0c439e56ec68e0319ee9f84b806dc00ea9ccaef8f0584e8f89c9f6f8ac6b86ed194a8edd2597d92f229f6aeac6b004da90be98655eebc47c2
data/lib/mupdf/box.rb CHANGED
@@ -3,26 +3,26 @@
3
3
  module MuPDF
4
4
  # A bounding box for a PDF (e.g. media / crop / bleed / trim).
5
5
  class Box
6
- REGEX = /l="(?<l>\d+)" b="(?<b>\d+)" r="(?<r>\d+)" t="(?<t>\d+)"/
6
+ REGEX = /l="(?<l>\d+.?\d*)" b="(?<b>\d+.?\d*)" r="(?<r>\d+.?\d*)" t="(?<t>\d+.?\d*)"/
7
7
 
8
8
  # @!attribute l
9
- # @return [String] The left coordinate.
9
+ # @return [BigDecimal] The left coordinate.
10
10
  attr_reader :l
11
11
 
12
12
  # @!attribute b
13
- # @return [String] The bottom coordinate.
13
+ # @return [BigDecimal] The bottom coordinate.
14
14
  attr_reader :b
15
15
 
16
16
  # @!attribute r
17
- # @return [String] The right coordinate.
17
+ # @return [BigDecimal] The right coordinate.
18
18
  attr_reader :r
19
19
 
20
20
  # @!attribute t
21
- # @return [String] The top coordinate.
21
+ # @return [BigDecimal] The top coordinate.
22
22
  attr_reader :t
23
23
 
24
24
  # @!attribute kind
25
- # @return [Symbol] The kind of box.
25
+ # @return [BigDecimal] The kind of box.
26
26
  attr_reader :kind
27
27
 
28
28
  # @param text [String]
@@ -34,18 +34,18 @@ module MuPDF
34
34
  return unless match
35
35
 
36
36
  new(
37
- l: Integer(match[:l]),
38
- b: Integer(match[:b]),
39
- r: Integer(match[:r]),
40
- t: Integer(match[:t]),
37
+ l: BigDecimal(match[:l]),
38
+ b: BigDecimal(match[:b]),
39
+ r: BigDecimal(match[:r]),
40
+ t: BigDecimal(match[:t]),
41
41
  kind:
42
42
  )
43
43
  end
44
44
 
45
- # @param l [Integer]
46
- # @param b [Integer]
47
- # @param r [Integer]
48
- # @param t [Integer]
45
+ # @param l [BigDecimal]
46
+ # @param b [BigDecimal]
47
+ # @param r [BigDecimal]
48
+ # @param t [BigDecimal]
49
49
  # @param kind [Symbol] optional
50
50
  def initialize(l:, b:, r:, t:, kind: nil)
51
51
  @l = l
@@ -60,12 +60,12 @@ module MuPDF
60
60
  "#<#{self.class.name} l=#{l} b=#{b} r=#{r} t=#{t} kind=#{kind}>"
61
61
  end
62
62
 
63
- # @return [Integer]
63
+ # @return [BigDecimal]
64
64
  def width
65
65
  @r - @l
66
66
  end
67
67
 
68
- # @return [Integer]
68
+ # @return [BigDecimal]
69
69
  def height
70
70
  @t - @b
71
71
  end
data/lib/mupdf/page.rb CHANGED
@@ -96,9 +96,9 @@ module MuPDF
96
96
  # @return [MuPDFBox, nil]
97
97
  attr_accessor :trim_box
98
98
 
99
- # @!attribute pagenum
99
+ # @!attribute number
100
100
  # @return [Integer]
101
- attr_accessor :pagenum
101
+ attr_accessor :number
102
102
 
103
103
  # @param media_box [MuPDF::Box]
104
104
  # @param crop_box [MuPDF::Box]
@@ -117,17 +117,17 @@ module MuPDF
117
117
 
118
118
  # @return [String]
119
119
  def inspect
120
- "#<#{self.class.name} number=#{@number}>"
120
+ "#<#{self.class.name} number=#{@number} width=#{width} height=#{height}>"
121
121
  end
122
122
 
123
- # @return [Integer]
123
+ # @return [BigDecimal, nil]
124
124
  def width
125
- @media_box.width
125
+ @media_box&.width
126
126
  end
127
127
 
128
- # @return [Integer]
128
+ # @return [BigDecimal, nil]
129
129
  def height
130
- @media_box.height
130
+ @media_box&.height
131
131
  end
132
132
  end
133
133
  end
data/lib/mupdf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuPDF
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.4'
5
5
  end
data/lib/mupdf.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bigdecimal'
3
4
  require 'open3'
4
5
  require 'zeitwerk'
5
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mupdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
@@ -10,6 +10,20 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2025-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bigdecimal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: open3
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,8 +76,8 @@ licenses:
62
76
  metadata:
63
77
  rubygems_mfa_required: 'true'
64
78
  homepage_uri: https://github.com/ksylvest/mupdf
65
- source_code_uri: https://github.com/ksylvest/mupdf/tree/v1.0.2
66
- changelog_uri: https://github.com/ksylvest/mupdf/releases/tag/v1.0.2
79
+ source_code_uri: https://github.com/ksylvest/mupdf/tree/v1.0.4
80
+ changelog_uri: https://github.com/ksylvest/mupdf/releases/tag/v1.0.4
67
81
  documentation_uri: https://mupdf.ksylvest.com/
68
82
  post_install_message:
69
83
  rdoc_options: []