pdfcrowd 5.10.0 → 5.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pdfcrowd.rb +560 -39
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26cd6f43af08ebb5a8181d034a73d17b884e5deef10c8ee92750690f5e35d62f
4
- data.tar.gz: 193dd80310673a5783d9f25642f6f09d1eed40f68762fb51c232036ba7543316
3
+ metadata.gz: 1e9ead18e25818ca273cb083afa7c71972b32ae7b1dde2bad0f627fa938f1fb2
4
+ data.tar.gz: e2db755bfd4fcc1cb0b07008980a0b0fc5b8725dc69c1dee66b9e96c164ce5b9
5
5
  SHA512:
6
- metadata.gz: 963f817840495dcca5869a5150c059a6d8bc14a94e378dd977cbeeb8a4ad0b9092d683e03eef37cb214654603c0bf4926505b877b3fddf82df44b7c2347cf866
7
- data.tar.gz: 324747ca72b05e865906855c1b4b4333a9f679f691379685e8db501176ae3fe732a38ef9c5d2c0583dc2c4720515ebf222ef978f8a4ae93928e4cc424a72bfb0
6
+ metadata.gz: e64915870affbacefc774cec4cc2fecc80e6aceb36cc902c82000a3eee4961f2fb2e45b4974ae30ed19d2f9243b1a936f137e3853d1c4151eb8de2dfcc763f25
7
+ data.tar.gz: 641de5978ca2174f15764a7069a8cd1d441c18acb57b4b3c597c923207086cec9745b5d64348499dbaa80bae135ac26bb9b779b91dc7621895ea598a310bbcc5
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.10.0'
533
+ CLIENT_VERSION = '5.12.0'
534
534
 
535
535
  class ConnectionHelper
536
536
  def initialize(user_name, api_key)
@@ -541,7 +541,7 @@ module Pdfcrowd
541
541
 
542
542
  setProxy(nil, nil, nil, nil)
543
543
  setUseHttp(false)
544
- setUserAgent('pdfcrowd_ruby_client/5.10.0 (https://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.12.0 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -963,11 +963,11 @@ module Pdfcrowd
963
963
 
964
964
  # Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF.
965
965
  #
966
- # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
966
+ # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
967
967
  # * *Returns* - The converter object.
968
968
  def setPageWidth(width)
969
969
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
970
- raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setPageWidth", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_page_width"), 470);
970
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setPageWidth", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_page_width"), 470);
971
971
  end
972
972
 
973
973
  @fields['page_width'] = width
@@ -976,11 +976,11 @@ module Pdfcrowd
976
976
 
977
977
  # 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.
978
978
  #
979
- # * +height+ - The value must be -1 or specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
979
+ # * +height+ - The value must be -1 or specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
980
980
  # * *Returns* - The converter object.
981
981
  def setPageHeight(height)
982
982
  unless /(?i)^0$|^\-1$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
983
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setPageHeight", "html-to-pdf", "The value must be -1 or specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_page_height"), 470);
983
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setPageHeight", "html-to-pdf", "The value must be -1 or specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_page_height"), 470);
984
984
  end
985
985
 
986
986
  @fields['page_height'] = height
@@ -989,8 +989,8 @@ module Pdfcrowd
989
989
 
990
990
  # Set the output page dimensions.
991
991
  #
992
- # * +width+ - Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
993
- # * +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. The value must be -1 or specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
992
+ # * +width+ - Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
993
+ # * +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. The value must be -1 or specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
994
994
  # * *Returns* - The converter object.
995
995
  def setPageDimensions(width, height)
996
996
  setPageWidth(width)
@@ -1013,11 +1013,11 @@ module Pdfcrowd
1013
1013
 
1014
1014
  # Set the output page top margin.
1015
1015
  #
1016
- # * +top+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1016
+ # * +top+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1017
1017
  # * *Returns* - The converter object.
1018
1018
  def setMarginTop(top)
1019
1019
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
1020
- raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_margin_top"), 470);
1020
+ raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_top"), 470);
1021
1021
  end
