pdfcrowd 5.3.0 → 5.6.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 +553 -28
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed729dfe75e90562328dd5177f9c60fcf157e3166bc536c5d401915bea22dc80
4
- data.tar.gz: 6c8ac01b9a57fc133dfb36d2fb29b6f40e73d401258de35c18415095d3cdf069
3
+ metadata.gz: 754116e98351d91f67691746a9efd3d78982c258d2c7970c23bae859fa6778b4
4
+ data.tar.gz: ef4d3a0ba05794d9d46fd1f00bbc075bdc3ca9f4808eed2de3837b367a8d7d49
5
5
  SHA512:
6
- metadata.gz: ce55f67a0b100d59ecc270053f943dcad2c047713f0a5d6e78fdff4702985c0c18d433aee8c476458d50a5aa28f85e74bbfd707690b73bbdddb23465666b7ef2
7
- data.tar.gz: 2533a247f44824b1124cc388ac92f0c16d9b10503c20f4f71d602668ba7b7ac7601df51f366f7ac5c64cd345ed786fea55c2590d49da5a89aa5269f4e295f2fa
6
+ metadata.gz: 407d8b1c1f328d8908d3053c3bbb80d84e4220c0c275515b0b9f46c826edefecaf42dfff75e6b7f25a4f19521e787b9008183ce999d211f3c8195b73cd403d4c
7
+ data.tar.gz: 52401dad8cbe75333fddf0064e2c24fcf32986d115bea96197c9677f19d2983ab40b69d9839d98bdae14b65eba65b62ac9523dc0528ca7c651b22208500d601d
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.3.0'
533
+ CLIENT_VERSION = '5.6.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.3.0 (https://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.6.0 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -1183,7 +1183,7 @@ module Pdfcrowd
1183
1183
  self
1184
1184
  end
1185
1185
 
1186
- # Load an HTML code from the specified URL and use it as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1186
+ # Load an HTML code from the specified URL and use it as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of the converted document pdfcrowd-source-title - the title of the converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1187
1187
  #
1188
1188
  # * +url+ - The supported protocols are http:// and https://.
1189
1189
  # * *Returns* - The converter object.
@@ -1196,7 +1196,7 @@ module Pdfcrowd
1196
1196
  self
1197
1197
  end
1198
1198
 
1199
- # Use the specified HTML code as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1199
+ # Use the specified HTML code as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of the converted document pdfcrowd-source-title - the title of the converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1200
1200
  #
1201
1201
  # * +html+ - The string must not be empty.
1202
1202
  # * *Returns* - The converter object.
@@ -1231,7 +1231,7 @@ module Pdfcrowd
1231
1231
  self
1232
1232
  end
1233
1233
 
1234
- # Load an HTML code from the specified URL and use it as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1234
+ # Load an HTML code from the specified URL and use it as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of the converted document pdfcrowd-source-title - the title of the converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1235
1235
  #
1236
1236
  # * +url+ - The supported protocols are http:// and https://.
1237
1237
  # * *Returns* - The converter object.
@@ -1244,7 +1244,7 @@ module Pdfcrowd
1244
1244
  self
1245
1245
  end
1246
1246
 
1247
- # Use the specified HTML as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1247
+ # Use the specified HTML as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of the converted document pdfcrowd-source-title - the title of the converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1248
1248
  #
1249
1249
  # * +html+ - The string must not be empty.
1250
1250
  # * *Returns* - The converter object.
@@ -1703,6 +1703,28 @@ module Pdfcrowd
1703
1703
  self
1704
1704
  end
1705
1705
 
1706
+ # The main HTML element for conversion is detected automatically.
1707
+ #
1708
+ # * +value+ - Set to true to detect the main element.
1709
+ # * *Returns* - The converter object.
1710
+ def setAutoDetectElementToConvert(value)
1711
+ @fields['auto_detect_element_to_convert'] = value
1712
+ self
1713
+ end
1714
+
1715
+ # The input HTML is automatically enhanced to improve the readability.
1716
+ #
1717
+ # * +enhancements+ - Allowed values are none, readability-v1.
1718
+ # * *Returns* - The converter object.
1719
+ def setReadabilityEnhancements(enhancements)
1720
+ unless /(?i)^(none|readability-v1)$/.match(enhancements)
1721
+ raise Error.new(Pdfcrowd.create_invalid_value_message(enhancements, "setReadabilityEnhancements", "html-to-pdf", "Allowed values are none, readability-v1.", "set_readability_enhancements"), 470);
1722
+ end
1723
+
1724
+ @fields['readability_enhancements'] = enhancements
1725
+ self
1726
+ end
1727
+
1706
1728
  # Set the viewport width in pixels. The viewport is the user's visible area of the page.
