pdfcrowd 4.3.5 → 4.4.1

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 +357 -200
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9920dc8f51188640cf8e28e5d099b25d93d2790d
4
- data.tar.gz: 63c21d70f5be03f2d95e250670ec214b937dc835
3
+ metadata.gz: 5b44f300dd256f8cf5a78649a2b1178c571aa3f6
4
+ data.tar.gz: 5e9e2d111ef3f5082c24b71bea92513ee39be285
5
5
  SHA512:
6
- metadata.gz: 050296ddd39d3e6dfc53ac7b8144ac89d7d785cdcbcc0f676bf9252cd9a2d6eb1f5e4247ec3b1634244d1e8cdf35906db8aff3ac6de8032dcd39425196b87865
7
- data.tar.gz: d62428ea509f6739957f4464afc4c638d1ca0ee9f0257936c60fdc38c855c78dfe8a503b74ec418ad928012960001b64eb1b31a4887fd0c014f778ed29031ee9
6
+ metadata.gz: 5320c2c115da7612e9d630438fd29cfbaf72379242e67105c3cc2d2ac768f6d8ec34b6c59a59b087e820d0373167861ab6e0a46b7a91640cdafde442dcd96bfa
7
+ data.tar.gz: e49b46452a95be155ce566dbfc2366df5bd9da72e63f1974df0c61e4ba353b1af132f6c78618814ccc42839946d827f3e89061bc57eb34c32e186b7d39e67e84
data/lib/pdfcrowd.rb CHANGED
@@ -1,5 +1,5 @@
1
- # Copyright (C) 2009-2016 pdfcrowd.com
2
- #
1
+ # Copyright (C) 2009-2018 pdfcrowd.com
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person
4
4
  # obtaining a copy of this software and associated documentation
5
5
  # files (the "Software"), to deal in the Software without
@@ -8,10 +8,10 @@
8
8
  # copies of the Software, and to permit persons to whom the
9
9
  # Software is furnished to do so, subject to the following
10
10
  # conditions:
11
- #
11
+ #
12
12
  # The above copyright notice and this permission notice shall be
13
13
  # included in all copies or substantial portions of the Software.
14
- #
14
+ #
15
15
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
16
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
17
  # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -530,11 +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 = '4.3.5'
534
-
535
- def self.float_to_string(value)
536
- value.to_s.sub(',', '.')
537
- end
533
+ CLIENT_VERSION = '4.4.1'
538
534
 
539
535
  class ConnectionHelper
540
536
  def initialize(user_name, api_key)
@@ -545,7 +541,7 @@ module Pdfcrowd
545
541
 
546
542
  setProxy(nil, nil, nil, nil)
547
543
  setUseHttp(false)
548
- setUserAgent('pdfcrowd_ruby_client/4.3.5 (http://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/4.4.1 (http://pdfcrowd.com)')
549
545
 
550
546
  @retry_count = 1
551
547
  end
@@ -737,7 +733,7 @@ module Pdfcrowd
737
733
  # Conversion from HTML to PDF.
738
734
  class HtmlToPdfClient
739
735
  # Constructor for the Pdfcrowd API client.
740
- #
736
+ #
741
737
  # * +user_name+ - Your username at Pdfcrowd.
742
738
  # * +api_key+ - Your API key.
743
739
  def initialize(user_name, api_key)
@@ -752,7 +748,7 @@ module Pdfcrowd
752
748
  end
753
749
 
754
750
  # Convert a web page.
755
- #
751
+ #
756
752
  # * +url+ - The address of the web page to convert. The supported protocols are http:// and https://.
757
753
  # * *Returns* - Byte array containing the conversion output.
758
754
  def convertUrl(url)
@@ -765,7 +761,7 @@ module Pdfcrowd
765
761
  end
766
762
 
767
763
  # Convert a web page and write the result to an output stream.
768
- #
764
+ #
769
765
  # * +url+ - The address of the web page to convert. The supported protocols are http:// and https://.
770
766
  # * +out_stream+ - The output stream that will contain the conversion output.
771
767
  def convertUrlToStream(url, out_stream)
@@ -778,7 +774,7 @@ module Pdfcrowd
778
774
  end
779
775
 
780
776
  # Convert a web page and write the result to a local file.
781
- #
777
+ #
782
778
  # * +url+ - The address of the web page to convert. The supported protocols are http:// and https://.
783
779
  # * +file_path+ - The output file path. The string must not be empty.
784
780
  def convertUrlToFile(url, file_path)
@@ -798,7 +794,7 @@ module Pdfcrowd
798
794
  end
799
795
 
800
796
  # Convert a local file.
801
- #
797
+ #
802
798
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets. The file must exist and not be empty. The file name must have a valid extension.
803
799
  # * *Returns* - Byte array containing the conversion output.
804
800
  def convertFile(file)
@@ -815,7 +811,7 @@ module Pdfcrowd
815
811
  end
816
812
 
817
813
  # Convert a local file and write the result to an output stream.
818
- #
814
+ #
819
815
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets. The file must exist and not be empty. The file name must have a valid extension.
820
816
  # * +out_stream+ - The output stream that will contain the conversion output.
821
817
  def convertFileToStream(file, out_stream)
@@ -832,7 +828,7 @@ module Pdfcrowd
832
828
  end
833
829
 
834
830
  # Convert a local file and write the result to a local file.
835
- #
831
+ #
836
832
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets. The file must exist and not be empty. The file name must have a valid extension.
837
833
  # * +file_path+ - The output file path. The string must not be empty.
838
834
  def convertFileToFile(file, file_path)
@@ -852,7 +848,7 @@ module Pdfcrowd
852
848
  end
853
849
 
854
850
  # Convert a string.
855
- #
851
+ #
856
852
  # * +text+ - The string content to convert. The string must not be empty.
857
853
  # * *Returns* - Byte array containing the conversion output.
858
854
  def convertString(text)
@@ -865,7 +861,7 @@ module Pdfcrowd
865
861
  end
866
862
 
867
863
  # Convert a string and write the output to an output stream.
868
- #
864
+ #
869
865
  # * +text+ - The string content to convert. The string must not be empty.
870
866
  # * +out_stream+ - The output stream that will contain the conversion output.
871
867
  def convertStringToStream(text, out_stream)
@@ -878,7 +874,7 @@ module Pdfcrowd
878
874
  end
879
875
 
880
876
  # Convert a string and write the output to a file.
881
- #
877
+ #
882
878
  # * +text+ - The string content to convert. The string must not be empty.
883
879
  # * +file_path+ - The output file path. The string must not be empty.
884
880
  def convertStringToFile(text, file_path)
@@ -898,7 +894,7 @@ module Pdfcrowd
898
894
  end
899
895
 
900
896
  # Set the output page size.
901
- #
897
+ #
902
898
  # * +page_size+ - Allowed values are A2, A3, A4, A5, A6, Letter.
903
899
  # * *Returns* - The converter object.
904
900
  def setPageSize(page_size)
@@ -911,7 +907,7 @@ module Pdfcrowd
911
907
  end
912
908
 
913
909
  # Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF.
914
- #
910
+ #
915
911
  # * +page_width+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
916
912
  # * *Returns* - The converter object.
917
913
  def setPageWidth(page_width)
@@ -924,7 +920,7 @@ module Pdfcrowd
924
920
  end
925
921
 
926
922
  # Set the output page height. Use -1 for a single page PDF. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF.
927
- #
923
+ #
928
924
  # * +page_height+ - Can be -1 or specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
929
925
  # * *Returns* - The converter object.
930
926
  def setPageHeight(page_height)
@@ -937,7 +933,7 @@ module Pdfcrowd
937
933
  end
938
934
 
939
935
  # Set the output page dimensions.
940
- #
936
+ #
941
937
  # * +width+ - Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
942
938
  # * +height+ - Set the output page height. Use -1 for a single page PDF. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF. Can be -1 or specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
943
939
  # * *Returns* - The converter object.
@@ -948,7 +944,7 @@ module Pdfcrowd
948
944
  end
949
945
 
950
946
  # Set the output page orientation.
951
- #
947
+ #
952
948
  # * +orientation+ - Allowed values are landscape, portrait.
953
949
  # * *Returns* - The converter object.
954
950
  def setOrientation(orientation)
@@ -961,7 +957,7 @@ module Pdfcrowd
961
957
  end
962
958
 
963
959
  # Set the output page top margin.
964
- #
960
+ #
965
961
  # * +margin_top+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
966
962
  # * *Returns* - The converter object.
967
963
  def setMarginTop(margin_top)
@@ -974,7 +970,7 @@ module Pdfcrowd
974
970
  end
975
971
 
976
972
  # Set the output page right margin.
977
- #
973
+ #
978
974
  # * +margin_right+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
979
975
  # * *Returns* - The converter object.
980
976
  def setMarginRight(margin_right)
@@ -987,7 +983,7 @@ module Pdfcrowd
987
983
  end
988
984
 
989
985
  # Set the output page bottom margin.
990
- #
986
+ #
991
987
  # * +margin_bottom+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
992
988
  # * *Returns* - The converter object.
993
989
  def setMarginBottom(margin_bottom)
@@ -1000,7 +996,7 @@ module Pdfcrowd
1000
996
  end
1001
997
 
1002
998
  # Set the output page left margin.
1003
- #
999
+ #
1004
1000
  # * +margin_left+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1005
1001
  # * *Returns* - The converter object.
1006
1002
  def setMarginLeft(margin_left)
@@ -1013,7 +1009,7 @@ module Pdfcrowd
1013
1009
  end
1014
1010
 
1015
1011
  # Disable margins.
1016
- #
1012
+ #
1017
1013
  # * +no_margins+ - Set to true to disable margins.
1018
1014
  # * *Returns* - The converter object.
1019
1015
  def setNoMargins(no_margins)
@@ -1022,7 +1018,7 @@ module Pdfcrowd
1022
1018
  end
1023
1019
 
1024
1020
  # Set the output page margins.
1025
- #
1021
+ #
1026
1022
  # * +top+ - Set the output page top margin. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1027