1022
1022
 
1023
1023
  @fields['margin_top'] = top
@@ -1026,11 +1026,11 @@ module Pdfcrowd
1026
1026
 
1027
1027
  # Set the output page right margin.
1028
1028
  #
1029
- # * +right+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1029
+ # * +right+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1030
1030
  # * *Returns* - The converter object.
1031
1031
  def setMarginRight(right)
1032
1032
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
1033
- raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_margin_right"), 470);
1033
+ raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_right"), 470);
1034
1034
  end
1035
1035
 
1036
1036
  @fields['margin_right'] = right
@@ -1039,11 +1039,11 @@ module Pdfcrowd
1039
1039
 
1040
1040
  # Set the output page bottom margin.
1041
1041
  #
1042
- # * +bottom+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1042
+ # * +bottom+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1043
1043
  # * *Returns* - The converter object.
1044
1044
  def setMarginBottom(bottom)
1045
1045
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
1046
- raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_margin_bottom"), 470);
1046
+ raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_bottom"), 470);
1047
1047
  end
1048
1048
 
1049
1049
  @fields['margin_bottom'] = bottom
@@ -1052,11 +1052,11 @@ module Pdfcrowd
1052
1052
 
1053
1053
  # Set the output page left margin.
1054
1054
  #
1055
- # * +left+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1055
+ # * +left+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1056
1056
  # * *Returns* - The converter object.
1057
1057
  def setMarginLeft(left)
1058
1058
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
1059
- raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_margin_left"), 470);
1059
+ raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_left"), 470);
1060
1060
  end
1061
1061
 
1062
1062
  @fields['margin_left'] = left
@@ -1074,10 +1074,10 @@ module Pdfcrowd
1074
1074
 
1075
1075
  # Set the output page margins.
1076
1076
  #
1077
- # * +top+ - Set the output page top margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1078
- # * +right+ - Set the output page right margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1079
- # * +bottom+ - Set the output page bottom margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1080
- # * +left+ - Set the output page left margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1077
+ # * +top+ - Set the output page top margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1078
+ # * +right+ - Set the output page right margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1079
+ # * +bottom+ - Set the output page bottom margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1080
+ # * +left+ - Set the output page left margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1081
1081
  # * *Returns* - The converter object.
1082
1082
  def setPageMargins(top, right, bottom, left)
1083
1083
  setMarginTop(top)
@@ -1111,11 +1111,11 @@ module Pdfcrowd
1111
1111
 
1112
1112
  # Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
1113
1113
  #
1114
- # * +x+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt". It may contain a negative value.
1114
+ # * +x+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt". It may contain a negative value.
1115
1115
  # * *Returns* - The converter object.
1116
1116
  def setContentAreaX(x)
1117
1117
  unless /(?i)^0$|^\-?[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
1118
- raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setContentAreaX", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\". It may contain a negative value.", "set_content_area_x"), 470);
1118
+ raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setContentAreaX", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\". It may contain a negative value.", "set_content_area_x"), 470);
1119
1119
  end
1120
1120
 
1121
1121
  @fields['content_area_x'] = x
@@ -1124,11 +1124,11 @@ module Pdfcrowd
1124
1124
 
1125
1125
  # Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
1126
1126
  #
1127
- # * +y+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt". It may contain a negative value.
1127
+ # * +y+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt". It may contain a negative value.
1128
1128
  # * *Returns* - The converter object.
1129
1129
  def setContentAreaY(y)
1130
1130
  unless /(?i)^0$|^\-?[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
1131
- raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setContentAreaY", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\". It may contain a negative value.", "set_content_area_y"), 470);
1131
+ raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setContentAreaY", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\". It may contain a negative value.", "set_content_area_y"), 470);
1132
1132
  end
1133
1133
 
1134
1134
  @fields['content_area_y'] = y
@@ -1137,11 +1137,11 @@ module Pdfcrowd
1137
1137
 
1138
1138
  # Set the width of the content area. It should be at least 1 inch.
