pdfcrowd 5.1.0 → 5.1.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 +262 -262
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7043c685a1f94d4f4fc908be622607de34e3bc83df6c9b5c100baa6851e88b9
4
- data.tar.gz: 940c31501059ef749182c3162f81309747684f43299b2f2c0ce32cc5efff345a
3
+ metadata.gz: 2ce783233a9cfb07981027de99484b52696c70ac36865066e263cb4524fc3aa8
4
+ data.tar.gz: 8af414bdd2dd8822fcd83c02cf52837baa32449c46270aa19be1c2799c503ada
5
5
  SHA512:
6
- metadata.gz: 26430785af23b2f5a1002dd3b5b58958297379cdf19fef474f8e772ae903834476d481bd0f5b97c83fc2694410fd8709ead4b74300036326b926a46a2d846b3c
7
- data.tar.gz: 6372a0b8df9c3631110dab9fbcec8a42904503b15f3f6d43c6767b63b4f21232f4fed6e068a2dd8cd97094ebd1a5ca6e20ca02ccd84f44ff254bcafc81c136ab
6
+ metadata.gz: ea0a791e71eedbb2145fb754f9fb39a86583c5b5c7e4e00be87bc622a3299eca1267f1d111ee995fca6093cc5939643dda74c317aab13d067a420cf2b6e851c5
7
+ data.tar.gz: 110f85f489157e5db520340ca0d7ce68a14933566dbd2be2e2d5b338b4bdeb03dad99b143fbaee388a09e4c99e00477cbe51004fcb20aa14eec30145a4d2657b
data/lib/pdfcrowd.rb CHANGED
@@ -530,7 +530,7 @@ end
530
530
  module Pdfcrowd
531
531
  HOST = ENV["PDFCROWD_HOST"] || 'api.pdfcrowd.com'
532
532
  MULTIPART_BOUNDARY = '----------ThIs_Is_tHe_bOUnDary_$'
533
- CLIENT_VERSION = '5.1.0'
533
+ CLIENT_VERSION = '5.1.1'
534
534
 
535
535
  class ConnectionHelper
536
536
  def initialize(user_name, api_key)
@@ -541,7 +541,7 @@ module Pdfcrowd
541
541
 
542
542
  setProxy(nil, nil, nil, nil)
543
543
  setUseHttp(false)
