Class: Pdfcrowd::HtmlToPdfClient

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

Overview

Conversion from HTML to PDF.

Instance Method Summary collapse

Constructor Details

#initialize(user_name, api_key) ⇒ HtmlToPdfClient

Returns a new instance of HtmlToPdfClient.



778
779
780
781
782
783
784
785
786
787
# File 'lib/pdfcrowd.rb', line 778

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

Instance Method Details

#convertFile(file) ⇒ Object



827
828
829
830
831
832
833
834
# File 'lib/pdfcrowd.rb', line 827

def convertFile(file)
    if (!(File.file?(file) && !File.zero?(file)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFile", "html-to-pdf", "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



847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/pdfcrowd.rb', line 847

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-pdf", "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



837
838
839
840
841
842
843
844
# File 'lib/pdfcrowd.rb', line 837

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-pdf", "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



901
902
903
904
# File 'lib/pdfcrowd.rb', line 901

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

#convertStreamToFile(in_stream, file_path) ⇒ Object



913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
# File 'lib/pdfcrowd.rb', line 913

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-pdf", "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



907
908
909
910
# File 'lib/pdfcrowd.rb', line 907

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

#convertString(text) ⇒ Object



864
865
866
867
868
869
870
871
# File 'lib/pdfcrowd.rb', line 864

def convertString(text)
    if (!(!text.nil? && !text.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(text, "convertString", "html-to-pdf", "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



884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
# File 'lib/pdfcrowd.rb', line 884

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-pdf", "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



874
875
876
877
878
879
880
881
# File 'lib/pdfcrowd.rb', line 874

def convertStringToStream(text, out_stream)
    if (!(!text.nil? && !text.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(text, "convertStringToStream::text", "html-to-pdf", "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



790
791
792
793
794
795
796
797
# File 'lib/pdfcrowd.rb', line 790

def convertUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "html-to-pdf", "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



810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/pdfcrowd.rb', line 810

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-pdf", "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



800
801
802
803
804
805
806
807
# File 'lib/pdfcrowd.rb', line 800

def convertUrlToStream(url, out_stream)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "html-to-pdf", "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



1836
1837
1838
# File 'lib/pdfcrowd.rb', line 1836

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

#getDebugLogUrlObject



1826
1827
1828
# File 'lib/pdfcrowd.rb', line 1826

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

#getJobIdObject



1841
1842
1843
# File 'lib/pdfcrowd.rb', line 1841

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

#getOutputSizeObject



1856
1857
1858
# File 'lib/pdfcrowd.rb', line 1856

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

#getPageCountObject



1846
1847
1848
# File 'lib/pdfcrowd.rb', line 1846

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

#getRemainingCreditCountObject



1831
1832
1833
# File 'lib/pdfcrowd.rb', line 1831

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

#getTotalPageCountObject



1851
1852
1853
# File 'lib/pdfcrowd.rb', line 1851

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

#getVersionObject



1861
1862
1863
# File 'lib/pdfcrowd.rb', line 1861

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

#setAuthor(author) ⇒ Object



1658
1659
1660
1661
# File 'lib/pdfcrowd.rb', line 1658

def setAuthor(author)
    @fields['author'] = author
    self
end

#setAutoDetectElementToConvert(value) ⇒ Object



1495
1496
1497
1498
# File 'lib/pdfcrowd.rb', line 1495

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

#setBlockAds(value) ⇒ Object



1338
1339
1340
1341
# File 'lib/pdfcrowd.rb', line 1338

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

#setCenterWindow(value) ⇒ Object



1750
1751
1752
1753
# File 'lib/pdfcrowd.rb', line 1750

def setCenterWindow(value)
    @fields['center_window'] = value
    self
end

#setClientCertificate(certificate) ⇒ Object



1892
1893
1894
1895
1896
1897
1898
1899
# File 'lib/pdfcrowd.rb', line 1892

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

#setClientCertificatePassword(password) ⇒ Object



1902
1903
1904
1905
# File 'lib/pdfcrowd.rb', line 1902

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

#setClientUserAgent(agent) ⇒ Object



2057
2058
2059
2060
# File 'lib/pdfcrowd.rb', line 2057

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

#setContentArea(x, y, width, height) ⇒ Object



1958
1959
1960
1961
1962
1963
1964
# File 'lib/pdfcrowd.rb', line 1958

def setContentArea(x, y, width, height)
    setContentAreaX(x)
    setContentAreaY(y)
    setContentAreaWidth(width)
    setContentAreaHeight(height)
    self
end

#setContentAreaHeight(height) ⇒ Object



1948
1949
1950
1951
1952
1953
1954
1955
# File 'lib/pdfcrowd.rb', line 1948

def setContentAreaHeight(height)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
        raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentAreaHeight", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_content_area_height"), 470);
    end
    
    @fields['content_area_height'] = height
    self
end

#setContentAreaWidth(width) ⇒ Object



1938
1939
1940
1941
1942
1943
1944
1945
# File 'lib/pdfcrowd.rb', line 1938

def setContentAreaWidth(width)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
        raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentAreaWidth", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_content_area_width"), 470);
    end
    
    @fields['content_area_width'] = width
    self
end

#setContentAreaX(x) ⇒ Object



1918
1919
1920
1921
1922
1923
1924
1925
# File 'lib/pdfcrowd.rb', line 1918

def setContentAreaX(x)
    unless /(?i)^0$|^\-?[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
        raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setContentAreaX", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.", "set_content_area_x"), 470);
    end
    
    @fields['content_area_x'] = x
    self
end

#setContentAreaY(y) ⇒ Object



1928
1929
1930
1931
1932
1933
1934
1935
# File 'lib/pdfcrowd.rb', line 1928

def setContentAreaY(y)
    unless /(?i)^0$|^\-?[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
        raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setContentAreaY", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.", "set_content_area_y"), 470);
    end
    
    @fields['content_area_y'] = y
    self
end

#setContentFitMode(mode) ⇒ Object



1068
1069
1070
1071
1072
1073
1074
1075
# File 'lib/pdfcrowd.rb', line 1068

def setContentFitMode(mode)
    unless /(?i)^(auto|smart-scaling|no-scaling|viewport-width|content-width|single-page|single-page-ratio)$/.match(mode)
        raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setContentFitMode", "html-to-pdf", "Allowed values are auto, smart-scaling, no-scaling, viewport-width, content-width, single-page, single-page-ratio.", "set_content_fit_mode"), 470);
    end
    
    @fields['content_fit_mode'] = mode
    self
end

#setContentsMatrix(matrix) ⇒ Object



1967
1968
1969
1970
# File 'lib/pdfcrowd.rb', line 1967

def setContentsMatrix(matrix)
    @fields['contents_matrix'] = matrix
    self
end

#setContentViewportHeight(height) ⇒ Object



1058
1059
1060
1061
1062
1063
1064
1065
# File 'lib/pdfcrowd.rb', line 1058

def setContentViewportHeight(height)
    unless /(?i)^(auto|large|[0-9]+(px)?)$/.match(height)
        raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentViewportHeight", "html-to-pdf", "The value must be 'auto', 'large', or a number.", "set_content_viewport_height"), 470);
    end
    
    @fields['content_viewport_height'] = height
    self
end

#setContentViewportWidth(width) ⇒ Object



1048
1049
1050
1051
1052
1053
1054
1055
# File 'lib/pdfcrowd.rb', line 1048

def setContentViewportWidth(width)
    unless /(?i)^(balanced|small|medium|large|extra-large|[0-9]+(px)?)$/.match(width)
        raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentViewportWidth", "html-to-pdf", "The value must be 'balanced', 'small', 'medium', 'large', 'extra-large', or a number in the range 96-65000px.", "set_content_viewport_width"), 470);
    end
    
    @fields['content_viewport_width'] = width
    self
end

#setConversionConfig(json_string) ⇒ Object



2013
2014
2015
2016
# File 'lib/pdfcrowd.rb', line 2013

def setConversionConfig(json_string)
    @fields['conversion_config'] = json_string
    self
end

#setConversionConfigFile(filepath) ⇒ Object



2019
2020
2021
2022
2023
2024
2025
2026
# File 'lib/pdfcrowd.rb', line 2019

def setConversionConfigFile(filepath)
    if (!(File.file?(filepath) && !File.zero?(filepath)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(filepath, "setConversionConfigFile", "html-to-pdf", "The file must exist and not be empty.", "set_conversion_config_file"), 470);
    end
    
    @files['conversion_config_file'] = filepath
    self
end

#setConverterUserAgent(agent) ⇒ Object



2035
2036
2037
2038
# File 'lib/pdfcrowd.rb', line 2035

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

#setConverterVersion(version) ⇒ Object



2041
2042
2043
2044
2045
2046
2047
2048
# File 'lib/pdfcrowd.rb', line 2041

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-pdf", "Allowed values are 24.04, 20.10, 18.10, latest.", "set_converter_version"), 470);
    end
    
    @helper.setConverterVersion(version)
    self
end

#setConvertImagesToJpeg(images) ⇒ Object



1578
1579
1580
1581
1582
1583
1584
1585
# File 'lib/pdfcrowd.rb', line 1578

def setConvertImagesToJpeg(images)
    unless /(?i)^(none|opaque|all)$/.match(images)
        raise Error.new(Pdfcrowd.create_invalid_value_message(images, "setConvertImagesToJpeg", "html-to-pdf", "Allowed values are none, opaque, all.", "set_convert_images_to_jpeg"), 470);
    end
    
    @fields['convert_images_to_jpeg'] = images
    self
end

#setCookies(cookies) ⇒ Object



1375
1376
1377
1378
# File 'lib/pdfcrowd.rb', line 1375

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

#setCssPageRuleMode(mode) ⇒ Object



1405
1406
1407
1408
1409
1410
1411
1412
# File 'lib/pdfcrowd.rb', line 1405

def setCssPageRuleMode(mode)
    unless /(?i)^(default|mode1|mode2)$/.match(mode)
        raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setCssPageRuleMode", "html-to-pdf", "Allowed values are default, mode1, mode2.", "set_css_page_rule_mode"), 470);
    end
    
    @fields['css_page_rule_mode'] = mode
    self
end

#setCustomCss(css) ⇒ Object



1415
1416
1417
1418
1419
1420
1421
1422
# File 'lib/pdfcrowd.rb', line 1415

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

#setCustomHttpHeader(header) ⇒ Object



1445
1446
1447
1448
1449
1450
1451
1452
# File 'lib/pdfcrowd.rb', line 1445

def setCustomHttpHeader(header)
    unless /^.+:.+$/.match(header)
        raise Error.new(Pdfcrowd.create_invalid_value_message(header, "setCustomHttpHeader", "html-to-pdf", "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



1425
1426
1427
1428
1429
1430
1431
1432
# File 'lib/pdfcrowd.rb', line 1425

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

#setDataAutoEscape(value) ⇒ Object



1802
1803
1804
1805
# File 'lib/pdfcrowd.rb', line 1802

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

#setDataEncoding(encoding) ⇒ Object



1790
1791
1792
1793
# File 'lib/pdfcrowd.rb', line 1790

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

#setDataFile(data_file) ⇒ Object



1774
1775
1776
1777
# File 'lib/pdfcrowd.rb', line 1774

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

#setDataFormat(data_format) ⇒ Object



1780
1781
1782
1783
1784
1785
1786
1787
# File 'lib/pdfcrowd.rb', line 1780

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-pdf", "Allowed values are auto, json, xml, yaml, csv.", "set_data_format"), 470);
    end
    
    @fields['data_format'] = data_format
    self
end

#setDataIgnoreUndefined(value) ⇒ Object



1796
1797
1798
1799
# File 'lib/pdfcrowd.rb', line 1796

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

#setDataOptions(options) ⇒ Object



1814
1815
1816
1817
# File 'lib/pdfcrowd.rb', line 1814

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

#setDataString(data_string) ⇒ Object



1768
1769
1770
1771
# File 'lib/pdfcrowd.rb', line 1768

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

#setDataTrimBlocks(value) ⇒ Object



1808
1809
1810
1811
# File 'lib/pdfcrowd.rb', line 1808

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

#setDebugLog(value) ⇒ Object



1820
1821
1822
1823
# File 'lib/pdfcrowd.rb', line 1820

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

#setDefaultEncoding(encoding) ⇒ Object



1344
1345
1346
1347
# File 'lib/pdfcrowd.rb', line 1344

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

#setDisableImageLoading(value) ⇒ Object



1310
1311
1312
1313
# File 'lib/pdfcrowd.rb', line 1310

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

#setDisableJavascript(value) ⇒ Object



1304
1305
1306
1307
# File 'lib/pdfcrowd.rb', line 1304

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

#setDisablePageHeightOptimization(value) ⇒ Object



1985
1986
1987
1988
# File 'lib/pdfcrowd.rb', line 1985

def setDisablePageHeightOptimization(value)
    @fields['disable_page_height_optimization'] = value
    self
end

#setDisableRemoteFonts(value) ⇒ Object



1316
1317
1318
1319
# File 'lib/pdfcrowd.rb', line 1316

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

#setDisplayTitle(value) ⇒ Object



1756
1757
1758
1759
# File 'lib/pdfcrowd.rb', line 1756

def setDisplayTitle(value)
    @fields['display_title'] = value
    self
end

#setElementToConvert(selectors) ⇒ Object



1465
1466
1467
1468
1469
1470
1471
1472
# File 'lib/pdfcrowd.rb', line 1465

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

#setElementToConvertMode(mode) ⇒ Object



1475
1476
1477
1478
1479
1480
1481
1482
# File 'lib/pdfcrowd.rb', line 1475

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-pdf", "Allowed values are cut-out, remove-siblings, hide-siblings.", "set_element_to_convert_mode"), 470);
    end
    
    @fields['element_to_convert_mode'] = mode
    self
end

#setEnablePdfForms(value) ⇒ Object



1598
1599
1600
1601
# File 'lib/pdfcrowd.rb', line 1598

def setEnablePdfForms(value)
    @fields['enable_pdf_forms'] = value
    self
end

#setEncrypt(value) ⇒ Object



1610
1611
1612
1613
# File 'lib/pdfcrowd.rb', line 1610

def setEncrypt(value)
    @fields['encrypt'] = value
    self
end

#setExcludeFooterOnPages(pages) ⇒ Object



1176
1177
1178
1179
1180
1181
1182
1183
# File 'lib/pdfcrowd.rb', line 1176

def setExcludeFooterOnPages(pages)
    unless /^(?:\s*\-?\d+\s*,)*\s*\-?\d+\s*$/.match(pages)
        raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setExcludeFooterOnPages", "html-to-pdf", "A comma separated list of page numbers.", "set_exclude_footer_on_pages"), 470);
    end
    
    @fields['exclude_footer_on_pages'] = pages
    self
end

#setExcludeHeaderOnPages(pages) ⇒ Object



1166
1167
1168
1169
1170
1171
1172
1173
# File 'lib/pdfcrowd.rb', line 1166

def setExcludeHeaderOnPages(pages)
    unless /^(?:\s*\-?\d+\s*,)*\s*\-?\d+\s*$/.match(pages)
        raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setExcludeHeaderOnPages", "html-to-pdf", "A comma separated list of page numbers.", "set_exclude_header_on_pages"), 470);
    end
    
    @fields['exclude_header_on_pages'] = pages
    self
end

#setExtractMetaTags(value) ⇒ Object



1670
1671
1672
1673
# File 'lib/pdfcrowd.rb', line 1670

def setExtractMetaTags(value)
    @fields['extract_meta_tags'] = value
    self
end

#setFailOnAnyUrlError(fail_on_error) ⇒ Object



1393
1394
1395
1396
# File 'lib/pdfcrowd.rb', line 1393

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

#setFailOnMainUrlError(fail_on_error) ⇒ Object



1387
1388
1389
1390
# File 'lib/pdfcrowd.rb', line 1387

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

#setFitWindow(value) ⇒ Object



1744
1745
1746
1747
# File 'lib/pdfcrowd.rb', line 1744

def setFitWindow(value)
    @fields['fit_window'] = value
    self
end

#setFooterHeight(height) ⇒ Object



1144
1145
1146
1147
1148
1149
1150
1151
# File 'lib/pdfcrowd.rb', line 1144

def setFooterHeight(height)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
        raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setFooterHeight", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_footer_height"), 470);
    end
    
    @fields['footer_height'] = height
    self
end

#setFooterHtml(html) ⇒ Object



1134
1135
1136
1137
1138
1139
1140
1141
# File 'lib/pdfcrowd.rb', line 1134

def setFooterHtml(html)
    if (!(!html.nil? && !html.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(html, "setFooterHtml", "html-to-pdf", "The string must not be empty.", "set_footer_html"), 470);
    end
    
    @fields['footer_html'] = html
    self
end

#setFooterMatrix(matrix) ⇒ Object



1979
1980
1981
1982
# File 'lib/pdfcrowd.rb', line 1979

def setFooterMatrix(matrix)
    @fields['footer_matrix'] = matrix
    self
end

#setFooterUrl(url) ⇒ Object



1124
1125
1126
1127
1128
1129
1130
1131
# File 'lib/pdfcrowd.rb', line 1124

def setFooterUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setFooterUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_footer_url"), 470);
    end
    
    @fields['footer_url'] = url
    self
end

#setHeaderFooterCssAnnotation(value) ⇒ Object



1997
1998
1999
2000
# File 'lib/pdfcrowd.rb', line 1997

def setHeaderFooterCssAnnotation(value)
    @fields['header_footer_css_annotation'] = value
    self
end

#setHeaderFooterScaleFactor(factor) ⇒ Object



1186
1187
1188
1189
1190
1191
1192
1193
# File 'lib/pdfcrowd.rb', line 1186

def setHeaderFooterScaleFactor(factor)
    if (!(Integer(factor) >= 10 && Integer(factor) <= 500))
        raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setHeaderFooterScaleFactor", "html-to-pdf", "The accepted range is 10-500.", "set_header_footer_scale_factor"), 470);
    end
    
    @fields['header_footer_scale_factor'] = factor
    self
end

#setHeaderHeight(height) ⇒ Object



1108
1109
1110
1111
1112
1113
1114
1115
# File 'lib/pdfcrowd.rb', line 1108

def setHeaderHeight(height)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
        raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setHeaderHeight", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_header_height"), 470);
    end
    
    @fields['header_height'] = height
    self
end

#setHeaderHtml(html) ⇒ Object



1098
1099
1100
1101
1102
1103
1104
1105
# File 'lib/pdfcrowd.rb', line 1098

def setHeaderHtml(html)
    if (!(!html.nil? && !html.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(html, "setHeaderHtml", "html-to-pdf", "The string must not be empty.", "set_header_html"), 470);
    end
    
    @fields['header_html'] = html
    self
end

#setHeaderMatrix(matrix) ⇒ Object



1973
1974
1975
1976
# File 'lib/pdfcrowd.rb', line 1973

def setHeaderMatrix(matrix)
    @fields['header_matrix'] = matrix
    self
end

#setHeaderUrl(url) ⇒ Object



1088
1089
1090
1091
1092
1093
1094
1095
# File 'lib/pdfcrowd.rb', line 1088

def setHeaderUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setHeaderUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_header_url"), 470);
    end
    
    @fields['header_url'] = url
    self
end

#setHideMenubar(value) ⇒ Object



1732
1733
1734
1735
# File 'lib/pdfcrowd.rb', line 1732

def setHideMenubar(value)
    @fields['hide_menubar'] = value
    self
end

#setHideToolbar(value) ⇒ Object



1726
1727
1728
1729
# File 'lib/pdfcrowd.rb', line 1726

def setHideToolbar(value)
    @fields['hide_toolbar'] = value
    self
end

#setHideWindowUi(value) ⇒ Object



1738
1739
1740
1741
# File 'lib/pdfcrowd.rb', line 1738

def setHideWindowUi(value)
    @fields['hide_window_ui'] = value
    self
end

#setHttpAuth(user_name, password) ⇒ Object



1368
1369
1370
1371
1372
# File 'lib/pdfcrowd.rb', line 1368

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

#setHttpAuthPassword(password) ⇒ Object



1362
1363
1364
1365
# File 'lib/pdfcrowd.rb', line 1362

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

#setHttpAuthUserName(user_name) ⇒ Object



1356
1357
1358
1359
# File 'lib/pdfcrowd.rb', line 1356

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

#setHttpProxy(proxy) ⇒ Object



1872
1873
1874
1875
1876
1877
1878
1879
# File 'lib/pdfcrowd.rb', line 1872

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-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
    end
    
    @fields['http_proxy'] = proxy
    self
end

#setHttpsProxy(proxy) ⇒ Object



1882
1883
1884
1885
1886
1887
1888
1889
# File 'lib/pdfcrowd.rb', line 1882

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-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
    end
    
    @fields['https_proxy'] = proxy
    self
end

#setImageDpi(dpi) ⇒ Object



1588
1589
1590
1591
1592
1593
1594
1595
# File 'lib/pdfcrowd.rb', line 1588

def setImageDpi(dpi)
    if (!(Integer(dpi) >= 0))
        raise Error.new(Pdfcrowd.create_invalid_value_message(dpi, "setImageDpi", "html-to-pdf", "Must be a positive integer or 0.", "set_image_dpi"), 470);
    end
    
    @fields['image_dpi'] = dpi
    self
end

#setInitialPage(page) ⇒ Object



1706
1707
1708
1709
1710
1711
1712
1713
# File 'lib/pdfcrowd.rb', line 1706

def setInitialPage(page)
    if (!(Integer(page) > 0))
        raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "html-to-pdf", "Must be a positive integer.", "set_initial_page"), 470);
    end
    
    @fields['initial_page'] = page
    self
end

#setInitialZoom(zoom) ⇒ Object



1716
1717
1718
1719
1720
1721
1722
1723
# File 'lib/pdfcrowd.rb', line 1716

def setInitialZoom(zoom)
    if (!(Integer(zoom) > 0))
        raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "html-to-pdf", "Must be a positive integer.", "set_initial_zoom"), 470);
    end
    
    @fields['initial_zoom'] = zoom
    self