1023
  # * +right+ - Set the output page right margin. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1028
1024
  # * +bottom+ - Set the output page bottom margin. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
@@ -1037,7 +1033,7 @@ module Pdfcrowd
1037
1033
  end
1038
1034
 
1039
1035
  # 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 Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values 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>
1040
- #
1036
+ #
1041
1037
  # * +header_url+ - The supported protocols are http:// and https://.
1042
1038
  # * *Returns* - The converter object.
1043
1039
  def setHeaderUrl(header_url)
@@ -1050,7 +1046,7 @@ module Pdfcrowd
1050
1046
  end
1051
1047
 
1052
1048
  # 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 Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values 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>
1053
- #
1049
+ #
1054
1050
  # * +header_html+ - The string must not be empty.
1055
1051
  # * *Returns* - The converter object.
1056
1052
  def setHeaderHtml(header_html)
@@ -1063,7 +1059,7 @@ module Pdfcrowd
1063
1059
  end
1064
1060
 
1065
1061
  # Set the header height.
1066
- #
1062
+ #
1067
1063
  # * +header_height+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1068
1064
  # * *Returns* - The converter object.
1069
1065
  def setHeaderHeight(header_height)
@@ -1076,7 +1072,7 @@ module Pdfcrowd
1076
1072
  end
1077
1073
 
1078
1074
  # 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 Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values 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>
1079
- #
1075
+ #
1080
1076
  # * +footer_url+ - The supported protocols are http:// and https://.
1081
1077
  # * *Returns* - The converter object.
1082
1078
  def setFooterUrl(footer_url)
@@ -1089,7 +1085,7 @@ module Pdfcrowd
1089
1085
  end
1090
1086
 
1091
1087
  # 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 Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values 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>
1092
- #
1088
+ #
1093
1089
  # * +footer_html+ - The string must not be empty.
1094
1090
  # * *Returns* - The converter object.
1095
1091
  def setFooterHtml(footer_html)
@@ -1102,7 +1098,7 @@ module Pdfcrowd
1102
1098
  end
1103
1099
 
1104
1100
  # Set the footer height.
1105
- #
1101
+ #
1106
1102
  # * +footer_height+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1107
1103
  # * *Returns* - The converter object.
1108
1104
  def setFooterHeight(footer_height)
@@ -1115,7 +1111,7 @@ module Pdfcrowd
1115
1111
  end
1116
1112
 
1117
1113
  # Set the page range to print.
1118
- #
1114
+ #
1119
1115
  # * +pages+ - A comma seperated list of page numbers or ranges.
1120
1116
  # * *Returns* - The converter object.
1121
1117
  def setPrintPageRange(pages)
@@ -1127,8 +1123,21 @@ module Pdfcrowd
1127
1123
  self
1128
1124
  end
1129
1125
 
