libis-format 2.0.0 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/bin/{droid → droid_tool} +0 -0
  4. data/bin/{fido → fido_tool} +0 -0
  5. data/lib/libis/format.rb +7 -1
  6. data/lib/libis/format/config.rb +13 -11
  7. data/lib/libis/format/converter/audio_converter.rb +6 -6
  8. data/lib/libis/format/converter/base.rb +1 -0
  9. data/lib/libis/format/converter/image_converter.rb +1 -1
  10. data/lib/libis/format/converter/image_splitter.rb +4 -0
  11. data/lib/libis/format/converter/jp2_converter.rb +4 -2
  12. data/lib/libis/format/converter/pdf_converter.rb +4 -72
  13. data/lib/libis/format/converter/pdf_metadata.rb +82 -0
  14. data/lib/libis/format/converter/pdf_optimizer.rb +0 -3
  15. data/lib/libis/format/converter/pdf_protecter.rb +147 -0
  16. data/lib/libis/format/converter/pdf_selecter.rb +83 -0
  17. data/lib/libis/format/converter/pdf_splitter.rb +20 -15
  18. data/lib/libis/format/converter/pdf_watermarker_header.rb +71 -0
  19. data/lib/libis/format/converter/pdf_watermarker_image.rb +76 -0
  20. data/lib/libis/format/converter/{pdf_watermarker.rb → pdf_watermarker_text.rb} +14 -31
  21. data/lib/libis/format/converter/video_converter.rb +22 -22
  22. data/lib/libis/format/tool.rb +4 -1
  23. data/lib/libis/format/tool/pdf_merge.rb +3 -3
  24. data/lib/libis/format/tool/{pdf_copy.rb → pdf_metadata.rb} +5 -5
  25. data/lib/libis/format/tool/pdf_protect.rb +47 -0
  26. data/lib/libis/format/tool/pdf_select.rb +47 -0
  27. data/lib/libis/format/tool/pdf_split.rb +4 -4
  28. data/lib/libis/format/tool/pdf_watermark.rb +47 -0
  29. data/lib/libis/format/version.rb +1 -1
  30. data/libis-format.gemspec +1 -1
  31. data/tools/PdfTool.jar +0 -0
  32. data/tools/bcpkix-jdk15on-167.jar +0 -0
  33. data/tools/bcprov-jdk15on-167.jar +0 -0
  34. metadata +23 -17
  35. data/bin/pdf_copy +0 -13
  36. data/tools/bcpkix-jdk15on-1.49.jar +0 -0
  37. data/tools/bcprov-jdk15on-1.49.jar +0 -0
@@ -12,10 +12,13 @@ module Libis
12
12
  autoload :OfficeToPdf, 'libis/format/tool/office_to_pdf'
13
13
  autoload :FFMpeg, 'libis/format/tool/ffmpeg'
14
14
  autoload :FopPdf, 'libis/format/tool/fop_pdf'
15
- autoload :PdfCopy, 'libis/format/tool/pdf_copy'
16
15
  autoload :PdfMerge, 'libis/format/tool/pdf_merge'
16
+ autoload :PdfMetadata, 'libis/format/tool/pdf_metadata'
17
17
  autoload :PdfOptimizer, 'libis/format/tool/pdf_optimizer'
18
+ autoload :PdfProtect, 'libis/format/tool/pdf_protect'
19
+ autoload :PdfSelect, 'libis/format/tool/pdf_select'
18
20
  autoload :PdfSplit, 'libis/format/tool/pdf_split'
21
+ autoload :PdfWatermark, 'libis/format/tool/pdf_watermark'
19
22
  autoload :PdfToPdfa, 'libis/format/tool/pdf_to_pdfa'
20
23
  autoload :PdfaValidator, 'libis/format/tool/pdfa_validator'
21
24
 
@@ -27,9 +27,9 @@ module Libis
27
27
  timeout = Libis::Format::Config[:timeouts][:pdf_merge]