end

#setInitialZoomType(zoom_type) ⇒ Object



1696
1697
1698
1699
1700
1701
1702
1703
# File 'lib/pdfcrowd.rb', line 1696

def setInitialZoomType(zoom_type)
    unless /(?i)^(fit-width|fit-height|fit-page)$/.match(zoom_type)
        raise Error.new(Pdfcrowd.create_invalid_value_message(zoom_type, "setInitialZoomType", "html-to-pdf", "Allowed values are fit-width, fit-height, fit-page.", "set_initial_zoom_type"), 470);
    end
    
    @fields['initial_zoom_type'] = zoom_type
    self
end

#setJavascriptDelay(delay) ⇒ Object



1455
1456
1457
1458
1459
1460
1461
1462
# File 'lib/pdfcrowd.rb', line 1455

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

#setJpegQuality(quality) ⇒ Object



1568
1569
1570
1571
1572
1573
1574
1575
# File 'lib/pdfcrowd.rb', line 1568

def setJpegQuality(quality)
    if (!(Integer(quality) >= 1 && Integer(quality) <= 100))
        raise Error.new(Pdfcrowd.create_invalid_value_message(quality, "setJpegQuality", "html-to-pdf", "The accepted range is 1-100.", "set_jpeg_quality"), 470);
    end
    
    @fields['jpeg_quality'] = quality
    self