544
- setUserAgent('pdfcrowd_ruby_client/5.1.0 (https://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.1.1 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -895,27 +895,27 @@ module Pdfcrowd
895
895
  end
896
896
  end
897
897
 
898
- # Convert an input stream.
898
+ # Convert the contents of an input stream.
899
899
  #
900
- # * +in_stream+ - The input stream with the source data.
900
+ # * +in_stream+ - The input stream with source data. The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).The archive can contain HTML code and its external assets (images, style sheets, javascript).
901
901
  # * *Returns* - Byte array containing the conversion output.
902
902
  def convertStream(in_stream)
903
903
  @raw_data['stream'] = in_stream.read
904
904
  @helper.post(@fields, @files, @raw_data)
905
905
  end
906
906
 
907
- # Convert an input stream and write the result to an output stream.
907
+ # Convert the contents of an input stream and write the result to an output stream.
908
908
  #
909
- # * +in_stream+ - The input stream with the source data.
909
+ # * +in_stream+ - The input stream with source data. The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).The archive can contain HTML code and its external assets (images, style sheets, javascript).
910
910
  # * +out_stream+ - The output stream that will contain the conversion output.
911
911
  def convertStreamToStream(in_stream, out_stream)
912
912
  @raw_data['stream'] = in_stream.read
913
913
  @helper.post(@fields, @files, @raw_data, out_stream)
914
914
  end
915
915
 
916
- # Convert an input stream and write the result to a local file.
916
+ # Convert the contents of an input stream and write the result to a local file.
917
917
  #
918
- # * +in_stream+ - The input stream with the source data.
918
+ # * +in_stream+ - The input stream with source data. The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).The archive can contain HTML code and its external assets (images, style sheets, javascript).
919
919
  # * +file_path+ - The output file path. The string must not be empty.
920
920
  def convertStreamToFile(in_stream, file_path)
921
921
  if (!(!file_path.nil? && !file_path.empty?))
@@ -1072,93 +1072,6 @@ module Pdfcrowd
1072
1072
  self
1073
1073
  end
1074
1074
 
1075
- # 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>
1076
- #
1077
- # * +url+ - The supported protocols are http:// and https://.
1078
- # * *Returns* - The converter object.
1079
- def setHeaderUrl(url)
1080
- unless /(?i)^https?:\/\/.*$/.match(url)
1081
- raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setHeaderUrl", "html-to-pdf", "The supported protocols are http:// and https://.", "set_header_url"), 470);
1082
- end
1083
-
1084
- @fields['header_url'] = url
1085
- self
1086
- end
1087
-
1088
- # 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>
1089
- #
1090
- # * +html+ - The string must not be empty.
1091
- # * *Returns* - The converter object.
1092
- def setHeaderHtml(html)
1093
- if (!(!html.nil? && !html.empty?))
1094
- raise Error.new(Pdfcrowd.create_invalid_value_message(html, "setHeaderHtml", "html-to-pdf", "The string must not be empty.", "set_header_html"), 470);
1095
- end
1096
-
1097
- @fields['header_html'] = html
1098
- self
1099
- end
1100
-
1101
- # Set the header height.
1102
- #
1103
- # * +height+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1104
- # * *Returns* - The converter object.
1105
- def setHeaderHeight(height)
1106
- unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1107
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setHeaderHeight", "html-to-pdf", "Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).", "set_header_height"), 470);
1108
- end
1109
-
1110
- @fields['header_height'] = height
1111
- self
1112
- end
1113
-
1114
- # 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>
1115
- #
1116
- # * +url+ - The supported protocols are http:// and https://.
1117
- # * *Returns* - The converter object.
1118
- def setFooterUrl(url)
1119
- unless /(?i)^https?:\/\/.*$/.match(url)
1120
- raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setFooterUrl", "html-to-pdf", "The supported protocols are http:// and https://.", "set_footer_url"), 470);
1121
- end
1122
-
1123
- @fields['footer_url'] = url
1124
- self
1125
- end
1126
-
1127
- # 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>
1128
- #
1129
- # * +html+ - The string must not be empty.
1130
- # * *Returns* - The converter object.
1131
- def setFooterHtml(html)
1132
- if (!(!html.nil? && !html.empty?))
1133
- raise Error.new(Pdfcrowd.create_invalid_value_message(html, "setFooterHtml", "html-to-pdf", "The string must not be empty.", "set_footer_html"), 470);
1134
- end
1135
-
1136
- @fields['footer_html'] = html
1137
- self
1138
- end
1139
-
1140
- # Set the footer height.
1141
- #
1142
- # * +height+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1143
- # * *Returns* - The converter object.
1144
- def setFooterHeight(height)
1145
- unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1146
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setFooterHeight", "html-to-pdf", "Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).", "set_footer_height"), 470);
1147
- end
1148
-
1149
- @fields['footer_height'] = height
1150
- self
1151
- end
1152
-
1153
- # Disable horizontal page margins for header and footer. The header/footer contents width will be equal to the physical page width.
1154
- #
1155
- # * +value+ - Set to true to disable horizontal margins for header and footer.
1156
- # * *Returns* - The converter object.
1157
- def setNoHeaderFooterHorizontalMargins(value)
1158
- @fields['no_header_footer_horizontal_margins'] = value
1159
- self
1160
- end
1161
-
1162
1075
  # Set the page range to print.
1163
1076
  #
1164
1077
  # * +pages+ - A comma separated list of page numbers or ranges.
@@ -1172,32 +1085,6 @@ module Pdfcrowd
1172
1085
  self
1173
1086
  end
1174
1087
 