1126
+ # The page background color in RGB or RGBA hexadecimal format. The color fills the entire page regardless of the margins.
1127
+ #
1128
+ # * +page_background_color+ - The value must be in RRGGBB or RRGGBBAA hexadecimal format.
1129
+ # * *Returns* - The converter object.
1130
+ def setPageBackgroundColor(page_background_color)
1131
+ unless /^[0-9a-fA-F]{6,8}$/.match(page_background_color)
1132
+ raise Error.new(Pdfcrowd.create_invalid_value_message(page_background_color, "page_background_color", "html-to-pdf", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_page_background_color"), 470);
1133
+ end
1134
+
1135
+ @fields['page_background_color'] = page_background_color
1136
+ self
1137
+ end
1138
+
1130
1139
  # Apply the first page of the watermark PDF to every page of the output PDF.
1131
- #
1140
+ #
1132
1141
  # * +page_watermark+ - The file path to a local watermark PDF file. The file must exist and not be empty.
1133
1142
  # * *Returns* - The converter object.
1134
1143
  def setPageWatermark(page_watermark)
@@ -1141,7 +1150,7 @@ module Pdfcrowd
1141
1150
  end
1142
1151
 
1143
1152
  # Apply each page of the specified watermark PDF to the corresponding page of the output PDF.
1144
- #
1153
+ #
1145
1154
  # * +multipage_watermark+ - The file path to a local watermark PDF file. The file must exist and not be empty.
1146
1155
  # * *Returns* - The converter object.
1147
1156
  def setMultipageWatermark(multipage_watermark)
@@ -1154,7 +1163,7 @@ module Pdfcrowd
1154
1163
  end
1155
1164
 
1156
1165
  # Apply the first page of the specified PDF to the background of every page of the output PDF.
1157
- #
1166
+ #
1158
1167
  # * +page_background+ - The file path to a local background PDF file. The file must exist and not be empty.
1159
1168
  # * *Returns* - The converter object.
1160
1169
  def setPageBackground(page_background)
@@ -1167,7 +1176,7 @@ module Pdfcrowd
1167
1176
  end
1168
1177
 
1169
1178
  # Apply each page of the specified PDF to the background of the corresponding page of the output PDF.
1170
- #
1179
+ #
1171
1180
  # * +multipage_background+ - The file path to a local background PDF file. The file must exist and not be empty.
1172
1181
  # * *Returns* - The converter object.
1173
1182
  def setMultipageBackground(multipage_background)
@@ -1180,7 +1189,7 @@ module Pdfcrowd
1180
1189
  end
1181
1190
 
1182
1191
  # The page header is not printed on the specified pages.
1183
- #
1192
+ #
1184
1193
  # * +pages+ - List of physical page numbers. Negative numbers count backwards from the last page: -1 is the last page, -2 is the last but one page, and so on. A comma seperated list of page numbers.
1185
1194
  # * *Returns* - The converter object.
1186
1195
  def setExcludeHeaderOnPages(pages)
@@ -1193,7 +1202,7 @@ module Pdfcrowd
1193
1202
  end
1194
1203
 
1195
1204
  # The page footer is not printed on the specified pages.
1196
- #
1205
+ #
1197
1206
  # * +pages+ - List of physical page numbers. Negative numbers count backwards from the last page: -1 is the last page, -2 is the last but one page, and so on. A comma seperated list of page numbers.
1198
1207
  # * *Returns* - The converter object.
1199
1208
  def setExcludeFooterOnPages(pages)
@@ -1206,7 +1215,7 @@ module Pdfcrowd
1206
1215
  end
1207
1216
 
1208
1217
  # Set an offset between physical and logical page numbers.
1209
- #
1218
+ #
1210
1219
  # * +offset+ - Integer specifying page offset.
1211
1220
  # * *Returns* - The converter object.
1212
1221
  def setPageNumberingOffset(offset)
@@ -1215,7 +1224,7 @@ module Pdfcrowd
1215
1224
  end
1216
1225
 
1217
1226
  # Do not print the background graphics.
1218
- #
1227
+ #
1219
1228
  # * +no_background+ - Set to true to disable the background graphics.
1220
1229
  # * *Returns* - The converter object.
1221
1230
  def setNoBackground(no_background)
@@ -1224,7 +1233,7 @@ module Pdfcrowd
1224
1233
  end
1225
1234
 
1226
1235
  # Do not execute JavaScript.
1227
- #
1236
+ #
1228
1237
  # * +disable_javascript+ - Set to true to disable JavaScript in web pages.
1229
1238
  # * *Returns* - The converter object.
1230
1239
  def setDisableJavascript(disable_javascript)
@@ -1233,7 +1242,7 @@ module Pdfcrowd
1233
1242
  end
1234
1243
 
1235
1244
  # Do not load images.
1236
- #
1245
+ #
1237
1246
  # * +disable_image_loading+ - Set to true to disable loading of images.
1238
1247
  # * *Returns* - The converter object.
1239
1248
  def setDisableImageLoading(disable_image_loading)
@@ -1242,7 +1251,7 @@ module Pdfcrowd
1242
1251
  end
1243
1252
 
1244
1253
  # Disable loading fonts from remote sources.
1245
- #
1254
+ #
1246
1255
  # * +disable_remote_fonts+ - Set to true disable loading remote fonts.
1247
1256
  # * *Returns* - The converter object.
1248
1257
  def setDisableRemoteFonts(disable_remote_fonts)
@@ -1251,7 +1260,7 @@ module Pdfcrowd
1251
1260
  end
1252
1261
 
1253
1262
  # Try to block ads. Enabling this option can produce smaller output and speed up the conversion.
1254
- #
1263
+ #
1255
1264
  # * +block_ads+ - Set to true to block ads in web pages.
1256
1265
  # * *Returns* - The converter object.
1257
1266
  def setBlockAds(block_ads)
@@ -1260,7 +1269,7 @@ module Pdfcrowd
1260
1269
  end
1261
1270
 
1262
1271
  # Set the default HTML content text encoding.
1263
- #
1272
+ #
1264
1273
  # * +default_encoding+ - The text encoding of the HTML content.
1265
1274
  # * *Returns* - The converter object.
1266
1275
  def setDefaultEncoding(default_encoding)
@@ -1269,7 +1278,7 @@ module Pdfcrowd
1269
1278
  end
1270
1279
 
1271
1280
  # Set the HTTP authentication user name.
1272
- #
1281
+ #
1273
1282
  # * +user_name+ - The user name.
1274
1283
  # * *Returns* - The converter object.
1275
1284
  def setHttpAuthUserName(user_name)
@@ -1278,7 +1287,7 @@ module Pdfcrowd
1278
1287
  end
1279
1288
 
1280
1289
  # Set the HTTP authentication password.
1281
- #
1290
+ #
1282
1291
  # * +password+ - The password.
1283
1292
  # * *Returns* - The converter object.
1284
1293
  def setHttpAuthPassword(password)
@@ -1287,7 +1296,7 @@ module Pdfcrowd
1287
1296
  end
1288
1297
 
1289
1298
  # Set credentials to access HTTP base authentication protected websites.
1290
- #
1299
+ #
1291
1300
  # * +user_name+ - Set the HTTP authentication user name.
1292
1301
  # * +password+ - Set the HTTP authentication password.
1293
1302
  # * *Returns* - The converter object.
@@ -1298,7 +1307,7 @@ module Pdfcrowd
1298
1307
  end
1299
1308
 
1300
1309
  # Use the print version of the page if available (@media print).
1301
- #
1310
+ #
1302
1311
  # * +use_print_media+ - Set to true to use the print version of the page.
1303
1312
  # * *Returns* - The converter object.
1304
1313
  def setUsePrintMedia(use_print_media)
@@ -1307,7 +1316,7 @@ module Pdfcrowd
1307
1316
  end
1308
1317
 
1309
1318
  # Do not send the X-Pdfcrowd HTTP header in Pdfcrowd HTTP requests.
1310
- #
1319
+ #
1311
1320
  # * +no_xpdfcrowd_header+ - Set to true to disable sending X-Pdfcrowd HTTP header.
1312
1321
  # * *Returns* - The converter object.
1313
1322
  def setNoXpdfcrowdHeader(no_xpdfcrowd_header)
@@ -1316,7 +1325,7 @@ module Pdfcrowd
1316
1325
  end
1317
1326
 
1318
1327
  # Set cookies that are sent in Pdfcrowd HTTP requests.
1319
- #
1328
+ #
1320
1329
  # * +cookies+ - The cookie string.
1321
1330
  # * *Returns* - The converter object.
1322
1331
  def setCookies(cookies)
@@ -1325,7 +1334,7 @@ module Pdfcrowd
1325
1334
  end
1326
1335
 
1327
1336
  # Do not allow insecure HTTPS connections.
1328
- #
1337
+ #
1329
1338
  # * +verify_ssl_certificates+ - Set to true to enable SSL certificate verification.
1330
1339
  # * *Returns* - The converter object.
1331
1340
  def setVerifySslCertificates(verify_ssl_certificates)
@@ -1334,7 +1343,7 @@ module Pdfcrowd
1334
1343
  end
1335
1344
 
1336
1345
  # Abort the conversion if the main URL HTTP status code is greater than or equal to 400.
1337
- #
1346
+ #
1338
1347
  # * +fail_on_error+ - Set to true to abort the conversion.
1339
1348
  # * *Returns* - The converter object.
1340
1349
  def setFailOnMainUrlError(fail_on_error)
@@ -1342,8 +1351,8 @@ module Pdfcrowd
1342
1351
  self
1343
1352
  end
1344
1353
 
1345
- # Abort the conversion if any of the sub-request HTTP status code is greater than or equal to 400.
1346
- #
1354
+ # Abort the conversion if any of the sub-request HTTP status code is greater than or equal to 400 or if some sub-requests are still pending. See details in a debug log.
1355
+ #
1347
1356
  # * +fail_on_error+ - Set to true to abort the conversion.
1348
1357
  # * *Returns* - The converter object.
1349
1358
  def setFailOnAnyUrlError(fail_on_error)
@@ -1352,7 +1361,7 @@ module Pdfcrowd
1352
1361
  end
1353
1362
 
1354
1363
  # Run a custom JavaScript after the document is loaded. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...).
1355
- #
1364
+ #
1356
1365
  # * +custom_javascript+ - String containing a JavaScript code. The string must not be empty.
1357
1366
  # * *Returns* - The converter object.
1358
1367
  def setCustomJavascript(custom_javascript)
@@ -1365,7 +1374,7 @@ module Pdfcrowd
1365
1374
  end
1366
1375
 
1367
1376
  # Set a custom HTTP header that is sent in Pdfcrowd HTTP requests.
1368
- #
1377
+ #
1369
1378
  # * +custom_http_header+ - A string containing the header name and value separated by a colon.
1370
1379
  # * *Returns* - The converter object.
1371
1380
  def setCustomHttpHeader(custom_http_header)
@@ -1378,7 +1387,7 @@ module Pdfcrowd
1378
1387
  end
1379
1388
 
1380
1389
  # Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. The maximum value is determined by your API license.
1381
- #
1390
+ #
1382
1391
  # * +javascript_delay+ - The number of milliseconds to wait. Must be a positive integer number or 0.
1383
1392
  # * *Returns* - The converter object.
1384
1393
  def setJavascriptDelay(javascript_delay)
@@ -1391,7 +1400,7 @@ module Pdfcrowd
1391
1400
  end
1392
1401
 
1393
1402
  # Convert only the specified element from the main document and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
1394
- #
1403
+ #
1395
1404
  # * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
1396
1405
  # * *Returns* - The converter object.
1397
1406
  def setElementToConvert(selectors)
@@ -1404,7 +1413,7 @@ module Pdfcrowd
1404
1413
  end
1405
1414
 
1406
1415
  # Specify the DOM handling when only a part of the document is converted.
1407
- #
1416
+ #
1408
1417
  # * +mode+ - Allowed values are cut-out, remove-siblings, hide-siblings.
1409
1418
  # * *Returns* - The converter object.
1410
1419
  def setElementToConvertMode(mode)
@@ -1416,8 +1425,8 @@ module Pdfcrowd
1416
1425
  self
1417
1426
  end
1418
1427
 
1419
- # Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails.
1420
- #
1428
+ # Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails. Your API license defines the maximum wait time by "Max Delay" parameter.
1429
+ #
1421
1430
  # * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
1422
1431
  # * *Returns* - The converter object.
1423
1432
  def setWaitForElement(selectors)
@@ -1430,7 +1439,7 @@ module Pdfcrowd
1430
1439
  end
1431
1440
 
1432
1441
  # Set the viewport width in pixels. The viewport is the user's visible area of the page.
1433
- #
1442
+ #
1434
1443
  # * +viewport_width+ - The value must be in a range 96-7680.
1435
1444
  # * *Returns* - The converter object.
1436
1445
  def setViewportWidth(viewport_width)
@@ -1443,7 +1452,7 @@ module Pdfcrowd
1443
1452
  end
1444
1453
 
1445
1454
  # Set the viewport height in pixels. The viewport is the user's visible area of the page.
1446
- #
1455
+ #
1447
1456
  # * +viewport_height+ - Must be a positive integer number.
1448
1457
  # * *Returns* - The converter object.
1449
1458
  def setViewportHeight(viewport_height)
@@ -1456,7 +1465,7 @@ module Pdfcrowd
1456
1465
  end
1457
1466
 
1458
1467
  # Set the viewport size. The viewport is the user's visible area of the page.
1459
- #
1468
+ #
1460
1469
  # * +width+ - Set the viewport width in pixels. The viewport is the user's visible area of the page. The value must be in a range 96-7680.
1461
1470
  # * +height+ - Set the viewport height in pixels. The viewport is the user's visible area of the page. Must be a positive integer number.
1462
1471
  # * *Returns* - The converter object.
@@ -1467,7 +1476,7 @@ module Pdfcrowd
1467
1476
  end
1468
1477
 
1469
1478
  # Sets the rendering mode.
1470
- #
1479
+ #
1471
1480
  # * +rendering_mode+ - The rendering mode. Allowed values are default, viewport.
1472
1481
  # * *Returns* - The converter object.
1473
1482
  def setRenderingMode(rendering_mode)
@@ -1480,7 +1489,7 @@ module Pdfcrowd
1480
1489
  end
1481
1490
 
1482
1491
  # Set the scaling factor (zoom) for the main page area.
1483
- #
1492
+ #
1484
1493
  # * +scale_factor+ - The scale factor. The value must be in a range 10-500.
1485
1494
  # * *Returns* - The converter object.
1486
1495
  def setScaleFactor(scale_factor)
@@ -1493,7 +1502,7 @@ module Pdfcrowd
1493
1502
  end
1494
1503
 
1495
1504
  # Set the scaling factor (zoom) for the header and footer.
1496
- #
1505
+ #
1497
1506
  # * +header_footer_scale_factor+ - The scale factor. The value must be in a range 10-500.
1498
1507
  # * *Returns* - The converter object.
1499
1508
  def setHeaderFooterScaleFactor(header_footer_scale_factor)
@@ -1506,7 +1515,7 @@ module Pdfcrowd
1506
1515
  end
1507
1516
 
1508
1517
  # Disable the intelligent shrinking strategy that tries to optimally fit the HTML contents to a PDF page.
1509
- #
1518
+ #
1510
1519
  # * +disable_smart_shrinking+ - Set to true to disable the intelligent shrinking strategy.
1511
1520
  # * *Returns* - The converter object.
1512
1521
  def setDisableSmartShrinking(disable_smart_shrinking)
@@ -1515,7 +1524,7 @@ module Pdfcrowd
1515
1524
  end
1516
1525
 
1517
1526
  # Create linearized PDF. This is also known as Fast Web View.
1518
- #
1527
+ #
1519
1528
  # * +linearize+ - Set to true to create linearized PDF.
1520
1529
  # * *Returns* - The converter object.
1521
1530
  def setLinearize(linearize)
@@ -1524,7 +1533,7 @@ module Pdfcrowd
1524
1533
  end
1525
1534
 
1526
1535
  # Encrypt the PDF. This prevents search engines from indexing the contents.
1527
- #
1536
+ #
1528
1537
  # * +encrypt+ - Set to true to enable PDF encryption.
1529
1538
  # * *Returns* - The converter object.
1530
1539
  def setEncrypt(encrypt)
@@ -1533,7 +1542,7 @@ module Pdfcrowd
1533
1542
  end
1534
1543
 
1535
1544
  # Protect the PDF with a user password. When a PDF has a user password, it must be supplied in order to view the document and to perform operations allowed by the access permissions.
1536
- #
1545
+ #
1537
1546
  # * +user_password+ - The user password.
1538
1547
  # * *Returns* - The converter object.
1539
1548
  def setUserPassword(user_password)
@@ -1542,7 +1551,7 @@ module Pdfcrowd
1542
1551
  end
1543
1552
 
1544
1553
  # Protect the PDF with an owner password. Supplying an owner password grants unlimited access to the PDF including changing the passwords and access permissions.
1545
- #
1554
+ #
1546
1555
  # * +owner_password+ - The owner password.
1547
1556
  # * *Returns* - The converter object.
1548
1557
  def setOwnerPassword(owner_password)
@@ -1551,7 +1560,7 @@ module Pdfcrowd
1551
1560
  end
1552
1561
 
1553
1562
  # Disallow printing of the output PDF.
1554
- #
1563
+ #
1555
1564
  # * +no_print+ - Set to true to set the no-print flag in the output PDF.
1556
1565
  # * *Returns* - The converter object.
1557
1566
  def setNoPrint(no_print)
@@ -1560,7 +1569,7 @@ module Pdfcrowd
1560
1569
  end
1561
1570
 
1562
1571
  # Disallow modification of the ouput PDF.
1563
- #
1572
+ #
1564
1573
  # * +no_modify+ - Set to true to set the read-only only flag in the output PDF.
1565
1574
  # * *Returns* - The converter object.
1566
1575
  def setNoModify(no_modify)
@@ -1569,7 +1578,7 @@ module Pdfcrowd
1569
1578
  end
1570
1579
 
1571
1580
  # Disallow text and graphics extraction from the output PDF.
1572
- #
1581
+ #
1573
1582
  # * +no_copy+ - Set to true to set the no-copy flag in the output PDF.
1574
1583
  # * *Returns* - The converter object.
1575
1584
  def setNoCopy(no_copy)
@@ -1578,7 +1587,7 @@ module Pdfcrowd
1578
1587
  end
1579
1588
 
1580
1589
  # Set the title of the PDF.
1581
- #
1590
+ #
1582
1591
  # * +title+ - The title.
1583
1592
  # * *Returns* - The converter object.
1584
1593
  def setTitle(title)
@@ -1587,7 +1596,7 @@ module Pdfcrowd
1587
1596
  end
1588
1597
 
1589
1598
  # Set the subject of the PDF.
1590
- #
1599
+ #
1591
1600
  # * +subject+ - The subject.
1592
1601
  # * *Returns* - The converter object.
1593
1602
  def setSubject(subject)
@@ -1596,7 +1605,7 @@ module Pdfcrowd
1596
1605
  end
1597
1606
 
1598
1607
  # Set the author of the PDF.
1599
- #
1608
+ #
1600
1609
  # * +author+ - The author.
1601
1610
  # * *Returns* - The converter object.
1602
1611
  def setAuthor(author)
@@ -1605,7 +1614,7 @@ module Pdfcrowd
1605
1614
  end
1606
1615
 
1607
1616
  # Associate keywords with the document.
1608
- #
1617
+ #
1609
1618
  # * +keywords+ - The string with the keywords.
1610
1619
  # * *Returns* - The converter object.
1611
1620
  def setKeywords(keywords)
@@ -1614,7 +1623,7 @@ module Pdfcrowd
1614
1623
  end
1615
1624
 
1616
1625
  # Specify the page layout to be used when the document is opened.
1617
- #
1626
+ #
1618
1627
  # * +page_layout+ - Allowed values are single-page, one-column, two-column-left, two-column-right.
1619
1628
  # * *Returns* - The converter object.
1620
1629
  def setPageLayout(page_layout)
@@ -1627,7 +1636,7 @@ module Pdfcrowd
1627
1636
  end
1628
1637
 
1629
1638
  # Specify how the document should be displayed when opened.
1630
- #
1639
+ #
1631
1640
  # * +page_mode+ - Allowed values are full-screen, thumbnails, outlines.
1632
1641
  # * *Returns* - The converter object.
1633
1642
  def setPageMode(page_mode)
@@ -1640,7 +1649,7 @@ module Pdfcrowd
1640
1649
  end
1641
1650
 
1642
1651
  # Specify how the page should be displayed when opened.
1643
- #
1652
+ #
1644
1653
  # * +initial_zoom_type+ - Allowed values are fit-width, fit-height, fit-page.
1645
1654
  # * *Returns* - The converter object.
1646
1655
  def setInitialZoomType(initial_zoom_type)
@@ -1653,7 +1662,7 @@ module Pdfcrowd
1653
1662
  end
1654
1663
 
1655
1664
  # Display the specified page when the document is opened.
1656
- #
1665
+ #
1657
1666
  # * +initial_page+ - Must be a positive integer number.
1658
1667
  # * *Returns* - The converter object.
1659
1668
  def setInitialPage(initial_page)
@@ -1666,7 +1675,7 @@ module Pdfcrowd
1666
1675
  end
1667
1676
 
1668
1677
  # Specify the initial page zoom in percents when the document is opened.
1669
- #
1678
+ #
1670
1679
  # * +initial_zoom+ - Must be a positive integer number.
1671
1680
  # * *Returns* - The converter object.
1672
1681
  def setInitialZoom(initial_zoom)
@@ -1679,7 +1688,7 @@ module Pdfcrowd
1679
1688
  end
1680
1689
 
1681
1690
  # Specify whether to hide the viewer application's tool bars when the document is active.
1682
- #
1691
+ #
1683
1692
  # * +hide_toolbar+ - Set to true to hide tool bars.
1684
1693
  # * *Returns* - The converter object.
1685
1694
  def setHideToolbar(hide_toolbar)
@@ -1688,7 +1697,7 @@ module Pdfcrowd
1688
1697
  end
1689
1698
 
1690
1699
  # Specify whether to hide the viewer application's menu bar when the document is active.
1691
- #
1700
+ #
1692
1701
  # * +hide_menubar+ - Set to true to hide the menu bar.
1693
1702
  # * *Returns* - The converter object.
1694
1703
  def setHideMenubar(hide_menubar)
@@ -1697,7 +1706,7 @@ module Pdfcrowd
1697
1706
  end
1698
1707
 
1699
1708
  # Specify whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
1700
- #
1709
+ #
1701
1710
  # * +hide_window_ui+ - Set to true to hide ui elements.
1702
1711
  # * *Returns* - The converter object.
1703
1712
  def setHideWindowUi(hide_window_ui)
@@ -1706,7 +1715,7 @@ module Pdfcrowd
1706
1715
  end
1707
1716
 
1708
1717
  # Specify whether to resize the document's window to fit the size of the first displayed page.
1709
- #
1718
+ #
1710
1719
  # * +fit_window+ - Set to true to resize the window.
1711
1720
  # * *Returns* - The converter object.
1712
1721
  def setFitWindow(fit_window)
@@ -1715,7 +1724,7 @@ module Pdfcrowd
1715
1724
  end
1716
1725
 
1717
1726
  # Specify whether to position the document's window in the center of the screen.
1718
- #
1727
+ #
1719
1728
  # * +center_window+ - Set to true to center the window.
1720
1729
  # * *Returns* - The converter object.
1721
1730
  def setCenterWindow(center_window)
@@ -1724,7 +1733,7 @@ module Pdfcrowd
1724
1733
  end
1725
1734
 
1726
1735
  # Specify whether the window's title bar should display the document title. If false , the title bar should instead display the name of the PDF file containing the document.
1727
- #
1736
+ #
1728
1737
  # * +display_title+ - Set to true to display the title.
1729
1738
  # * *Returns* - The converter object.
1730
1739
  def setDisplayTitle(display_title)
@@ -1733,7 +1742,7 @@ module Pdfcrowd
1733
1742
  end
1734
1743
 
1735
1744
  # Set the predominant reading order for text to right-to-left. This option has no direct effect on the document's contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up
1736
- #
1745
+ #
1737
1746
  # * +right_to_left+ - Set to true to set right-to-left reading order.
1738
1747
  # * *Returns* - The converter object.
1739
1748
  def setRightToLeft(right_to_left)
@@ -1741,8 +1750,8 @@ module Pdfcrowd
1741
1750
  self
1742
1751
  end
1743
1752
 
1744
- # 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.
1745
- #
1753
+ # 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.
1754
+ #
1746
1755
  # * +debug_log+ - Set to true to enable the debug logging.
1747
1756
  # * *Returns* - The converter object.
1748
1757
  def setDebugLog(debug_log)
@@ -1789,7 +1798,7 @@ module Pdfcrowd
1789
1798
  end
1790
1799
 
1791
1800
  # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
1792
- #
1801
+ #
1793
1802
  # * +tag+ - A string with the custom tag.
1794
1803
  # * *Returns* - The converter object.
1795
1804
  def setTag(tag)
@@ -1797,8 +1806,56 @@ module Pdfcrowd
1797
1806
  self
1798
1807
  end
1799
1808
 
1809
+ # 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.
1810
+ #
1811
+ # * +http_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
1812
+ # * *Returns* - The converter object.
1813
+ def setHttpProxy(http_proxy)
1814
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(http_proxy)
1815
+ raise Error.new(Pdfcrowd.create_invalid_value_message(http_proxy, "http_proxy", "html-to-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
1816
+ end
1817
+
1818
+ @fields['http_proxy'] = http_proxy
1819
+ self
1820
+ end
1821
+
1822
+ # 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.
1823
+ #
1824
+ # * +https_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
1825
+ # * *Returns* - The converter object.
1826
+ def setHttpsProxy(https_proxy)
1827
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(https_proxy)
1828
+ raise Error.new(Pdfcrowd.create_invalid_value_message(https_proxy, "https_proxy", "html-to-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
1829
+ end
1830
+
1831
+ @fields['https_proxy'] = https_proxy
1832
+ self
1833
+ end
1834
+
1835
+ # A client certificate to authenticate Pdfcrowd converter on your web server. The certificate is used for two-way SSL/TLS authentication and adds extra security.
1836
+ #
1837
+ # * +client_certificate+ - The file must be in PKCS12 format. The file must exist and not be empty.
1838
+ # * *Returns* - The converter object.
1839
+ def setClientCertificate(client_certificate)
1840
+ if (!(File.file?(client_certificate) && !File.zero?(client_certificate)))
1841
+ raise Error.new(Pdfcrowd.create_invalid_value_message(client_certificate, "client_certificate", "html-to-pdf", "The file must exist and not be empty.", "set_client_certificate"), 470);
1842
+ end
1843
+
1844
+ @files['client_certificate'] = client_certificate
1845
+ self
1846
+ end
1847
+
1848
+ # A password for PKCS12 file with a client certificate if it's needed.
1849
+ #
1850
+ # * +client_certificate_password+ -
1851
+ # * *Returns* - The converter object.
1852
+ def setClientCertificatePassword(client_certificate_password)
1853
+ @fields['client_certificate_password'] = client_certificate_password
1854
+ self
1855
+ end
1856
+
1800
1857
  # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
1801
- #
1858
+ #
1802
1859
  # * +use_http+ - Set to true to use HTTP.
1803
1860
  # * *Returns* - The converter object.
1804
1861
  def setUseHttp(use_http)
@@ -1807,7 +1864,7 @@ module Pdfcrowd
1807
1864
  end
1808
1865
 
1809
1866
  # Set a custom user agent HTTP header. It can be usefull if you are behind some proxy or firewall.
1810
- #
1867
+ #
1811
1868
  # * +user_agent+ - The user agent string.
1812
1869
  # * *Returns* - The converter object.
1813
1870
  def setUserAgent(user_agent)
@@ -1816,7 +1873,7 @@ module Pdfcrowd
1816
1873
  end
1817
1874
 
1818
1875
  # Specifies an HTTP proxy that the API client library will use to connect to the internet.
1819
- #
1876
+ #
1820
1877
  # * +host+ - The proxy hostname.
1821
1878
  # * +port+ - The proxy port.
1822
1879
  # * +user_name+ - The username.
@@ -1828,7 +1885,7 @@ module Pdfcrowd
1828
1885
  end
1829
1886
 
1830
1887
  # 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.
1831
- #
1888
+ #
1832
1889
  # * +retry_count+ - Number of retries wanted.
1833
1890
  # * *Returns* - The converter object.
1834
1891
  def setRetryCount(retry_count)
@@ -1841,7 +1898,7 @@ module Pdfcrowd
1841
1898
  # Conversion from HTML to image.
1842
1899
  class HtmlToImageClient
1843
1900
  # Constructor for the Pdfcrowd API client.
1844
- #
1901
+ #
1845
1902
  # * +user_name+ - Your username at Pdfcrowd.
1846
1903
  # * +api_key+ - Your API key.
1847
1904
  def initialize(user_name, api_key)
@@ -1856,7 +1913,7 @@ module Pdfcrowd
1856
1913
  end
1857
1914
 
1858
1915
  # The format of the output file.
1859
- #
1916
+ #
1860
1917
  # * +output_format+ - Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.
1861
1918
  # * *Returns* - The converter object.
1862
1919
  def setOutputFormat(output_format)
@@ -1869,7 +1926,7 @@ module Pdfcrowd
1869
1926
  end
1870
1927
 
1871
1928
  # Convert a web page.
1872
- #
1929
+ #
1873
1930
  # * +url+ - The address of the web page to convert. The supported protocols are http:// and https://.
1874
1931
  # * *Returns* - Byte array containing the conversion output.
1875
1932
  def convertUrl(url)
@@ -1882,7 +1939,7 @@ module Pdfcrowd
1882
1939
  end
1883
1940
 
1884
1941
  # Convert a web page and write the result to an output stream.
1885
- #
1942
+ #
1886
1943
  # * +url+ - The address of the web page to convert. The supported protocols are http:// and https://.
1887
1944
  # * +out_stream+ - The output stream that will contain the conversion output.
1888
1945
  def convertUrlToStream(url, out_stream)
@@ -1895,7 +1952,7 @@ module Pdfcrowd
1895
1952
  end
1896
1953
 
1897
1954
  # Convert a web page and write the result to a local file.
1898
- #
1955
+ #
1899
1956
  # * +url+ - The address of the web page to convert. The supported protocols are http:// and https://.
1900
1957
  # * +file_path+ - The output file path. The string must not be empty.
1901
1958
  def convertUrlToFile(url, file_path)
@@ -1915,7 +1972,7 @@ module Pdfcrowd
1915
1972
  end
1916
1973
 
1917
1974
  # Convert a local file.
1918
- #
1975
+ #
1919
1976
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets. The file must exist and not be empty. The file name must have a valid extension.
1920
1977
  # * *Returns* - Byte array containing the conversion output.
1921
1978
  def convertFile(file)
@@ -1932,7 +1989,7 @@ module Pdfcrowd
1932
1989
  end
1933
1990
 
1934
1991
  # Convert a local file and write the result to an output stream.
1935
- #
1992
+ #
1936
1993
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets. The file must exist and not be empty. The file name must have a valid extension.
1937
1994
  # * +out_stream+ - The output stream that will contain the conversion output.
1938
1995
  def convertFileToStream(file, out_stream)
@@ -1949,7 +2006,7 @@ module Pdfcrowd
1949
2006
  end
1950
2007
 
1951
2008
  # Convert a local file and write the result to a local file.
1952
- #
2009
+ #
1953
2010
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets. The file must exist and not be empty. The file name must have a valid extension.
1954
2011
  # * +file_path+ - The output file path. The string must not be empty.
1955
2012
  def convertFileToFile(file, file_path)
@@ -1969,7 +2026,7 @@ module Pdfcrowd
1969
2026
  end
1970
2027
 
1971
2028
  # Convert a string.
1972
- #
2029
+ #
1973
2030
  # * +text+ - The string content to convert. The string must not be empty.
1974
2031
  # * *Returns* - Byte array containing the conversion output.
1975
2032
  def convertString(text)
@@ -1982,7 +2039,7 @@ module Pdfcrowd
1982
2039
  end
1983
2040
 
1984
2041
  # Convert a string and write the output to an output stream.
1985
- #
2042
+ #
1986
2043
  # * +text+ - The string content to convert. The string must not be empty.
1987
2044
  # * +out_stream+ - The output stream that will contain the conversion output.
1988
2045
  def convertStringToStream(text, out_stream)
@@ -1995,7 +2052,7 @@ module Pdfcrowd
1995
2052
  end
1996
2053
 
1997
2054
  # Convert a string and write the output to a file.
1998
- #
2055
+ #
1999
2056
  # * +text+ - The string content to convert. The string must not be empty.
2000
2057
  # * +file_path+ - The output file path. The string must not be empty.
2001
2058
  def convertStringToFile(text, file_path)
@@ -2015,7 +2072,7 @@ module Pdfcrowd
2015
2072
  end
2016
2073
 
2017
2074
  # Do not print the background graphics.
2018
- #
2075
+ #
2019
2076
  # * +no_background+ - Set to true to disable the background graphics.
2020
2077
  # * *Returns* - The converter object.
2021
2078
  def setNoBackground(no_background)
@@ -2024,7 +2081,7 @@ module Pdfcrowd
2024
2081
  end
2025
2082
 
2026
2083
  # Do not execute JavaScript.
2027
- #
2084
+ #
2028
2085
  # * +disable_javascript+ - Set to true to disable JavaScript in web pages.
2029
2086
  # * *Returns* - The converter object.
2030
2087
  def setDisableJavascript(disable_javascript)
@@ -2033,7 +2090,7 @@ module Pdfcrowd
2033
2090
  end
2034
2091
 
2035
2092
  # Do not load images.
2036
- #
2093
+ #
2037
2094
  # * +disable_image_loading+ - Set to true to disable loading of images.
2038
2095
  # * *Returns* - The converter object.
2039
2096
  def setDisableImageLoading(disable_image_loading)
@@ -2042,7 +2099,7 @@ module Pdfcrowd
2042
2099
  end
2043
2100
 
2044
2101
  # Disable loading fonts from remote sources.
2045
- #
2102
+ #
2046
2103
  # * +disable_remote_fonts+ - Set to true disable loading remote fonts.
2047
2104
  # * *Returns* - The converter object.
2048
2105
  def setDisableRemoteFonts(disable_remote_fonts)
@@ -2051,7 +2108,7 @@ module Pdfcrowd
2051
2108
  end
2052
2109
 
2053
2110
  # Try to block ads. Enabling this option can produce smaller output and speed up the conversion.
2054
- #
2111
+ #
2055
2112
  # * +block_ads+ - Set to true to block ads in web pages.
2056
2113
  # * *Returns* - The converter object.
2057
2114
  def setBlockAds(block_ads)
@@ -2060,7 +2117,7 @@ module Pdfcrowd
2060
2117
  end
2061
2118
 
2062
2119
  # Set the default HTML content text encoding.
2063
- #
2120
+ #
2064
2121
  # * +default_encoding+ - The text encoding of the HTML content.
2065
2122
  # * *Returns* - The converter object.
2066
2123
  def setDefaultEncoding(default_encoding)
@@ -2069,7 +2126,7 @@ module Pdfcrowd
2069
2126
  end
2070
2127
 
2071
2128
  # Set the HTTP authentication user name.
2072
- #
2129
+ #
2073
2130
  # * +user_name+ - The user name.
2074
2131
  # * *Returns* - The converter object.
2075
2132
  def setHttpAuthUserName(user_name)
@@ -2078,7 +2135,7 @@ module Pdfcrowd
2078
2135
  end
2079
2136
 
2080
2137
  # Set the HTTP authentication password.
2081
- #
2138
+ #
2082
2139
  # * +password+ - The password.
2083
2140
  # * *Returns* - The converter object.
2084
2141
  def setHttpAuthPassword(password)
@@ -2087,7 +2144,7 @@ module Pdfcrowd
2087
2144
  end
2088
2145
 
2089
2146
  # Set credentials to access HTTP base authentication protected websites.
2090
- #
2147
+ #
2091
2148
  # * +user_name+ - Set the HTTP authentication user name.
2092
2149
  # * +password+ - Set the HTTP authentication password.
2093
2150
  # * *Returns* - The converter object.
@@ -2098,7 +2155,7 @@ module Pdfcrowd
2098
2155
  end
2099
2156
 
2100
2157
  # Use the print version of the page if available (@media print).
2101
- #
2158
+ #
2102
2159
  # * +use_print_media+ - Set to true to use the print version of the page.
2103
2160
  # * *Returns* - The converter object.
2104
2161
  def setUsePrintMedia(use_print_media)
@@ -2107,7 +2164,7 @@ module Pdfcrowd
2107
2164
  end
2108
2165
 
2109
2166
  # Do not send the X-Pdfcrowd HTTP header in Pdfcrowd HTTP requests.
2110
- #
2167
+ #
2111
2168
  # * +no_xpdfcrowd_header+ - Set to true to disable sending X-Pdfcrowd HTTP header.
2112
2169
  # * *Returns* - The converter object.
2113
2170
  def setNoXpdfcrowdHeader(no_xpdfcrowd_header)
@@ -2116,7 +2173,7 @@ module Pdfcrowd
2116
2173
  end
2117
2174
 
2118
2175
  # Set cookies that are sent in Pdfcrowd HTTP requests.
2119
- #
2176
+ #
2120
2177
  # * +cookies+ - The cookie string.
2121
2178
  # * *Returns* - The converter object.
2122
2179
  def setCookies(cookies)
@@ -2125,7 +2182,7 @@ module Pdfcrowd
2125
2182
  end
2126
2183
 
2127
2184
  # Do not allow insecure HTTPS connections.
2128
- #
2185
+ #
2129
2186
  # * +verify_ssl_certificates+ - Set to true to enable SSL certificate verification.
2130
2187
  # * *Returns* - The converter object.
2131
2188
  def setVerifySslCertificates(verify_ssl_certificates)
@@ -2134,7 +2191,7 @@ module Pdfcrowd
2134
2191
  end
2135
2192
 
2136
2193
  # Abort the conversion if the main URL HTTP status code is greater than or equal to 400.
2137
- #
2194
+ #
2138
2195
  # * +fail_on_error+ - Set to true to abort the conversion.
2139
2196
  # * *Returns* - The converter object.
2140
2197
  def setFailOnMainUrlError(fail_on_error)
@@ -2142,8 +2199,8 @@ module Pdfcrowd
2142
2199
  self
2143
2200
  end
2144
2201
 
2145
- # Abort the conversion if any of the sub-request HTTP status code is greater than or equal to 400.
2146
- #
2202
+ # Abort the conversion if any of the sub-request HTTP status code is greater than or equal to 400 or if some sub-requests are still pending. See details in a debug log.
2203
+ #
2147
2204
  # * +fail_on_error+ - Set to true to abort the conversion.
2148
2205
  # * *Returns* - The converter object.
2149
2206
  def setFailOnAnyUrlError(fail_on_error)
@@ -2152,7 +2209,7 @@ module Pdfcrowd
2152
2209
  end
2153
2210
 
2154
2211
  # Run a custom JavaScript after the document is loaded. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...).
2155
- #
2212
+ #
2156
2213
  # * +custom_javascript+ - String containing a JavaScript code. The string must not be empty.
2157
2214
  # * *Returns* - The converter object.
2158
2215
  def setCustomJavascript(custom_javascript)
@@ -2165,7 +2222,7 @@ module Pdfcrowd
2165
2222
  end
2166
2223
 
2167
2224
  # Set a custom HTTP header that is sent in Pdfcrowd HTTP requests.
2168
- #
2225
+ #
2169
2226
  # * +custom_http_header+ - A string containing the header name and value separated by a colon.
2170
2227
  # * *Returns* - The converter object.
2171
2228
  def setCustomHttpHeader(custom_http_header)
@@ -2178,7 +2235,7 @@ module Pdfcrowd
2178
2235
  end
2179
2236
 
2180
2237
  # Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. The maximum value is determined by your API license.
2181
- #
2238
+ #
2182
2239
  # * +javascript_delay+ - The number of milliseconds to wait. Must be a positive integer number or 0.
2183
2240
  # * *Returns* - The converter object.
2184
2241
  def setJavascriptDelay(javascript_delay)
@@ -2191,7 +2248,7 @@ module Pdfcrowd
2191
2248
  end
2192
2249
 
2193
2250
  # Convert only the specified element from the main document and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
2194
- #
2251
+ #
2195
2252
  # * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
2196
2253
  # * *Returns* - The converter object.
2197
2254
  def setElementToConvert(selectors)
@@ -2204,7 +2261,7 @@ module Pdfcrowd
2204
2261
  end
2205
2262
 
2206
2263
  # Specify the DOM handling when only a part of the document is converted.
2207
- #
2264
+ #
2208
2265
  # * +mode+ - Allowed values are cut-out, remove-siblings, hide-siblings.
2209
2266
  # * *Returns* - The converter object.
2210
2267
  def setElementToConvertMode(mode)
@@ -2216,8 +2273,8 @@ module Pdfcrowd
2216
2273
  self
2217
2274
  end
2218
2275
 
2219
- # Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails.
2220
- #
2276
+ # Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails. Your API license defines the maximum wait time by "Max Delay" parameter.
2277
+ #
2221
2278
  # * +selectors+ - One or more CSS selectors separated by commas. The string must not be empty.
2222
2279
  # * *Returns* - The converter object.
2223
2280
  def setWaitForElement(selectors)
@@ -2230,7 +2287,7 @@ module Pdfcrowd
2230
2287
  end
2231
2288
 
2232
2289
  # Set the output image width in pixels.
2233
- #
2290
+ #
2234
2291
  # * +screenshot_width+ - The value must be in a range 96-7680.
2235
2292
  # * *Returns* - The converter object.
2236
2293
  def setScreenshotWidth(screenshot_width)
@@ -2243,7 +2300,7 @@ module Pdfcrowd
2243
2300
  end
2244
2301
 
2245
2302
  # Set the output image height in pixels. If it's not specified, actual document height is used.
2246
- #
2303
+ #
2247
2304
  # * +screenshot_height+ - Must be a positive integer number.
2248
2305
  # * *Returns* - The converter object.
2249
2306
  def setScreenshotHeight(screenshot_height)
@@ -2255,8 +2312,8 @@ module Pdfcrowd
2255
2312
  self
2256
2313
  end
2257
2314
 
2258
- # 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.
2259
- #
2315
+ # 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.
2316
+ #
2260
2317
  # * +debug_log+ - Set to true to enable the debug logging.
2261
2318
  # * *Returns* - The converter object.
2262
2319
  def setDebugLog(debug_log)
@@ -2297,7 +2354,7 @@ module Pdfcrowd
2297
2354
  end
2298
2355
 
2299
2356
  # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
2300
- #
2357
+ #
2301
2358
  # * +tag+ - A string with the custom tag.
2302
2359
  # * *Returns* - The converter object.
2303
2360
  def setTag(tag)
@@ -2305,8 +2362,56 @@ module Pdfcrowd
2305
2362
  self
2306
2363
  end
2307
2364
 
2365
+ # 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.
2366
+ #
2367
+ # * +http_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
2368
+ # * *Returns* - The converter object.
2369
+ def setHttpProxy(http_proxy)
2370
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(http_proxy)
2371
+ raise Error.new(Pdfcrowd.create_invalid_value_message(http_proxy, "http_proxy", "html-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
2372
+ end
2373
+
2374
+ @fields['http_proxy'] = http_proxy
2375
+ self
2376
+ end
2377
+
2378
+ # 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.
2379
+ #
2380
+ # * +https_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
2381
+ # * *Returns* - The converter object.
2382
+ def setHttpsProxy(https_proxy)
2383
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(https_proxy)
2384
+ raise Error.new(Pdfcrowd.create_invalid_value_message(https_proxy, "https_proxy", "html-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
2385
+ end
2386
+
2387
+ @fields['https_proxy'] = https_proxy
2388
+ self
2389
+ end
2390
+
2391
+ # A client certificate to authenticate Pdfcrowd converter on your web server. The certificate is used for two-way SSL/TLS authentication and adds extra security.
2392
+ #
2393
+ # * +client_certificate+ - The file must be in PKCS12 format. The file must exist and not be empty.
2394
+ # * *Returns* - The converter object.
2395
+ def setClientCertificate(client_certificate)
2396
+ if (!(File.file?(client_certificate) && !File.zero?(client_certificate)))
2397
+ raise Error.new(Pdfcrowd.create_invalid_value_message(client_certificate, "client_certificate", "html-to-image", "The file must exist and not be empty.", "set_client_certificate"), 470);
2398
+ end
2399
+
2400
+ @files['client_certificate'] = client_certificate
2401
+ self
2402
+ end
2403
+
2404
+ # A password for PKCS12 file with a client certificate if it's needed.
2405
+ #
2406
+ # * +client_certificate_password+ -
2407
+ # * *Returns* - The converter object.
2408
+ def setClientCertificatePassword(client_certificate_password)
2409
+ @fields['client_certificate_password'] = client_certificate_password
2410
+ self
2411
+ end
2412
+
2308
2413
  # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
2309
- #
2414
+ #
2310
2415
  # * +use_http+ - Set to true to use HTTP.
2311
2416
  # * *Returns* - The converter object.
2312
2417
  def setUseHttp(use_http)
@@ -2315,7 +2420,7 @@ module Pdfcrowd
2315
2420
  end
2316
2421
 
2317
2422
  # Set a custom user agent HTTP header. It can be usefull if you are behind some proxy or firewall.
2318
- #
2423
+ #
2319
2424
  # * +user_agent+ - The user agent string.
2320
2425
  # * *Returns* - The converter object.
2321
2426
  def setUserAgent(user_agent)
@@ -2324,7 +2429,7 @@ module Pdfcrowd
2324
2429
  end
2325
2430
 
2326
2431
  # Specifies an HTTP proxy that the API client library will use to connect to the internet.
2327
- #
2432
+ #
2328
2433
  # * +host+ - The proxy hostname.
2329
2434
  # * +port+ - The proxy port.
2330
2435
  # * +user_name+ - The username.
@@ -2336,7 +2441,7 @@ module Pdfcrowd
2336
2441
  end
2337
2442
 
2338
2443
  # 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.
2339
- #
2444
+ #
2340
2445
  # * +retry_count+ - Number of retries wanted.
2341
2446
  # * *Returns* - The converter object.
2342
2447
  def setRetryCount(retry_count)
@@ -2349,7 +2454,7 @@ module Pdfcrowd
2349
2454
  # Conversion from one image format to another image format.
2350
2455
  class ImageToImageClient
2351
2456
  # Constructor for the Pdfcrowd API client.
2352
- #
2457
+ #
2353
2458
  # * +user_name+ - Your username at Pdfcrowd.
2354
2459
  # * +api_key+ - Your API key.
2355
2460
  def initialize(user_name, api_key)
@@ -2364,7 +2469,7 @@ module Pdfcrowd
2364
2469
  end
2365
2470
 
2366
2471
  # Convert an image.
2367
- #
2472
+ #
2368
2473
  # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
2369
2474
  # * *Returns* - Byte array containing the conversion output.
2370
2475
  def convertUrl(url)
@@ -2377,7 +2482,7 @@ module Pdfcrowd
2377
2482
  end
2378
2483
 
2379
2484
  # Convert an image and write the result to an output stream.
2380
- #
2485
+ #
2381
2486
  # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
2382
2487
  # * +out_stream+ - The output stream that will contain the conversion output.
2383
2488
  def convertUrlToStream(url, out_stream)
@@ -2390,7 +2495,7 @@ module Pdfcrowd
2390
2495
  end
2391
2496
 
2392
2497
  # Convert an image and write the result to a local file.
2393
- #
2498
+ #
2394
2499
  # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
2395
2500
  # * +file_path+ - The output file path. The string must not be empty.
2396
2501
  def convertUrlToFile(url, file_path)
@@ -2410,7 +2515,7 @@ module Pdfcrowd
2410
2515
  end
2411
2516
 
2412
2517
  # Convert a local file.
2413
- #
2518
+ #
2414
2519
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). The file must exist and not be empty.
2415
2520
  # * *Returns* - Byte array containing the conversion output.
2416
2521
  def convertFile(file)
@@ -2423,7 +2528,7 @@ module Pdfcrowd
2423
2528
  end
2424
2529
 
2425
2530
  # Convert a local file and write the result to an output stream.
2426
- #
2531
+ #
2427
2532
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). The file must exist and not be empty.
2428
2533
  # * +out_stream+ - The output stream that will contain the conversion output.
2429
2534
  def convertFileToStream(file, out_stream)
@@ -2436,7 +2541,7 @@ module Pdfcrowd
2436
2541
  end
2437
2542
 
2438
2543
  # Convert a local file and write the result to a local file.
2439
- #
2544
+ #
2440
2545
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). The file must exist and not be empty.
2441
2546
  # * +file_path+ - The output file path. The string must not be empty.
2442
2547
  def convertFileToFile(file, file_path)
@@ -2456,7 +2561,7 @@ module Pdfcrowd
2456
2561
  end
2457
2562
 
2458
2563
  # Convert raw data.
2459
- #
2564
+ #
2460
2565
  # * +data+ - The raw content to be converted.
2461
2566
  # * *Returns* - Byte array with the output.
2462
2567
  def convertRawData(data)
@@ -2465,7 +2570,7 @@ module Pdfcrowd
2465
2570
  end
2466
2571
 
2467
2572
  # Convert raw data and write the result to an output stream.
2468
- #
2573
+ #
2469
2574
  # * +data+ - The raw content to be converted.
2470
2575
  # * +out_stream+ - The output stream that will contain the conversion output.
2471
2576
  def convertRawDataToStream(data, out_stream)
@@ -2474,7 +2579,7 @@ module Pdfcrowd
2474
2579
  end
2475
2580
 
2476
2581
  # Convert raw data to a file.
2477
- #
2582
+ #
2478
2583
  # * +data+ - The raw content to be converted.
2479
2584
  # * +file_path+ - The output file path. The string must not be empty.
2480
2585
  def convertRawDataToFile(data, file_path)
@@ -2494,7 +2599,7 @@ module Pdfcrowd
2494
2599
  end
2495
2600
 
2496
2601
  # The format of the output file.
2497
- #
2602
+ #
2498
2603
  # * +output_format+ - Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.
2499
2604
  # * *Returns* - The converter object.
2500
2605
  def setOutputFormat(output_format)
@@ -2507,7 +2612,7 @@ module Pdfcrowd
2507
2612
  end
2508
2613
 
2509
2614
  # Resize the image.
2510
- #
2615
+ #
2511
2616
  # * +resize+ - The resize percentage or new image dimensions.
2512
2617
  # * *Returns* - The converter object.
2513
2618
  def setResize(resize)
@@ -2516,7 +2621,7 @@ module Pdfcrowd
2516
2621
  end
2517
2622
 
2518
2623
  # Rotate the image.
2519
- #
2624
+ #
2520
2625
  # * +rotate+ - The rotation specified in degrees.
2521
2626
  # * *Returns* - The converter object.
2522
2627
  def setRotate(rotate)
@@ -2524,8 +2629,8 @@ module Pdfcrowd
2524
2629
  self
2525
2630
  end
2526
2631
 
2527
- # 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.
2528
- #
2632
+ # 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.
2633
+ #
2529
2634
  # * +debug_log+ - Set to true to enable the debug logging.
2530
2635
  # * *Returns* - The converter object.
2531
2636
  def setDebugLog(debug_log)
@@ -2566,7 +2671,7 @@ module Pdfcrowd
2566
2671
  end
2567
2672
 
2568
2673
  # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
2569
- #
2674
+ #
2570
2675
  # * +tag+ - A string with the custom tag.
2571
2676
  # * *Returns* - The converter object.
2572
2677
  def setTag(tag)
@@ -2574,8 +2679,34 @@ module Pdfcrowd
2574
2679
  self
2575
2680
  end
2576
2681
 
2682
+ # 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.
2683
+ #
2684
+ # * +http_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
2685
+ # * *Returns* - The converter object.
2686
+ def setHttpProxy(http_proxy)
2687
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(http_proxy)
2688
+ raise Error.new(Pdfcrowd.create_invalid_value_message(http_proxy, "http_proxy", "image-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
2689
+ end
2690
+
2691
+ @fields['http_proxy'] = http_proxy
2692
+ self
2693
+ end
2694
+
2695
+ # 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.
2696
+ #
2697
+ # * +https_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
2698
+ # * *Returns* - The converter object.
2699
+ def setHttpsProxy(https_proxy)
2700
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(https_proxy)
2701
+ raise Error.new(Pdfcrowd.create_invalid_value_message(https_proxy, "https_proxy", "image-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
2702
+ end
2703
+
2704
+ @fields['https_proxy'] = https_proxy
2705
+ self
2706
+ end
2707
+
2577
2708
  # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
2578
- #
2709
+ #
2579
2710
  # * +use_http+ - Set to true to use HTTP.
2580
2711
  # * *Returns* - The converter object.
2581
2712
  def setUseHttp(use_http)
@@ -2584,7 +2715,7 @@ module Pdfcrowd
2584
2715
  end
2585
2716
 
2586
2717
  # Set a custom user agent HTTP header. It can be usefull if you are behind some proxy or firewall.
2587
- #
2718
+ #
2588
2719
  # * +user_agent+ - The user agent string.
2589
2720
  # * *Returns* - The converter object.
2590
2721
  def setUserAgent(user_agent)
@@ -2593,7 +2724,7 @@ module Pdfcrowd
2593
2724
  end
2594
2725
 
2595
2726
  # Specifies an HTTP proxy that the API client library will use to connect to the internet.
2596
- #
2727
+ #
2597
2728
  # * +host+ - The proxy hostname.
2598
2729
  # * +port+ - The proxy port.
2599
2730
  # * +user_name+ - The username.
@@ -2605,7 +2736,7 @@ module Pdfcrowd
2605
2736
  end
2606
2737
 
2607
2738
  # 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.
2608
- #
2739
+ #
2609
2740
  # * +retry_count+ - Number of retries wanted.
2610
2741
  # * *Returns* - The converter object.
2611
2742
  def setRetryCount(retry_count)
@@ -2618,7 +2749,7 @@ module Pdfcrowd
2618
2749
  # Conversion from PDF to PDF.
2619
2750
  class PdfToPdfClient
2620
2751
  # Constructor for the Pdfcrowd API client.
2621
- #
2752
+ #
2622
2753
  # * +user_name+ - Your username at Pdfcrowd.
2623
2754
  # * +api_key+ - Your API key.
2624
2755
  def initialize(user_name, api_key)
@@ -2633,7 +2764,7 @@ module Pdfcrowd
2633
2764
  end
2634
2765
 
2635
2766
  # Specifies the action to be performed on the input PDFs.
2636
- #
2767
+ #
2637
2768
  # * +action+ - Allowed values are join, shuffle.
2638
2769
  # * *Returns* - The converter object.
2639
2770
  def setAction(action)
@@ -2652,14 +2783,14 @@ module Pdfcrowd
2652
2783
  end
2653
2784
 
2654
2785
  # Perform an action on the input files and write the output PDF to an output stream.
2655
- #
2786
+ #
2656
2787
  # * +out_stream+ - The output stream that will contain the output PDF.
2657
2788
  def convertToStream(out_stream)
2658
2789
  @helper.post(@fields, @files, @raw_data, out_stream)
2659
2790
  end
2660
2791
 
2661
2792
  # Perform an action on the input files and write the output PDF to a file.
2662
- #
2793
+ #
2663
2794
  # * +file_path+ - The output file path. The string must not be empty.
2664
2795
  def convertToFile(file_path)
2665
2796
  if (!(!file_path.nil? && !file_path.empty?))
@@ -2672,7 +2803,7 @@ module Pdfcrowd
2672
2803
  end
2673
2804
 
2674
2805
  # Add a PDF file to the list of the input PDFs.
2675
- #
2806
+ #
2676
2807
  # * +file_path+ - The file path to a local PDF file. The file must exist and not be empty.
2677
2808
  # * *Returns* - The converter object.
2678
2809
  def addPdfFile(file_path)
@@ -2686,7 +2817,7 @@ module Pdfcrowd
2686
2817
  end
2687
2818
 
2688
2819
  # Add in-memory raw PDF data to the list of the input PDFs.Typical usage is for adding PDF created by another Pdfcrowd converter. Example in PHP: $clientPdf2Pdf->addPdfRawData($clientHtml2Pdf->convertUrl('http://www.example.com'));
2689
- #
2820
+ #
2690
2821
  # * +pdf_raw_data+ - The raw PDF data. The input data must be PDF content.
2691
2822
  # * *Returns* - The converter object.
2692
2823
  def addPdfRawData(pdf_raw_data)
@@ -2699,8 +2830,8 @@ module Pdfcrowd
2699
2830
  self
2700
2831
  end
2701
2832
 
2702
- # 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.
2703
- #
2833
+ # 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.
2834
+ #
2704
2835
  # * +debug_log+ - Set to true to enable the debug logging.
2705
2836
  # * *Returns* - The converter object.
2706
2837
  def setDebugLog(debug_log)
@@ -2747,7 +2878,7 @@ module Pdfcrowd
2747
2878
  end
2748
2879
 
2749
2880
  # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
2750
- #
2881
+ #
2751
2882
  # * +tag+ - A string with the custom tag.
2752
2883
  # * *Returns* - The converter object.
2753
2884
  def setTag(tag)
@@ -2756,7 +2887,7 @@ module Pdfcrowd
2756
2887
  end
2757
2888
 
2758
2889
  # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
2759
- #
2890
+ #
2760
2891
  # * +use_http+ - Set to true to use HTTP.
2761
2892
  # * *Returns* - The converter object.
2762
2893
  def setUseHttp(use_http)
@@ -2765,7 +2896,7 @@ module Pdfcrowd
2765
2896
  end
2766
2897
 
2767
2898
  # Set a custom user agent HTTP header. It can be usefull if you are behind some proxy or firewall.
2768
- #
2899
+ #
2769
2900
  # * +user_agent+ - The user agent string.
2770
2901
  # * *Returns* - The converter object.
2771
2902
  def setUserAgent(user_agent)
@@ -2774,7 +2905,7 @@ module Pdfcrowd
2774
2905
  end
2775
2906
 
2776
2907
  # Specifies an HTTP proxy that the API client library will use to connect to the internet.
2777
- #
2908
+ #
2778
2909
  # * +host+ - The proxy hostname.
2779
2910
  # * +port+ - The proxy port.
2780
2911
  # * +user_name+ - The username.
@@ -2786,7 +2917,7 @@ module Pdfcrowd
2786
2917
  end
2787
2918
 
2788
2919
  # 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.
2789
- #
2920
+ #
2790
2921
  # * +retry_count+ - Number of retries wanted.
2791
2922
  # * *Returns* - The converter object.
2792
2923
  def setRetryCount(retry_count)
@@ -2799,7 +2930,7 @@ module Pdfcrowd
2799
2930
  # Conversion from an image to PDF.
2800
2931
  class ImageToPdfClient
2801
2932
  # Constructor for the Pdfcrowd API client.
2802
- #
2933
+ #
2803
2934
  # * +user_name+ - Your username at Pdfcrowd.
2804
2935
  # * +api_key+ - Your API key.
2805
2936
  def initialize(user_name, api_key)
@@ -2814,7 +2945,7 @@ module Pdfcrowd
2814
2945
  end
2815
2946
 
2816
2947
  # Convert an image.
2817
- #
2948
+ #
2818
2949
  # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
2819
2950
  # * *Returns* - Byte array containing the conversion output.
2820
2951
  def convertUrl(url)
@@ -2827,7 +2958,7 @@ module Pdfcrowd
2827
2958
  end
2828
2959
 
2829
2960
  # Convert an image and write the result to an output stream.
2830
- #
2961
+ #
2831
2962
  # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
2832
2963
  # * +out_stream+ - The output stream that will contain the conversion output.
2833
2964
  def convertUrlToStream(url, out_stream)
@@ -2840,7 +2971,7 @@ module Pdfcrowd
2840
2971
  end
2841
2972
 
2842
2973
  # Convert an image and write the result to a local file.
2843
- #
2974
+ #
2844
2975
  # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
2845
2976
  # * +file_path+ - The output file path. The string must not be empty.
2846
2977
  def convertUrlToFile(url, file_path)
@@ -2860,7 +2991,7 @@ module Pdfcrowd
2860
2991
  end
2861
2992
 
2862
2993
  # Convert a local file.
2863
- #
2994
+ #
2864
2995
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). The file must exist and not be empty.
2865
2996
  # * *Returns* - Byte array containing the conversion output.
2866
2997
  def convertFile(file)
@@ -2873,7 +3004,7 @@ module Pdfcrowd
2873
3004
  end
2874
3005
 
2875
3006
  # Convert a local file and write the result to an output stream.
2876
- #
3007
+ #
2877
3008
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). The file must exist and not be empty.
2878
3009
  # * +out_stream+ - The output stream that will contain the conversion output.
2879
3010
  def convertFileToStream(file, out_stream)
@@ -2886,7 +3017,7 @@ module Pdfcrowd
2886
3017
  end
2887
3018
 
2888
3019
  # Convert a local file and write the result to a local file.
2889
- #
3020
+ #
2890
3021
  # * +file+ - The path to a local file to convert. The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip). The file must exist and not be empty.
2891
3022
  # * +file_path+ - The output file path. The string must not be empty.
2892
3023
  def convertFileToFile(file, file_path)
@@ -2906,7 +3037,7 @@ module Pdfcrowd
2906
3037
  end
2907
3038
 
2908
3039
  # Convert raw data.
2909
- #
3040
+ #
2910
3041
  # * +data+ - The raw content to be converted.
2911
3042
  # * *Returns* - Byte array with the output.
2912
3043
  def convertRawData(data)
@@ -2915,7 +3046,7 @@ module Pdfcrowd
2915
3046
  end
2916
3047
 
2917
3048
  # Convert raw data and write the result to an output stream.
2918
- #
3049
+ #
2919
3050
  # * +data+ - The raw content to be converted.
2920
3051
  # * +out_stream+ - The output stream that will contain the conversion output.
2921
3052
  def convertRawDataToStream(data, out_stream)
@@ -2924,7 +3055,7 @@ module Pdfcrowd
2924
3055
  end
2925
3056
 
2926
3057
  # Convert raw data to a file.
2927
- #
3058
+ #
2928
3059
  # * +data+ - The raw content to be converted.
2929
3060
  # * +file_path+ - The output file path. The string must not be empty.
2930
3061
  def convertRawDataToFile(data, file_path)
@@ -2944,7 +3075,7 @@ module Pdfcrowd
2944
3075
  end
2945
3076
 
2946
3077
  # Resize the image.
2947
- #
3078
+ #
2948
3079
  # * +resize+ - The resize percentage or new image dimensions.
2949
3080
  # * *Returns* - The converter object.
2950
3081
  def setResize(resize)
@@ -2953,7 +3084,7 @@ module Pdfcrowd
2953
3084
  end
2954
3085
 
2955
3086
  # Rotate the image.
2956
- #
3087
+ #
2957
3088
  # * +rotate+ - The rotation specified in degrees.
2958
3089
  # * *Returns* - The converter object.
2959
3090
  def setRotate(rotate)
@@ -2961,8 +3092,8 @@ module Pdfcrowd
2961
3092
  self
2962
3093
  end
2963
3094
 
2964
- # 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.
2965
- #
3095
+ # 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.
3096
+ #
2966
3097
  # * +debug_log+ - Set to true to enable the debug logging.
2967
3098
  # * *Returns* - The converter object.
2968
3099
  def setDebugLog(debug_log)
@@ -3003,7 +3134,7 @@ module Pdfcrowd
3003
3134
  end
3004
3135
 
3005
3136
  # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
3006
- #
3137
+ #
3007
3138
  # * +tag+ - A string with the custom tag.
3008
3139
  # * *Returns* - The converter object.
3009
3140
  def setTag(tag)
@@ -3011,8 +3142,34 @@ module Pdfcrowd
3011
3142
  self
3012
3143
  end
3013
3144
 
3145
+ # 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.
3146
+ #
3147
+ # * +http_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
3148
+ # * *Returns* - The converter object.
3149
+ def setHttpProxy(http_proxy)
3150
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(http_proxy)
3151
+ raise Error.new(Pdfcrowd.create_invalid_value_message(http_proxy, "http_proxy", "image-to-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
3152
+ end
3153
+
3154
+ @fields['http_proxy'] = http_proxy
3155
+ self
3156
+ end
3157
+
3158
+ # 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.
3159
+ #
3160
+ # * +https_proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
3161
+ # * *Returns* - The converter object.
3162
+ def setHttpsProxy(https_proxy)
3163
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(https_proxy)
3164
+ raise Error.new(Pdfcrowd.create_invalid_value_message(https_proxy, "https_proxy", "image-to-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
3165
+ end
3166
+
3167
+ @fields['https_proxy'] = https_proxy
3168
+ self
3169
+ end
3170
+
3014
3171
  # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
3015
- #
3172
+ #
3016
3173
  # * +use_http+ - Set to true to use HTTP.
3017
3174
  # * *Returns* - The converter object.
3018
3175
  def setUseHttp(use_http)
@@ -3021,7 +3178,7 @@ module Pdfcrowd
3021
3178
  end
3022
3179
 
3023
3180
  # Set a custom user agent HTTP header. It can be usefull if you are behind some proxy or firewall.
3024
- #
3181
+ #
3025
3182
  # * +user_agent+ - The user agent string.
3026
3183
  # * *Returns* - The converter object.
3027
3184
  def setUserAgent(user_agent)
@@ -3030,7 +3187,7 @@ module Pdfcrowd
3030
3187
  end
3031
3188
 
3032
3189
  # Specifies an HTTP proxy that the API client library will use to connect to the internet.
3033
- #
3190
+ #
3034
3191
  # * +host+ - The proxy hostname.
3035
3192
  # * +port+ - The proxy port.
3036
3193
  # * +user_name+ - The username.
@@ -3042,7 +3199,7 @@ module Pdfcrowd
3042
3199
  end
3043
3200
 
3044
3201
  # 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.
3045
- #
3202
+ #
3046
3203
  # * +retry_count+ - Number of retries wanted.
3047
3204
  # * *Returns* - The converter object.
3048
3205
  def setRetryCount(retry_count)