end

#setKeywords(keywords) ⇒ Object



1664
1665
1666
1667
# File 'lib/pdfcrowd.rb', line 1664

def setKeywords(keywords)
    @fields['keywords'] = keywords
    self
end

#setLayoutDpi(dpi) ⇒ Object



1908
1909
1910
1911
1912
1913
1914
1915
# File 'lib/pdfcrowd.rb', line 1908

def setLayoutDpi(dpi)
    if (!(Integer(dpi) >= 72 && Integer(dpi) <= 600))
        raise Error.new(Pdfcrowd.create_invalid_value_message(dpi, "setLayoutDpi", "html-to-pdf", "The accepted range is 72-600.", "set_layout_dpi"), 470);
    end
    
    @fields['layout_dpi'] = dpi
    self
end

#setLinearize(value) ⇒ Object



1604
1605
1606
1607
# File 'lib/pdfcrowd.rb', line 1604

def setLinearize(value)
    @fields['linearize'] = value
    self
end

#setLoadIframes(iframes) ⇒ Object



1328
1329
1330
1331
1332
1333
1334
1335
# File 'lib/pdfcrowd.rb', line 1328

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

#setLocale(locale) ⇒ Object



1350
1351
1352
1353
# File 'lib/pdfcrowd.rb', line 1350

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