1707
1729
  #
1708
1730
  # * +width+ - The value must be in the range 96-65000.
@@ -1716,7 +1738,7 @@ module Pdfcrowd
1716
1738
  self
1717
1739
  end
1718
1740
 
1719
- # Set the viewport height in pixels. The viewport is the user's visible area of the page.
1741
+ # Set the viewport height in pixels. The viewport is the user's visible area of the page. If the input HTML uses lazily loaded images, try using a large value that covers the entire height of the HTML, e.g. 100000.
1720
1742
  #
1721
1743
  # * +height+ - Must be a positive integer number.
1722
1744
  # * *Returns* - The converter object.
@@ -1732,7 +1754,7 @@ module Pdfcrowd
1732
1754
  # Set the viewport size. The viewport is the user's visible area of the page.
1733
1755
  #
1734
1756
  # * +width+ - Set the viewport width in pixels. The viewport is the user's visible area of the page. The value must be in the range 96-65000.
1735
- # * +height+ - Set the viewport height in pixels. The viewport is the user's visible area of the page. Must be a positive integer number.
1757
+ # * +height+ - Set the viewport height in pixels. The viewport is the user's visible area of the page. If the input HTML uses lazily loaded images, try using a large value that covers the entire height of the HTML, e.g. 100000. Must be a positive integer number.
1736
1758
  # * *Returns* - The converter object.
1737
1759
  def setViewport(width, height)
1738
1760
  setViewportWidth(width)
@@ -1818,6 +1840,15 @@ module Pdfcrowd
1818
1840
  self
1819
1841
  end
1820
1842
 
1843
+ # Convert HTML forms to fillable PDF forms. Details can be found in the blog post.
1844
+ #
1845
+ # * +value+ - Set to true to make fillable PDF forms.
1846
+ # * *Returns* - The converter object.
1847
+ def setEnablePdfForms(value)
1848
+ @fields['enable_pdf_forms'] = value
1849
+ self
1850
+ end
1851
+
1821
1852
  # Create linearized PDF. This is also known as Fast Web View.
1822
1853
  #
1823
1854
  # * +value+ - Set to true to create linearized PDF.
@@ -2146,7 +2177,7 @@ module Pdfcrowd
2146
2177
  end
2147
2178
 
2148
2179
  # Get the number of conversion credits available in your account.
2149
- # This method can only be called after a call to one of the convertXYZ methods.
2180
+ # This method can only be called after a call to one of the convertXtoY methods.
2150
2181
  # The returned value can differ from the actual count if you run parallel conversions.
2151
2182
  # The special value 999999 is returned if the information is not available.
2152
2183
  # * *Returns* - The number of credits.
@@ -2332,7 +2363,7 @@ module Pdfcrowd
2332
2363
  self
2333
2364
  end
2334
2365
 
2335
- # Set a custom user agent HTTP header. It can be useful if you are behind some proxy or firewall.
2366
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
2336
2367
  #
2337
2368
  # * +agent+ - The user agent string.
2338
2369
  # * *Returns* - The converter object.
@@ -2353,9 +2384,9 @@ module Pdfcrowd
2353
2384
  self
2354
2385
  end
2355
2386
 
2356
- # Specifies the number of retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
2387
+ # Specifies the number of automatic retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
2357
2388
  #
2358
- # * +count+ - Number of retries wanted.
2389
+ # * +count+ - Number of retries.
2359
2390
  # * *Returns* - The converter object.
2360
2391
  def setRetryCount(count)
2361
2392
  @helper.setRetryCount(count)
@@ -2838,6 +2869,28 @@ module Pdfcrowd
2838
2869
  self
2839
2870
  end
2840
2871
 