28
28
  result = Libis::Tools::Command.run(
29
29
  Libis::Format::Config[:java_cmd],
30
- '-cp', Libis::Format::Config[:pdf_tool],
31
- 'MergePdf',
32
- '--file_output', target,
30
+ '-jar', Libis::Format::Config[:pdf_tool],
31
+ 'merge',
32
+ '-o', target,
33
33
  *options,
34
34
  *source,
35
35
  timeout: timeout,
@@ -10,7 +10,7 @@ module Libis
10
10
  module Format
11
11
  module Tool
12
12
 
13
- class PdfCopy
13
+ class PdfMetadata
14
14
  include ::Libis::Tools::Logger
15
15
 
16
16
  def self.run(source, target, options = [])
@@ -26,10 +26,10 @@ module Libis
26
26
  timeout = Libis::Format::Config[:timeouts][:pdf_copy]
27
27
  result = Libis::Tools::Command.run(
28
28
  Libis::Format::Config[:java_cmd],
29
- '-cp', Libis::Format::Config[:pdf_tool],
30
- 'CopyPdf',
31
- '--file_input', source,
32
- '--file_output', target,
29
+ '-jar', Libis::Format::Config[:pdf_tool],
30
+ 'metadata',
31
+ '-i', source,
32
+ '-o', target,
33
33
  *options,
34
34
  timeout: timeout,
35
35
  kill_after: timeout * 2
@@ -0,0 +1,47 @@
1
+ require 'os'
2
+
3
+ require 'libis/tools/extend/string'
4
+ require 'libis/tools/logger'
5
+ require 'libis/tools/command'
6
+
7
+ require 'libis/format/config'
8
+
9
+ module Libis
10
+ module Format
11
+ module Tool
12
+
13
+ class PdfProtect
14
+ include ::Libis::Tools::Logger
15
+
16
+ def self.run(source, target, options = [])
17
+ self.new.run source, target, options
18
+ end
19
+
20
+ def run(source, target, options = [])
21
+
22
+ if OS.java?
23
+ # TODO: import library and execute in current VM. For now do exactly as in MRI.
24
+ end
25
+
26
+ timeout = Libis::Format::Config[:timeouts][:pdf_copy]
27
+ result = Libis::Tools::Command.run(
28
+ Libis::Format::Config[:java_cmd],
29
+ '-jar', Libis::Format::Config[:pdf_tool],
30
+ 'protect',
31
+ '-i', source,
32
+ '-o', target,
33
+ *options,
34
+ timeout: timeout,
35
+ kill_after: timeout * 2
36
+ )
37
+
38
+ raise RuntimeError, "#{self.class} took too long (> #{timeout} seconds) to complete" if result[:timeout]
39
+ raise RuntimeError, "#{self.class} errors: #{result[:err].join("\n")}" unless result[:status] == 0 && result[:err].empty?
40
+
41
+ result
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ require 'os'
2
+
3
+ require 'libis/tools/extend/string'
4
+ require 'libis/tools/logger'
5
+ require 'libis/tools/command'
6
+
7
+ require 'libis/format/config'
8
+
9
+ module Libis
10
+ module Format
11
+ module Tool
12
+
13
+ class PdfSelect
14
+ include ::Libis::Tools::Logger
15
+
16
+ def self.run(source, target, options = [])
17
+ self.new.run source, target, options
18
+ end
19
+
20
+ def run(source, target, options = [])
21
+
22
+ if OS.java?
23
+ # TODO: import library and execute in current VM. For now do exactly as in MRI.
24
+ end
25
+
26
+ timeout = Libis::Format::Config[:timeouts][:pdf_select]
27
+ result = Libis::Tools::Command.run(
28
+ Libis::Format::Config[:java_cmd],
29
+ '-jar', Libis::Format::Config[:pdf_tool],
30
+ 'select',
31
+ '-i', source,
32
+ '-o', target,
33
+ *options,
34
+ timeout: timeout,
35
+ kill_after: timeout * 2
36
+ )
37
+
38
+ raise RuntimeError, "#{self.class} took too long (> #{timeout} seconds) to complete" if result[:timeout]
39
+ raise RuntimeError, "#{self.class} errors: #{result[:err].join("\n")}" unless result[:status] == 0 && result[:err].empty?
40
+
41
+ result
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -26,10 +26,10 @@ module Libis
26
26
  timeout = Libis::Format::Config[:timeouts][:pdf_split]
27
27
  result = Libis::Tools::Command.run(
28
28
  Libis::Format::Config[:java_cmd],
29
- '-cp', Libis::Format::Config[:pdf_tool],
30
- 'SplitPdf',
31
- '--file_input', source,
32
- '--file_output', target,
29
+ '-jar', Libis::Format::Config[:pdf_tool],
30
+ 'split',
31
+ '-i', source,
32
+ '-o', target,
33
33
  *options,
34
34
  timeout: timeout,
35
35
  kill_after: timeout * 2
@@ -0,0 +1,47 @@
1
+ require 'os'
2
+
3
+ require 'libis/tools/extend/string'
4
+ require 'libis/tools/logger'
5
+ require 'libis/tools/command'
6
+
7
+ require 'libis/format/config'
8
+
9
+ module Libis
10
+ module Format
11
+ module Tool
12
+
13
+ class PdfWatermark
14
+ include ::Libis::Tools::Logger
15
+
16
+ def self.run(source, target, wm_type, options = [])
17
+ self.new.run source, target, wm_type, options
18
+ end
19
+
20
+ def run(source, target, wm_type, options = [])
21
+
22
+ if OS.java?
23
+ # TODO: import library and execute in current VM. For now do exactly as in MRI.
24
+ end
25
+
26
+ timeout = Libis::Format::Config[:timeouts][:pdf_watermark]
27
+ result = Libis::Tools::Command.run(
28
+ Libis::Format::Config[:java_cmd],
29
+ '-jar', Libis::Format::Config[:pdf_tool],
30
+ 'watermark', wm_type,
31
+ '-i', source,
32
+ '-o', target,
33
+ *options,
34
+ timeout: timeout,
35
+ kill_after: timeout * 2
36
+ )
37
+
38
+ raise RuntimeError, "#{self.class} took too long (> #{timeout} seconds) to complete" if result[:timeout]
39
+ raise RuntimeError, "#{self.class} errors: #{result[:err].join("\n")}" unless result[:status] == 0 && result[:err].empty?
40
+
41
+ result
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Format
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.5'
4
4
  end
5
5
  end
data/libis-format.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'nokogiri'
34
34
  end
35
35
 
36
- spec.add_runtime_dependency 'libis-tools', '~> 1.0'
36
+ spec.add_runtime_dependency 'libis-tools', '>= 1.0.9'
37
37
  spec.add_runtime_dependency 'os', '= 0.9.6'
38
38
  spec.add_runtime_dependency 'mini_magick', '~> 4.3'
39
39
  spec.add_runtime_dependency 'deep_dive', '~> 0.3'
data/tools/PdfTool.jar CHANGED
Binary file
Binary file
Binary file
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: 2.0.0
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: libis-tools
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '1.0'
89
+ version: 1.0.9
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '1.0'
96
+ version: 1.0.9
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: os
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -169,11 +169,10 @@ description: Collection of tools and classes that help to identify formats of bi
169
169
  email:
170
170
  - kris.dekeyser@libis.be
171
171
  executables:
172
- - droid
173
- - fido
172
+ - droid_tool
173
+ - fido_tool
174
174
  - formatinfo
175
175
  - libis_format
176
- - pdf_copy
177
176
  extensions: []
178
177
  extra_rdoc_files: []
179
178
  files:
@@ -188,11 +187,10 @@ files:
188
187
  - base/Dockerfile.alpine
189
188
  - base/Dockerfile.rvm
190
189
  - base/rework_path
191
- - bin/droid
192
- - bin/fido
190
+ - bin/droid_tool
191
+ - bin/fido_tool
193
192
  - bin/formatinfo
194
193
  - bin/libis_format
195
- - bin/pdf_copy
196
194
  - data/ISOcoated_v2_eci.icc
197
195
  - data/PDFA_def.ps
198
196
  - data/ead.xsd
@@ -222,9 +220,14 @@ files:
222
220
  - lib/libis/format/converter/office_converter.rb
223
221
  - lib/libis/format/converter/pdf_assembler.rb
224
222
  - lib/libis/format/converter/pdf_converter.rb
223
+ - lib/libis/format/converter/pdf_metadata.rb
225
224
  - lib/libis/format/converter/pdf_optimizer.rb
225
+ - lib/libis/format/converter/pdf_protecter.rb
226
+ - lib/libis/format/converter/pdf_selecter.rb
226
227
  - lib/libis/format/converter/pdf_splitter.rb
227
- - lib/libis/format/converter/pdf_watermarker.rb
228
+ - lib/libis/format/converter/pdf_watermarker_header.rb
229
+ - lib/libis/format/converter/pdf_watermarker_image.rb
230
+ - lib/libis/format/converter/pdf_watermarker_text.rb
228
231
  - lib/libis/format/converter/repository.rb
229
232
  - lib/libis/format/converter/spreadsheet_converter.rb
230
233
  - lib/libis/format/converter/video_converter.rb
@@ -241,19 +244,22 @@ files:
241
244
  - lib/libis/format/tool/fop_pdf.rb
242
245
  - lib/libis/format/tool/identification_tool.rb
243
246
  - lib/libis/format/tool/office_to_pdf.rb
244
- - lib/libis/format/tool/pdf_copy.rb
245
247
  - lib/libis/format/tool/pdf_merge.rb
248
+ - lib/libis/format/tool/pdf_metadata.rb
246
249
  - lib/libis/format/tool/pdf_optimizer.rb
250
+ - lib/libis/format/tool/pdf_protect.rb
251
+ - lib/libis/format/tool/pdf_select.rb
247
252
  - lib/libis/format/tool/pdf_split.rb
248
253
  - lib/libis/format/tool/pdf_to_pdfa.rb
254
+ - lib/libis/format/tool/pdf_watermark.rb
249
255
  - lib/libis/format/tool/pdfa_validator.rb
250
256
  - lib/libis/format/tool/spreadsheet_to_ods.rb
251
257
  - lib/libis/format/version.rb
252
258
  - lib/libis/format/yaml_loader.rb
253
259
  - libis-format.gemspec
254
260
  - tools/PdfTool.jar
255
- - tools/bcpkix-jdk15on-1.49.jar
256
- - tools/bcprov-jdk15on-1.49.jar
261
+ - tools/bcpkix-jdk15on-167.jar
262
+ - tools/bcprov-jdk15on-167.jar
257
263
  - tools/fop/build/fop.jar
258
264
  - tools/fop/conf/fop.xconf
259
265
  - tools/fop/fop
@@ -325,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
331
  - !ruby/object:Gem::Version
326
332
  version: '0'
327
333
  requirements: []
328
- rubygems_version: 3.0.8
334
+ rubygems_version: 3.1.4
329
335
  signing_key:
330
336
  specification_version: 4
331
337
  summary: LIBIS File format format services.
data/bin/pdf_copy DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'libis-format'
4
- require 'libis-tools'
5
-
6
- ::Libis::Tools::Config.logger.level = :WARN
7
-
8
- source = ARGV.shift
9
- target = ARGV.shift
10
- options = ARGV
11
-
12
- ::Libis::Format::Tool::PdfCopy.run source, target, options
13
-
Binary file
Binary file