#setMainDocumentCssAnnotation(value) ⇒ Object



1991
1992
1993
1994
# File 'lib/pdfcrowd.rb', line 1991

def setMainDocumentCssAnnotation(value)
    @fields['main_document_css_annotation'] = value
    self
end

#setMarginBottom(bottom) ⇒ Object



1003
1004
1005
1006
1007
1008
1009
1010
# File 'lib/pdfcrowd.rb', line 1003

def setMarginBottom(bottom)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
        raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_margin_bottom"), 470);
    end
    
    @fields['margin_bottom'] = bottom
    self
end

#setMarginLeft(left) ⇒ Object



1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/pdfcrowd.rb', line 1013

def setMarginLeft(left)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
        raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_margin_left"), 470);
    end
    
    @fields['margin_left'] = left
    self
end

#setMarginRight(right) ⇒ Object



993
994
995
996
997
998
999
1000
# File 'lib/pdfcrowd.rb', line 993

def setMarginRight(right)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
        raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_margin_right"), 470);
    end
    
    @fields['margin_right'] = right
    self
end

#setMarginTop(top) ⇒ Object



983
984
985
986
987
988
989
990
# File 'lib/pdfcrowd.rb', line 983

def setMarginTop(top)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
        raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_margin_top"), 470);
    end
    
    @fields['margin_top'] = top
    self
