aspose_pdf_cloud 20.2.0 → 20.8.0

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -13
  3. data/docs/ApiInfo.md +10 -0
  4. data/docs/Cell.md +3 -0
  5. data/docs/CheckBoxField.md +1 -0
  6. data/docs/ChoiceField.md +1 -0
  7. data/docs/ComboBoxField.md +1 -0
  8. data/docs/FormField.md +1 -0
  9. data/docs/ImageCompressionVersion.md +12 -0
  10. data/docs/ImageEncoding.md +13 -0
  11. data/docs/ImageFragment.md +15 -0
  12. data/docs/ListBoxField.md +1 -0
  13. data/docs/OptimizeOptions.md +13 -7
  14. data/docs/OutputFormat.md +11 -0
  15. data/docs/Paragraph.md +2 -2
  16. data/docs/PdfAType.md +3 -2
  17. data/docs/PdfApi.md +170 -25
  18. data/docs/RadioButtonField.md +1 -0
  19. data/docs/RadioButtonOptionField.md +1 -0
  20. data/docs/SignatureField.md +1 -0
  21. data/docs/TextBoxField.md +1 -0
  22. data/docs/TextState.md +2 -1
  23. data/lib/aspose_pdf_cloud.rb +5 -0
  24. data/lib/aspose_pdf_cloud/api/pdf_api.rb +478 -41
  25. data/lib/aspose_pdf_cloud/api_client.rb +1 -1
  26. data/lib/aspose_pdf_cloud/models/api_info.rb +209 -0
  27. data/lib/aspose_pdf_cloud/models/cell.rb +36 -4
  28. data/lib/aspose_pdf_cloud/models/check_box_field.rb +11 -1
  29. data/lib/aspose_pdf_cloud/models/choice_field.rb +11 -1
  30. data/lib/aspose_pdf_cloud/models/combo_box_field.rb +11 -1
  31. data/lib/aspose_pdf_cloud/models/form_field.rb +11 -1
  32. data/lib/aspose_pdf_cloud/models/image_compression_version.rb +45 -0
  33. data/lib/aspose_pdf_cloud/models/image_encoding.rb +46 -0
  34. data/lib/aspose_pdf_cloud/models/image_fragment.rb +283 -0
  35. data/lib/aspose_pdf_cloud/models/list_box_field.rb +11 -1
  36. data/lib/aspose_pdf_cloud/models/optimize_options.rb +60 -35
  37. data/lib/aspose_pdf_cloud/models/output_format.rb +44 -0
  38. data/lib/aspose_pdf_cloud/models/paragraph.rb +2 -2
  39. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +1 -0
  40. data/lib/aspose_pdf_cloud/models/radio_button_field.rb +11 -1
  41. data/lib/aspose_pdf_cloud/models/radio_button_option_field.rb +11 -1
  42. data/lib/aspose_pdf_cloud/models/signature_field.rb +11 -1
  43. data/lib/aspose_pdf_cloud/models/text_box_field.rb +11 -1
  44. data/lib/aspose_pdf_cloud/models/text_state.rb +15 -5
  45. data/lib/aspose_pdf_cloud/version.rb +1 -1
  46. data/test/pdf_tests.rb +140 -98
  47. data/test_data/Righteous-Regular.ttf +0 -0
  48. metadata +13 -2
@@ -20,5 +20,5 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  module AsposePdfCloud
23
- VERSION = "20.2.0"
23
+ VERSION = "20.8.0"
24
24
  end
@@ -33,7 +33,6 @@ class PdfTests < Minitest::Test
33
33
  def setup
34
34
  # Get App key and App SID from https://aspose.cloud
35
35
  @pdf_api = PdfApi.new('app_key', 'app_sid')
36
-
37
36
  @temp_folder = 'TempPdfCloud'
38
37
  @test_data_folder = '../test_data/'
39
38
 
@@ -389,82 +388,121 @@ class PdfTests < Minitest::Test
389
388
  end
390
389
 
391
390
  def __draw_table
