pdf4me 2.0.3 → 2.0.4
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/LICENSE.txt +0 -0
- data/README.md +246 -15
- data/lib/pdf4me.rb +30 -0
- data/lib/pdf4me/actions/complex_action.rb +5 -0
- data/lib/pdf4me/actions/convert_file_to_pdf.rb +3 -1
- data/lib/pdf4me/actions/convert_to_pdf.rb +1 -5
- data/lib/pdf4me/actions/create_images.rb +10 -0
- data/lib/pdf4me/actions/create_pdf_a.rb +0 -0
- data/lib/pdf4me/actions/create_thumbnail.rb +3 -1
- data/lib/pdf4me/actions/extract.rb +10 -0
- data/lib/pdf4me/actions/extract_pages.rb +4 -2
- data/lib/pdf4me/actions/merge.rb +35 -0
- data/lib/pdf4me/actions/merge_two_pdfs.rb +5 -4
- data/lib/pdf4me/actions/optimize.rb +0 -0
- data/lib/pdf4me/actions/optimize_by_profile.rb +3 -1
- data/lib/pdf4me/actions/pdf_a.rb +10 -0
- data/lib/pdf4me/actions/split.rb +10 -0
- data/lib/pdf4me/actions/split_by_page_nr.rb +0 -0
- data/lib/pdf4me/actions/stamp.rb +10 -0
- data/lib/pdf4me/actions/text_stamp.rb +9 -2
- data/lib/pdf4me/actions/wrapper_action.rb +0 -0
- data/lib/pdf4me/client.rb +0 -0
- data/lib/pdf4me/configuration.rb +0 -0
- data/lib/pdf4me/exceptions.rb +0 -0
- data/lib/pdf4me/models/base.rb +5 -1
- data/lib/pdf4me/models/color.rb +10 -0
- data/lib/pdf4me/models/convert_to_pdf_action.rb +0 -0
- data/lib/pdf4me/models/convert_to_pdf_res.rb +2 -1
- data/lib/pdf4me/models/create_images_res.rb +9 -0
- data/lib/pdf4me/models/custom_cms_config.rb +23 -0
- data/lib/pdf4me/models/doc_log.rb +0 -0
- data/lib/pdf4me/models/doc_metadata.rb +0 -0
- data/lib/pdf4me/models/document.rb +0 -0
- data/lib/pdf4me/models/extract_action.rb +28 -0
- data/lib/pdf4me/models/extract_res.rb +9 -0
- data/lib/pdf4me/models/image.rb +11 -0
- data/lib/pdf4me/models/image_action.rb +110 -0
- data/lib/pdf4me/models/merge_action.rb +8 -0
- data/lib/pdf4me/models/merge_res.rb +8 -0
- data/lib/pdf4me/models/notification.rb +1 -1
- data/lib/pdf4me/models/optimize_action.rb +0 -0
- data/lib/pdf4me/models/optimize_res.rb +2 -1
- data/lib/pdf4me/models/page.rb +0 -0
- data/lib/pdf4me/models/page_selection.rb +21 -0
- data/lib/pdf4me/models/pdf_a_action.rb +33 -0
- data/lib/pdf4me/models/pdf_a_res.rb +8 -0
- data/lib/pdf4me/models/pdf_font.rb +9 -0
- data/lib/pdf4me/models/rgb_set.rb +10 -0
- data/lib/pdf4me/models/rotate.rb +12 -0
- data/lib/pdf4me/models/split_action.rb +11 -0
- data/lib/pdf4me/models/split_res.rb +8 -0
- data/lib/pdf4me/models/stamp_action.rb +60 -0
- data/lib/pdf4me/models/stamp_res.rb +8 -0
- data/lib/pdf4me/models/text.rb +37 -0
- data/lib/pdf4me/models/transform.rb +16 -0
- data/lib/pdf4me/models/translate.rb +12 -0
- data/lib/pdf4me/utils/assigner.rb +0 -0
- data/lib/pdf4me/utils/serializer.rb +2 -0
- data/lib/pdf4me/version.rb +1 -1
- data/spec/actions/complex_action_spec.rb +12 -0
- data/spec/actions/convert_file_to_pdf_spec.rb +21 -0
- data/spec/actions/convert_to_pdf_spec.rb +16 -0
- data/spec/actions/create_pdf_a_spec.rb +0 -0
- data/spec/actions/create_thumbnail_spec.rb +27 -0
- data/spec/actions/extract_pages_spec.rb +24 -0
- data/spec/actions/extract_spec.rb +16 -0
- data/spec/actions/merge_spec.rb +17 -0
- data/spec/actions/merge_two_pdfs_spec.rb +21 -0
- data/spec/actions/optimize_by_profile_spec.rb +22 -0
- data/spec/actions/optimize_spec.rb +16 -0
- data/spec/actions/pdf_a_spec.rb +16 -0
- data/spec/actions/split_by_page_nr_spec.rb +21 -0
- data/spec/actions/split_spec.rb +16 -0
- data/spec/actions/stamp_spec.rb +16 -0
- data/spec/actions/text_stamp_spec.rb +24 -0
- data/spec/actions/wrapper_action_spec.rb +0 -0
- data/spec/files/4.pdf +0 -0
- data/spec/models/base_spec.rb +9 -0
- data/spec/models/color_spec.rb +7 -0
- data/spec/models/convert_to_pdf_action_spec.rb +23 -0
- data/spec/models/convert_to_pdf_res_spec.rb +7 -0
- data/spec/models/create_images_res_spec.rb +7 -0
- data/spec/models/custom_cms_config_spec.rb +7 -0
- data/spec/models/doc_log_spec.rb +36 -0
- data/spec/models/doc_metadata_spec.rb +7 -0
- data/spec/models/document_spec.rb +12 -0
- data/spec/models/extract_action_spec.rb +7 -0
- data/spec/models/extract_res_spec.rb +7 -0
- data/spec/models/image_action_spec.rb +46 -0
- data/spec/models/merge_action_spec.rb +7 -0
- data/spec/models/merge_res_spec.rb +7 -0
- data/spec/models/notification_spec.rb +13 -0
- data/spec/models/optimize_action_spec.rb +44 -0
- data/spec/models/optimize_res_spec.rb +7 -0
- data/spec/models/page_selection_spec.rb +17 -0
- data/spec/models/page_spec.rb +7 -0
- data/spec/models/pdf_a_action_spec.rb +22 -0
- data/spec/models/pdf_a_res_spec.rb +7 -0
- data/spec/models/pdf_font_spec.rb +7 -0
- data/spec/models/rgb_set_spec.rb +7 -0
- data/spec/models/rotate_spec.rb +13 -0
- data/spec/models/split_action_spec.rb +7 -0
- data/spec/models/split_res_spec.rb +7 -0
- data/spec/models/stamp_action_spec.rb +27 -0
- data/spec/models/stamp_res_spec.rb +7 -0
- data/spec/models/text_spec.rb +22 -0
- data/spec/models/transform_spec.rb +16 -0
- data/spec/models/translate_spec.rb +12 -0
- data/spec/spec_helper.rb +0 -0
- metadata +142 -90
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::Optimize, type: :action do
|
4
|
+
|
5
|
+
it 'extends Base Action' do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::ComplexAction)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'methods' do
|
10
|
+
describe '.path' do
|
11
|
+
it 'should give the right path' do
|
12
|
+
expect(subject.path).to eq('/Optimize/Optimize')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::PdfA, type: :action do
|
4
|
+
|
5
|
+
it 'extends Base Action' do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::ComplexAction)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'methods' do
|
10
|
+
describe '.path' do
|
11
|
+
it 'should give the right path' do
|
12
|
+
expect(subject.path).to eq('PdfA/PdfA')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::SplitByPageNr, type: :action do
|
4
|
+
|
5
|
+
it 'extends Base Action' do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::WrapperAction)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'validations' do
|
10
|
+
it { should validate_presence_of :file }
|
11
|
+
it { should validate_numericality_of :page_number }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'methods' do
|
15
|
+
describe '.path' do
|
16
|
+
it 'should give the right path' do
|
17
|
+
expect(subject.path).to eq('/Split/SplitByPageNr')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::Split, type: :action do
|
4
|
+
|
5
|
+
it 'extends Base action' do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::ComplexAction)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'methods' do
|
10
|
+
describe '.path' do
|
11
|
+
it 'should give the right path' do
|
12
|
+
expect(subject.path).to eq('/Split/Split')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::Stamp, type: :action do
|
4
|
+
|
5
|
+
it 'extends Base Action' do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::ComplexAction)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'methods' do
|
10
|
+
describe '.path' do
|
11
|
+
it 'should give the right path' do
|
12
|
+
expect(subject.path).to eq('/Stamp/Stamp')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::TextStamp, type: :action do
|
4
|
+
|
5
|
+
it "extends Base Action" do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::WrapperAction)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'validations' do
|
10
|
+
before(:each) do
|
11
|
+
subject.pages=(3)
|
12
|
+
end
|
13
|
+
it { should validate_presence_of :text }
|
14
|
+
it { should validate_presence_of :pages }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'methods' do
|
18
|
+
describe '.path' do
|
19
|
+
it 'should give the right path' do
|
20
|
+
expect(subject.path).to eq('/Stamp/TextStamp')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
File without changes
|
data/spec/files/4.pdf
CHANGED
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::ConvertToPdfAction, type: :model do
|
4
|
+
|
5
|
+
it 'extends base Action' do
|
6
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'validations' do
|
10
|
+
it { should validate_presence_of :pdf_conformance }
|
11
|
+
it { should validate_presence_of :conversion_mode }
|
12
|
+
it { should validate_inclusion_of(:pdf_conformance).in_array %w|pdf17 pdfA1 pdfA2 pdfA3| }
|
13
|
+
it { should validate_inclusion_of(:conversion_mode).in_array %w|fast detailed| }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.default ' do
|
17
|
+
it 'should give the default values' do
|
18
|
+
expect(subject.defaults[:pdf_conformance]).to eq('pdf17')
|
19
|
+
expect(subject.defaults[:conversion_mode]).to eq('fast')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::DocLog, type: :model do
|
4
|
+
it 'extends base Action' do
|
5
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.doc_log_level=' do
|
9
|
+
it 'the log level is 0' do
|
10
|
+
subject.doc_log_level = (0)
|
11
|
+
expect(subject.doc_log_level).to eq('verbose')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'the log level is 1' do
|
15
|
+
subject.doc_log_level = (1)
|
16
|
+
expect(subject.doc_log_level).to eq('info')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'the log level is 2' do
|
20
|
+
subject.doc_log_level = (2)
|
21
|
+
expect(subject.doc_log_level).to eq('warning')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'the log level is 3' do
|
25
|
+
subject.doc_log_level = (3)
|
26
|
+
expect(subject.doc_log_level).to eq('error')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'the log level is 4' do
|
30
|
+
subject.doc_log_level = (4)
|
31
|
+
expect(subject.doc_log_level).to eq('timing')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::ImageAction, type: :model do
|
4
|
+
it 'extends base Action' do
|
5
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'validations' do
|
9
|
+
it { should validate_presence_of :image_extension }
|
10
|
+
|
11
|
+
it { should validate_inclusion_of(:bits_per_pixel).in_array [1, 8, 24, 32] }
|
12
|
+
it { should validate_inclusion_of(:rotate_mode).in_array %w|none attribute potrait landscape| }
|
13
|
+
it { should validate_inclusion_of(:cms_engine).in_array %w|none neugebauer lcms customCMS| }
|
14
|
+
it { should validate_inclusion_of(:dithering).in_array %w|none floydSteinberg halftone pattern g3Optimized g4Optimized atkinson| }
|
15
|
+
it { should validate_inclusion_of(:fill_order).in_array %w|mSB ISB| }
|
16
|
+
it { should validate_inclusion_of(:image_extension).in_array %w|jpg jpeg bmp gif jb2 jp2 jpf jpx png tif tiff| }
|
17
|
+
it { should validate_inclusion_of(:color_space).in_array %w|RGB RGBA Gray GrayA CMYK YCbCR YCbCrK Palette LAB CMYK_Konly CMYKA| }
|
18
|
+
it { should validate_inclusion_of(:compression).in_array %w|raw jPEG flate LZW group3 group3_2D group4 jBIG2 jPEG2000 tlFFJPEG| }
|
19
|
+
|
20
|
+
it { should validate_numericality_of(:bilevel_threshold).is_less_than_or_equal_to(255) }
|
21
|
+
it { should validate_numericality_of(:bilevel_threshold).is_greater_than_or_equal_to(0) }
|
22
|
+
it { should validate_numericality_of(:image_quality).is_less_than_or_equal_to(100) }
|
23
|
+
it { should validate_numericality_of(:image_quality).is_greater_than_or_equal_to(1) }
|
24
|
+
it { should validate_numericality_of(:filter_ratio).is_less_than_or_equal_to(3) }
|
25
|
+
it { should validate_numericality_of(:filter_ratio).is_greater_than_or_equal_to(1) }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.defaults' do
|
29
|
+
it 'should give the default values' do
|
30
|
+
expect(subject.defaults[:center]).to eq(false)
|
31
|
+
expect(subject.defaults[:fit_page]).to eq(true)
|
32
|
+
expect(subject.defaults[:bits_per_pixel]).to eq(24)
|
33
|
+
expect(subject.defaults[:bilevel_threshold]).to eq(181)
|
34
|
+
expect(subject.defaults[:rotate_mode]).to eq('attribute')
|
35
|
+
expect(subject.defaults[:preserve_aspect_ratio]).to eq(true)
|
36
|
+
expect(subject.defaults[:image_quality]).to eq(80)
|
37
|
+
expect(subject.defaults[:cms_engine]).to eq('lcms')
|
38
|
+
expect(subject.defaults[:dithering]).to eq('floydSteinberg')
|
39
|
+
expect(subject.defaults[:dpi]).to eq(150)
|
40
|
+
expect(subject.defaults[:fill_order]).to eq('mSB')
|
41
|
+
expect(subject.defaults[:filter_ratio]).to eq(1)
|
42
|
+
expect(subject.defaults[:color_space]).to eq('RGB')
|
43
|
+
expect(subject.defaults[:compression]).to eq('LZW')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::Notification, type: :model do
|
4
|
+
it 'extends base Action' do
|
5
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.defaults' do
|
9
|
+
it 'gives the default values' do
|
10
|
+
expect(subject.defaults[:get_notification]).to eq(false)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::OptimizeAction, type: :model do
|
4
|
+
it 'extends base Action' do
|
5
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'validations' do
|
9
|
+
it { should validate_inclusion_of(:profile).in_array %w|default web print max| }
|
10
|
+
it { should validate_inclusion_of(:dithering_mode).in_array %w|none floydSteinberg halftone pattern g3Optimized g4Optimized atkinson| }
|
11
|
+
|
12
|
+
it { should validate_numericality_of(:image_quality).is_less_than_or_equal_to(100) }
|
13
|
+
it { should validate_numericality_of(:image_quality).is_greater_than_or_equal_to(1) }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.defaults' do
|
17
|
+
it 'should give default values' do
|
18
|
+
expect(subject.defaults[:profile]).to eq('default')
|
19
|
+
expect(subject.defaults[:use_profile]).to eq(false)
|
20
|
+
expect(subject.defaults[:remove_redundant_objects]).to eq(false)
|
21
|
+
expect(subject.defaults[:subset_fonts]).to eq(false)
|
22
|
+
expect(subject.defaults[:optimize_resources]).to eq(false)
|
23
|
+
expect(subject.defaults[:force_compression_types]).to eq(false)
|
24
|
+
expect(subject.defaults[:force_recompression]).to eq(false)
|
25
|
+
expect(subject.defaults[:reduce_color_complexity]).to eq(false)
|
26
|
+
expect(subject.defaults[:merge_embedded_fonts]).to eq(false)
|
27
|
+
expect(subject.defaults[:bitonal_compressions]).to eq(['none'])
|
28
|
+
expect(subject.defaults[:bitonal_resolution_dpi]).to eq(200)
|
29
|
+
expect(subject.defaults[:bitonal_threshold_dpi]).to eq(-1)
|
30
|
+
expect(subject.defaults[:clip_images]).to eq(false)
|
31
|
+
expect(subject.defaults[:continuous_compressions]).to eq(['none'])
|
32
|
+
expect(subject.defaults[:linearize]).to eq(false)
|
33
|
+
expect(subject.defaults[:image_quality]).to eq(75)
|
34
|
+
expect(subject.defaults[:dithering_mode]).to eq('none')
|
35
|
+
expect(subject.defaults[:color_resolution_dpi]).to eq(150)
|
36
|
+
expect(subject.defaults[:color_threshold_dpi]).to eq(-1)
|
37
|
+
expect(subject.defaults[:monochrome_resolution_dpi]).to eq(150)
|
38
|
+
expect(subject.defaults[:monochrome_threshold_dpi]).to eq(-1)
|
39
|
+
expect(subject.defaults[:threshold_dpi]).to eq(-1)
|
40
|
+
expect(subject.defaults[:strip]).to eq(['threads'])
|
41
|
+
expect(subject.defaults[:flatten_signature_fields]).to eq(false)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::PageSelection, type: :model do
|
4
|
+
it 'extends base Action' do
|
5
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'validations' do
|
9
|
+
it { should validate_inclusion_of(:page_sequence).in_array %w|all first last odd even notFirst notLast| }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '.defaults' do
|
13
|
+
it 'should give the default values' do
|
14
|
+
expect(subject.defaults[:page_sequence]).to eq('all')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pdf4me::PdfAAction, type: :model do
|
4
|
+
it 'extends base Action' do
|
5
|
+
expect(subject).to be_kind_of(Pdf4me::Base)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'validations' do
|
9
|
+
it { should validate_inclusion_of(:compliance).in_array %w|pdfA1b pdfA2B pdfA3b pdfA1a pdfA2a pdfA3a pdfA2u pdfA3u| }
|
10
|
+
it { should validate_inclusion_of(:out_put_intent_profile).in_array %w|notSet sRGBColorSpace| }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '.defaults' do
|
14
|
+
it 'should give default values' do
|
15
|
+
expect(subject.defaults[:compliance]).to eq('pdf2Ab')
|
16
|
+
expect(subject.defaults[:allow_downgrade]).to eq(false)
|
17
|
+
expect(subject.defaults[:allow_upgrade]).to eq(false)
|
18
|
+
expect(subject.defaults[:out_put_intent_profile]).to eq('notSet')
|
19
|
+
expect(subject.defaults[:linearize]).to eq(false)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|