end

#setMaxLoadingTime(max_time) ⇒ Object



2003
2004
2005
2006
2007
2008
2009
2010
# File 'lib/pdfcrowd.rb', line 2003

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-pdf", "The accepted range is 10-30.", "set_max_loading_time"), 470);
    end
    
    @fields['max_loading_time'] = max_time
    self
end

#setMultipageBackground(background) ⇒ Object



1262
1263
1264
1265
1266
1267
1268
1269
# File 'lib/pdfcrowd.rb', line 1262

def setMultipageBackground(background)
    if (!(File.file?(background) && !File.zero?(background)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(background, "setMultipageBackground", "html-to-pdf", "The file must exist and not be empty.", "set_multipage_background"), 470);
    end
    
    @files['multipage_background'] = background
    self
end

#setMultipageBackgroundUrl(url) ⇒ Object



1272
1273
1274
1275
1276
1277
1278
1279
# File 'lib/pdfcrowd.rb', line 1272

def setMultipageBackgroundUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_background_url"), 470);
    end
    
    @fields['multipage_background_url'] = url
    self
end

#setMultipageWatermark(watermark) ⇒ Object



1222
1223
1224
1225
1226
1227
1228
1229
# File 'lib/pdfcrowd.rb', line 1222

def setMultipageWatermark(watermark)
    if (!(File.file?(watermark) && !File.zero?(watermark)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(watermark, "setMultipageWatermark", "html-to-pdf", "The file must exist and not be empty.", "set_multipage_watermark"), 470);
    end
    
    @files['multipage_watermark'] = watermark
    self
end

#setMultipageWatermarkUrl(url) ⇒ Object



1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/pdfcrowd.rb', line 1232

def setMultipageWatermarkUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_watermark_url"), 470);
    end
    
    @fields['multipage_watermark_url'] = url
    self
end

#setNoBackground(value) ⇒ Object



1298
1299
1300
1301
# File 'lib/pdfcrowd.rb', line 1298

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

#setNoCopy(value) ⇒ Object



1640
1641
1642
1643
# File 'lib/pdfcrowd.rb', line 1640

def setNoCopy(value)
    @fields['no_copy'] = value
    self
end

#setNoHeaderFooterHorizontalMargins(value) ⇒ Object



1160
1161
1162
1163
# File 'lib/pdfcrowd.rb', line 1160

def setNoHeaderFooterHorizontalMargins(value)
    @fields['no_header_footer_horizontal_margins'] = value
    self
end

#setNoMargins(value) ⇒ Object



1023
1024
1025
1026
# File 'lib/pdfcrowd.rb', line 1023

def setNoMargins(value)
    @fields['no_margins'] = value
    self
end

#setNoModify(value) ⇒ Object



1634
1635
1636
1637
# File 'lib/pdfcrowd.rb', line 1634

def setNoModify(value)
    @fields['no_modify'] = value
    self
end

#setNoPrint(value) ⇒ Object



1628
1629
1630
1631
# File 'lib/pdfcrowd.rb', line 1628

def setNoPrint(value)
    @fields['no_print'] = value
    self
end

#setNoXpdfcrowdHeader(value) ⇒ Object



1399
1400
1401
1402
# File 'lib/pdfcrowd.rb', line 1399

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

#setOnLoadJavascript(javascript) ⇒ Object



1435
1436
1437
1438
1439
1440
1441
1442
# File 'lib/pdfcrowd.rb', line 1435

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

#setOrientation(orientation) ⇒ Object



973
974
975
976
977
978
979
980
# File 'lib/pdfcrowd.rb', line 973

def setOrientation(orientation)
    unless /(?i)^(landscape|portrait)$/.match(orientation)
        raise Error.new(Pdfcrowd.create_invalid_value_message(orientation, "setOrientation", "html-to-pdf", "Allowed values are landscape, portrait.", "set_orientation"), 470);
    end
    
    @fields['orientation'] = orientation
    self
end

#setOwnerPassword(password) ⇒ Object



1622
1623
1624
1625
# File 'lib/pdfcrowd.rb', line 1622

def setOwnerPassword(password)
    @fields['owner_password'] = password
    self
end

#setPageBackground(background) ⇒ Object



1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/pdfcrowd.rb', line 1242

def setPageBackground(background)
    if (!(File.file?(background) && !File.zero?(background)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(background, "setPageBackground", "html-to-pdf", "The file must exist and not be empty.", "set_page_background"), 470);
    end
    
    @files['page_background'] = background
    self
end

#setPageBackgroundColor(color) ⇒ Object



1282
1283
1284
1285
1286
1287
1288
1289
# File 'lib/pdfcrowd.rb', line 1282

def setPageBackgroundColor(color)
    unless /^[0-9a-fA-F]{6,8}$/.match(color)
        raise Error.new(Pdfcrowd.create_invalid_value_message(color, "setPageBackgroundColor", "html-to-pdf", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_page_background_color"), 470);
    end
    
    @fields['page_background_color'] = color
    self
end

#setPageBackgroundUrl(url) ⇒ Object



1252
1253
1254
1255
1256
1257
1258
1259
# File 'lib/pdfcrowd.rb', line 1252

def setPageBackgroundUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_page_background_url"), 470);
    end
    
    @fields['page_background_url'] = url
    self
end

#setPageDimensions(width, height) ⇒ Object



966
967
968
969
970
# File 'lib/pdfcrowd.rb', line 966

def setPageDimensions(width, height)
    setPageWidth(width)
    setPageHeight(height)
    self
end

#setPageHeight(height) ⇒ Object



956
957
958
959
960
961
962
963
# File 'lib/pdfcrowd.rb', line 956

def setPageHeight(height)
    unless /(?i)^0$|^\-1$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
        raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setPageHeight", "html-to-pdf", "The value must be -1 or specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_page_height"), 470);
    end
    
    @fields['page_height'] = height
    self
end

#setPageLayout(layout) ⇒ Object



1676
1677
1678
1679
1680
1681
1682
1683
# File 'lib/pdfcrowd.rb', line 1676

def setPageLayout(layout)
    unless /(?i)^(single-page|one-column|two-column-left|two-column-right)$/.match(layout)
        raise Error.new(Pdfcrowd.create_invalid_value_message(layout, "setPageLayout", "html-to-pdf", "Allowed values are single-page, one-column, two-column-left, two-column-right.", "set_page_layout"), 470);
    end
    
    @fields['page_layout'] = layout
    self
end

#setPageMargins(top, right, bottom, left) ⇒ Object



1029
1030
1031
1032
1033
1034
1035
# File 'lib/pdfcrowd.rb', line 1029

def setPageMargins(top, right, bottom, left)
    setMarginTop(top)
    setMarginRight(right)
    setMarginBottom(bottom)
    setMarginLeft(left)
    self
end

#setPageMode(mode) ⇒ Object



1686
1687
1688
1689
1690
1691
1692
1693
# File 'lib/pdfcrowd.rb', line 1686

def setPageMode(mode)
    unless /(?i)^(full-screen|thumbnails|outlines)$/.match(mode)
        raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setPageMode", "html-to-pdf", "Allowed values are full-screen, thumbnails, outlines.", "set_page_mode"), 470);
    end
    
    @fields['page_mode'] = mode
    self
end

#setPageNumberingOffset(offset) ⇒ Object



1196
1197
1198
1199
# File 'lib/pdfcrowd.rb', line 1196

def setPageNumberingOffset(offset)
    @fields['page_numbering_offset'] = offset
    self
end

#setPageSize(size) ⇒ Object



936
937
938
939
940
941
942
943
# File 'lib/pdfcrowd.rb', line 936

def setPageSize(size)
    unless /(?i)^(A0|A1|A2|A3|A4|A5|A6|Letter)$/.match(size)
        raise Error.new(Pdfcrowd.create_invalid_value_message(size, "setPageSize", "html-to-pdf", "Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.", "set_page_size"), 470);
    end
    
    @fields['page_size'] = size
    self
end

#setPageWatermark(watermark) ⇒ Object



1202
1203
1204
1205
1206
1207
1208
1209
# File 'lib/pdfcrowd.rb', line 1202

def setPageWatermark(watermark)
    if (!(File.file?(watermark) && !File.zero?(watermark)))
        raise Error.new(Pdfcrowd.create_invalid_value_message(watermark, "setPageWatermark", "html-to-pdf", "The file must exist and not be empty.", "set_page_watermark"), 470);
    end
    
    @files['page_watermark'] = watermark
    self
end

#setPageWatermarkUrl(url) ⇒ Object



1212
1213
1214
1215
1216
1217
1218
1219
# File 'lib/pdfcrowd.rb', line 1212

def setPageWatermarkUrl(url)
    unless /(?i)^https?:\/\/.*$/.match(url)
        raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_page_watermark_url"), 470);
    end
    
    @fields['page_watermark_url'] = url
    self
end

#setPageWidth(width) ⇒ Object



946
947
948
949
950
951
952
953
# File 'lib/pdfcrowd.rb', line 946

def setPageWidth(width)
    unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
        raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setPageWidth", "html-to-pdf", "The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.", "set_page_width"), 470);
    end
    
    @fields['page_width'] = width
    self
end

#setPrintPageRange(pages) ⇒ Object



1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/pdfcrowd.rb', line 1038

def setPrintPageRange(pages)
    unless /^(?:\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*)|odd|even|last)\s*,\s*)*\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*)|odd|even|last)\s*$/.match(pages)
        raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setPrintPageRange", "html-to-pdf", "A comma separated list of page numbers or ranges. Special strings may be used, such as 'odd', 'even' and 'last'.", "set_print_page_range"), 470);
    end
    
    @fields['print_page_range'] = pages
    self
end

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



2069
2070
2071
2072
# File 'lib/pdfcrowd.rb', line 2069

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

#setReadabilityEnhancements(enhancements) ⇒ Object



1501
1502
1503
1504
1505
1506
1507
1508
# File 'lib/pdfcrowd.rb', line 1501

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-pdf", "Allowed values are none, readability-v1, readability-v2, readability-v3, readability-v4.", "set_readability_enhancements"), 470);
    end
    
    @fields['readability_enhancements'] = enhancements
    self
end

#setRemoveBlankPages(pages) ⇒ Object



1078
1079
1080
1081
1082
1083
1084
1085
# File 'lib/pdfcrowd.rb', line 1078

def setRemoveBlankPages(pages)
    unless /(?i)^(trailing|all|none)$/.match(pages)
        raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setRemoveBlankPages", "html-to-pdf", "Allowed values are trailing, all, none.", "set_remove_blank_pages"), 470);
    end
    
    @fields['remove_blank_pages'] = pages
    self
end

#setRenderingMode(mode) ⇒ Object



1538
1539
1540
1541
1542
1543
1544
1545
# File 'lib/pdfcrowd.rb', line 1538

def setRenderingMode(mode)
    unless /(?i)^(default|viewport)$/.match(mode)
        raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setRenderingMode", "html-to-pdf", "Allowed values are default, viewport.", "set_rendering_mode"), 470);
    end
    
    @fields['rendering_mode'] = mode
    self
end

#setRetryCount(count) ⇒ Object



2075
2076
2077
2078
# File 'lib/pdfcrowd.rb', line 2075

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

#setRightToLeft(value) ⇒ Object



1762
1763
1764
1765
# File 'lib/pdfcrowd.rb', line 1762

def setRightToLeft(value)
    @fields['right_to_left'] = value
    self
end

#setScaleFactor(factor) ⇒ Object



1558
1559
1560
1561
1562
1563
1564
1565
# File 'lib/pdfcrowd.rb', line 1558

def setScaleFactor(factor)
    if (!(Integer(factor) >= 10 && Integer(factor) <= 500))
        raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-pdf", "The accepted range is 10-500.", "set_scale_factor"), 470);
    end
    
    @fields['scale_factor'] = factor
    self
end

#setSmartScalingMode(mode) ⇒ Object



1548
1549
1550
1551
1552
1553
1554
1555
# File 'lib/pdfcrowd.rb', line 1548

def setSmartScalingMode(mode)
    unless /(?i)^(default|disabled|viewport-fit|content-fit|single-page-fit|single-page-fit-ex|mode1)$/.match(mode)
        raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setSmartScalingMode", "html-to-pdf", "Allowed values are default, disabled, viewport-fit, content-fit, single-page-fit, single-page-fit-ex, mode1.", "set_smart_scaling_mode"), 470);
    end
    
    @fields['smart_scaling_mode'] = mode
    self
end

#setSubject(subject) ⇒ Object



1652
1653
1654
1655
# File 'lib/pdfcrowd.rb', line 1652

def setSubject(subject)
    @fields['subject'] = subject
    self
end

#setSubprocessReferrer(referrer) ⇒ Object



2029
2030
2031
2032
# File 'lib/pdfcrowd.rb', line 2029

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

#setTag(tag) ⇒ Object



1866
1867
1868
1869
# File 'lib/pdfcrowd.rb', line 1866

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

#setTitle(title) ⇒ Object



1646
1647
1648
1649
# File 'lib/pdfcrowd.rb', line 1646

def setTitle(title)
    @fields['title'] = title
    self
end

#setUseHttp(value) ⇒ Object



2051
2052
2053
2054
# File 'lib/pdfcrowd.rb', line 2051

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

#setUseMobileUserAgent(value) ⇒ Object



1322
1323
1324
1325
# File 'lib/pdfcrowd.rb', line 1322

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

#setUsePrintMedia(value) ⇒ Object



1292
1293
1294
1295
# File 'lib/pdfcrowd.rb', line 1292

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

#setUserAgent(agent) ⇒ Object



2063
2064
2065
2066
# File 'lib/pdfcrowd.rb', line 2063

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

#setUserPassword(password) ⇒ Object



1616
1617
1618
1619
# File 'lib/pdfcrowd.rb', line 1616

def setUserPassword(password)
    @fields['user_password'] = password
    self
end

#setVerifySslCertificates(value) ⇒ Object



1381
1382
1383
1384
# File 'lib/pdfcrowd.rb', line 1381

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

#setViewport(width, height) ⇒ Object



1531
1532
1533
1534
1535
# File 'lib/pdfcrowd.rb', line 1531

def setViewport(width, height)
    setViewportWidth(width)
    setViewportHeight(height)
    self
end

#setViewportHeight(height) ⇒ Object



1521
1522
1523
1524
1525
1526
1527
1528
# File 'lib/pdfcrowd.rb', line 1521

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

#setViewportWidth(width) ⇒ Object



1511
1512
1513
1514
1515
1516
1517
1518
# File 'lib/pdfcrowd.rb', line 1511

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

#setWaitForElement(selectors) ⇒ Object



1485
1486
1487
1488
1489
1490
1491
1492
# File 'lib/pdfcrowd.rb', line 1485

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

#setZipFooterFilename(filename) ⇒ Object



1154
1155
1156
1157
# File 'lib/pdfcrowd.rb', line 1154

def setZipFooterFilename(filename)
    @fields['zip_footer_filename'] = filename
    self
end

#setZipHeaderFilename(filename) ⇒ Object



1118
1119
1120
1121
# File 'lib/pdfcrowd.rb', line 1118

def setZipHeaderFilename(filename)
    @fields['zip_header_filename'] = filename
    self
end

#setZipMainFilename(filename) ⇒ Object



930
931
932
933
# File 'lib/pdfcrowd.rb', line 930

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