392
-
393
- text_state = TextState.new
394
- text_state.font = 'Arial'
395
- text_state.font_size = 10
396
- text_state.foreground_color = Color.new({:A => 0xFF, :R => 0, :G => 0xFF, :B => 0})
397
- text_state.background_color = Color.new({:A => 0xFF, :R => 0xFF, :G => 0, :B => 0})
398
- text_state.font_style = FontStyles::BOLD
399
-
400
- num_of_cols = 5
401
- num_of_rows = 5
402
-
403
- table = Table.new
404
- table.rows = Array.new(num_of_rows)
405
-
406
- col_widths = '';
407
- (1..num_of_cols).each do
408
- col_widths += ' 30'
409
- end
410
-
411
- table.column_widths = col_widths
412
-
413
- table.default_cell_text_state = text_state
414
-
415
- border_table_border = GraphInfo.new
416
-
417
- border_table_border.color = Color.new({:A => 0xFF, :R => 0, :G => 0xFF, :B => 0xFF})
418
- border_table_border.line_width = 1
419
-
420
- border_info = BorderInfo.new
421
- border_info.top = border_table_border
422
- border_info.right = border_table_border
423
- border_info.bottom = border_table_border
424
- border_info.left = border_table_border
425
-
426
- table.default_cell_border = border_info
427
- table.top = 100
428
-
429
-
430
-
431
- (0..(num_of_rows - 1)).each do |r|
432
- row = Row.new
433
- row.cells = Array.new(num_of_cols)
434
-
435
- (0..(num_of_rows - 1)).each do |c|
436
- cell = Cell.new
437
- cell.background_color = Color.new({:A => 0xFF, :R => 0xFF, :G => 0, :B => 0xFF})
438
- cell.default_cell_text_state = text_state
439
- cell.paragraphs = Array.new(1)
440
- cell.paragraphs[0] = TextRect.new({:Text => 'value'})
441
-
442
- # change properties on cell
443
-
444
- if c == 1
445
- cell.default_cell_text_state.foreground_color = Color.new({:A => 0xFF, :R => 0xFF, :G => 0, :B => 0xFF})
446
-
447
- # change properties on cell AFTER first clearing and re-adding paragraphs
448
- elsif c == 2
449
- cell.paragraphs[0] = TextRect.new({:Text => 'y'})
450
- cell.default_cell_text_state.foreground_color = Color.new({:A => 0xFF, :R => 0, :G => 0, :B => 0xFF})
451
-
452
- #change properties on paragraph
453
- elsif c == 3
454
- cell.paragraphs[0].text_state = text_state
455
- cell.paragraphs[0].text_state.foreground_color = Color.new({:A => 0xFF, :R => 0, :G => 0, :B => 0xFF})
456
-
457
- # change properties on paragraph AFTER first clearing and re-adding paragraphs
458
- elsif c == 4
459
- cell.paragraphs[0] = TextRect.new({:Text => 'y'})
460
- cell.paragraphs[0].text_state = text_state
461
- cell.paragraphs[0].text_state.foreground_color = Color.new({:A => 0xFF, :R => 0, :G => 0, :B => 0xFF})
462
- end
463
-
464
- row.cells[c] = cell
465
- end
466
- table.rows[r] = row
467
- end
391
+ colorBlack = Color.new({:A => 0xFF, :R => 0, :G => 0, :B => 0})
392
+ borderGraphInfo = GraphInfo.new({:Color => colorBlack, :LineWidth => 1})
393
+ image = 'Penguins.jpg'
394
+ table = Table.new({
395
+ :Top => 100,
396
+ :ColumnWidths => '150 300',
397
+ :IsBordersIncluded => true,
398
+ :DefaultCellTextState => TextState.new({:FontSize => 11, :ForegroundColor => Color.new({:A => 255, :R => 0, :G => 255, :B => 0})}),
399
+ :Margin => MarginInfo.new({
400
+ :Bottom => 10,
401
+ :Left => 10,
402
+ :Right => 10,
403
+ :Top => 10
404
+ }),
405
+ :Border => BorderInfo.new({
406
+ :Top => borderGraphInfo,
407
+ :Left => borderGraphInfo
408
+ }),
409
+ :DefaultCellBorder => BorderInfo.new({
410
+ :Right => borderGraphInfo,
411
+ }),
412
+ :DefaultCellPadding => MarginInfo.new({
413
+ :Top => 5,
414
+ :Left => 5,
415
+ :Right => 5,
416
+ :Bottom => 5,
417
+ }),
418
+ :Rows => [
419
+ Row.new({
420
+ :MinRowHeight => 100,
421
+ :Border => BorderInfo.new({
422
+ :Bottom => borderGraphInfo,
423
+ }),
424
+ :Cells => [
425
+ Cell.new({
426
+ :Paragraphs => [
427
+ TextRect.new({
428
+ :Text => 'BackgroundImageStorageFile field, from storage file',
429
+ :HorizontalAlignment => HorizontalAlignment::CENTER,
430
+ :TextState => TextState.new({:FontSize => 10, :ForegroundColor => Color.new({:A => 0xff, :R => 0x3d, :G => 0x8e, :B =>0xc4})}),
431
+ })
432
+ ]
433
+ }),
434
+ Cell.new({
435
+ :BackgroundColor => colorBlack,
436
+ :BackgroundImageStorageFile => "#{@temp_folder}/#{image}"
437
+ })
438
+ ]
439
+ }),
440
+ Row.new({
441
+ :MinRowHeight => 100,
442
+ :Border => BorderInfo.new({:Bottom => borderGraphInfo}),
443
+ :Cells => [
444
+ Cell.new({
445
+ :Paragraphs => [
446
+ TextRect.new({
447
+ :Text => 'HtmlFragment',
448
+ :HorizontalAlignment => HorizontalAlignment::CENTER,
449
+ :TextState => TextState.new({
450
+ :FontSize => 10,
451
+ :ForegroundColor => Color.new({:A => 255, :R => 0x3d, :G => 0x8e, :B => 0xc4}),
452
+ })
453
+ })
454
+ ]
455
+ }),
456
+ Cell.new({:HtmlFragment => '<ul><li>First</li><li>Second</li></ul>'}),
457
+ ]
458
+ }),
459
+ Row.new({
460
+ :FixedRowHeight => 100,
461
+ :Border => BorderInfo.new({:Bottom => borderGraphInfo}),
462
+ :Cells => [
463
+ Cell.new({
464
+ :Paragraphs => [
465
+ TextRect.new({:Text => 'FixedRowHeight = 100'}),
466
+ TextRect.new({
467
+ :Text => 'Images field, from storage file, without Margin and Size',
468
+ :HorizontalAlignment => HorizontalAlignment::CENTER,
469
+ :TextState => TextState.new({:FontSize => 10, :ForegroundColor => Color.new({:A => 255, :R => 0x3d, :G => 0x8e, :B => 0xc4})}),
470
+ })
471
+ ]
472
+ }),
473
+ Cell.new({
474
+ :BackgroundColor => colorBlack,
475
+ :Images => [ImageFragment.new({ImageFile: "#{@temp_folder}/#{image}"})]
476
+ })
477
+ ]
478
+ }),
479
+ Row.new({
480
+ :FixedRowHeight => 100,
481
+ :Border => BorderInfo.new({:Bottom => borderGraphInfo}),
482
+ :Cells => [
483
+ Cell.new({
484
+ :Paragraphs => [
485
+ TextRect.new({:Text => 'FixedRowHeight = 100'}),
486
+ TextRect.new({
487
+ :Text => 'Images field, from storage file, with no Margin and Size = 150x50',
488
+ :HorizontalAlignment => HorizontalAlignment::CENTER,
489
+ :TextState => TextState.new({:FontSize => 10, :ForegroundColor => Color.new({:A => 255, :R => 0x3d, :G => 0x8e, :B => 0xc4})})
490
+ })
491
+ ]
492
+ }),
493
+ Cell.new({
494
+ :BackgroundColor => colorBlack,
495
+ :Images => [
496
+ ImageFragment.new({
497
+ :ImageFile => "#{@temp_folder}/#{image}",
498
+ :ImageScale => 0.1
499
+ })
500
+ ]
501
+ })
502
+ ]
503
+ })
504
+ ]
505
+ })
468
506
  table
