dragonfly_pdf 2.1.0 → 2.1.1
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
- data/CHANGELOG.md +4 -0
- data/dragonfly_pdf.gemspec +1 -1
- data/lib/dragonfly_pdf/analysers/pdf_properties.rb +2 -1
- data/lib/dragonfly_pdf/processors/append.rb +2 -1
- data/lib/dragonfly_pdf/processors/convert.rb +3 -2
- data/lib/dragonfly_pdf/processors/page.rb +2 -1
- data/lib/dragonfly_pdf/processors/page_thumb.rb +2 -1
- data/lib/dragonfly_pdf/processors/remove_password.rb +2 -1
- data/lib/dragonfly_pdf/processors/rotate.rb +2 -1
- data/lib/dragonfly_pdf/processors/stamp.rb +2 -1
- data/lib/dragonfly_pdf/processors/subset_fonts.rb +2 -1
- data/lib/dragonfly_pdf/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31dabd88ff1e3af14b23f0ca1312faf01b94e7c6c9ef96e8f76d766dfdf69760
|
4
|
+
data.tar.gz: fcbb5962181c123ebcbf0232be065eb4bc70ee55d83909338750c6884839d37a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2e5ff96f6a72f1b4559b0e7b63a42fe14638964d6319f5cc4ab447d1da03c90fc23f33edf59a3b7a2f0066cc499e3a0431f87fa80aff5d3f5b8c2a83391bbd7
|
7
|
+
data.tar.gz: 0c6abc55f4abff7cbcc88403993fdddb6810844e4b0e4d72fe26b8c33bdc7c794c565af8aa333eee4e7174af10bf7fcfd835a2ee87c8f3aa5efc940b01328816
|
data/CHANGELOG.md
CHANGED
data/dragonfly_pdf.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'dragonfly', '~> 1.0'
|
22
|
-
spec.add_dependency 'dragonfly_libvips', '~> 2.
|
22
|
+
spec.add_dependency 'dragonfly_libvips', '~> 2.3.0', '>= 2.3.1'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.12'
|
25
25
|
spec.add_development_dependency 'guard'
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Analysers
|
3
3
|
class PdfProperties
|
4
4
|
def call(content, options = {})
|
5
|
-
return {} unless
|
5
|
+
return {} unless content.ext
|
6
|
+
return {} unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
data = `pdftk #{content.path} dump_data`
|
8
9
|
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Processors
|
3
3
|
class Append
|
4
4
|
def call(content, pdfs_to_append, options = {})
|
5
|
-
raise UnsupportedFormat unless
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
content.shell_update(ext: 'pdf') do |old_path, new_path|
|
8
9
|
"#{pdftk_command} #{old_path} #{pdfs_to_append.map(&:path).join(' ')} cat output #{new_path}"
|
@@ -7,12 +7,13 @@ module DragonflyPdf
|
|
7
7
|
DPI = 600
|
8
8
|
|
9
9
|
def call(content, page, geometry = nil, options = {})
|
10
|
-
raise UnsupportedFormat unless
|
10
|
+
raise UnsupportedFormat unless content.ext
|
11
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
11
12
|
|
12
13
|
options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
|
13
14
|
format = options.fetch('format', 'png').to_s
|
14
15
|
|
15
|
-
raise UnsupportedOutputFormat unless SUPPORTED_OUTPUT_FORMATS.include?(format)
|
16
|
+
raise UnsupportedOutputFormat unless SUPPORTED_OUTPUT_FORMATS.include?(format.downcase)
|
16
17
|
|
17
18
|
case format
|
18
19
|
when 'pdf'
|
@@ -4,7 +4,8 @@ module DragonflyPdf
|
|
4
4
|
module Processors
|
5
5
|
class Page
|
6
6
|
def call(content, page_number = 1, _opts = {})
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
pdf_properties = DragonflyPdf::Analysers::PdfProperties.new.call(content)
|
10
11
|
raise DragonflyPdf::PageNotFound unless pdf_properties['page_numbers'].include?(page_number)
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Processors
|
3
3
|
class PageThumb
|
4
4
|
def call(content, page, geometry = nil, options = {})
|
5
|
-
raise UnsupportedFormat unless
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
|
8
9
|
format = options.delete('format') { 'jpg' }.to_s
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Processors
|
3
3
|
class RemovePassword
|
4
4
|
def call(content, _options = {})
|
5
|
-
raise UnsupportedFormat unless
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
content.shell_update(ext: 'pdf') do |old_path, new_path|
|
8
9
|
"#{gs_command} -q -sOutputFile=#{new_path} -c .setpdfwrite -f #{old_path}"
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Processors
|
3
3
|
class Rotate
|
4
4
|
def call(content, arg)
|
5
|
-
raise UnsupportedFormat unless
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
rotate_args = case arg
|
8
9
|
when String, Symbol
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Processors
|
3
3
|
class Stamp
|
4
4
|
def call(content, stamp_pdf, _options = {})
|
5
|
-
raise UnsupportedFormat unless
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
content.shell_update(ext: 'pdf') do |old_path, new_path|
|
8
9
|
"#{pdftk_command} #{old_path} stamp #{stamp_pdf.path} output #{new_path}"
|
@@ -2,7 +2,8 @@ module DragonflyPdf
|
|
2
2
|
module Processors
|
3
3
|
class SubsetFonts
|
4
4
|
def call(content, _opts = {})
|
5
|
-
raise UnsupportedFormat unless
|
5
|
+
raise UnsupportedFormat unless content.ext
|
6
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
6
7
|
|
7
8
|
content.shell_update(ext: 'pdf') do |old_path, new_path|
|
8
9
|
"#{gs_command} -o #{new_path} -f #{old_path}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dragonfly
|
@@ -30,14 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.3.0
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.3.1
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
43
|
+
version: 2.3.0
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.3.1
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bundler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|