pdfcrowd 5.13.1 → 5.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pdfcrowd.rb +106 -54
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3b46f24d1656d84d213fa15a588861bc11e4bedc6bd93ac5a87b3c2e50a25ca
4
- data.tar.gz: 154772540e506f59ffbd6c3cc64e25e859482e2845c230a10eb7ac5e4dc47a2c
3
+ metadata.gz: 7d96eee1f2494868b0edd320d65d8176e42291b823034832cf717edbc48bba44
4
+ data.tar.gz: 0b9def3cb91cb453bc8b7328b45c4b131971f37c0816639ced5d87a864cdd710
5
5
  SHA512:
6
- metadata.gz: f91d281e04c15b4236d4360cb94ae82da42fc2c7ca9da4db7e9176b1803047e514f6eebacf3b942c0a9e37d515ae8efb698a2453bd1b5c4bb209ab609053f90b
7
- data.tar.gz: 8e2c56c82011c3095e3f44976d28920b43245f3597be42d3eea68c2decb057f68bd2a0b6f45dd7eadc8c41850c17fd53686a496ee8372988d864e1bd41cf724d
6
+ metadata.gz: 5f0e397040820e52b4c4a7f248ba7999685eb9b66b44e31e6aca14fd2870248237649394fc30c38d76f89f5d072ec6c777d59fd8abc5bfd7e170959d0b7ae230
7
+ data.tar.gz: 7ef83fc8034db9c2e998e714767284539eb94751ed8114dfc32b9e83150599fcf75adfbaab80e09cfe97bf8eb6ffd585a6f415d31a177115935a76cddfefd6f7
data/lib/pdfcrowd.rb CHANGED
@@ -530,7 +530,7 @@ end
530
530
  module Pdfcrowd
531
531
  HOST = ENV["PDFCROWD_HOST"] || 'api.pdfcrowd.com'
532
532
  MULTIPART_BOUNDARY = '----------ThIs_Is_tHe_bOUnDary_$'
533
- CLIENT_VERSION = '5.13.1'
533
+ CLIENT_VERSION = '5.15.0'
534
534
 
535
535
  class ConnectionHelper
536
536
  def initialize(user_name, api_key)
@@ -541,7 +541,7 @@ module Pdfcrowd
541
541
 
542
542
  setProxy(nil, nil, nil, nil)
543
543
  setUseHttp(false)