1139
1139
  #
1140
- # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1140
+ # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1141
1141
  # * *Returns* - The converter object.
1142
1142
  def setContentAreaWidth(width)
1143
1143
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
1144
- raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentAreaWidth", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_content_area_width"), 470);
1144
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentAreaWidth", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_content_area_width"), 470);
1145
1145
  end
1146
1146
 
1147
1147
  @fields['content_area_width'] = width
@@ -1150,11 +1150,11 @@ module Pdfcrowd
1150
1150
 
1151
1151
  # Set the height of the content area. It should be at least 1 inch.
1152
1152
  #
1153
- # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1153
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1154
1154
  # * *Returns* - The converter object.
1155
1155
  def setContentAreaHeight(height)
1156
1156
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1157
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentAreaHeight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_content_area_height"), 470);
1157
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentAreaHeight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_content_area_height"), 470);
1158
1158
  end
1159
1159
 
1160
1160
  @fields['content_area_height'] = height
@@ -1163,10 +1163,10 @@ module Pdfcrowd
1163
1163
 
1164
1164
  # Set the content area position and size. The content area enables to specify a web page area to be converted.
1165
1165
  #
1166
- # * +x+ - Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt". It may contain a negative value.
1167
- # * +y+ - Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt". It may contain a negative value.
1168
- # * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1169
- # * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1166
+ # * +x+ - Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt". It may contain a negative value.
1167
+ # * +y+ - Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt". It may contain a negative value.
1168
+ # * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1169
+ # * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1170
1170
  # * *Returns* - The converter object.
1171
1171
  def setContentArea(x, y, width, height)
1172
1172
  setContentAreaX(x)
@@ -1217,11 +1217,11 @@ module Pdfcrowd
1217
1217
 
1218
1218
  # Set the header height.
1219
1219
  #
1220
- # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1220
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1221
1221
  # * *Returns* - The converter object.
1222
1222
  def setHeaderHeight(height)
1223
1223
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1224
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setHeaderHeight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_header_height"), 470);
1224
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setHeaderHeight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_header_height"), 470);
1225
1225
  end
1226
1226
 
1227
1227
  @fields['header_height'] = height
@@ -1265,11 +1265,11 @@ module Pdfcrowd
1265
1265
 
1266
1266
  # Set the footer height.
1267
1267
  #
1268
- # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", or points "pt".
1268
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
1269
1269
  # * *Returns* - The converter object.
1270
1270
  def setFooterHeight(height)
1271
1271
  unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
1272
- raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setFooterHeight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", or points \"pt\".", "set_footer_height"), 470);
1272
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setFooterHeight", "html-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_footer_height"), 470);
1273
1273
  end
1274
1274
 
1275
1275
  @fields['footer_height'] = height
@@ -3407,6 +3407,260 @@ module Pdfcrowd
3407
3407
  self
3408
3408
  end
3409
3409
 
