libis-format 1.3.2 → 1.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68f64b7c012a051d6c25eb3cb02fb74d662c0f1da348d4b3b5b4af5b7004d543
4
- data.tar.gz: 62708947cef69d89540b2dd73b85a546eb012fae7e6565e329e989ab0573949b
3
+ metadata.gz: e8f7ecb168b9a5db9a47b91035c1f8988c8a079963ad0764e23ad00b2bde61b1
4
+ data.tar.gz: 2fecf5a7eb4f0a74573d8182111dac6bb4abc05e9c8d22c248b79cc6533a93ef
5
5
  SHA512:
6
- metadata.gz: ed3dc449c70eb71f081a6c55f06d8a2b484afb0094a6988aad0ca018ae36e07beb1d9fae3a8fb0a3a026e90c13386f83686b7c66be34b8a028d588ef9412bd99
7
- data.tar.gz: 44bc49f3315e99974e5c7f992e1f496ec3e59dbd15839f93a0e2f8b20fc73dcbfba0f77e178514f0e78f0f561961f55f31895e843ba217e70e2a3cc79b47cdfb
6
+ metadata.gz: 4ea0eced4ca98790237cbb936cd347964693a0b5d627e9564fb184621d018868d69e6208c5afc2cbaf78db096e5a7342fa42af9604921bf411b3b2c70c4e8722
7
+ data.tar.gz: 339f5f89b61747862d2f005ede140300f09ae8ab9aee4693d0214edac3bfba52b8f8b2eaa04b9e1e499debdee805403f1e8434c3ef7907d4ea0ae86e54bdc01f
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'os'
4
+
5
+ require 'libis/tools/extend/string'
6
+ require 'libis/tools/logger'
7
+ require 'libis/tools/command'
8
+
9
+ require 'libis/format/config'
10
+
11
+ module Libis
12
+ module Format
13
+ module Tool
14
+ class PdfMerge
15
+ include ::Libis::Tools::Logger
16
+
17
+ def self.installed?
18
+ result = Libis::Tools::Command.run(Libis::Format::Config[:java_cmd], '-version')
19
+ return false unless (result[:status]).zero?
20
+
21
+ File.exist?(Libis::Format::Config[:pdf_tool])
22
+ end
23
+
24
+ def self.run(source, target, *options)
25
+ new.run source, target, options
26
+ end
27
+
28
+ def run(source, target, *options)
29
+ source = [source] unless source.is_a?(Array)
30
+
31
+ if OS.java?
32
+ # TODO: import library and execute in current VM. For now do exactly as in MRI.
33
+ end
34
+
35
+ timeout = Libis::Format::Config[:timeouts][:pdf_tool]
36
+ args = [
37
+ Libis::Format::Config[:java_cmd],
38
+ '-jar', Libis::Format::Config[:pdf_tool],
39
+ 'merge',
40
+ '-o', target,
41
+ options,
42
+ source
43
+ ].flatten
44
+
45
+ result = Libis::Tools::Command.run(*args, timeout: , kill_after: timeout * 2)
46
+
47
+ result[:err] << "#{self.class} took too long (> #{timeout} seconds) to complete" if result[:timeout]
48
+
49
+ result
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'libis/format/tool/pdf_tool'
4
+
5
+ module Libis
6
+ module Format
7
+ module Tool
8
+ class PdfSplit
9
+
10
+ def self.run(source, target, *options)
11
+ PdfTool.run('split', source, target, *options)
12
+ end
13
+
14
+ def run(source, target, *options)
15
+ PdfTool.run('split', source, target, *options)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Libis
4
4
  module Format
5
- VERSION = '1.3.2'
5
+ VERSION = '1.3.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chromaprint
@@ -281,7 +281,9 @@ files:
281
281
  - lib/libis/format/tool/identification_tool.rb
282
282
  - lib/libis/format/tool/msg_to_pdf.rb
283
283
  - lib/libis/format/tool/office_to_pdf.rb
284
+ - lib/libis/format/tool/pdf_merge.rb
284
285
  - lib/libis/format/tool/pdf_optimizer.rb
286
+ - lib/libis/format/tool/pdf_split.rb
285
287
  - lib/libis/format/tool/pdf_to_pdfa.rb
286
288
  - lib/libis/format/tool/pdf_tool.rb
287
289
  - lib/libis/format/tool/pdfa_validator.rb