1175
- # The page header is not printed on the specified pages.
1176
- #
1177
- # * +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 separated list of page numbers.
1178
- # * *Returns* - The converter object.
1179
- def setExcludeHeaderOnPages(pages)
1180
- unless /^(?:\s*\-?\d+\s*,)*\s*\-?\d+\s*$/.match(pages)
1181
- 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);
1182
- end
1183
-
1184
- @fields['exclude_header_on_pages'] = pages
1185
- self
1186
- end
1187
-
1188
- # The page footer is not printed on the specified pages.
1189
- #
1190
- # * +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 separated list of page numbers.
1191
- # * *Returns* - The converter object.
1192
- def setExcludeFooterOnPages(pages)
1193
- unless /^(?:\s*\-?\d+\s*,)*\s*\-?\d+\s*$/.match(pages)
1194
- 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);
1195
- end
1196
-
1197
- @fields['exclude_footer_on_pages'] = pages
1198
- self
1199
- end
1200
-
1201
1088
  # Set an offset between physical and logical page numbers.
1202
1089
  #
1203
1090
  # * +offset+ - Integer specifying page offset.
@@ -1287,79 +1174,129 @@ module Pdfcrowd
1287
1174
  self
1288
1175
  end
1289
1176
 
1290
- # Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
1177
+ # 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>
1291
1178
  #
1292
- # * +data_string+ - The input data string.
1179
+ # * +url+ - The supported protocols are http:// and https://.
1293
1180
  # * *Returns* - The converter object.
1294
- def setDataString(data_string)
1295
- @fields['data_string'] = data_string
1181
+ def setHeaderUrl(url)
1182
+ unless /(?i)^https?:\/\/.*$/.match(url)
1183
+ raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setHeaderUrl", "html-to-pdf", "The supported protocols are http:// and https://.", "set_header_url"), 470);
1184
+ end
1185
+
1186
+ @fields['header_url'] = url
1296
1187
  self
1297
1188
  end
1298
1189
 
1299
- # Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.
1190
+ # 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>
1300
1191
  #
1301
- # * +data_file+ - The file path to a local file containing the input data.
1192
+ # * +html+ - The string must not be empty.
1302
1193
  # * *Returns* - The converter object.
1303
- def setDataFile(data_file)
1304
- @files['data_file'] = data_file
1194
+ def setHeaderHtml(html)
1195
+ if (!(!html.nil? && !html.empty?))
1196
+ raise Error.new(Pdfcrowd.create_invalid_value_message(html, "setHeaderHtml", "html-to-pdf", "The string must not be empty.", "set_header_html"), 470);
1197
+ end
1198
+
1199
+ @fields['header_html'] = html
1305
1200
  self
1306
1201
  end
1307
1202
 
1308
- # Specify the input data format.
1203
+ # Set the header height.
1309
1204
  #
1310
- # * +data_format+ - The data format. Allowed values are auto, json, xml, yaml, csv.
1205
+ # * +height+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1311
1206
  # * *Returns* - The converter object.
1312
- def setDataFormat(data_format)
1313
- unless /(?i)^(auto|json|xml|yaml|csv)$/.match(data_format)
1314
- 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);
1207
+ def setHeaderHeight(height)
1208
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1209
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setHeaderHeight", "html-to-pdf", "Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).", "set_header_height"), 470);
1315
1210
  end
1316
1211
 
1317
- @fields['data_format'] = data_format
1212
+ @fields['header_height'] = height
1318
1213
  self
1319
1214
  end
1320
1215
 
1321
- # Set the encoding of the data file set by setDataFile.
1216
+ # 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>
1322
1217
  #
1323
- # * +encoding+ - The data file encoding.
1218
+ # * +url+ - The supported protocols are http:// and https://.
1324
1219
  # * *Returns* - The converter object.
1325
- def setDataEncoding(encoding)
1326
- @fields['data_encoding'] = encoding
1220
+ def setFooterUrl(url)
1221
+ unless /(?i)^https?:\/\/.*$/.match(url)
1222
+ raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setFooterUrl", "html-to-pdf", "The supported protocols are http:// and https://.", "set_footer_url"), 470);
1223
+ end
1224
+
1225
+ @fields['footer_url'] = url
1327
1226
  self
1328
1227
  end
1329
1228
 
1330
- # Ignore undefined variables in the HTML template. The default mode is strict so any undefined variable causes the conversion to fail. You can use {% if variable is defined %} to check if the variable is defined.
1229
+ # 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>
1331
1230
  #
1332
- # * +value+ - Set to true to ignore undefined variables.
1231
+ # * +html+ - The string must not be empty.
1333
1232
  # * *Returns* - The converter object.