544
- setUserAgent('pdfcrowd_ruby_client/5.13.1 (https://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.15.0 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -1627,6 +1627,19 @@ module Pdfcrowd
1627
1627
  self
1628
1628
  end
1629
1629
 
1630
+ # Apply custom CSS to the input HTML document. It allows you to modify the visual appearance and layout of your HTML content dynamically. Tip: Using !important in custom CSS provides a way to prioritize and override conflicting styles.
1631
+ #
1632
+ # * +css+ - A string containing valid CSS. The string must not be empty.
1633
+ # * *Returns* - The converter object.
1634
+ def setCustomCss(css)
1635
+ if (!(!css.nil? && !css.empty?))
1636
+ raise Error.new(Pdfcrowd.create_invalid_value_message(css, "setCustomCss", "html-to-pdf", "The string must not be empty.", "set_custom_css"), 470);
1637
+ end
1638
+
1639
+ @fields['custom_css'] = css
1640
+ self
1641
+ end
1642
+
1630
1643
  # Run a custom JavaScript after the document is loaded and ready to print. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...). In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.
1631
1644
  #
1632
1645
  # * +javascript+ - A string containing a JavaScript code. The string must not be empty.
@@ -2361,6 +2374,19 @@ module Pdfcrowd
2361
2374
  self
2362
2375
  end
2363
2376
 
2377
+ # Set the maximum time to load the page and its resources. After this time, all requests will be considered successful. This can be useful to ensure that the conversion does not timeout. Use this method if there is no other way to fix page loading.
2378
+ #
2379
+ # * +max_time+ - The number of seconds to wait. The value must be in the range 10-30.
2380
+ # * *Returns* - The converter object.
2381
+ def setMaxLoadingTime(max_time)
2382
+ if (!(Integer(max_time) >= 10 && Integer(max_time) <= 30))
2383
+ raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-pdf", "The value must be in the range 10-30.", "set_max_loading_time"), 470);
2384
+ end
2385
+
2386
+ @fields['max_loading_time'] = max_time
2387
+ self
2388
+ end
2389
+
2364
2390
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
2365
2391
  #
2366
2392
  # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
@@ -2631,6 +2657,58 @@ module Pdfcrowd
2631
2657
  self
2632
2658
  end
2633
2659
 
2660
+ # Set the output image width in pixels.
2661
+ #
2662
+ # * +width+ - The value must be in the range 96-65000.
2663
+ # * *Returns* - The converter object.
2664
+ def setScreenshotWidth(width)
2665
+ if (!(Integer(width) >= 96 && Integer(width) <= 65000))
2666
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setScreenshotWidth", "html-to-image", "The value must be in the range 96-65000.", "set_screenshot_width"), 470);
2667
+ end
2668
+
2669
+ @fields['screenshot_width'] = width
2670
+ self
2671
+ end
2672
+
2673
+ # Set the output image height in pixels. If it is not specified, actual document height is used.
2674
+ #
2675
+ # * +height+ - Must be a positive integer number.
2676
+ # * *Returns* - The converter object.
2677
+ def setScreenshotHeight(height)
2678
+ if (!(Integer(height) > 0))
2679
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setScreenshotHeight", "html-to-image", "Must be a positive integer number.", "set_screenshot_height"), 470);
2680
+ end
2681
+
2682
+ @fields['screenshot_height'] = height
2683
+ self
2684
+ end
2685
+
2686
+ # Set the scaling factor (zoom) for the output image.
2687
+ #
2688
+ # * +factor+ - The percentage value. Must be a positive integer number.
2689
+ # * *Returns* - The converter object.
2690
+ def setScaleFactor(factor)
2691
+ if (!(Integer(factor) > 0))
2692
+ raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-image", "Must be a positive integer number.", "set_scale_factor"), 470);
2693
+ end
2694
+
2695
+ @fields['scale_factor'] = factor
2696
+ self
2697
+ end
2698
+
2699
+ # The output image background color.
2700
+ #
2701
+ # * +color+ - The value must be in RRGGBB or RRGGBBAA hexadecimal format.
2702
+ # * *Returns* - The converter object.
2703
+ def setBackgroundColor(color)
2704
+ unless /^[0-9a-fA-F]{6,8}$/.match(color)
2705
+ raise Error.new(Pdfcrowd.create_invalid_value_message(color, "setBackgroundColor", "html-to-image", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_background_color"), 470);
2706
+ end
2707
+
2708
+ @fields['background_color'] = color
2709
+ self
2710
+ end
2711
+
2634
2712
  # Use the print version of the page if available (@media print).
2635
2713
  #
2636
2714
  # * +value+ - Set to true to use the print version of the page.
@@ -2799,6 +2877,19 @@ module Pdfcrowd
2799
2877
  self
2800
2878
  end
2801
2879
 
2880
+ # Apply custom CSS to the input HTML document. It allows you to modify the visual appearance and layout of your HTML content dynamically. Tip: Using !important in custom CSS provides a way to prioritize and override conflicting styles.
2881
+ #
2882
+ # * +css+ - A string containing valid CSS. The string must not be empty.
2883
+ # * *Returns* - The converter object.
2884
+ def setCustomCss(css)
2885
+ if (!(!css.nil? && !css.empty?))
2886
+ raise Error.new(Pdfcrowd.create_invalid_value_message(css, "setCustomCss", "html-to-image", "The string must not be empty.", "set_custom_css"), 470);
2887
+ end
2888
+
2889
+ @fields['custom_css'] = css
2890
+ self
2891
+ end
2892
+
2802
2893
  # Run a custom JavaScript after the document is loaded and ready to print. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...). In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.
2803
2894
  #
2804
2895
  # * +javascript+ - A string containing a JavaScript code. The string must not be empty.
@@ -2912,58 +3003,6 @@ module Pdfcrowd
2912
3003
  self
2913
3004
  end
2914
3005
 
2915
- # Set the output image width in pixels.
2916
- #
2917
- # * +width+ - The value must be in the range 96-65000.
2918
- # * *Returns* - The converter object.
2919
- def setScreenshotWidth(width)
2920
- if (!(Integer(width) >= 96 && Integer(width) <= 65000))
2921
- raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setScreenshotWidth", "html-to-image", "The value must be in the range 96-65000.", "set_screenshot_width"), 470);
2922
- end
2923
-
2924
- @fields['screenshot_width'] = width
2925
- self
2926
- end
2927
-
2928
- # Set the output image height in pixels. If it is not specified, actual document height is used.
2929
- #
2930
- # * +height+ - Must be a positive integer number.
2931
- # * *Returns* - The converter object.
2932
- def setScreenshotHeight(height)
2933
- if (!(Integer(height) > 0))
2934
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setScreenshotHeight", "html-to-image", "Must be a positive integer number.", "set_screenshot_height"), 470);
2935
- end
2936
-
2937
- @fields['screenshot_height'] = height
2938
- self
2939
- end
2940
-
2941
- # Set the scaling factor (zoom) for the output image.
2942
- #
2943
- # * +factor+ - The percentage value. Must be a positive integer number.
2944
- # * *Returns* - The converter object.
2945
- def setScaleFactor(factor)
2946
- if (!(Integer(factor) > 0))
2947
- raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-image", "Must be a positive integer number.", "set_scale_factor"), 470);
2948
- end
2949
-
2950
- @fields['scale_factor'] = factor
2951
- self
2952
- end
2953
-
2954
- # The output image background color.
2955
- #
2956
- # * +color+ - The value must be in RRGGBB or RRGGBBAA hexadecimal format.
2957
- # * *Returns* - The converter object.
2958
- def setBackgroundColor(color)
2959
- unless /^[0-9a-fA-F]{6,8}$/.match(color)
2960
- raise Error.new(Pdfcrowd.create_invalid_value_message(color, "setBackgroundColor", "html-to-image", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_background_color"), 470);
2961
- end
2962
-
2963
- @fields['background_color'] = color
2964
- self
2965
- end
2966
-
2967
3006
  # Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
2968
3007
  #
2969
3008
  # * +data_string+ - The input data string.
@@ -3145,6 +3184,19 @@ module Pdfcrowd
3145
3184
  self
3146
3185
  end
3147
3186
 
3187
+ # Set the maximum time to load the page and its resources. After this time, all requests will be considered successful. This can be useful to ensure that the conversion does not timeout. Use this method if there is no other way to fix page loading.
3188
+ #
3189
+ # * +max_time+ - The number of seconds to wait. The value must be in the range 10-30.
3190
+ # * *Returns* - The converter object.
3191
+ def setMaxLoadingTime(max_time)
3192
+ if (!(Integer(max_time) >= 10 && Integer(max_time) <= 30))
3193
+ raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-image", "The value must be in the range 10-30.", "set_max_loading_time"), 470);
3194
+ end
3195
+
3196
+ @fields['max_loading_time'] = max_time
3197
+ self
3198
+ end
3199
+
3148
3200
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
3149
3201
  #
3150
3202
  # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfcrowd
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.13.1
4
+ version: 5.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pdfcrowd Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-02 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Pdfcrowd API lets you easily convert between HTML, PDF and various
14
14
  image formats.