2872
+ # The main HTML element for conversion is detected automatically.
2873
+ #
2874
+ # * +value+ - Set to true to detect the main element.
2875
+ # * *Returns* - The converter object.
2876
+ def setAutoDetectElementToConvert(value)
2877
+ @fields['auto_detect_element_to_convert'] = value
2878
+ self
2879
+ end
2880
+
2881
+ # The input HTML is automatically enhanced to improve the readability.
2882
+ #
2883
+ # * +enhancements+ - Allowed values are none, readability-v1.
2884
+ # * *Returns* - The converter object.
2885
+ def setReadabilityEnhancements(enhancements)
2886
+ unless /(?i)^(none|readability-v1)$/.match(enhancements)
2887
+ raise Error.new(Pdfcrowd.create_invalid_value_message(enhancements, "setReadabilityEnhancements", "html-to-image", "Allowed values are none, readability-v1.", "set_readability_enhancements"), 470);
2888
+ end
2889
+
2890
+ @fields['readability_enhancements'] = enhancements
2891
+ self
2892
+ end
2893
+
2841
2894
  # Set the output image width in pixels.
2842
2895
  #
2843
2896
  # * +width+ - The value must be in the range 96-65000.
@@ -2982,7 +3035,7 @@ module Pdfcrowd
2982
3035
  end
2983
3036
 
2984
3037
  # Get the number of conversion credits available in your account.
2985
- # This method can only be called after a call to one of the convertXYZ methods.
3038
+ # This method can only be called after a call to one of the convertXtoY methods.
2986
3039
  # The returned value can differ from the actual count if you run parallel conversions.
2987
3040
  # The special value 999999 is returned if the information is not available.
2988
3041
  # * *Returns* - The number of credits.
@@ -3094,7 +3147,7 @@ module Pdfcrowd
3094
3147
  self
3095
3148
  end
3096
3149
 
3097
- # Set a custom user agent HTTP header. It can be useful if you are behind some proxy or firewall.
3150
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
3098
3151
  #
3099
3152
  # * +agent+ - The user agent string.
3100
3153
  # * *Returns* - The converter object.
@@ -3115,9 +3168,9 @@ module Pdfcrowd
3115
3168
  self
3116
3169
  end
3117
3170
 
3118
- # Specifies the number of retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
3171
+ # Specifies the number of automatic retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
3119
3172
  #
3120
- # * +count+ - Number of retries wanted.
3173
+ # * +count+ - Number of retries.
3121
3174
  # * *Returns* - The converter object.
3122
3175
  def setRetryCount(count)
3123
3176
  @helper.setRetryCount(count)
@@ -3358,7 +3411,7 @@ module Pdfcrowd
3358
3411
  end
3359
3412
 
3360
3413
  # Get the number of conversion credits available in your account.
3361
- # This method can only be called after a call to one of the convertXYZ methods.
3414
+ # This method can only be called after a call to one of the convertXtoY methods.
3362
3415
  # The returned value can differ from the actual count if you run parallel conversions.
3363
3416
  # The special value 999999 is returned if the information is not available.
3364
3417
  # * *Returns* - The number of credits.
@@ -3448,7 +3501,7 @@ module Pdfcrowd
3448
3501
  self
3449
3502
  end
3450
3503
 
3451
- # Set a custom user agent HTTP header. It can be useful if you are behind some proxy or firewall.
3504
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
3452
3505
  #
3453
3506
  # * +agent+ - The user agent string.
3454
3507
  # * *Returns* - The converter object.
@@ -3469,9 +3522,9 @@ module Pdfcrowd
3469
3522
  self
3470
3523
  end
3471
3524
 
3472
- # Specifies the number of retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
3525
+ # Specifies the number of automatic retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
3473
3526
  #
3474
- # * +count+ - Number of retries wanted.
3527
+ # * +count+ - Number of retries.
3475
3528
  # * *Returns* - The converter object.
3476
3529
  def setRetryCount(count)
3477
3530
  @helper.setRetryCount(count)
@@ -3564,6 +3617,15 @@ module Pdfcrowd
3564
3617
  self
3565
3618
  end
3566
3619
 
3620
+ # Password to open the encrypted PDF file.
3621
+ #
3622
+ # * +password+ - The input PDF password.
3623
+ # * *Returns* - The converter object.
3624
+ def setInputPdfPassword(password)
3625
+ @fields['input_pdf_password'] = password
3626
+ self
3627
+ end
3628
+
3567
3629
  # Apply the first page of the watermark PDF to every page of the output PDF.
3568
3630
  #
3569
3631
  # * +watermark+ - The file path to a local watermark PDF file. The file must exist and not be empty.
@@ -3924,7 +3986,7 @@ module Pdfcrowd
3924
3986
  end