1334
- def setDataIgnoreUndefined(value)
1335
- @fields['data_ignore_undefined'] = value
1233
+ def setFooterHtml(html)
1234
+ if (!(!html.nil? && !html.empty?))
1235
+ raise Error.new(Pdfcrowd.create_invalid_value_message(html, "setFooterHtml", "html-to-pdf", "The string must not be empty.", "set_footer_html"), 470);
1236
+ end
1237
+
1238
+ @fields['footer_html'] = html
1336
1239
  self
1337
1240
  end
1338
1241
 
1339
- # Auto escape HTML symbols in the input data before placing them into the output.
1242
+ # Set the footer height.
1340
1243
  #
1341
- # * +value+ - Set to true to turn auto escaping on.
1244
+ # * +height+ - Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).
1342
1245
  # * *Returns* - The converter object.
1343
- def setDataAutoEscape(value)
1344
- @fields['data_auto_escape'] = value
1246
+ def setFooterHeight(height)
1247
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1248
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setFooterHeight", "html-to-pdf", "Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt).", "set_footer_height"), 470);
1249
+ end
1250
+
1251
+ @fields['footer_height'] = height
1345
1252
  self
1346
1253
  end
1347
1254
 
1348
- # Auto trim whitespace around each template command block.
1255
+ # Disable horizontal page margins for header and footer. The header/footer contents width will be equal to the physical page width.
1349
1256
  #
1350
- # * +value+ - Set to true to turn auto trimming on.
1257
+ # * +value+ - Set to true to disable horizontal margins for header and footer.
1351
1258
  # * *Returns* - The converter object.
1352
- def setDataTrimBlocks(value)
1353
- @fields['data_trim_blocks'] = value
1259
+ def setNoHeaderFooterHorizontalMargins(value)
1260
+ @fields['no_header_footer_horizontal_margins'] = value
1354
1261
  self
1355
1262
  end
1356
1263
 
1357
- # Set the advanced data options:csv_delimiter - The CSV data delimiter, the default is ,.xml_remove_root - Remove the root XML element from the input data.data_root - The name of the root element inserted into the input data without a root node (e.g. CSV), the default is data.
1264
+ # The page header is not printed on the specified pages.
1358
1265
  #
1359
- # * +options+ - Comma separated list of options.
1266
+ # * +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 separated list of page numbers.
1360
1267
  # * *Returns* - The converter object.
1361
- def setDataOptions(options)
1362
- @fields['data_options'] = options
1268
+ def setExcludeHeaderOnPages(pages)
1269
+ unless /^(?:\s*\-?\d+\s*,)*\s*\-?\d+\s*$/.match(pages)
1270
+ 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);
1271
+ end
1272
+
1273
+ @fields['exclude_header_on_pages'] = pages
1274
+ self
1275
+ end
1276
+
1277
+ # The page footer is not printed on the specified pages.
1278
+ #
1279
+ # * +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 separated list of page numbers.
1280
+ # * *Returns* - The converter object.
1281
+ def setExcludeFooterOnPages(pages)
1282
+ unless /^(?:\s*\-?\d+\s*,)*\s*\-?\d+\s*$/.match(pages)
1283
+ 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);
1284
+ end
1285
+
1286
+ @fields['exclude_footer_on_pages'] = pages
1287
+ self
1288
+ end
1289
+
1290
+ # Set the scaling factor (zoom) for the header and footer.
1291
+ #
1292
+ # * +factor+ - The percentage value. The value must be in the range 10-500.
1293
+ # * *Returns* - The converter object.
1294
+ def setHeaderFooterScaleFactor(factor)
1295
+ if (!(Integer(factor) >= 10 && Integer(factor) <= 500))
1296
+ raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setHeaderFooterScaleFactor", "html-to-pdf", "The value must be in the range 10-500.", "set_header_footer_scale_factor"), 470);
1297
+ end
1298
+
1299
+ @fields['header_footer_scale_factor'] = factor
1363
1300
  self
1364
1301
  end
1365
1302
 
@@ -1806,19 +1743,6 @@ module Pdfcrowd
1806
1743
  self
1807
1744
  end
1808
1745
 