469
507
  end
470
508
 
@@ -3012,10 +3050,11 @@ class PdfTests < Minitest::Test
3012
3050
  def test_put_pdf_in_storage_to_html
3013
3051
  file_name = '4pages.pdf'
3014
3052
  upload_file(file_name)
3015
- res_file = 'result.zip'
3053
+ res_file = 'result_4pages.html'
3016
3054
 
3017
3055
  opts = {
3018
- :folder => @temp_folder
3056
+ :folder => @temp_folder,
3057
+ :output_format => OutputFormat::FOLDER
3019
3058
  }
3020
3059
  response = @pdf_api.put_pdf_in_storage_to_html(file_name, @temp_folder + '/' + res_file, opts)
3021
3060
  assert(response, 'Filed to convert PDF to HTML.')
@@ -3106,7 +3145,7 @@ class PdfTests < Minitest::Test
3106
3145
  assert(response, 'Filed to convert PDF to PPTX.')
3107
3146
  end
3108
3147
 
3109
- def test_get_pdf_in_storage_to_la_te_x
3148
+ def test_get_pdf_in_storage_to_te_x
3110
3149
  file_name = '4pages.pdf'
3111
3150
  upload_file(file_name)
3112
3151
 
@@ -3114,33 +3153,33 @@ class PdfTests < Minitest::Test
3114
3153
  :folder => @temp_folder