3925
3987
 
3926
3988
  # Get the number of conversion credits available in your account.
3927
- # This method can only be called after a call to one of the convertXYZ methods.
3989
+ # This method can only be called after a call to one of the convertXtoY methods.
3928
3990
  # The returned value can differ from the actual count if you run parallel conversions.
3929
3991
  # The special value 999999 is returned if the information is not available.
3930
3992
  # * *Returns* - The number of credits.
@@ -3994,7 +4056,7 @@ module Pdfcrowd
3994
4056
  self
3995
4057
  end
3996
4058
 
3997
- # Set a custom user agent HTTP header. It can be useful if you are behind some proxy or firewall.
4059
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
3998
4060
  #
3999
4061
  # * +agent+ - The user agent string.
4000
4062
  # * *Returns* - The converter object.
@@ -4015,9 +4077,9 @@ module Pdfcrowd
4015
4077
  self
4016
4078
  end
4017
4079
 
4018
- # Specifies the number of retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
4080
+ # Specifies the number of automatic retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
4019
4081
  #
4020
- # * +count+ - Number of retries wanted.
4082
+ # * +count+ - Number of retries.
4021
4083
  # * *Returns* - The converter object.
4022
4084
  def setRetryCount(count)
4023
4085
  @helper.setRetryCount(count)
@@ -4245,7 +4307,7 @@ module Pdfcrowd
4245
4307
  end
4246
4308
 
4247
4309
  # Get the number of conversion credits available in your account.
4248
- # This method can only be called after a call to one of the convertXYZ methods.
4310
+ # This method can only be called after a call to one of the convertXtoY methods.
4249
4311
  # The returned value can differ from the actual count if you run parallel conversions.
4250
4312
  # The special value 999999 is returned if the information is not available.
4251
4313
  # * *Returns* - The number of credits.
@@ -4335,7 +4397,7 @@ module Pdfcrowd
4335
4397
  self
4336
4398
  end
4337
4399
 
4338
- # Set a custom user agent HTTP header. It can be useful if you are behind some proxy or firewall.
4400
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
4339
4401
  #
4340
4402
  # * +agent+ - The user agent string.
4341
4403
  # * *Returns* - The converter object.
@@ -4356,9 +4418,9 @@ module Pdfcrowd
4356
4418
  self
4357
4419
  end
4358
4420
 
4359
- # Specifies the number of retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
4421
+ # Specifies the number of automatic retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
4360
4422
  #
4361
- # * +count+ - Number of retries wanted.
4423
+ # * +count+ - Number of retries.
4362
4424
  # * *Returns* - The converter object.
4363
4425
  def setRetryCount(count)
4364
4426
  @helper.setRetryCount(count)
@@ -4367,4 +4429,467 @@ module Pdfcrowd
4367
4429
 
4368
4430
  end
4369
4431
 
