libis-format 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libis/format/tool/pdf_merge.rb +54 -0
- data/lib/libis/format/tool/pdf_split.rb +20 -0
- data/lib/libis/format/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8f7ecb168b9a5db9a47b91035c1f8988c8a079963ad0764e23ad00b2bde61b1
|
4
|
+
data.tar.gz: 2fecf5a7eb4f0a74573d8182111dac6bb4abc05e9c8d22c248b79cc6533a93ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/libis/format/version.rb
CHANGED
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.
|
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-
|
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
|