Class: Pdfcrowd::HtmlToImageClient

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfcrowd.rb

Overview

Conversion from HTML to image.

Instance Method Summary collapse

Constructor Details

#initialize(user_name, api_key) ⇒ HtmlToImageClient

Returns a new instance of HtmlToImageClient.



2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
# File 'lib/pdfcrowd.rb', line 2124

def initialize(user_name, api_key)
    @helper = ConnectionHelper.new(user_name, api_key)
    @fields = {
        'input_format'=>'html',
        'output_format'=>'png'
    }
    @file_id = 1
    @files = {}
    @raw_data = {}
end

Instance Method Details

#convertFile(file) ⇒ Object



2183
2184
2185
2186
2187
2188
2189
2190
# File 'lib/pdfcrowd.rb', line 2183

def convertFile(file)
    if (!(File.file?(file) && !File.zero?(file)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFile", "html-to-image", "The file must exist and not be empty.", "convert_file"), 470);
    end
    
    @files['file'] = file
    @helper.post(@fields, @files, @raw_data)
end

#convertFileToFile(file, file_path) ⇒ Object



2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
# File 'lib/pdfcrowd.rb', line 2203

def convertFileToFile(file, file_path)
    if (!(!file_path.nil? && !file_path.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertFileToFile::file_path", "html-to-image", "The string must not be empty.", "convert_file_to_file"), 470);
    end
    
    output_file = open(file_path, "wb")
    begin
        convertFileToStream(file, output_file)
        output_file.close()
    rescue Error => why
        output_file.close()
        FileUtils.rm(file_path)
        raise
    end
end

#convertFileToStream(file, out_stream) ⇒ Object



2193
2194
2195
2196
2197
2198
2199
2200
# File 'lib/pdfcrowd.rb', line 2193

def convertFileToStream(file, out_stream)
    if (!(File.file?(file) && !File.zero?(file)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFileToStream::file", "html-to-image", "The file must exist and not be empty.", "convert_file_to_stream"), 470);
    end
    
    @files['file'] = file
    @helper.post(@fields, @files, @raw_data, out_stream)
end

#convertStream(in_stream) ⇒ Object



2257
2258
2259
2260
# File 'lib/pdfcrowd.rb', line 2257

def convertStream(in_stream)
    @raw_data['stream'] = in_stream.read
    @helper.post(@fields, @files, @raw_data)
end

#convertStreamToFile(in_stream, file_path) ⇒ Object



2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
# File 'lib/pdfcrowd.rb', line 2269

def convertStreamToFile(in_stream, file_path)
    if (!(!file_path.nil? && !file_path.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "html-to-image", "The string must not be empty.", "convert_stream_to_file"), 470);
    end
    
    output_file = open(file_path, "wb")
    begin
        convertStreamToStream(in_stream, output_file)
        output_file.close()
    rescue Error => why
        output_file.close()
        FileUtils.rm(file_path)
        raise
    end
end

#convertStreamToStream(in_stream, out_stream) ⇒ Object



2263
2264
2265
2266
# File 'lib/pdfcrowd.rb', line 2263

def convertStreamToStream(in_stream, out_stream)
    @raw_data['stream'] = in_stream.read
    @helper.post(@fields, @files, @raw_data, out_stream)
end

#convertString(text) ⇒ Object



2220
2221
2222
2223
2224
2225
2226
2227
# File 'lib/pdfcrowd.rb', line 2220

def convertString(text)
    if (!(!text.nil? && !text.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(text, "convertString", "html-to-image", "The string must not be empty.", "convert_string"), 470);
    end
    
    @fields['text'] = text
    @helper.post(@fields, @files, @raw_data)
end

#convertStringToFile(text, file_path) ⇒ Object



2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
# File 'lib/pdfcrowd.rb', line 2240

def convertStringToFile(text, file_path)
    if (!(!file_path.nil? && !file_path.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStringToFile::file_path", "html-to-image", "The string must not be empty.", "convert_string_to_file"), 470);
    end
    
    output_file = open(file_path, "wb")
    begin
        convertStringToStream(text, output_file)
        output_file.close()
    rescue Error => why
        output_file.close()
        FileUtils.rm(file_path)
        raise
    end
end

#convertStringToStream(text, out_stream) ⇒ Object



2230
2231
2232
2233
2234
2235
2236
2237
# File 'lib/pdfcrowd.rb', line 2230

def convertStringToStream(text, out_stream)
    if (!(!text.nil? && !text.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(text, "convertStringToStream::text", "html-to-image", "The string must not be empty.", "convert_string_to_stream"), 470);
    end
    
    @fields['text'] = text
    @helper.post(@fields, @files, @raw_data, out_stream)
end

#convertUrl(url) ⇒ Object



2146
2147
2148
2149
2150
2151
2152
2153
# File 'lib/pdfcrowd.rb', line 2146

def convertUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "html-to-image", "Supported protocols are http:// and https://.", "convert_url"), 470);
    end
    
    @fields['url'] = url
    @helper.post(@fields, @files, @raw_data)
end

#convertUrlToFile(url, file_path) ⇒ Object



2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
# File 'lib/pdfcrowd.rb', line 2166

def convertUrlToFile(url, file_path)
    if (!(!file_path.nil? && !file_path.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertUrlToFile::file_path", "html-to-image", "The string must not be empty.", "convert_url_to_file"), 470);
    end
    
    output_file = open(file_path, "wb")
    begin
        convertUrlToStream(url, output_file)
        output_file.close()
    rescue Error => why
        output_file.close()
        FileUtils.rm(file_path)
        raise
    end
end

#convertUrlToStream(url, out_stream) ⇒ Object



2156
2157
2158
2159
2160
2161
2162
2163
# File 'lib/pdfcrowd.rb', line 2156

def convertUrlToStream(url, out_stream)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "html-to-image", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
    end
    
    @fields['url'] = url
    @helper.post(@fields, @files, @raw_data, out_stream)
end

#getConsumedCreditCountObject



2619
2620
2621
# File 'lib/pdfcrowd.rb', line 2619

def getConsumedCreditCount()
    return @helper.getConsumedCreditCount()
end

#getDebugLogUrlObject



2609
2610
2611
# File 'lib/pdfcrowd.rb', line 2609

def getDebugLogUrl()
    return @helper.getDebugLogUrl()
end

#getJobIdObject



2624
2625
2626
# File 'lib/pdfcrowd.rb', line 2624

def getJobId()
    return @helper.getJobId()
end

#getOutputSizeObject



2629
2630
2631
# File 'lib/pdfcrowd.rb', line 2629

def getOutputSize()
    return @helper.getOutputSize()
end

#getRemainingCreditCountObject



2614
2615
2616
# File 'lib/pdfcrowd.rb', line 2614

def getRemainingCreditCount()
    return @helper.getRemainingCreditCount()
end

#getVersionObject



2634
2635
2636
# File 'lib/pdfcrowd.rb', line 2634

def getVersion()
    return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion()
end

#setAutoDetectElementToConvert(value) ⇒ Object



2525
2526
2527
2528
# File 'lib/pdfcrowd.rb', line 2525

def setAutoDetectElementToConvert(value)
    @fields['auto_detect_element_to_convert'] = value
    self
end

#setBackgroundColor(color) ⇒ Object



2322
2323
2324
2325
2326
2327
2328
2329
# File 'lib/pdfcrowd.rb', line 2322

def setBackgroundColor(color)
    unless /^[0-9a-fA-F]{6,8}$/.match(color)
        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);
    end
    
    @fields['background_color'] = color
    self
end

#setBlockAds(value) ⇒ Object



2378
2379
2380
2381
# File 'lib/pdfcrowd.rb', line 2378

def setBlockAds(value)
    @fields['block_ads'] = value
    self
end

#setClientCertificate(certificate) ⇒ Object



2665
2666
2667
2668
2669
2670
2671
2672
# File 'lib/pdfcrowd.rb', line 2665

def setClientCertificate(certificate)
    if (!(File.file?(certificate) && !File.zero?(certificate)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(certificate, "setClientCertificate", "html-to-image", "The file must exist and not be empty.", "set_client_certificate"), 470);
    end
    
    @files['client_certificate'] = certificate
    self
end

#setClientCertificatePassword(password) ⇒ Object



2675
2676
2677
2678
# File 'lib/pdfcrowd.rb', line 2675

def setClientCertificatePassword(password)
    @fields['client_certificate_password'] = password
    self
end

#setClientUserAgent(agent) ⇒ Object



2719
2720
2721
2722
# File 'lib/pdfcrowd.rb', line 2719

def setClientUserAgent(agent)
    @helper.setUserAgent(agent)
    self
end

#setConverterUserAgent(agent) ⇒ Object



2697
2698
2699
2700
# File 'lib/pdfcrowd.rb', line 2697

def setConverterUserAgent(agent)
    @fields['converter_user_agent'] = agent
    self
end

#setConverterVersion(version) ⇒ Object



2703
2704
2705
2706
2707
2708
2709
2710
# File 'lib/pdfcrowd.rb', line 2703

def setConverterVersion(version)
    unless /(?i)^(24.04|20.10|18.10|latest)$/.match(version)
        raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "html-to-image", "Allowed values are 24.04, 20.10, 18.10, latest.", "set_converter_version"), 470);
    end
    
    @helper.setConverterVersion(version)
    self
end

#setCookies(cookies) ⇒ Object



2415
2416
2417
2418
# File 'lib/pdfcrowd.rb', line 2415

def setCookies(cookies)
    @fields['cookies'] = cookies
    self
end

#setCustomCss(css) ⇒ Object



2445
2446
2447
2448
2449
2450
2451
2452
# File 'lib/pdfcrowd.rb', line 2445

def setCustomCss(css)
    if (!(!css.nil? && !css.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(css, "setCustomCss", "html-to-image", "The string must not be empty.", "set_custom_css"), 470);
    end
    
    @fields['custom_css'] = css
    self
end

#setCustomHttpHeader(header) ⇒ Object



2475
2476
2477
2478
2479
2480
2481
2482
# File 'lib/pdfcrowd.rb', line 2475

def setCustomHttpHeader(header)
    unless /^.+:.+$/.match(header)
        raise Error.new(Pdfcrowd.create_invalid_value_message(header, "setCustomHttpHeader", "html-to-image", "A string containing the header name and value separated by a colon.", "set_custom_http_header"), 470);
    end
    
    @fields['custom_http_header'] = header
    self
end

#setCustomJavascript(javascript) ⇒ Object



2455
2456
2457
2458
2459
2460
2461
2462
# File 'lib/pdfcrowd.rb', line 2455

def setCustomJavascript(javascript)
    if (!(!javascript.nil? && !javascript.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(javascript, "setCustomJavascript", "html-to-image", "The string must not be empty.", "set_custom_javascript"), 470);
    end
    
    @fields['custom_javascript'] = javascript
    self
end

#setDataAutoEscape(value) ⇒ Object



2575
2576
2577
2578
# File 'lib/pdfcrowd.rb', line 2575

def setDataAutoEscape(value)
    @fields['data_auto_escape'] = value
    self
end

#setDataEncoding(encoding) ⇒ Object



2563
2564
2565
2566
# File 'lib/pdfcrowd.rb', line 2563

def setDataEncoding(encoding)
    @fields['data_encoding'] = encoding
    self
end

#setDataFile(data_file) ⇒ Object



2547
2548
2549
2550
# File 'lib/pdfcrowd.rb', line 2547

def setDataFile(data_file)
    @files['data_file'] = data_file
    self
end

#setDataFormat(data_format) ⇒ Object



2553
2554
2555
2556
2557
2558
2559
2560
# File 'lib/pdfcrowd.rb', line 2553

def setDataFormat(data_format)
    unless /(?i)^(auto|json|xml|yaml|csv)$/.match(data_format)
        raise Error.new(Pdfcrowd.create_invalid_value_message(data_format, "setDataFormat", "html-to-image", "Allowed values are auto, json, xml, yaml, csv.", "set_data_format"), 470);
    end
    
    @fields['data_format'] = data_format
    self
end

#setDataIgnoreUndefined(value) ⇒ Object



2569
2570
2571
2572
# File 'lib/pdfcrowd.rb', line 2569

def setDataIgnoreUndefined(value)
    @fields['data_ignore_undefined'] = value
    self
end

#setDataOptions(options) ⇒ Object



2597
2598
2599
2600
# File 'lib/pdfcrowd.rb', line 2597

def setDataOptions(options)
    @fields['data_options'] = options
    self
end

#setDataString(data_string) ⇒ Object



2541
2542
2543
2544
# File 'lib/pdfcrowd.rb', line 2541

def setDataString(data_string)
    @fields['data_string'] = data_string
    self
end

#setDataTrimBlocks(value) ⇒ Object



2581
2582
2583
2584
# File 'lib/pdfcrowd.rb', line 2581

def setDataTrimBlocks(value)
    @fields['data_trim_blocks'] = value
    self
end

#setDataVariableMarkers(markers) ⇒ Object



2587
2588
2589
2590
2591
2592
2593
2594
# File 'lib/pdfcrowd.rb', line 2587

def setDataVariableMarkers(markers)
    unless /(?i)^(standard|square|angle)$/.match(markers)
        raise Error.new(Pdfcrowd.create_invalid_value_message(markers, "setDataVariableMarkers", "html-to-image", "Allowed values are standard, square, angle.", "set_data_variable_markers"), 470);
    end
    
    @fields['data_variable_markers'] = markers
    self
end

#setDebugLog(value) ⇒ Object



2603
2604
2605
2606
# File 'lib/pdfcrowd.rb', line 2603

def setDebugLog(value)
    @fields['debug_log'] = value
    self
end

#setDefaultEncoding(encoding) ⇒ Object



2384
2385
2386
2387
# File 'lib/pdfcrowd.rb', line 2384

def setDefaultEncoding(encoding)
    @fields['default_encoding'] = encoding
    self
end

#setDisableImageLoading(value) ⇒ Object



2350
2351
2352
2353
# File 'lib/pdfcrowd.rb', line 2350

def setDisableImageLoading(value)
    @fields['disable_image_loading'] = value
    self
end

#setDisableJavascript(value) ⇒ Object



2344
2345
2346
2347
# File 'lib/pdfcrowd.rb', line 2344

def setDisableJavascript(value)
    @fields['disable_javascript'] = value
    self
end

#setDisableRemoteFonts(value) ⇒ Object



2356
2357
2358
2359
# File 'lib/pdfcrowd.rb', line 2356

def setDisableRemoteFonts(value)
    @fields['disable_remote_fonts'] = value
    self
end

#setElementToConvert(selectors) ⇒ Object



2495
2496
2497
2498
2499
2500
2501
2502
# File 'lib/pdfcrowd.rb', line 2495

def setElementToConvert(selectors)
    if (!(!selectors.nil? && !selectors.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(selectors, "setElementToConvert", "html-to-image", "The string must not be empty.", "set_element_to_convert"), 470);
    end
    
    @fields['element_to_convert'] = selectors
    self
end

#setElementToConvertMode(mode) ⇒ Object



2505
2506
2507
2508
2509
2510
2511
2512
# File 'lib/pdfcrowd.rb', line 2505

def setElementToConvertMode(mode)
    unless /(?i)^(cut-out|remove-siblings|hide-siblings)$/.match(mode)
        raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setElementToConvertMode", "html-to-image", "Allowed values are cut-out, remove-siblings, hide-siblings.", "set_element_to_convert_mode"), 470);
    end
    
    @fields['element_to_convert_mode'] = mode
    self
end

#setFailOnAnyUrlError(fail_on_error) ⇒ Object



2433
2434
2435
2436
# File 'lib/pdfcrowd.rb', line 2433

def setFailOnAnyUrlError(fail_on_error)
    @fields['fail_on_any_url_error'] = fail_on_error
    self
end

#setFailOnMainUrlError(fail_on_error) ⇒ Object



2427
2428
2429
2430
# File 'lib/pdfcrowd.rb', line 2427

def setFailOnMainUrlError(fail_on_error)
    @fields['fail_on_main_url_error'] = fail_on_error
    self
end

#setHttpAuth(user_name, password) ⇒ Object



2408
2409
2410
2411
2412
# File 'lib/pdfcrowd.rb', line 2408

def setHttpAuth(user_name, password)
    setHttpAuthUserName(user_name)
    setHttpAuthPassword(password)
    self
end

#setHttpAuthPassword(password) ⇒ Object



2402
2403
2404
2405
# File 'lib/pdfcrowd.rb', line 2402

def setHttpAuthPassword(password)
    @fields['http_auth_password'] = password
    self
end

#setHttpAuthUserName(user_name) ⇒ Object



2396
2397
2398
2399
# File 'lib/pdfcrowd.rb', line 2396

def setHttpAuthUserName(user_name)
    @fields['http_auth_user_name'] = user_name
    self
end

#setHttpProxy(proxy) ⇒ Object



2645
2646
2647
2648
2649
2650
2651
2652
# File 'lib/pdfcrowd.rb', line 2645

def setHttpProxy(proxy)
    unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy)
        raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, "setHttpProxy", "html-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
    end
    
    @fields['http_proxy'] = proxy
    self
end

#setHttpsProxy(proxy) ⇒ Object



2655
2656
2657
2658
2659
2660
2661
2662
# File 'lib/pdfcrowd.rb', line 2655

def setHttpsProxy(proxy)
    unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy)
        raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, "setHttpsProxy", "html-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
    end
    
    @fields['https_proxy'] = proxy
    self
end

#setJavascriptDelay(delay) ⇒ Object



2485
2486
2487
2488
2489
2490
2491
2492
# File 'lib/pdfcrowd.rb', line 2485

def setJavascriptDelay(delay)
    if (!(Integer(delay) >= 0))
        raise Error.new(Pdfcrowd.create_invalid_value_message(delay, "setJavascriptDelay", "html-to-image", "Must be a positive integer or 0.", "set_javascript_delay"), 470);
    end
    
    @fields['javascript_delay'] = delay
    self
end

#setLoadIframes(iframes) ⇒ Object



2368
2369
2370
2371
2372
2373
2374
2375
# File 'lib/pdfcrowd.rb', line 2368

def setLoadIframes(iframes)
    unless /(?i)^(all|same-origin|none)$/.match(iframes)
        raise Error.new(Pdfcrowd.create_invalid_value_message(iframes, "setLoadIframes", "html-to-image", "Allowed values are all, same-origin, none.", "set_load_iframes"), 470);
    end
    
    @fields['load_iframes'] = iframes
    self
end

#setLocale(locale) ⇒ Object



2390
2391
2392
2393
# File 'lib/pdfcrowd.rb', line 2390

def setLocale(locale)
    @fields['locale'] = locale
    self
end

#setMaxLoadingTime(max_time) ⇒ Object



2681
2682
2683
2684
2685
2686
2687
2688
# File 'lib/pdfcrowd.rb', line 2681

def setMaxLoadingTime(max_time)
    if (!(Integer(max_time) >= 10 && Integer(max_time) <= 30))
        raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-image", "The accepted range is 10-30.", "set_max_loading_time"), 470);
    end
    
    @fields['max_loading_time'] = max_time
    self
end

#setNoBackground(value) ⇒ Object



2338
2339
2340
2341
# File 'lib/pdfcrowd.rb', line 2338

def setNoBackground(value)
    @fields['no_background'] = value
    self
end

#setNoXpdfcrowdHeader(value) ⇒ Object



2439
2440
2441
2442
# File 'lib/pdfcrowd.rb', line 2439

def setNoXpdfcrowdHeader(value)
    @fields['no_xpdfcrowd_header'] = value
    self
end

#setOnLoadJavascript(javascript) ⇒ Object



2465
2466
2467
2468
2469
2470
2471
2472
# File 'lib/pdfcrowd.rb', line 2465

def setOnLoadJavascript(javascript)
    if (!(!javascript.nil? && !javascript.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(javascript, "setOnLoadJavascript", "html-to-image", "The string must not be empty.", "set_on_load_javascript"), 470);
    end
    
    @fields['on_load_javascript'] = javascript
    self
end

#setOutputFormat(output_format) ⇒ Object



2136
2137
2138
2139
2140
2141
2142
2143
# File 'lib/pdfcrowd.rb', line 2136

def setOutputFormat(output_format)
    unless /(?i)^(png|jpg|gif|tiff|bmp|ico|ppm|pgm|pbm|pnm|psb|pct|ras|tga|sgi|sun|webp)$/.match(output_format)
        raise Error.new(Pdfcrowd.create_invalid_value_message(output_format, "setOutputFormat", "html-to-image", "Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.", "set_output_format"), 470);
    end
    
    @fields['output_format'] = output_format
    self
end

#setProxy(host, port, user_name, password) ⇒ Object



2731
2732
2733
2734
# File 'lib/pdfcrowd.rb', line 2731

def setProxy(host, port, user_name, password)
    @helper.setProxy(host, port, user_name, password)
    self
end

#setReadabilityEnhancements(enhancements) ⇒ Object



2531
2532
2533
2534
2535
2536
2537
2538
# File 'lib/pdfcrowd.rb', line 2531

def setReadabilityEnhancements(enhancements)
    unless /(?i)^(none|readability-v1|readability-v2|readability-v3|readability-v4)$/.match(enhancements)
        raise Error.new(Pdfcrowd.create_invalid_value_message(enhancements, "setReadabilityEnhancements", "html-to-image", "Allowed values are none, readability-v1, readability-v2, readability-v3, readability-v4.", "set_readability_enhancements"), 470);
    end
    
    @fields['readability_enhancements'] = enhancements
    self
end

#setRetryCount(count) ⇒ Object



2737
2738
2739
2740
# File 'lib/pdfcrowd.rb', line 2737

def setRetryCount(count)
    @helper.setRetryCount(count)
    self
end

#setScaleFactor(factor) ⇒ Object



2312
2313
2314
2315
2316
2317
2318
2319
# File 'lib/pdfcrowd.rb', line 2312

def setScaleFactor(factor)
    if (!(Integer(factor) > 0))
        raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-image", "Must be a positive integer.", "set_scale_factor"), 470);
    end
    
    @fields['scale_factor'] = factor
    self
end

#setScreenshotHeight(height) ⇒ Object



2302
2303
2304
2305
2306
2307
2308
2309
# File 'lib/pdfcrowd.rb', line 2302

def setScreenshotHeight(height)
    if (!(Integer(height) > 0))
        raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setScreenshotHeight", "html-to-image", "Must be a positive integer.", "set_screenshot_height"), 470);
    end
    
    @fields['screenshot_height'] = height
    self
end

#setScreenshotWidth(width) ⇒ Object



2292
2293
2294
2295
2296
2297
2298
2299
# File 'lib/pdfcrowd.rb', line 2292

def setScreenshotWidth(width)
    if (!(Integer(width) >= 96 && Integer(width) <= 65000))
        raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setScreenshotWidth", "html-to-image", "The accepted range is 96-65000.", "set_screenshot_width"), 470);
    end
    
    @fields['screenshot_width'] = width
    self
end

#setSubprocessReferrer(referrer) ⇒ Object



2691
2692
2693
2694
# File 'lib/pdfcrowd.rb', line 2691

def setSubprocessReferrer(referrer)
    @fields['subprocess_referrer'] = referrer
    self
end

#setTag(tag) ⇒ Object



2639
2640
2641
2642
# File 'lib/pdfcrowd.rb', line 2639

def setTag(tag)
    @fields['tag'] = tag
    self
end

#setUseHttp(value) ⇒ Object



2713
2714
2715
2716
# File 'lib/pdfcrowd.rb', line 2713

def setUseHttp(value)
    @helper.setUseHttp(value)
    self
end

#setUseMobileUserAgent(value) ⇒ Object



2362
2363
2364
2365
# File 'lib/pdfcrowd.rb', line 2362

def setUseMobileUserAgent(value)
    @fields['use_mobile_user_agent'] = value
    self
end

#setUsePrintMedia(value) ⇒ Object



2332
2333
2334
2335
# File 'lib/pdfcrowd.rb', line 2332

def setUsePrintMedia(value)
    @fields['use_print_media'] = value
    self
end

#setUserAgent(agent) ⇒ Object



2725
2726
2727
2728
# File 'lib/pdfcrowd.rb', line 2725

def setUserAgent(agent)
    @helper.setUserAgent(agent)
    self
end

#setVerifySslCertificates(value) ⇒ Object



2421
2422
2423
2424
# File 'lib/pdfcrowd.rb', line 2421

def setVerifySslCertificates(value)
    @fields['verify_ssl_certificates'] = value
    self
end

#setWaitForElement(selectors) ⇒ Object



2515
2516
2517
2518
2519
2520
2521
2522
# File 'lib/pdfcrowd.rb', line 2515

def setWaitForElement(selectors)
    if (!(!selectors.nil? && !selectors.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(selectors, "setWaitForElement", "html-to-image", "The string must not be empty.", "set_wait_for_element"), 470);
    end
    
    @fields['wait_for_element'] = selectors
    self
end

#setZipMainFilename(filename) ⇒ Object



2286
2287
2288
2289
# File 'lib/pdfcrowd.rb', line 2286

def setZipMainFilename(filename)
    @fields['zip_main_filename'] = filename
    self
end