4432
+ # Conversion from PDF to HTML.
4433
+ class PdfToHtmlClient
4434
+ # Constructor for the Pdfcrowd API client.
4435
+ #
4436
+ # * +user_name+ - Your username at Pdfcrowd.
4437
+ # * +api_key+ - Your API key.
4438
+ def initialize(user_name, api_key)
4439
+ @helper = ConnectionHelper.new(user_name, api_key)
4440
+ @fields = {
4441
+ 'input_format'=>'pdf',
4442
+ 'output_format'=>'html'
4443
+ }
4444
+ @file_id = 1
4445
+ @files = {}
4446
+ @raw_data = {}
4447
+ end
4448
+
4449
+ # Convert a PDF.
4450
+ #
4451
+ # * +url+ - The address of the PDF to convert. The supported protocols are http:// and https://.
4452
+ # * *Returns* - Byte array containing the conversion output.
4453
+ def convertUrl(url)
4454
+ unless /(?i)^https?:\/\/.*$/.match(url)
4455
+ raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-html", "The supported protocols are http:// and https://.", "convert_url"), 470);
4456
+ end
4457
+
4458
+ @fields['url'] = url
4459
+ @helper.post(@fields, @files, @raw_data)
4460
+ end
4461
+
4462
+ # Convert a PDF and write the result to an output stream.
4463
+ #
4464
+ # * +url+ - The address of the PDF to convert. The supported protocols are http:// and https://.
4465
+ # * +out_stream+ - The output stream that will contain the conversion output.
4466
+ def convertUrlToStream(url, out_stream)
4467
+ unless /(?i)^https?:\/\/.*$/.match(url)
4468
+ raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-html", "The supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
4469
+ end
4470
+
4471
+ @fields['url'] = url
4472
+ @helper.post(@fields, @files, @raw_data, out_stream)
4473
+ end
4474
+
4475
+ # Convert a PDF and write the result to a local file.
4476
+ #
4477
+ # * +url+ - The address of the PDF to convert. The supported protocols are http:// and https://.
4478
+ # * +file_path+ - The output file path. The string must not be empty. The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.
4479
+ def convertUrlToFile(url, file_path)
4480
+ if (!(!file_path.nil? && !file_path.empty?))
4481
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertUrlToFile::file_path", "pdf-to-html", "The string must not be empty.", "convert_url_to_file"), 470);
4482
+ end
4483
+
4484
+ if (!(isOutputTypeValid(file_path)))
4485
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertUrlToFile::file_path", "pdf-to-html", "The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.", "convert_url_to_file"), 470);
4486
+ end
4487
+
4488
+ output_file = open(file_path, "wb")
4489
+ begin
4490
+ convertUrlToStream(url, output_file)
4491
+ output_file.close()
4492
+ rescue Error => why
4493
+ output_file.close()
4494
+ FileUtils.rm(file_path)
4495
+ raise
4496
+ end
4497
+ end
4498
+
4499
+ # Convert a local file.
4500
+ #
4501
+ # * +file+ - The path to a local file to convert. The file must exist and not be empty.
4502
+ # * *Returns* - Byte array containing the conversion output.
4503
+ def convertFile(file)
4504
+ if (!(File.file?(file) && !File.zero?(file)))
4505
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFile", "pdf-to-html", "The file must exist and not be empty.", "convert_file"), 470);
4506
+ end
4507
+
4508
+ @files['file'] = file
4509
+ @helper.post(@fields, @files, @raw_data)
4510
+ end
4511
+
4512
+ # Convert a local file and write the result to an output stream.
4513
+ #
4514
+ # * +file+ - The path to a local file to convert. The file must exist and not be empty.
4515
+ # * +out_stream+ - The output stream that will contain the conversion output.
4516
+ def convertFileToStream(file, out_stream)
4517
+ if (!(File.file?(file) && !File.zero?(file)))
4518
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFileToStream::file", "pdf-to-html", "The file must exist and not be empty.", "convert_file_to_stream"), 470);
4519
+ end
4520
+
4521
+ @files['file'] = file
4522
+ @helper.post(@fields, @files, @raw_data, out_stream)
4523
+ end
4524
+
4525
+ # Convert a local file and write the result to a local file.
4526
+ #
4527
+ # * +file+ - The path to a local file to convert. The file must exist and not be empty.
4528
+ # * +file_path+ - The output file path. The string must not be empty. The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.
4529
+ def convertFileToFile(file, file_path)
4530
+ if (!(!file_path.nil? && !file_path.empty?))
4531
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertFileToFile::file_path", "pdf-to-html", "The string must not be empty.", "convert_file_to_file"), 470);
4532
+ end
4533
+
4534
+ if (!(isOutputTypeValid(file_path)))
4535
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertFileToFile::file_path", "pdf-to-html", "The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.", "convert_file_to_file"), 470);
4536
+ end
4537
+
4538
+ output_file = open(file_path, "wb")
4539
+ begin
4540
+ convertFileToStream(file, output_file)
4541
+ output_file.close()
4542
+ rescue Error => why
4543
+ output_file.close()
4544
+ FileUtils.rm(file_path)
4545
+ raise
4546
+ end
4547
+ end
4548
+
4549
+ # Convert raw data.
4550
+ #
4551
+ # * +data+ - The raw content to be converted.
4552
+ # * *Returns* - Byte array with the output.
4553
+ def convertRawData(data)
4554
+ @raw_data['file'] = data
4555
+ @helper.post(@fields, @files, @raw_data)
4556
+ end
4557
+
4558
+ # Convert raw data and write the result to an output stream.
4559
+ #
4560
+ # * +data+ - The raw content to be converted.
4561
+ # * +out_stream+ - The output stream that will contain the conversion output.
4562
+ def convertRawDataToStream(data, out_stream)
4563
+ @raw_data['file'] = data
4564
+ @helper.post(@fields, @files, @raw_data, out_stream)
4565
+ end
4566
+
4567
+ # Convert raw data to a file.
4568
+ #
4569
+ # * +data+ - The raw content to be converted.
4570
+ # * +file_path+ - The output file path. The string must not be empty. The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.
4571
+ def convertRawDataToFile(data, file_path)
4572
+ if (!(!file_path.nil? && !file_path.empty?))
4573
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertRawDataToFile::file_path", "pdf-to-html", "The string must not be empty.", "convert_raw_data_to_file"), 470);
4574
+ end
4575
+
4576
+ if (!(isOutputTypeValid(file_path)))
4577
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertRawDataToFile::file_path", "pdf-to-html", "The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.", "convert_raw_data_to_file"), 470);
4578
+ end
4579
+
4580
+ output_file = open(file_path, "wb")
4581
+ begin
4582
+ convertRawDataToStream(data, output_file)
4583
+ output_file.close()
4584
+ rescue Error => why
4585
+ output_file.close()
4586
+ FileUtils.rm(file_path)
4587
+ raise
4588
+ end
4589
+ end
4590
+
4591
+ # Convert the contents of an input stream.
4592
+ #
4593
+ # * +in_stream+ - The input stream with source data.
4594
+ # * *Returns* - Byte array containing the conversion output.
4595
+ def convertStream(in_stream)
4596
+ @raw_data['stream'] = in_stream.read
4597
+ @helper.post(@fields, @files, @raw_data)
4598
+ end
4599
+
4600
+ # Convert the contents of an input stream and write the result to an output stream.
4601
+ #
4602
+ # * +in_stream+ - The input stream with source data.
4603
+ # * +out_stream+ - The output stream that will contain the conversion output.
4604
+ def convertStreamToStream(in_stream, out_stream)
4605
+ @raw_data['stream'] = in_stream.read
4606
+ @helper.post(@fields, @files, @raw_data, out_stream)
4607
+ end
4608
+
4609
+ # Convert the contents of an input stream and write the result to a local file.
4610
+ #
4611
+ # * +in_stream+ - The input stream with source data.
4612
+ # * +file_path+ - The output file path. The string must not be empty. The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.
4613
+ def convertStreamToFile(in_stream, file_path)
4614
+ if (!(!file_path.nil? && !file_path.empty?))
4615
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "pdf-to-html", "The string must not be empty.", "convert_stream_to_file"), 470);
4616
+ end
4617
+
4618
+ if (!(isOutputTypeValid(file_path)))
4619
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "pdf-to-html", "The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.", "convert_stream_to_file"), 470);
4620
+ end
4621
+
4622
+ output_file = open(file_path, "wb")
4623
+ begin
4624
+ convertStreamToStream(in_stream, output_file)
4625
+ output_file.close()
4626
+ rescue Error => why
4627
+ output_file.close()
4628
+ FileUtils.rm(file_path)
4629
+ raise
4630
+ end
4631
+ end
4632
+
4633
+ # Password to open the encrypted PDF file.
4634
+ #
4635
+ # * +password+ - The input PDF password.
4636
+ # * *Returns* - The converter object.
4637
+ def setPdfPassword(password)
4638
+ @fields['pdf_password'] = password
4639
+ self
4640
+ end
4641
+
4642
+ # Set the scaling factor (zoom) for the main page area.
4643
+ #
4644
+ # * +factor+ - The percentage value. Must be a positive integer number.
4645
+ # * *Returns* - The converter object.
4646
+ def setScaleFactor(factor)
4647
+ if (!(Integer(factor) > 0))
4648
+ raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "pdf-to-html", "Must be a positive integer number.", "set_scale_factor"), 470);
4649
+ end
4650
+
4651
+ @fields['scale_factor'] = factor
4652
+ self
4653
+ end
4654
+
4655
+ # Set the page range to print.
4656
+ #
4657
+ # * +pages+ - A comma separated list of page numbers or ranges.
4658
+ # * *Returns* - The converter object.
4659
+ def setPrintPageRange(pages)
4660
+ unless /^(?:\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*))\s*,\s*)*\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*))\s*$/.match(pages)
4661
+ raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setPrintPageRange", "pdf-to-html", "A comma separated list of page numbers or ranges.", "set_print_page_range"), 470);
4662
+ end
4663
+
4664
+ @fields['print_page_range'] = pages
4665
+ self
4666
+ end
4667
+
4668
+ # Specifies where the images are stored.
4669
+ #
4670
+ # * +mode+ - The image storage mode. Allowed values are embed, separate.
4671
+ # * *Returns* - The converter object.
4672
+ def setImageMode(mode)
4673
+ unless /(?i)^(embed|separate)$/.match(mode)
4674
+ raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setImageMode", "pdf-to-html", "Allowed values are embed, separate.", "set_image_mode"), 470);
4675
+ end
4676
+
4677
+ @fields['image_mode'] = mode
4678
+ self
4679
+ end
4680
+
4681
+ # Specifies where the style sheets are stored.
4682
+ #
4683
+ # * +mode+ - The style sheet storage mode. Allowed values are embed, separate.
4684
+ # * *Returns* - The converter object.
4685
+ def setCssMode(mode)
4686
+ unless /(?i)^(embed|separate)$/.match(mode)
4687
+ raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setCssMode", "pdf-to-html", "Allowed values are embed, separate.", "set_css_mode"), 470);
4688
+ end
4689
+
4690
+ @fields['css_mode'] = mode
4691
+ self
4692
+ end
4693
+
4694
+ # Specifies where the fonts are stored.
4695
+ #
4696
+ # * +mode+ - The font storage mode. Allowed values are embed, separate.
4697
+ # * *Returns* - The converter object.
4698
+ def setFontMode(mode)
4699
+ unless /(?i)^(embed|separate)$/.match(mode)
4700
+ raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setFontMode", "pdf-to-html", "Allowed values are embed, separate.", "set_font_mode"), 470);
4701
+ end
4702
+
4703
+ @fields['font_mode'] = mode
4704
+ self
4705
+ end
4706
+
4707
+ # A helper method to determine if the output file is a zip archive. The output of the conversion may be either an HTML file or a zip file containing the HTML and its external assets.
4708
+ # * *Returns* - True if the conversion output is a zip file, otherwise False.
4709
+ def isZippedOutput()
4710
+ @fields.fetch('image_mode', '') == 'separate' || @fields.fetch('css_mode', '') == 'separate' || @fields.fetch('font_mode', '') == 'separate' || @fields.fetch('force_zip', false) == true
4711
+ end
4712
+
4713
+ # Enforces the zip output format.
4714
+ #
4715
+ # * +value+ - Set to true to get the output as a zip archive.
4716
+ # * *Returns* - The converter object.
4717
+ def setForceZip(value)
4718
+ @fields['force_zip'] = value
4719
+ self
4720
+ end
4721
+
4722
+ # Set the HTML title. The title from the input PDF is used by default.
4723
+ #
4724
+ # * +title+ - The HTML title.
4725
+ # * *Returns* - The converter object.
4726
+ def setTitle(title)
4727
+ @fields['title'] = title
4728
+ self
4729
+ end
4730
+
4731
+ # Set the HTML subject. The subject from the input PDF is used by default.
4732
+ #
4733
+ # * +subject+ - The HTML subject.
4734
+ # * *Returns* - The converter object.
4735
+ def setSubject(subject)
4736
+ @fields['subject'] = subject
4737
+ self
4738
+ end
4739
+
4740
+ # Set the HTML author. The author from the input PDF is used by default.
4741
+ #
4742
+ # * +author+ - The HTML author.
4743
+ # * *Returns* - The converter object.
4744
+ def setAuthor(author)
4745
+ @fields['author'] = author
4746
+ self
4747
+ end
4748
+
4749
+ # Associate keywords with the HTML document. Keywords from the input PDF are used by default.
4750
+ #
4751
+ # * +keywords+ - The string containing the keywords.
4752
+ # * *Returns* - The converter object.
4753
+ def setKeywords(keywords)
4754
+ @fields['keywords'] = keywords
4755
+ self
4756
+ end
4757
+
4758
+ # Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method or available in conversion statistics.
4759
+ #
4760
+ # * +value+ - Set to true to enable the debug logging.
4761
+ # * *Returns* - The converter object.
4762
+ def setDebugLog(value)
4763
+ @fields['debug_log'] = value
4764
+ self
4765
+ end
4766
+
4767
+ # Get the URL of the debug log for the last conversion.
4768
+ # * *Returns* - The link to the debug log.
4769
+ def getDebugLogUrl()
4770
+ return @helper.getDebugLogUrl()
4771
+ end
4772
+
4773
+ # Get the number of conversion credits available in your account.
4774
+ # This method can only be called after a call to one of the convertXtoY methods.
4775
+ # The returned value can differ from the actual count if you run parallel conversions.
4776
+ # The special value 999999 is returned if the information is not available.
4777
+ # * *Returns* - The number of credits.
4778
+ def getRemainingCreditCount()
4779
+ return @helper.getRemainingCreditCount()
4780
+ end
4781
+
4782
+ # Get the number of credits consumed by the last conversion.
4783
+ # * *Returns* - The number of credits.
4784
+ def getConsumedCreditCount()
4785
+ return @helper.getConsumedCreditCount()
4786
+ end
4787
+
4788
+ # Get the job id.
4789
+ # * *Returns* - The unique job identifier.
4790
+ def getJobId()
4791
+ return @helper.getJobId()
4792
+ end
4793
+
4794
+ # Get the total number of pages in the output document.
4795
+ # * *Returns* - The page count.
4796
+ def getPageCount()
4797
+ return @helper.getPageCount()
4798
+ end
4799
+
4800
+ # Get the size of the output in bytes.
4801
+ # * *Returns* - The count of bytes.
4802
+ def getOutputSize()
4803
+ return @helper.getOutputSize()
4804
+ end
4805
+
4806
+ # Get the version details.
4807
+ # * *Returns* - API version, converter version, and client version.
4808
+ def getVersion()
4809
+ return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion()
4810
+ end
4811
+
4812
+ # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
4813
+ #
4814
+ # * +tag+ - A string with the custom tag.
4815
+ # * *Returns* - The converter object.
4816
+ def setTag(tag)
4817
+ @fields['tag'] = tag
4818
+ self
4819
+ end
4820
+
4821
+ # A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
4822
+ #
4823
+ # * +proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
4824
+ # * *Returns* - The converter object.
4825
+ def setHttpProxy(proxy)
4826
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy)
4827
+ raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, "setHttpProxy", "pdf-to-html", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
4828
+ end
4829
+
4830
+ @fields['http_proxy'] = proxy
4831
+ self
4832
+ end
4833
+
4834
+ # A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
4835
+ #
4836
+ # * +proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
4837
+ # * *Returns* - The converter object.
4838
+ def setHttpsProxy(proxy)
4839
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy)
4840
+ raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, "setHttpsProxy", "pdf-to-html", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
4841
+ end
4842
+
4843
+ @fields['https_proxy'] = proxy
4844
+ self
4845
+ end
4846
+
4847
+ # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
4848
+ # Warning: Using HTTP is insecure as data sent over HTTP is not encrypted. Enable this option only if you know what you are doing.
4849
+ #
4850
+ # * +value+ - Set to true to use HTTP.
4851
+ # * *Returns* - The converter object.
4852
+ def setUseHttp(value)
4853
+ @helper.setUseHttp(value)
4854
+ self
4855
+ end
4856
+
4857
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
4858
+ #
4859
+ # * +agent+ - The user agent string.
4860
+ # * *Returns* - The converter object.
4861
+ def setUserAgent(agent)
4862
+ @helper.setUserAgent(agent)
4863
+ self
4864
+ end
4865
+
4866
+ # Specifies an HTTP proxy that the API client library will use to connect to the internet.
4867
+ #
4868
+ # * +host+ - The proxy hostname.
4869
+ # * +port+ - The proxy port.
4870
+ # * +user_name+ - The username.
4871
+ # * +password+ - The password.
4872
+ # * *Returns* - The converter object.
4873
+ def setProxy(host, port, user_name, password)
4874
+ @helper.setProxy(host, port, user_name, password)
4875
+ self
4876
+ end
4877
+
4878
+ # Specifies the number of automatic retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
4879
+ #
4880
+ # * +count+ - Number of retries.
4881
+ # * *Returns* - The converter object.
4882
+ def setRetryCount(count)
4883
+ @helper.setRetryCount(count)
4884
+ self
4885
+ end
4886
+
4887
+ private
4888
+
4889
+ def isOutputTypeValid(file_path)
4890
+ extension = File.extname(file_path).downcase
4891
+ (extension == '.zip') == isZippedOutput()
4892
+ end
4893
+ end
4894
+
4370
4895
  end
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.3.0
4
+ version: 5.6.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: 2022-01-10 00:00:00.000000000 Z
11
+ date: 2022-05-19 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.