3410
+ # Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
3411
+ #
3412
+ # * +x+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3413
+ # * *Returns* - The converter object.
3414
+ def setCropAreaX(x)
3415
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
3416
+ raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_x"), 470);
3417
+ end
3418
+
3419
+ @fields['crop_area_x'] = x
3420
+ self
3421
+ end
3422
+
3423
+ # Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
3424
+ #
3425
+ # * +y+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3426
+ # * *Returns* - The converter object.
3427
+ def setCropAreaY(y)
3428
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
3429
+ raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_y"), 470);
3430
+ end
3431
+
3432
+ @fields['crop_area_y'] = y
3433
+ self
3434
+ end
3435
+
3436
+ # Set the width of the content area. It should be at least 1 inch.
3437
+ #
3438
+ # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3439
+ # * *Returns* - The converter object.
3440
+ def setCropAreaWidth(width)
3441
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
3442
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_width"), 470);
3443
+ end
3444
+
3445
+ @fields['crop_area_width'] = width
3446
+ self
3447
+ end
3448
+
3449
+ # Set the height of the content area. It should be at least 1 inch.
3450
+ #
3451
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3452
+ # * *Returns* - The converter object.
3453
+ def setCropAreaHeight(height)
3454
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
3455
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_height"), 470);
3456
+ end
3457
+
3458
+ @fields['crop_area_height'] = height
3459
+ self
3460
+ end
3461
+
3462
+ # Set the content area position and size. The content area enables to specify the part to be converted.
3463
+ #
3464
+ # * +x+ - Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3465
+ # * +y+ - Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3466
+ # * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3467
+ # * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3468
+ # * *Returns* - The converter object.
3469
+ def setCropArea(x, y, width, height)
3470
+ setCropAreaX(x)
3471
+ setCropAreaY(y)
3472
+ setCropAreaWidth(width)
3473
+ setCropAreaHeight(height)
3474
+ self
3475
+ end
3476
+
3477
+ # Remove borders of an image which does not change in color.
3478
+ #
3479
+ # * +value+ - Set to true to remove borders.
3480
+ # * *Returns* - The converter object.
3481
+ def setRemoveBorders(value)
3482
+ @fields['remove_borders'] = value
3483
+ self
3484
+ end
3485
+
3486
+ # Set the output canvas size.
3487
+ #
3488
+ # * +size+ - Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.
3489
+ # * *Returns* - The converter object.
3490
+ def setCanvasSize(size)
3491
+ unless /(?i)^(A0|A1|A2|A3|A4|A5|A6|Letter)$/.match(size)
3492
+ raise Error.new(Pdfcrowd.create_invalid_value_message(size, "setCanvasSize", "image-to-image", "Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.", "set_canvas_size"), 470);
3493
+ end
3494
+
3495
+ @fields['canvas_size'] = size
3496
+ self
3497
+ end
3498
+
3499
+ # Set the output canvas width.
3500
+ #
3501
+ # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3502
+ # * *Returns* - The converter object.
3503
+ def setCanvasWidth(width)
3504
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
3505
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCanvasWidth", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_canvas_width"), 470);
3506
+ end
3507
+
3508
+ @fields['canvas_width'] = width
3509
+ self
3510
+ end
3511
+
3512
+ # Set the output canvas height.
3513
+ #
3514
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3515
+ # * *Returns* - The converter object.
3516
+ def setCanvasHeight(height)
3517
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
3518
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCanvasHeight", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_canvas_height"), 470);
3519
+ end
3520
+
3521
+ @fields['canvas_height'] = height
3522
+ self
3523
+ end
3524
+
3525
+ # Set the output canvas dimensions. If no canvas size is specified, margins are applied as a border around the image.
3526
+ #
3527
+ # * +width+ - Set the output canvas width. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3528
+ # * +height+ - Set the output canvas height. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3529
+ # * *Returns* - The converter object.
3530
+ def setCanvasDimensions(width, height)
3531
+ setCanvasWidth(width)
3532
+ setCanvasHeight(height)
3533
+ self
3534
+ end
3535
+
3536
+ # Set the output canvas orientation.
3537
+ #
3538
+ # * +orientation+ - Allowed values are landscape, portrait.
3539
+ # * *Returns* - The converter object.
3540
+ def setOrientation(orientation)
3541
+ unless /(?i)^(landscape|portrait)$/.match(orientation)
3542
+ raise Error.new(Pdfcrowd.create_invalid_value_message(orientation, "setOrientation", "image-to-image", "Allowed values are landscape, portrait.", "set_orientation"), 470);
3543
+ end
3544
+
3545
+ @fields['orientation'] = orientation
3546
+ self
3547
+ end
3548
+
3549
+ # Set the image position on the canvas.
3550
+ #
3551
+ # * +position+ - Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.
3552
+ # * *Returns* - The converter object.
3553
+ def setPosition(position)
3554
+ unless /(?i)^(center|top|bottom|left|right|top-left|top-right|bottom-left|bottom-right)$/.match(position)
3555
+ raise Error.new(Pdfcrowd.create_invalid_value_message(position, "setPosition", "image-to-image", "Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.", "set_position"), 470);
3556
+ end
3557
+
3558
+ @fields['position'] = position
3559
+ self
3560
+ end
3561
+
3562
+ # Set the mode to print the image on the canvas.
3563
+ #
3564
+ # * +mode+ - Allowed values are default, fit, stretch.
3565
+ # * *Returns* - The converter object.
3566
+ def setPrintCanvasMode(mode)
3567
+ unless /(?i)^(default|fit|stretch)$/.match(mode)
3568
+ raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setPrintCanvasMode", "image-to-image", "Allowed values are default, fit, stretch.", "set_print_canvas_mode"), 470);
3569
+ end
3570
+
3571
+ @fields['print_canvas_mode'] = mode
3572
+ self
3573
+ end
3574
+
3575
+ # Set the output canvas top margin.
3576
+ #
3577
+ # * +top+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3578
+ # * *Returns* - The converter object.
3579
+ def setMarginTop(top)
3580
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
3581
+ raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_top"), 470);
3582
+ end
3583
+
3584
+ @fields['margin_top'] = top
3585
+ self
3586
+ end
3587
+
3588
+ # Set the output canvas right margin.
3589
+ #
3590
+ # * +right+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3591
+ # * *Returns* - The converter object.
3592
+ def setMarginRight(right)
3593
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
3594
+ raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_right"), 470);
3595
+ end
3596
+
3597
+ @fields['margin_right'] = right
3598
+ self
3599
+ end
3600
+
3601
+ # Set the output canvas bottom margin.
3602
+ #
3603
+ # * +bottom+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3604
+ # * *Returns* - The converter object.
3605
+ def setMarginBottom(bottom)
3606
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
3607
+ raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_bottom"), 470);
3608
+ end
3609
+
3610
+ @fields['margin_bottom'] = bottom
3611
+ self
3612
+ end
3613
+
3614
+ # Set the output canvas left margin.
3615
+ #
3616
+ # * +left+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3617
+ # * *Returns* - The converter object.
3618
+ def setMarginLeft(left)
3619
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
3620
+ raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "image-to-image", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_left"), 470);
3621
+ end
3622
+
3623
+ @fields['margin_left'] = left
3624
+ self
3625
+ end
3626
+
3627
+ # Set the output canvas margins.
3628
+ #
3629
+ # * +top+ - Set the output canvas top margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3630
+ # * +right+ - Set the output canvas right margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3631
+ # * +bottom+ - Set the output canvas bottom margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3632
+ # * +left+ - Set the output canvas left margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
3633
+ # * *Returns* - The converter object.
3634
+ def setMargins(top, right, bottom, left)
3635
+ setMarginTop(top)
3636
+ setMarginRight(right)
3637
+ setMarginBottom(bottom)
3638
+ setMarginLeft(left)
3639
+ self
3640
+ end
3641
+
3642
+ # The canvas background color in RGB or RGBA hexadecimal format. The color fills the entire canvas regardless of margins. If no canvas size is specified and the image format supports background (e.g. PDF, PNG), the background color is applied too.
3643
+ #
3644
+ # * +color+ - The value must be in RRGGBB or RRGGBBAA hexadecimal format.
3645
+ # * *Returns* - The converter object.
3646
+ def setCanvasBackgroundColor(color)
3647
+ unless /^[0-9a-fA-F]{6,8}$/.match(color)
3648
+ raise Error.new(Pdfcrowd.create_invalid_value_message(color, "setCanvasBackgroundColor", "image-to-image", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_canvas_background_color"), 470);
3649
+ end
3650
+
3651
+ @fields['canvas_background_color'] = color
3652
+ self
3653
+ end
3654
+
3655
+ # Set the DPI resolution of the input image. The DPI affects margin options specified in points too (e.g. 1 point is equal to 1 pixel in 96 DPI).
3656
+ #
3657
+ # * +dpi+ - The DPI value.
3658
+ # * *Returns* - The converter object.
3659
+ def setDpi(dpi)
3660
+ @fields['dpi'] = dpi
3661
+ self
3662
+ end
3663
+
3410
3664
  # 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.
3411
3665
  #
3412
3666
  # * +value+ - Set to true to enable the debug logging.
@@ -3564,11 +3818,11 @@ module Pdfcrowd
3564
3818
 
3565
3819
  # Specifies the action to be performed on the input PDFs.
3566
3820
  #
3567
- # * +action+ - Allowed values are join, shuffle.
3821
+ # * +action+ - Allowed values are join, shuffle, extract, delete.
3568
3822
  # * *Returns* - The converter object.
3569
3823
  def setAction(action)
3570
- unless /(?i)^(join|shuffle)$/.match(action)
3571
- raise Error.new(Pdfcrowd.create_invalid_value_message(action, "setAction", "pdf-to-pdf", "Allowed values are join, shuffle.", "set_action"), 470);
3824
+ unless /(?i)^(join|shuffle|extract|delete)$/.match(action)
3825
+ raise Error.new(Pdfcrowd.create_invalid_value_message(action, "setAction", "pdf-to-pdf", "Allowed values are join, shuffle, extract, delete.", "set_action"), 470);
3572
3826
  end
3573
3827
 
3574
3828
  @fields['action'] = action
@@ -3638,6 +3892,19 @@ module Pdfcrowd
3638
3892
  self
3639
3893
  end
3640
3894
 
3895
+ # Set the page range for extract or delete action.
3896
+ #
3897
+ # * +pages+ - A comma separated list of page numbers or ranges.
3898
+ # * *Returns* - The converter object.
3899
+ def setPageRange(pages)
3900
+ unless /^(?:\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*))\s*,\s*)*\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*))\s*$/.match(pages)
3901
+ raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setPageRange", "pdf-to-pdf", "A comma separated list of page numbers or ranges.", "set_page_range"), 470);
3902
+ end
3903
+
3904
+ @fields['page_range'] = pages
3905
+ self
3906
+ end
3907
+
3641
3908
  # Apply a watermark to each page of the output PDF file. A watermark can be either a PDF or an image. If a multi-page file (PDF or TIFF) is used, the first page is used as the watermark.