1809
- # Set the scaling factor (zoom) for the header and footer.
1810
- #
1811
- # * +factor+ - The percentage value. The value must be in the range 10-500.
1812
- # * *Returns* - The converter object.
1813
- def setHeaderFooterScaleFactor(factor)
1814
- if (!(Integer(factor) >= 10 && Integer(factor) <= 500))
1815
- raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setHeaderFooterScaleFactor", "html-to-pdf", "The value must be in the range 10-500.", "set_header_footer_scale_factor"), 470);
1816
- end
1817
-
1818
- @fields['header_footer_scale_factor'] = factor
1819
- self
1820
- end
1821
-
1822
1746
  # Set the quality of embedded JPEG images. A lower quality results in a smaller PDF file but can lead to compression artifacts.
1823
1747
  #
1824
1748
  # * +quality+ - The percentage value. The value must be in the range 1-100.
@@ -2085,6 +2009,82 @@ module Pdfcrowd
2085
2009
  self
2086
2010
  end
2087
2011
 
2012
+ # Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
2013
+ #
2014
+ # * +data_string+ - The input data string.
2015
+ # * *Returns* - The converter object.
2016
+ def setDataString(data_string)
2017
+ @fields['data_string'] = data_string
2018
+ self
2019
+ end
2020
+
2021
+ # Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.
2022
+ #
2023
+ # * +data_file+ - The file path to a local file containing the input data.
2024
+ # * *Returns* - The converter object.
2025
+ def setDataFile(data_file)
2026
+ @files['data_file'] = data_file
2027
+ self
2028
+ end
2029
+
2030
+ # Specify the input data format.
2031
+ #
2032
+ # * +data_format+ - The data format. Allowed values are auto, json, xml, yaml, csv.
2033
+ # * *Returns* - The converter object.
2034
+ def setDataFormat(data_format)
2035
+ unless /(?i)^(auto|json|xml|yaml|csv)$/.match(data_format)
2036
+ 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);
2037
+ end
2038
+
2039
+ @fields['data_format'] = data_format
2040
+ self
2041
+ end
2042
+
2043
+ # Set the encoding of the data file set by setDataFile.
2044
+ #
2045
+ # * +encoding+ - The data file encoding.
2046
+ # * *Returns* - The converter object.
2047
+ def setDataEncoding(encoding)
2048
+ @fields['data_encoding'] = encoding
2049
+ self
2050
+ end
2051
+
2052
+ # Ignore undefined variables in the HTML template. The default mode is strict so any undefined variable causes the conversion to fail. You can use {% if variable is defined %} to check if the variable is defined.
2053
+ #
2054
+ # * +value+ - Set to true to ignore undefined variables.
2055
+ # * *Returns* - The converter object.
2056
+ def setDataIgnoreUndefined(value)
2057
+ @fields['data_ignore_undefined'] = value
2058
+ self
2059
+ end
2060
+
2061
+ # Auto escape HTML symbols in the input data before placing them into the output.
2062
+ #
2063
+ # * +value+ - Set to true to turn auto escaping on.
2064
+ # * *Returns* - The converter object.
2065
+ def setDataAutoEscape(value)
2066
+ @fields['data_auto_escape'] = value
2067
+ self
2068
+ end
2069
+
2070
+ # Auto trim whitespace around each template command block.
2071
+ #
2072
+ # * +value+ - Set to true to turn auto trimming on.
2073
+ # * *Returns* - The converter object.
2074
+ def setDataTrimBlocks(value)
2075
+ @fields['data_trim_blocks'] = value
2076
+ self
2077
+ end
2078
+
2079
+ # Set the advanced data options:csv_delimiter - The CSV data delimiter, the default is ,.xml_remove_root - Remove the root XML element from the input data.data_root - The name of the root element inserted into the input data without a root node (e.g. CSV), the default is data.
2080
+ #
2081
+ # * +options+ - Comma separated list of options.
2082
+ # * *Returns* - The converter object.
2083
+ def setDataOptions(options)
2084
+ @fields['data_options'] = options
2085
+ self
2086
+ end
2087
+
2088
2088
  # 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.
2089
2089
  #
2090
2090
  # * +value+ - Set to true to enable the debug logging.
@@ -2487,27 +2487,27 @@ module Pdfcrowd
2487
2487
  end
2488
2488
  end