3115
3154
  }
3116
3155
 
3117
- response = @pdf_api.get_pdf_in_storage_to_la_te_x(file_name, opts)
3118
- assert(response, 'Filed to convert PDF to LaTex.')
3156
+ response = @pdf_api.get_pdf_in_storage_to_te_x(file_name, opts)
3157
+ assert(response, 'Filed to convert PDF to Tex.')
3119
3158
  end
3120
3159
 
3121
- def test_put_pdf_in_storage_to_la_te_x
3160
+ def test_put_pdf_in_storage_to_te_x
3122
3161
  file_name = '4pages.pdf'
3123
3162
  upload_file(file_name)
3124
- res_file = 'result.latex'
3163
+ res_file = 'result.tex'
3125
3164
 
3126
3165
  opts = {
3127
3166
  :folder => @temp_folder
3128
3167
  }
3129
- response = @pdf_api.put_pdf_in_storage_to_la_te_x(file_name, @temp_folder + '/' + res_file, opts)
3130
- assert(response, 'Filed to convert PDF to LaTeX.')
3168
+ response = @pdf_api.put_pdf_in_storage_to_te_x(file_name, @temp_folder + '/' + res_file, opts)
3169
+ assert(response, 'Filed to convert PDF to TeX.')
3131
3170
  end
3132
3171
 
3133
3172
 
3134
- def test_put_pdf_in_request_to_la_te_x
3173
+ def test_put_pdf_in_request_to_te_x
3135
3174
  file_name = '4pages.pdf'
3136
3175
 
3137
- res_file = 'result.latex'
3176
+ res_file = 'result.tex'
3138
3177
 
3139
3178
  opts = {
3140
3179
  :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
3141
3180
  }
3142
- response = @pdf_api.put_pdf_in_request_to_la_te_x(@temp_folder + '/' + res_file, opts)
3143
- assert(response, 'Filed to convert PDF to LaTeX.')
3181
+ response = @pdf_api.put_pdf_in_request_to_te_x(@temp_folder + '/' + res_file, opts)
3182
+ assert(response, 'Filed to convert PDF to TeX.')
3144
3183
  end
3145
3184
 
3146
3185
  def test_get_pdf_in_storage_to_mobi_xml
@@ -3334,16 +3373,16 @@ class PdfTests < Minitest::Test
3334
3373
  end
3335
3374
 
3336
3375
 
3337
- def test_get_la_te_x_in_storage_to_pdf
3376
+ def test_get_te_x_in_storage_to_pdf
3338
3377
  file_name = 'sample.tex'
3339
3378
  upload_file(file_name)
3340
3379
 
3341
3380
  src_path = @temp_folder + '/' + file_name
3342
- response = @pdf_api.get_la_te_x_in_storage_to_pdf(src_path)
3343
- assert(response, 'Failed to convert LaTeX to pdf.')
3381
+ response = @pdf_api.get_te_x_in_storage_to_pdf(src_path)
3382
+ assert(response, 'Failed to convert TeX to pdf.')
3344
3383
  end
3345
3384
 
3346
- def test_put_la_te_x_in_storage_to_pdf
3385
+ def test_put_te_x_in_storage_to_pdf
3347
3386
  file_name = 'sample.tex'
3348
3387
  upload_file(file_name)
3349
3388
  result_name = 'fromTex.pdf'
@@ -3352,8 +3391,8 @@ class PdfTests < Minitest::Test
3352
3391
  opts = {
3353
3392
  :dst_folder => @temp_folder
3354
3393
  }
3355
- response = @pdf_api.put_la_te_x_in_storage_to_pdf(result_name, src_path, opts)
3356
- assert(response, 'Failed to convert LaTeX to pdf.')
3394
+ response = @pdf_api.put_te_x_in_storage_to_pdf(result_name, src_path, opts)
3395
+ assert(response, 'Failed to convert TeX to pdf.')
3357
3396
  end
3358
3397
 
3359
3398
  def test_get_mht_in_storage_to_pdf
@@ -5836,6 +5875,8 @@ class PdfTests < Minitest::Test
5836
5875
  def test_put_add_text
5837
5876
  file_name = '4pages.pdf'
5838
5877
  upload_file(file_name)
5878
+ font_name = 'Righteous-Regular.ttf'
5879
+ upload_file(font_name)
5839
5880
 
5840
5881
  page_number = 1