3642
3909
  #
3643
3910
  # * +watermark+ - The file path to a local file. The file must exist and not be empty.
@@ -4303,6 +4570,260 @@ module Pdfcrowd
4303
4570
  self
4304
4571
  end
4305
4572
 
4573
+ # Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
4574
+ #
4575
+ # * +x+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4576
+ # * *Returns* - The converter object.
4577
+ def setCropAreaX(x)
4578
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
4579
+ raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_x"), 470);
4580
+ end
4581
+
4582
+ @fields['crop_area_x'] = x
4583
+ self
4584
+ end
4585
+
4586
+ # Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
4587
+ #
4588
+ # * +y+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4589
+ # * *Returns* - The converter object.
4590
+ def setCropAreaY(y)
4591
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
4592
+ raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_y"), 470);
4593
+ end
4594
+
4595
+ @fields['crop_area_y'] = y
4596
+ self
4597
+ end
4598
+
4599
+ # Set the width of the content area. It should be at least 1 inch.
4600
+ #
4601
+ # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4602
+ # * *Returns* - The converter object.
4603
+ def setCropAreaWidth(width)
4604
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
4605
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_width"), 470);
4606
+ end
4607
+
4608
+ @fields['crop_area_width'] = width
4609
+ self
4610
+ end
4611
+
4612
+ # Set the height of the content area. It should be at least 1 inch.
4613
+ #
4614
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4615
+ # * *Returns* - The converter object.
4616
+ def setCropAreaHeight(height)
4617
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
4618
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_crop_area_height"), 470);
4619
+ end
4620
+
4621
+ @fields['crop_area_height'] = height
4622
+ self
4623
+ end
4624
+
4625
+ # Set the content area position and size. The content area enables to specify the part to be converted.
4626
+ #
4627
+ # * +x+ - Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4628
+ # * +y+ - Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4629
+ # * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4630
+ # * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4631
+ # * *Returns* - The converter object.
4632
+ def setCropArea(x, y, width, height)
4633
+ setCropAreaX(x)
4634
+ setCropAreaY(y)
4635
+ setCropAreaWidth(width)
4636
+ setCropAreaHeight(height)
4637
+ self
4638
+ end
4639
+
4640
+ # Remove borders of an image which does not change in color.
4641
+ #
4642
+ # * +value+ - Set to true to remove borders.
4643
+ # * *Returns* - The converter object.
4644
+ def setRemoveBorders(value)
4645
+ @fields['remove_borders'] = value
4646
+ self
4647
+ end
4648
+
4649
+ # Set the output page size.
4650
+ #
4651
+ # * +size+ - Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.
4652
+ # * *Returns* - The converter object.
4653
+ def setPageSize(size)
4654
+ unless /(?i)^(A0|A1|A2|A3|A4|A5|A6|Letter)$/.match(size)
4655
+ raise Error.new(Pdfcrowd.create_invalid_value_message(size, "setPageSize", "image-to-pdf", "Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.", "set_page_size"), 470);
4656
+ end
4657
+
4658
+ @fields['page_size'] = size
4659
+ self
4660
+ end
4661
+
4662
+ # Set the output page width.
4663
+ #
4664
+ # * +width+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4665
+ # * *Returns* - The converter object.
4666
+ def setPageWidth(width)
4667
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
4668
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setPageWidth", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_page_width"), 470);
4669
+ end
4670
+
4671
+ @fields['page_width'] = width
4672
+ self
4673
+ end
4674
+
4675
+ # Set the output page height.
4676
+ #
4677
+ # * +height+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4678
+ # * *Returns* - The converter object.
4679
+ def setPageHeight(height)
4680
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
4681
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setPageHeight", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_page_height"), 470);
4682
+ end
4683
+
4684
+ @fields['page_height'] = height
4685
+ self
4686
+ end
4687
+
4688
+ # Set the output page dimensions. If no page size is specified, margins are applied as a border around the image.
4689
+ #
4690
+ # * +width+ - Set the output page width. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4691
+ # * +height+ - Set the output page height. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4692
+ # * *Returns* - The converter object.
4693
+ def setPageDimensions(width, height)
4694
+ setPageWidth(width)
4695
+ setPageHeight(height)
4696
+ self
4697
+ end
4698
+
4699
+ # Set the output page orientation.
4700
+ #
4701
+ # * +orientation+ - Allowed values are landscape, portrait.
4702
+ # * *Returns* - The converter object.
4703
+ def setOrientation(orientation)
4704
+ unless /(?i)^(landscape|portrait)$/.match(orientation)
4705
+ raise Error.new(Pdfcrowd.create_invalid_value_message(orientation, "setOrientation", "image-to-pdf", "Allowed values are landscape, portrait.", "set_orientation"), 470);
4706
+ end
4707
+
4708
+ @fields['orientation'] = orientation
4709
+ self
4710
+ end
4711
+
4712
+ # Set the image position on the page.
4713
+ #
4714
+ # * +position+ - Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.
4715
+ # * *Returns* - The converter object.
4716
+ def setPosition(position)
4717
+ unless /(?i)^(center|top|bottom|left|right|top-left|top-right|bottom-left|bottom-right)$/.match(position)
4718
+ raise Error.new(Pdfcrowd.create_invalid_value_message(position, "setPosition", "image-to-pdf", "Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.", "set_position"), 470);
4719
+ end
4720
+
4721
+ @fields['position'] = position
4722
+ self
4723
+ end
4724
+
4725
+ # Set the mode to print the image on the content area of the page.
4726
+ #
4727
+ # * +mode+ - Allowed values are default, fit, stretch.
4728
+ # * *Returns* - The converter object.
4729
+ def setPrintPageMode(mode)
4730
+ unless /(?i)^(default|fit|stretch)$/.match(mode)
4731
+ raise Error.new(Pdfcrowd.create_invalid_value_message(mode, "setPrintPageMode", "image-to-pdf", "Allowed values are default, fit, stretch.", "set_print_page_mode"), 470);
4732
+ end
4733
+
4734
+ @fields['print_page_mode'] = mode
4735
+ self
4736
+ end
4737
+
4738
+ # Set the output page top margin.
4739
+ #
4740
+ # * +top+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4741
+ # * *Returns* - The converter object.
4742
+ def setMarginTop(top)
4743
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
4744
+ raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_top"), 470);
4745
+ end
4746
+
4747
+ @fields['margin_top'] = top
4748
+ self
4749
+ end
4750
+
4751
+ # Set the output page right margin.
4752
+ #
4753
+ # * +right+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4754
+ # * *Returns* - The converter object.
4755
+ def setMarginRight(right)
4756
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
4757
+ raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_right"), 470);
4758
+ end
4759
+
4760
+ @fields['margin_right'] = right
4761
+ self
4762
+ end
4763
+
4764
+ # Set the output page bottom margin.
4765
+ #
4766
+ # * +bottom+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4767
+ # * *Returns* - The converter object.
4768
+ def setMarginBottom(bottom)
4769
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
4770
+ raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_bottom"), 470);
4771
+ end
4772
+
4773
+ @fields['margin_bottom'] = bottom
4774
+ self
4775
+ end
4776
+
4777
+ # Set the output page left margin.
4778
+ #
4779
+ # * +left+ - The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4780
+ # * *Returns* - The converter object.
4781
+ def setMarginLeft(left)
4782
+ unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
4783
+ raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "image-to-pdf", "The value must be specified in inches \"in\", millimeters \"mm\", centimeters \"cm\", pixels \"px\", or points \"pt\".", "set_margin_left"), 470);
4784
+ end
4785
+
4786
+ @fields['margin_left'] = left
4787
+ self
4788
+ end
4789
+
4790
+ # Set the output page margins.
4791
+ #
4792
+ # * +top+ - Set the output page top margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4793
+ # * +right+ - Set the output page right margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4794
+ # * +bottom+ - Set the output page bottom margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4795
+ # * +left+ - Set the output page left margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".
4796
+ # * *Returns* - The converter object.
4797
+ def setPageMargins(top, right, bottom, left)
4798
+ setMarginTop(top)
4799
+ setMarginRight(right)
4800
+ setMarginBottom(bottom)
4801
+ setMarginLeft(left)
4802
+ self
4803
+ end
4804
+
4805
+ # The page background color in RGB or RGBA hexadecimal format. The color fills the entire page regardless of the margins. If not page size is specified and the image format supports background (e.g. PDF, PNG), the background color is applied too.
4806
+ #
4807
+ # * +color+ - The value must be in RRGGBB or RRGGBBAA hexadecimal format.
4808
+ # * *Returns* - The converter object.
4809
+ def setPageBackgroundColor(color)
4810
+ unless /^[0-9a-fA-F]{6,8}$/.match(color)
4811
+ raise Error.new(Pdfcrowd.create_invalid_value_message(color, "setPageBackgroundColor", "image-to-pdf", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_page_background_color"), 470);
4812
+ end
4813
+
4814
+ @fields['page_background_color'] = color
4815
+ self
4816
+ end
4817
+
4818
+ # Set the DPI resolution of the input image. The DPI affects margin options specified in points too (e.g. 1 point is equal to 1 pixel in 96 DPI).
4819
+ #
4820
+ # * +dpi+ - The DPI value.
4821
+ # * *Returns* - The converter object.
4822
+ def setDpi(dpi)
4823
+ @fields['dpi'] = dpi
4824
+ self
4825
+ end
4826
+
4306
4827
  # Apply a watermark to each page of the output PDF file. A watermark can be either a PDF or an image. If a multi-page file (PDF or TIFF) is used, the first page is used as the watermark.
4307
4828
  #
4308
4829
  # * +watermark+ - The file path to a local file. The file must exist and not be 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.10.0
4
+ version: 5.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pdfcrowd Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
11
+ date: 2023-01-31 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.