2489
2489
 
2490
- # Convert an input stream.
2490
+ # Convert the contents of an input stream.
2491
2491
  #
2492
- # * +in_stream+ - The input stream with the source data.
2492
+ # * +in_stream+ - The input stream with source data. The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).The archive can contain HTML code and its external assets (images, style sheets, javascript).
2493
2493
  # * *Returns* - Byte array containing the conversion output.
2494
2494
  def convertStream(in_stream)
2495
2495
  @raw_data['stream'] = in_stream.read
2496
2496
  @helper.post(@fields, @files, @raw_data)
2497
2497
  end
2498
2498
 
2499
- # Convert an input stream and write the result to an output stream.
2499
+ # Convert the contents of an input stream and write the result to an output stream.
2500
2500
  #
2501
- # * +in_stream+ - The input stream with the source data.
2501
+ # * +in_stream+ - The input stream with source data. The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).The archive can contain HTML code and its external assets (images, style sheets, javascript).
2502
2502
  # * +out_stream+ - The output stream that will contain the conversion output.
2503
2503
  def convertStreamToStream(in_stream, out_stream)
2504
2504
  @raw_data['stream'] = in_stream.read
2505
2505
  @helper.post(@fields, @files, @raw_data, out_stream)
2506
2506
  end
2507
2507
 
2508
- # Convert an input stream and write the result to a local file.
2508
+ # Convert the contents of an input stream and write the result to a local file.
2509
2509
  #
2510
- # * +in_stream+ - The input stream with the source data.
2510
+ # * +in_stream+ - The input stream with source data. The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).The archive can contain HTML code and its external assets (images, style sheets, javascript).
2511
2511
  # * +file_path+ - The output file path. The string must not be empty.
2512
2512
  def convertStreamToFile(in_stream, file_path)
2513
2513
  if (!(!file_path.nil? && !file_path.empty?))
@@ -2525,82 +2525,6 @@ module Pdfcrowd
2525
2525
  end
2526
2526
  end
2527
2527
 
2528
- # Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
2529
- #
2530
- # * +data_string+ - The input data string.
2531
- # * *Returns* - The converter object.
2532
- def setDataString(data_string)
2533
- @fields['data_string'] = data_string
2534
- self
2535
- end
2536
-
2537
- # Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.
2538
- #
2539
- # * +data_file+ - The file path to a local file containing the input data.
2540
- # * *Returns* - The converter object.
2541
- def setDataFile(data_file)
2542
- @files['data_file'] = data_file
2543
- self
2544
- end
2545
-
2546
- # Specify the input data format.
2547
- #
2548
- # * +data_format+ - The data format. Allowed values are auto, json, xml, yaml, csv.
2549
- # * *Returns* - The converter object.
2550
- def setDataFormat(data_format)
2551
- unless /(?i)^(auto|json|xml|yaml|csv)$/.match(data_format)
2552
- raise Error.new(Pdfcrowd.create_invalid_value_message(data_format, "setDataFormat", "html-to-image", "Allowed values are auto, json, xml, yaml, csv.", "set_data_format"), 470);
2553
- end
2554
-
2555
- @fields['data_format'] = data_format
2556
- self
2557
- end
2558
-
2559
- # Set the encoding of the data file set by setDataFile.
2560
- #
2561
- # * +encoding+ - The data file encoding.
2562
- # * *Returns* - The converter object.
2563
- def setDataEncoding(encoding)
2564
- @fields['data_encoding'] = encoding
2565
- self
2566
- end
2567
-
2568
- # Ignore undefined variables in the HTML template. The default mode is strict so any undefined variable causes the conversion to fail. You can use {% if variable is defined %} to check if the variable is defined.
2569
- #
2570
- # * +value+ - Set to true to ignore undefined variables.
2571
- # * *Returns* - The converter object.
2572
- def setDataIgnoreUndefined(value)
2573
- @fields['data_ignore_undefined'] = value
2574
- self
2575
- end
2576
-
2577
- # Auto escape HTML symbols in the input data before placing them into the output.
2578
- #
2579
- # * +value+ - Set to true to turn auto escaping on.
2580
- # * *Returns* - The converter object.
2581
- def setDataAutoEscape(value)
2582
- @fields['data_auto_escape'] = value
2583
- self
2584
- end
2585
-
2586
- # Auto trim whitespace around each template command block.
2587
- #
2588
- # * +value+ - Set to true to turn auto trimming on.
2589
- # * *Returns* - The converter object.
2590
- def setDataTrimBlocks(value)
2591
- @fields['data_trim_blocks'] = value
2592
- self
2593
- end
2594
-
2595
- # Set the advanced data options:csv_delimiter - The CSV data delimiter, the default is ,.xml_remove_root - Remove the root XML element from the input data.data_root - The name of the root element inserted into the input data without a root node (e.g. CSV), the default is data.
2596
- #
2597
- # * +options+ - Comma separated list of options.
2598
- # * *Returns* - The converter object.
2599
- def setDataOptions(options)
2600
- @fields['data_options'] = options
2601
- self
2602
- end
2603
-
2604
2528
  # Use the print version of the page if available (@media print).