5841
5882
 
@@ -5858,11 +5899,12 @@ class PdfTests < Minitest::Test
5858
5899
  background_color.b = 0x00
5859
5900
 
5860
5901
  text_state = TextState.new
5861
- text_state.font = 'Arial'
5902
+ text_state.font = 'Righteous'
5862
5903
  text_state.font_size = 10
5863
5904
  text_state.foreground_color = foreground_color
5864
5905
  text_state.background_color = background_color
5865
- text_state.font_style = FontStyles::BOLD
5906
+ text_state.font_style = FontStyles::REGULAR
5907
+ text_state.font_file = @temp_folder + '/' + font_name
5866
5908
 
5867
5909
  segment = Segment.new
5868
5910
  segment.value = 'segment 1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_pdf_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 20.2.0
4
+ version: 20.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aspose PDF Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -78,6 +78,7 @@ files:
78
78
  - docs/AnnotationsInfo.md
79
79
  - docs/AnnotationsInfoResponse.md
80
80
  - docs/AntialiasingProcessingType.md
81
+ - docs/ApiInfo.md
81
82
  - docs/AsposeResponse.md
82
83
  - docs/Attachment.md
83
84
  - docs/AttachmentResponse.md
@@ -175,7 +176,10 @@ files:
175
176
  - docs/HtmlDocumentType.md
176
177
  - docs/HtmlMarkupGenerationModes.md
177
178
  - docs/Image.md
179
+ - docs/ImageCompressionVersion.md
180
+ - docs/ImageEncoding.md
178
181
  - docs/ImageFooter.md
182
+ - docs/ImageFragment.md
179
183
  - docs/ImageHeader.md
180
184
  - docs/ImageResponse.md
181
185
  - docs/ImageSrcType.md
@@ -219,6 +223,7 @@ files:
219
223
  - docs/ObjectExist.md
220
224
  - docs/OptimizeOptions.md
221
225
  - docs/Option.md
226
+ - docs/OutputFormat.md
222
227
  - docs/Page.md
223
228
  - docs/PageLayout.md
224
229
  - docs/PageMode.md
@@ -360,6 +365,7 @@ files:
360
365
  - lib/aspose_pdf_cloud/models/annotations_info.rb
361
366
  - lib/aspose_pdf_cloud/models/annotations_info_response.rb
362
367
  - lib/aspose_pdf_cloud/models/antialiasing_processing_type.rb
368
+ - lib/aspose_pdf_cloud/models/api_info.rb
363
369
  - lib/aspose_pdf_cloud/models/aspose_response.rb
364
370
  - lib/aspose_pdf_cloud/models/attachment.rb
365
371
  - lib/aspose_pdf_cloud/models/attachment_response.rb
@@ -457,7 +463,10 @@ files:
457
463
  - lib/aspose_pdf_cloud/models/html_document_type.rb
458
464
  - lib/aspose_pdf_cloud/models/html_markup_generation_modes.rb
459
465
  - lib/aspose_pdf_cloud/models/image.rb
466
+ - lib/aspose_pdf_cloud/models/image_compression_version.rb
467
+ - lib/aspose_pdf_cloud/models/image_encoding.rb
460
468
  - lib/aspose_pdf_cloud/models/image_footer.rb
469
+ - lib/aspose_pdf_cloud/models/image_fragment.rb
461
470
  - lib/aspose_pdf_cloud/models/image_header.rb
462
471
  - lib/aspose_pdf_cloud/models/image_response.rb
463
472
  - lib/aspose_pdf_cloud/models/image_src_type.rb
@@ -501,6 +510,7 @@ files:
501
510
  - lib/aspose_pdf_cloud/models/object_exist.rb
502
511
  - lib/aspose_pdf_cloud/models/optimize_options.rb
503
512
  - lib/aspose_pdf_cloud/models/option.rb
513
+ - lib/aspose_pdf_cloud/models/output_format.rb
504
514
  - lib/aspose_pdf_cloud/models/page.rb
505
515
  - lib/aspose_pdf_cloud/models/page_layout.rb
506
516
  - lib/aspose_pdf_cloud/models/page_mode.rb
@@ -664,6 +674,7 @@ files:
664
674
  - test_data/PdfWithXfaForm.pdf
665
675
  - test_data/Penguins.emf
666
676
  - test_data/Penguins.jpg
677
+ - test_data/Righteous-Regular.ttf
667
678
  - test_data/ScreenMovie.swf
668
679
  - test_data/Simple.svg
669
680
  - test_data/Simple.xps