2605
2529
  #
2606
2530
  # * +value+ - Set to true to use the print version of the page.
@@ -2903,6 +2827,82 @@ module Pdfcrowd
2903
2827
  self
2904
2828
  end
2905
2829
 
2830
+ # Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
2831
+ #
2832
+ # * +data_string+ - The input data string.
2833
+ # * *Returns* - The converter object.
2834
+ def setDataString(data_string)
2835
+ @fields['data_string'] = data_string
2836
+ self
2837
+ end
2838
+
2839
+ # Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.
2840
+ #
2841
+ # * +data_file+ - The file path to a local file containing the input data.
2842
+ # * *Returns* - The converter object.
2843
+ def setDataFile(data_file)
2844
+ @files['data_file'] = data_file
2845
+ self
2846
+ end
2847
+
2848
+ # Specify the input data format.
2849
+ #
2850
+ # * +data_format+ - The data format. Allowed values are auto, json, xml, yaml, csv.
2851
+ # * *Returns* - The converter object.
2852
+ def setDataFormat(data_format)
2853
+ unless /(?i)^(auto|json|xml|yaml|csv)$/.match(data_format)
2854
+ raise Error.new(Pdfcrowd.create_invalid_value_message(data_format, "setDataFormat", "html-to-image", "Allowed values are auto, json, xml, yaml, csv.", "set_data_format"), 470);
2855
+ end
2856
+
2857
+ @fields['data_format'] = data_format
2858
+ self
2859
+ end
2860
+
2861
+ # Set the encoding of the data file set by setDataFile.
2862
+ #
2863
+ # * +encoding+ - The data file encoding.
2864
+ # * *Returns* - The converter object.
2865
+ def setDataEncoding(encoding)
2866
+ @fields['data_encoding'] = encoding
2867
+ self
2868
+ end
2869
+
2870
+ # Ignore undefined variables in the HTML template. The default mode is strict so any undefined variable causes the conversion to fail. You can use {% if variable is defined %} to check if the variable is defined.
2871
+ #
2872
+ # * +value+ - Set to true to ignore undefined variables.
2873
+ # * *Returns* - The converter object.
2874
+ def setDataIgnoreUndefined(value)
2875
+ @fields['data_ignore_undefined'] = value
2876
+ self
2877
+ end
2878
+
2879
+ # Auto escape HTML symbols in the input data before placing them into the output.
2880
+ #
2881
+ # * +value+ - Set to true to turn auto escaping on.
2882
+ # * *Returns* - The converter object.
2883
+ def setDataAutoEscape(value)
2884
+ @fields['data_auto_escape'] = value
2885
+ self
2886
+ end
2887
+
2888
+ # Auto trim whitespace around each template command block.
2889
+ #
2890
+ # * +value+ - Set to true to turn auto trimming on.
2891
+ # * *Returns* - The converter object.
2892
+ def setDataTrimBlocks(value)
2893
+ @fields['data_trim_blocks'] = value
2894
+ self
2895
+ end
2896
+
2897
+ # Set the advanced data options:csv_delimiter - The CSV data delimiter, the default is ,.xml_remove_root - Remove the root XML element from the input data.data_root - The name of the root element inserted into the input data without a root node (e.g. CSV), the default is data.
2898
+ #
2899
+ # * +options+ - Comma separated list of options.
2900
+ # * *Returns* - The converter object.
2901
+ def setDataOptions(options)
2902
+ @fields['data_options'] = options
2903
+ self
2904
+ end
2905
+
2906
2906
  # 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.
2907
2907
  #
2908
2908
  # * +value+ - Set to true to enable the debug logging.
@@ -3210,27 +3210,27 @@ module Pdfcrowd
3210
3210
  end
3211
3211
  end
3212
3212
 
3213
- # Convert an input stream.
3213
+ # Convert the contents of an input stream.
3214
3214
  #
3215
- # * +in_stream+ - The input stream with the source data.
3215
+ # * +in_stream+ - The input stream with source data.
3216
3216
  # * *Returns* - Byte array containing the conversion output.
3217
3217
  def convertStream(in_stream)
3218
3218
  @raw_data['stream'] = in_stream.read
3219
3219
  @helper.post(@fields, @files, @raw_data)
3220
3220
  end
3221
3221
 
3222
- # Convert an input stream and write the result to an output stream.
3222
+ # Convert the contents of an input stream and write the result to an output stream.
3223
3223
  #
3224
- # * +in_stream+ - The input stream with the source data.
3224
+ # * +in_stream+ - The input stream with source data.
3225
3225
  # * +out_stream+ - The output stream that will contain the conversion output.
3226
3226
  def convertStreamToStream(in_stream, out_stream)
3227
3227
  @raw_data['stream'] = in_stream.read
3228
3228
  @helper.post(@fields, @files, @raw_data, out_stream)
3229
3229
  end
3230
3230
 
3231
- # Convert an input stream and write the result to a local file.
3231
+ # Convert the contents of an input stream and write the result to a local file.
3232
3232
  #
3233
- # * +in_stream+ - The input stream with the source data.
3233
+ # * +in_stream+ - The input stream with source data.
3234
3234
  # * +file_path+ - The output file path. The string must not be empty.
3235
3235
  def convertStreamToFile(in_stream, file_path)
3236
3236
  if (!(!file_path.nil? && !file_path.empty?))
@@ -4061,27 +4061,27 @@ module Pdfcrowd
4061
4061
  end
4062
4062
  end
4063
4063
 
4064
- # Convert an input stream.
4064
+ # Convert the contents of an input stream.
4065
4065
  #
4066
- # * +in_stream+ - The input stream with the source data.
4066
+ # * +in_stream+ - The input stream with source data.
4067
4067
  # * *Returns* - Byte array containing the conversion output.
4068
4068
  def convertStream(in_stream)
4069
4069
  @raw_data['stream'] = in_stream.read
4070
4070
  @helper.post(@fields, @files, @raw_data)
4071
4071
  end
4072
4072
 
4073
- # Convert an input stream and write the result to an output stream.
4073
+ # Convert the contents of an input stream and write the result to an output stream.
4074
4074
  #
4075
- # * +in_stream+ - The input stream with the source data.
4075
+ # * +in_stream+ - The input stream with source data.
4076
4076
  # * +out_stream+ - The output stream that will contain the conversion output.
4077
4077
  def convertStreamToStream(in_stream, out_stream)
4078
4078
  @raw_data['stream'] = in_stream.read
4079
4079
  @helper.post(@fields, @files, @raw_data, out_stream)
4080
4080
  end
4081
4081
 
4082
- # Convert an input stream and write the result to a local file.
4082
+ # Convert the contents of an input stream and write the result to a local file.
4083
4083
  #
4084
- # * +in_stream+ - The input stream with the source data.
4084
+ # * +in_stream+ - The input stream with source data.
4085
4085
  # * +file_path+ - The output file path. The string must not be empty.
4086
4086
  def convertStreamToFile(in_stream, file_path)
4087
4087
  if (!(!file_path.nil? && !file_path.empty?))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfcrowd
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pdfcrowd Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-14 00:00:00.000000000 Z
11
+ date: 2021-05-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Pdfcrowd API lets you easily convert between HTML, PDF and various
14
14
  image formats.
@@ -37,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  requirements: []
40
- rubygems_version: 3.1.3
40
+ rubygems_version: 3.1.2
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: A client for the Pdfcrowd API.