pdfcrowd 6.4.0 → 6.5.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.
- checksums.yaml +4 -4
- data/lib/pdfcrowd.rb +274 -246
- metadata +6 -6
data/lib/pdfcrowd.rb
CHANGED
@@ -44,24 +44,52 @@ module Pdfcrowd
|
|
44
44
|
# Thrown when an error occurs.
|
45
45
|
#
|
46
46
|
class Error < RuntimeError
|
47
|
-
attr_reader :http_code, :error
|
47
|
+
attr_reader :http_code, :error, :message, :doc_link, :reason_code
|
48
48
|
|
49
49
|
def initialize(error, http_code=nil)
|
50
50
|
super()
|
51
|
-
@http_code = http_code
|
52
51
|
@error = error
|
52
|
+
error_match = @error.match(/^(\d+)\.(\d+)\s+-\s+(.*?)(?:\s+Documentation link:\s+(.*))?$/) ||
|
53
|
+
@error.scan(/^(\d+)\.(\d+)\s+-\s+(.*?)(?:\s+Documentation link:\s+(.*))?$/m)
|
54
|
+
if error_match and error_match != []
|
55
|
+
@http_code = error_match[1]
|
56
|
+
@reason_code = error_match[2]
|
57
|
+
@message = error_match[3]
|
58
|
+
@doc_link = error_match[4] || ''
|
59
|
+
else
|
60
|
+
@http_code = http_code
|
61
|
+
@reason_code = -1
|
62
|
+
@message = @error
|
63
|
+
if @http_code
|
64
|
+
@error = "#{@http_code} - #{@error}"
|
65
|
+
end
|
66
|
+
@doc_link = ''
|
67
|
+
end
|
53
68
|
end
|
54
69
|
|
55
70
|
def to_s()
|
56
|
-
|
71
|
+
@error
|
57
72
|
end
|
58
73
|
|
59
74
|
def getCode()
|
75
|
+
warn "[DEPRECATION] `getCode` is obsolete and will be removed in future versions. Use `getStatusCode` instead."
|
76
|
+
@http_code
|
77
|
+
end
|
78
|
+
|
79
|
+
def getStatusCode()
|
60
80
|
@http_code
|
61
81
|
end
|
62
82
|
|
83
|
+
def getReasonCode()
|
84
|
+
@reason_code
|
85
|
+
end
|
86
|
+
|
63
87
|
def getMessage()
|
64
|
-
@
|
88
|
+
@message
|
89
|
+
end
|
90
|
+
|
91
|
+
def getDocumentationLink()
|
92
|
+
@doc_link
|
65
93
|
end
|
66
94
|
end
|
67
95
|
|
@@ -530,7 +558,7 @@ end
|
|
530
558
|
module Pdfcrowd
|
531
559
|
HOST = ENV["PDFCROWD_HOST"] || 'api.pdfcrowd.com'
|
532
560
|
MULTIPART_BOUNDARY = '----------ThIs_Is_tHe_bOUnDary_$'
|
533
|
-
CLIENT_VERSION = '6.
|
561
|
+
CLIENT_VERSION = '6.5.0'
|
534
562
|
|
535
563
|
class ConnectionHelper
|
536
564
|
def initialize(user_name, api_key)
|
@@ -541,7 +569,7 @@ module Pdfcrowd
|
|
541
569
|
|
542
570
|
setProxy(nil, nil, nil, nil)
|
543
571
|
setUseHttp(false)
|
544
|
-
setUserAgent('pdfcrowd_ruby_client/6.
|
572
|
+
setUserAgent('pdfcrowd_ruby_client/6.5.0 (https://pdfcrowd.com)')
|
545
573
|
|
546
574
|
@retry_count = 1
|
547
575
|
@converter_version = '24.04'
|
@@ -681,7 +709,7 @@ module Pdfcrowd
|
|
681
709
|
begin
|
682
710
|
return exec_request(request, out_stream)
|
683
711
|
rescue Error => err
|
684
|
-
if (err.
|
712
|
+
if (err.getStatusCode() == '502' or err.getStatusCode() == '503') and @retry_count > @retry
|
685
713
|
@retry += 1
|
686
714
|
sleep(@retry * 0.1)
|
687
715
|
else
|
@@ -726,18 +754,18 @@ module Pdfcrowd
|
|
726
754
|
rescue Timeout::Error => why
|
727
755
|
raise Error.new("Operation timed out\n")
|
728
756
|
rescue OpenSSL::SSL::SSLError => why
|
729
|
-
raise Error.new("There was a problem connecting to
|
730
|
-
"\nYou can still use the API over HTTP, you just need to add the following line right after
|
731
|
-
|
757
|
+
raise Error.new("400.356 - There was a problem connecting to PDFCrowd servers over HTTPS:\n#{why}" +
|
758
|
+
"\nYou can still use the API over HTTP, you just need to add the following line right after PDFCrowd client initialization:\nself.setUseHttp(true)",
|
759
|
+
0)
|
732
760
|
end
|
733
761
|
end
|
734
762
|
end
|
735
763
|
end
|
736
764
|
|
737
765
|
def self.create_invalid_value_message(value, field, converter, hint, id)
|
738
|
-
message = "Invalid value '%s' for %s." % [value, field]
|
766
|
+
message = "400.311 - Invalid value '%s' for the '%s' option." % [value, field]
|
739
767
|
message += " " + hint if hint
|
740
|
-
return message + " " + "
|
768
|
+
return message + " " + "Documentation link: https://www.pdfcrowd.com/api/%s-ruby/ref/#%s" % [converter, id]
|
741
769
|
end
|
742
770
|
|
743
771
|
# generated code
|
@@ -761,11 +789,11 @@ module Pdfcrowd
|
|
761
789
|
|
762
790
|
# Convert a web page.
|
763
791
|
#
|
764
|
-
# * +url+ - The address of the web page to convert.
|
792
|
+
# * +url+ - The address of the web page to convert. Supported protocols are http:// and https://.
|
765
793
|
# * *Returns* - Byte array containing the conversion output.
|
766
794
|
def convertUrl(url)
|
767
795
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
768
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "html-to-pdf", "
|
796
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
769
797
|
end
|
770
798
|
|
771
799
|
@fields['url'] = url
|
@@ -774,11 +802,11 @@ module Pdfcrowd
|
|
774
802
|
|
775
803
|
# Convert a web page and write the result to an output stream.
|
776
804
|
#
|
777
|
-
# * +url+ - The address of the web page to convert.
|
805
|
+
# * +url+ - The address of the web page to convert. Supported protocols are http:// and https://.
|
778
806
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
779
807
|
def convertUrlToStream(url, out_stream)
|
780
808
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
781
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "html-to-pdf", "
|
809
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "html-to-pdf", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
782
810
|
end
|
783
811
|
|
784
812
|
@fields['url'] = url
|
@@ -787,7 +815,7 @@ module Pdfcrowd
|
|
787
815
|
|
788
816
|
# Convert a web page and write the result to a local file.
|
789
817
|
#
|
790
|
-
# * +url+ - The address of the web page to convert.
|
818
|
+
# * +url+ - The address of the web page to convert. Supported protocols are http:// and https://.
|
791
819
|
# * +file_path+ - The output file path. The string must not be empty.
|
792
820
|
def convertUrlToFile(url, file_path)
|
793
821
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -959,11 +987,11 @@ module Pdfcrowd
|
|
959
987
|
|
960
988
|
# Set the output page width. The safe maximum is 200in otherwise some PDF viewers may be unable to open the PDF.
|
961
989
|
#
|
962
|
-
# * +width+ - The value must be specified in inches
|
990
|
+
# * +width+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
963
991
|
# * *Returns* - The converter object.
|
964
992
|
def setPageWidth(width)
|
965
993
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
|
966
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setPageWidth", "html-to-pdf", "The value must be specified in inches
|
994
|
+
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);
|
967
995
|
end
|
968
996
|
|
969
997
|
@fields['page_width'] = width
|
@@ -972,11 +1000,11 @@ module Pdfcrowd
|
|
972
1000
|
|
973
1001
|
# 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.
|
974
1002
|
#
|
975
|
-
# * +height+ - The value must be -1 or specified in inches
|
1003
|
+
# * +height+ - The value must be -1 or specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
976
1004
|
# * *Returns* - The converter object.
|
977
1005
|
def setPageHeight(height)
|
978
1006
|
unless /(?i)^0$|^\-1$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
979
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setPageHeight", "html-to-pdf", "The value must be -1 or specified in inches
|
1007
|
+
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);
|
980
1008
|
end
|
981
1009
|
|
982
1010
|
@fields['page_height'] = height
|
@@ -985,8 +1013,8 @@ module Pdfcrowd
|
|
985
1013
|
|
986
1014
|
# Set the output page dimensions.
|
987
1015
|
#
|
988
|
-
# * +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
|
989
|
-
# * +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
|
1016
|
+
# * +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'.
|
1017
|
+
# * +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'.
|
990
1018
|
# * *Returns* - The converter object.
|
991
1019
|
def setPageDimensions(width, height)
|
992
1020
|
setPageWidth(width)
|
@@ -1009,11 +1037,11 @@ module Pdfcrowd
|
|
1009
1037
|
|
1010
1038
|
# Set the output page top margin.
|
1011
1039
|
#
|
1012
|
-
# * +top+ - The value must be specified in inches
|
1040
|
+
# * +top+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1013
1041
|
# * *Returns* - The converter object.
|
1014
1042
|
def setMarginTop(top)
|
1015
1043
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
|
1016
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "html-to-pdf", "The value must be specified in inches
|
1044
|
+
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);
|
1017
1045
|
end
|
1018
1046
|
|
1019
1047
|
@fields['margin_top'] = top
|
@@ -1022,11 +1050,11 @@ module Pdfcrowd
|
|
1022
1050
|
|
1023
1051
|
# Set the output page right margin.
|
1024
1052
|
#
|
1025
|
-
# * +right+ - The value must be specified in inches
|
1053
|
+
# * +right+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1026
1054
|
# * *Returns* - The converter object.
|
1027
1055
|
def setMarginRight(right)
|
1028
1056
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
|
1029
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "html-to-pdf", "The value must be specified in inches
|
1057
|
+
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);
|
1030
1058
|
end
|
1031
1059
|
|
1032
1060
|
@fields['margin_right'] = right
|
@@ -1035,11 +1063,11 @@ module Pdfcrowd
|
|
1035
1063
|
|
1036
1064
|
# Set the output page bottom margin.
|
1037
1065
|
#
|
1038
|
-
# * +bottom+ - The value must be specified in inches
|
1066
|
+
# * +bottom+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1039
1067
|
# * *Returns* - The converter object.
|
1040
1068
|
def setMarginBottom(bottom)
|
1041
1069
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
|
1042
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "html-to-pdf", "The value must be specified in inches
|
1070
|
+
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);
|
1043
1071
|
end
|
1044
1072
|
|
1045
1073
|
@fields['margin_bottom'] = bottom
|
@@ -1048,11 +1076,11 @@ module Pdfcrowd
|
|
1048
1076
|
|
1049
1077
|
# Set the output page left margin.
|
1050
1078
|
#
|
1051
|
-
# * +left+ - The value must be specified in inches
|
1079
|
+
# * +left+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1052
1080
|
# * *Returns* - The converter object.
|
1053
1081
|
def setMarginLeft(left)
|
1054
1082
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
|
1055
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "html-to-pdf", "The value must be specified in inches
|
1083
|
+
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);
|
1056
1084
|
end
|
1057
1085
|
|
1058
1086
|
@fields['margin_left'] = left
|
@@ -1070,10 +1098,10 @@ module Pdfcrowd
|
|
1070
1098
|
|
1071
1099
|
# Set the output page margins.
|
1072
1100
|
#
|
1073
|
-
# * +top+ - Set the output page top margin. The value must be specified in inches
|
1074
|
-
# * +right+ - Set the output page right margin. The value must be specified in inches
|
1075
|
-
# * +bottom+ - Set the output page bottom margin. The value must be specified in inches
|
1076
|
-
# * +left+ - Set the output page left margin. The value must be specified in inches
|
1101
|
+
# * +top+ - Set the output page top margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1102
|
+
# * +right+ - Set the output page right margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1103
|
+
# * +bottom+ - Set the output page bottom margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1104
|
+
# * +left+ - Set the output page left margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1077
1105
|
# * *Returns* - The converter object.
|
1078
1106
|
def setPageMargins(top, right, bottom, left)
|
1079
1107
|
setMarginTop(top)
|
@@ -1085,11 +1113,11 @@ module Pdfcrowd
|
|
1085
1113
|
|
1086
1114
|
# Set the page range to print.
|
1087
1115
|
#
|
1088
|
-
# * +pages+ - A comma separated list of page numbers or ranges. Special strings may be used, such as
|
1116
|
+
# * +pages+ - A comma separated list of page numbers or ranges. Special strings may be used, such as 'odd', 'even' and 'last'.
|
1089
1117
|
# * *Returns* - The converter object.
|
1090
1118
|
def setPrintPageRange(pages)
|
1091
1119
|
unless /^(?:\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*)|odd|even|last)\s*,\s*)*\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*)|odd|even|last)\s*$/.match(pages)
|
1092
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setPrintPageRange", "html-to-pdf", "A comma separated list of page numbers or ranges. Special strings may be used, such as
|
1120
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setPrintPageRange", "html-to-pdf", "A comma separated list of page numbers or ranges. Special strings may be used, such as 'odd', 'even' and 'last'.", "set_print_page_range"), 470);
|
1093
1121
|
end
|
1094
1122
|
|
1095
1123
|
@fields['print_page_range'] = pages
|
@@ -1098,11 +1126,11 @@ module Pdfcrowd
|
|
1098
1126
|
|
1099
1127
|
# Set the viewport width for formatting the HTML content when generating a PDF. By specifying a viewport width, you can control how the content is rendered, ensuring it mimics the appearance on various devices or matches specific design requirements.
|
1100
1128
|
#
|
1101
|
-
# * +width+ - The width of the viewport. The value must be
|
1129
|
+
# * +width+ - The width of the viewport. The value must be 'balanced', 'small', 'medium', 'large', 'extra-large', or a number in the range 96-65000px.
|
1102
1130
|
# * *Returns* - The converter object.
|
1103
1131
|
def setContentViewportWidth(width)
|
1104
1132
|
unless /(?i)^(balanced|small|medium|large|extra-large|[0-9]+(px)?)$/.match(width)
|
1105
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentViewportWidth", "html-to-pdf", "The value must be
|
1133
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentViewportWidth", "html-to-pdf", "The value must be 'balanced', 'small', 'medium', 'large', 'extra-large', or a number in the range 96-65000px.", "set_content_viewport_width"), 470);
|
1106
1134
|
end
|
1107
1135
|
|
1108
1136
|
@fields['content_viewport_width'] = width
|
@@ -1111,11 +1139,11 @@ module Pdfcrowd
|
|
1111
1139
|
|
1112
1140
|
# Set the viewport height for formatting the HTML content when generating a PDF. By specifying a viewport height, you can enforce loading of lazy-loaded images and also affect vertical positioning of absolutely positioned elements within the content.
|
1113
1141
|
#
|
1114
|
-
# * +height+ - The viewport height. The value must be
|
1142
|
+
# * +height+ - The viewport height. The value must be 'auto', 'large', or a number.
|
1115
1143
|
# * *Returns* - The converter object.
|
1116
1144
|
def setContentViewportHeight(height)
|
1117
1145
|
unless /(?i)^(auto|large|[0-9]+(px)?)$/.match(height)
|
1118
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentViewportHeight", "html-to-pdf", "The value must be
|
1146
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentViewportHeight", "html-to-pdf", "The value must be 'auto', 'large', or a number.", "set_content_viewport_height"), 470);
|
1119
1147
|
end
|
1120
1148
|
|
1121
1149
|
@fields['content_viewport_height'] = height
|
@@ -1150,11 +1178,11 @@ module Pdfcrowd
|
|
1150
1178
|
|
1151
1179
|
# 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 the converted document pdfcrowd-source-title - the title of the converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. 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>
|
1152
1180
|
#
|
1153
|
-
# * +url+ -
|
1181
|
+
# * +url+ - Supported protocols are http:// and https://.
|
1154
1182
|
# * *Returns* - The converter object.
|
1155
1183
|
def setHeaderUrl(url)
|
1156
1184
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
1157
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setHeaderUrl", "html-to-pdf", "
|
1185
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setHeaderUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_header_url"), 470);
|
1158
1186
|
end
|
1159
1187
|
|
1160
1188
|
@fields['header_url'] = url
|
@@ -1176,11 +1204,11 @@ module Pdfcrowd
|
|
1176
1204
|
|
1177
1205
|
# Set the header height.
|
1178
1206
|
#
|
1179
|
-
# * +height+ - The value must be specified in inches
|
1207
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1180
1208
|
# * *Returns* - The converter object.
|
1181
1209
|
def setHeaderHeight(height)
|
1182
1210
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
1183
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setHeaderHeight", "html-to-pdf", "The value must be specified in inches
|
1211
|
+
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);
|
1184
1212
|
end
|
1185
1213
|
|
1186
1214
|
@fields['header_height'] = height
|
@@ -1198,11 +1226,11 @@ module Pdfcrowd
|
|
1198
1226
|
|
1199
1227
|
# 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 the converted document pdfcrowd-source-title - the title of the converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. 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>
|
1200
1228
|
#
|
1201
|
-
# * +url+ -
|
1229
|
+
# * +url+ - Supported protocols are http:// and https://.
|
1202
1230
|
# * *Returns* - The converter object.
|
1203
1231
|
def setFooterUrl(url)
|
1204
1232
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
1205
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setFooterUrl", "html-to-pdf", "
|
1233
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setFooterUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_footer_url"), 470);
|
1206
1234
|
end
|
1207
1235
|
|
1208
1236
|
@fields['footer_url'] = url
|
@@ -1224,11 +1252,11 @@ module Pdfcrowd
|
|
1224
1252
|
|
1225
1253
|
# Set the footer height.
|
1226
1254
|
#
|
1227
|
-
# * +height+ - The value must be specified in inches
|
1255
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
1228
1256
|
# * *Returns* - The converter object.
|
1229
1257
|
def setFooterHeight(height)
|
1230
1258
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
1231
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setFooterHeight", "html-to-pdf", "The value must be specified in inches
|
1259
|
+
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);
|
1232
1260
|
end
|
1233
1261
|
|
1234
1262
|
@fields['footer_height'] = height
|
@@ -1281,11 +1309,11 @@ module Pdfcrowd
|
|
1281
1309
|
|
1282
1310
|
# Set the scaling factor (zoom) for the header and footer.
|
1283
1311
|
#
|
1284
|
-
# * +factor+ - The percentage value. The
|
1312
|
+
# * +factor+ - The percentage value. The accepted range is 10-500.
|
1285
1313
|
# * *Returns* - The converter object.
|
1286
1314
|
def setHeaderFooterScaleFactor(factor)
|
1287
1315
|
if (!(Integer(factor) >= 10 && Integer(factor) <= 500))
|
1288
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setHeaderFooterScaleFactor", "html-to-pdf", "The
|
1316
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setHeaderFooterScaleFactor", "html-to-pdf", "The accepted range is 10-500.", "set_header_footer_scale_factor"), 470);
|
1289
1317
|
end
|
1290
1318
|
|
1291
1319
|
@fields['header_footer_scale_factor'] = factor
|
@@ -1316,11 +1344,11 @@ module Pdfcrowd
|
|
1316
1344
|
|
1317
1345
|
# Load a file from the specified URL and apply the file as a watermark to each page of the output PDF. 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.
|
1318
1346
|
#
|
1319
|
-
# * +url+ -
|
1347
|
+
# * +url+ - Supported protocols are http:// and https://.
|
1320
1348
|
# * *Returns* - The converter object.
|
1321
1349
|
def setPageWatermarkUrl(url)
|
1322
1350
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
1323
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "html-to-pdf", "
|
1351
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_page_watermark_url"), 470);
|
1324
1352
|
end
|
1325
1353
|
|
1326
1354
|
@fields['page_watermark_url'] = url
|
@@ -1342,11 +1370,11 @@ module Pdfcrowd
|
|
1342
1370
|
|
1343
1371
|
# Load a file from the specified URL and apply each page of the file as a watermark to the corresponding page of the output PDF. A watermark can be either a PDF or an image.
|
1344
1372
|
#
|
1345
|
-
# * +url+ -
|
1373
|
+
# * +url+ - Supported protocols are http:// and https://.
|
1346
1374
|
# * *Returns* - The converter object.
|
1347
1375
|
def setMultipageWatermarkUrl(url)
|
1348
1376
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
1349
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "html-to-pdf", "
|
1377
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_watermark_url"), 470);
|
1350
1378
|
end
|
1351
1379
|
|
1352
1380
|
@fields['multipage_watermark_url'] = url
|
@@ -1368,11 +1396,11 @@ module Pdfcrowd
|
|
1368
1396
|
|
1369
1397
|
# Load a file from the specified URL and apply the file as a background to each page of the output PDF. A background 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 background.
|
1370
1398
|
#
|
1371
|
-
# * +url+ -
|
1399
|
+
# * +url+ - Supported protocols are http:// and https://.
|
1372
1400
|
# * *Returns* - The converter object.
|
1373
1401
|
def setPageBackgroundUrl(url)
|
1374
1402
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
1375
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "html-to-pdf", "
|
1403
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_page_background_url"), 470);
|
1376
1404
|
end
|
1377
1405
|
|
1378
1406
|
@fields['page_background_url'] = url
|
@@ -1394,11 +1422,11 @@ module Pdfcrowd
|
|
1394
1422
|
|
1395
1423
|
# Load a file from the specified URL and apply each page of the file as a background to the corresponding page of the output PDF. A background can be either a PDF or an image.
|
1396
1424
|
#
|
1397
|
-
# * +url+ -
|
1425
|
+
# * +url+ - Supported protocols are http:// and https://.
|
1398
1426
|
# * *Returns* - The converter object.
|
1399
1427
|
def setMultipageBackgroundUrl(url)
|
1400
1428
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
1401
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "html-to-pdf", "
|
1429
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "html-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_background_url"), 470);
|
1402
1430
|
end
|
1403
1431
|
|
1404
1432
|
@fields['multipage_background_url'] = url
|
@@ -1647,11 +1675,11 @@ module Pdfcrowd
|
|
1647
1675
|
|
1648
1676
|
# Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. Your API license defines the maximum wait time by "Max Delay" parameter.
|
1649
1677
|
#
|
1650
|
-
# * +delay+ - The number of milliseconds to wait. Must be a positive integer
|
1678
|
+
# * +delay+ - The number of milliseconds to wait. Must be a positive integer or 0.
|
1651
1679
|
# * *Returns* - The converter object.
|
1652
1680
|
def setJavascriptDelay(delay)
|
1653
1681
|
if (!(Integer(delay) >= 0))
|
1654
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(delay, "setJavascriptDelay", "html-to-pdf", "Must be a positive integer
|
1682
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(delay, "setJavascriptDelay", "html-to-pdf", "Must be a positive integer or 0.", "set_javascript_delay"), 470);
|
1655
1683
|
end
|
1656
1684
|
|
1657
1685
|
@fields['javascript_delay'] = delay
|
@@ -1721,11 +1749,11 @@ module Pdfcrowd
|
|
1721
1749
|
|
1722
1750
|
# Set the viewport width in pixels. The viewport is the user's visible area of the page.
|
1723
1751
|
#
|
1724
|
-
# * +width+ - The
|
1752
|
+
# * +width+ - The accepted range is 96-65000.
|
1725
1753
|
# * *Returns* - The converter object.
|
1726
1754
|
def setViewportWidth(width)
|
1727
1755
|
if (!(Integer(width) >= 96 && Integer(width) <= 65000))
|
1728
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setViewportWidth", "html-to-pdf", "The
|
1756
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setViewportWidth", "html-to-pdf", "The accepted range is 96-65000.", "set_viewport_width"), 470);
|
1729
1757
|
end
|
1730
1758
|
|
1731
1759
|
@fields['viewport_width'] = width
|
@@ -1734,11 +1762,11 @@ module Pdfcrowd
|
|
1734
1762
|
|
1735
1763
|
# Set the viewport height in pixels. The viewport is the user's visible area of the page. If the input HTML uses lazily loaded images, try using a large value that covers the entire height of the HTML, e.g. 100000.
|
1736
1764
|
#
|
1737
|
-
# * +height+ - Must be a positive integer
|
1765
|
+
# * +height+ - Must be a positive integer.
|
1738
1766
|
# * *Returns* - The converter object.
|
1739
1767
|
def setViewportHeight(height)
|
1740
1768
|
if (!(Integer(height) > 0))
|
1741
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setViewportHeight", "html-to-pdf", "Must be a positive integer
|
1769
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setViewportHeight", "html-to-pdf", "Must be a positive integer.", "set_viewport_height"), 470);
|
1742
1770
|
end
|
1743
1771
|
|
1744
1772
|
@fields['viewport_height'] = height
|
@@ -1747,8 +1775,8 @@ module Pdfcrowd
|
|
1747
1775
|
|
1748
1776
|
# Set the viewport size. The viewport is the user's visible area of the page.
|
1749
1777
|
#
|
1750
|
-
# * +width+ - Set the viewport width in pixels. The viewport is the user's visible area of the page. The
|
1751
|
-
# * +height+ - Set the viewport height in pixels. The viewport is the user's visible area of the page. If the input HTML uses lazily loaded images, try using a large value that covers the entire height of the HTML, e.g. 100000. Must be a positive integer
|
1778
|
+
# * +width+ - Set the viewport width in pixels. The viewport is the user's visible area of the page. The accepted range is 96-65000.
|
1779
|
+
# * +height+ - Set the viewport height in pixels. The viewport is the user's visible area of the page. If the input HTML uses lazily loaded images, try using a large value that covers the entire height of the HTML, e.g. 100000. Must be a positive integer.
|
1752
1780
|
# * *Returns* - The converter object.
|
1753
1781
|
def setViewport(width, height)
|
1754
1782
|
setViewportWidth(width)
|
@@ -1784,11 +1812,11 @@ module Pdfcrowd
|
|
1784
1812
|
|
1785
1813
|
# Set the scaling factor (zoom) for the main page area.
|
1786
1814
|
#
|
1787
|
-
# * +factor+ - The percentage value. The
|
1815
|
+
# * +factor+ - The percentage value. The accepted range is 10-500.
|
1788
1816
|
# * *Returns* - The converter object.
|
1789
1817
|
def setScaleFactor(factor)
|
1790
1818
|
if (!(Integer(factor) >= 10 && Integer(factor) <= 500))
|
1791
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-pdf", "The
|
1819
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-pdf", "The accepted range is 10-500.", "set_scale_factor"), 470);
|
1792
1820
|
end
|
1793
1821
|
|
1794
1822
|
@fields['scale_factor'] = factor
|
@@ -1797,11 +1825,11 @@ module Pdfcrowd
|
|
1797
1825
|
|
1798
1826
|
# Set the quality of embedded JPEG images. A lower quality results in a smaller PDF file but can lead to compression artifacts.
|
1799
1827
|
#
|
1800
|
-
# * +quality+ - The percentage value. The
|
1828
|
+
# * +quality+ - The percentage value. The accepted range is 1-100.
|
1801
1829
|
# * *Returns* - The converter object.
|
1802
1830
|
def setJpegQuality(quality)
|
1803
1831
|
if (!(Integer(quality) >= 1 && Integer(quality) <= 100))
|
1804
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(quality, "setJpegQuality", "html-to-pdf", "The
|
1832
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(quality, "setJpegQuality", "html-to-pdf", "The accepted range is 1-100.", "set_jpeg_quality"), 470);
|
1805
1833
|
end
|
1806
1834
|
|
1807
1835
|
@fields['jpeg_quality'] = quality
|
@@ -1823,11 +1851,11 @@ module Pdfcrowd
|
|
1823
1851
|
|
1824
1852
|
# Set the DPI of images in PDF. A lower DPI may result in a smaller PDF file. If the specified DPI is higher than the actual image DPI, the original image DPI is retained (no upscaling is performed). Use 0 to leave the images unaltered.
|
1825
1853
|
#
|
1826
|
-
# * +dpi+ - The DPI value. Must be a positive integer
|
1854
|
+
# * +dpi+ - The DPI value. Must be a positive integer or 0.
|
1827
1855
|
# * *Returns* - The converter object.
|
1828
1856
|
def setImageDpi(dpi)
|
1829
1857
|
if (!(Integer(dpi) >= 0))
|
1830
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(dpi, "setImageDpi", "html-to-pdf", "Must be a positive integer
|
1858
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(dpi, "setImageDpi", "html-to-pdf", "Must be a positive integer or 0.", "set_image_dpi"), 470);
|
1831
1859
|
end
|
1832
1860
|
|
1833
1861
|
@fields['image_dpi'] = dpi
|
@@ -1992,11 +2020,11 @@ module Pdfcrowd
|
|
1992
2020
|
|
1993
2021
|
# Display the specified page when the document is opened.
|
1994
2022
|
#
|
1995
|
-
# * +page+ - Must be a positive integer
|
2023
|
+
# * +page+ - Must be a positive integer.
|
1996
2024
|
# * *Returns* - The converter object.
|
1997
2025
|
def setInitialPage(page)
|
1998
2026
|
if (!(Integer(page) > 0))
|
1999
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "html-to-pdf", "Must be a positive integer
|
2027
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "html-to-pdf", "Must be a positive integer.", "set_initial_page"), 470);
|
2000
2028
|
end
|
2001
2029
|
|
2002
2030
|
@fields['initial_page'] = page
|
@@ -2005,11 +2033,11 @@ module Pdfcrowd
|
|
2005
2033
|
|
2006
2034
|
# Specify the initial page zoom in percents when the document is opened.
|
2007
2035
|
#
|
2008
|
-
# * +zoom+ - Must be a positive integer
|
2036
|
+
# * +zoom+ - Must be a positive integer.
|
2009
2037
|
# * *Returns* - The converter object.
|
2010
2038
|
def setInitialZoom(zoom)
|
2011
2039
|
if (!(Integer(zoom) > 0))
|
2012
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "html-to-pdf", "Must be a positive integer
|
2040
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "html-to-pdf", "Must be a positive integer.", "set_initial_zoom"), 470);
|
2013
2041
|
end
|
2014
2042
|
|
2015
2043
|
@fields['initial_zoom'] = zoom
|
@@ -2274,11 +2302,11 @@ module Pdfcrowd
|
|
2274
2302
|
|
2275
2303
|
# Set the internal DPI resolution used for positioning of PDF contents. It can help in situations when there are small inaccuracies in the PDF. It is recommended to use values that are a multiple of 72, such as 288 or 360.
|
2276
2304
|
#
|
2277
|
-
# * +dpi+ - The DPI value. The
|
2305
|
+
# * +dpi+ - The DPI value. The accepted range is 72-600.
|
2278
2306
|
# * *Returns* - The converter object.
|
2279
2307
|
def setLayoutDpi(dpi)
|
2280
2308
|
if (!(Integer(dpi) >= 72 && Integer(dpi) <= 600))
|
2281
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(dpi, "setLayoutDpi", "html-to-pdf", "The
|
2309
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(dpi, "setLayoutDpi", "html-to-pdf", "The accepted range is 72-600.", "set_layout_dpi"), 470);
|
2282
2310
|
end
|
2283
2311
|
|
2284
2312
|
@fields['layout_dpi'] = dpi
|
@@ -2287,11 +2315,11 @@ module Pdfcrowd
|
|
2287
2315
|
|
2288
2316
|
# Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
|
2289
2317
|
#
|
2290
|
-
# * +x+ - The value must be specified in inches
|
2318
|
+
# * +x+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.
|
2291
2319
|
# * *Returns* - The converter object.
|
2292
2320
|
def setContentAreaX(x)
|
2293
2321
|
unless /(?i)^0$|^\-?[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
|
2294
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setContentAreaX", "html-to-pdf", "The value must be specified in inches
|
2322
|
+
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);
|
2295
2323
|
end
|
2296
2324
|
|
2297
2325
|
@fields['content_area_x'] = x
|
@@ -2300,11 +2328,11 @@ module Pdfcrowd
|
|
2300
2328
|
|
2301
2329
|
# Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
|
2302
2330
|
#
|
2303
|
-
# * +y+ - The value must be specified in inches
|
2331
|
+
# * +y+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'. It may contain a negative value.
|
2304
2332
|
# * *Returns* - The converter object.
|
2305
2333
|
def setContentAreaY(y)
|
2306
2334
|
unless /(?i)^0$|^\-?[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
|
2307
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setContentAreaY", "html-to-pdf", "The value must be specified in inches
|
2335
|
+
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);
|
2308
2336
|
end
|
2309
2337
|
|
2310
2338
|
@fields['content_area_y'] = y
|
@@ -2313,11 +2341,11 @@ module Pdfcrowd
|
|
2313
2341
|
|
2314
2342
|
# Set the width of the content area. It should be at least 1 inch.
|
2315
2343
|
#
|
2316
|
-
# * +width+ - The value must be specified in inches
|
2344
|
+
# * +width+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
2317
2345
|
# * *Returns* - The converter object.
|
2318
2346
|
def setContentAreaWidth(width)
|
2319
2347
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
|
2320
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setContentAreaWidth", "html-to-pdf", "The value must be specified in inches
|
2348
|
+
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);
|
2321
2349
|
end
|
2322
2350
|
|
2323
2351
|
@fields['content_area_width'] = width
|
@@ -2326,11 +2354,11 @@ module Pdfcrowd
|
|
2326
2354
|
|
2327
2355
|
# Set the height of the content area. It should be at least 1 inch.
|
2328
2356
|
#
|
2329
|
-
# * +height+ - The value must be specified in inches
|
2357
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
2330
2358
|
# * *Returns* - The converter object.
|
2331
2359
|
def setContentAreaHeight(height)
|
2332
2360
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
2333
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setContentAreaHeight", "html-to-pdf", "The value must be specified in inches
|
2361
|
+
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);
|
2334
2362
|
end
|
2335
2363
|
|
2336
2364
|
@fields['content_area_height'] = height
|
@@ -2339,10 +2367,10 @@ module Pdfcrowd
|
|
2339
2367
|
|
2340
2368
|
# Set the content area position and size. The content area enables to specify a web page area to be converted.
|
2341
2369
|
#
|
2342
|
-
# * +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
|
2343
|
-
# * +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
|
2344
|
-
# * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches
|
2345
|
-
# * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches
|
2370
|
+
# * +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.
|
2371
|
+
# * +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.
|
2372
|
+
# * +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'.
|
2373
|
+
# * +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'.
|
2346
2374
|
# * *Returns* - The converter object.
|
2347
2375
|
def setContentArea(x, y, width, height)
|
2348
2376
|
setContentAreaX(x)
|
@@ -2409,18 +2437,18 @@ module Pdfcrowd
|
|
2409
2437
|
|
2410
2438
|
# Set the maximum time to load the page and its resources. After this time, all requests will be considered successful. This can be useful to ensure that the conversion does not timeout. Use this method if there is no other way to fix page loading.
|
2411
2439
|
#
|
2412
|
-
# * +max_time+ - The number of seconds to wait. The
|
2440
|
+
# * +max_time+ - The number of seconds to wait. The accepted range is 10-30.
|
2413
2441
|
# * *Returns* - The converter object.
|
2414
2442
|
def setMaxLoadingTime(max_time)
|
2415
2443
|
if (!(Integer(max_time) >= 10 && Integer(max_time) <= 30))
|
2416
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-pdf", "The
|
2444
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-pdf", "The accepted range is 10-30.", "set_max_loading_time"), 470);
|
2417
2445
|
end
|
2418
2446
|
|
2419
2447
|
@fields['max_loading_time'] = max_time
|
2420
2448
|
self
|
2421
2449
|
end
|
2422
2450
|
|
2423
|
-
# Allows to configure conversion via JSON. The configuration defines various page settings for individual PDF pages or ranges of pages. It provides flexibility in designing each page of the PDF, giving control over each page's size, header, footer etc. If a page or parameter is not explicitly specified, the system will use the default settings for that page or attribute. If a JSON configuration is provided, the settings in the JSON will take precedence over the global options. The structure of the JSON must be: pageSetup: An array of objects where each object defines the configuration for a specific page or range of pages. The following properties can be set for each page object: pages: A comma-separated list of page numbers or ranges. Special strings may be used, such as `odd`, `even` and `last`. For example: 1-: from page 1 to the end of the document 2: only the 2nd page 2,4,6: pages 2, 4, and 6 2-5: pages 2 through 5 odd,2: the 2nd page and all odd pages pageSize: The page size (optional). Possible values: A0, A1, A2, A3, A4, A5, A6, Letter. pageWidth: The width of the page (optional). pageHeight: The height of the page (optional). marginLeft: Left margin (optional). marginRight: Right margin (optional). marginTop: Top margin (optional). marginBottom: Bottom margin (optional). displayHeader: Header appearance (optional). Possible values: none: completely excluded space: only the content is excluded, the space is used content: the content is printed (default) displayFooter: Footer appearance (optional). Possible values: none: completely excluded space: only the content is excluded, the space is used content: the content is printed (default) headerHeight: Height of the header (optional). footerHeight: Height of the footer (optional). orientation: Page orientation, such as "portrait" or "landscape" (optional). backgroundColor: Page background color in RRGGBB or RRGGBBAA hexadecimal format (optional). Dimensions may be empty, 0 or specified in inches
|
2451
|
+
# Allows to configure conversion via JSON. The configuration defines various page settings for individual PDF pages or ranges of pages. It provides flexibility in designing each page of the PDF, giving control over each page's size, header, footer etc. If a page or parameter is not explicitly specified, the system will use the default settings for that page or attribute. If a JSON configuration is provided, the settings in the JSON will take precedence over the global options. The structure of the JSON must be: pageSetup: An array of objects where each object defines the configuration for a specific page or range of pages. The following properties can be set for each page object: pages: A comma-separated list of page numbers or ranges. Special strings may be used, such as `odd`, `even` and `last`. For example: 1-: from page 1 to the end of the document 2: only the 2nd page 2,4,6: pages 2, 4, and 6 2-5: pages 2 through 5 odd,2: the 2nd page and all odd pages pageSize: The page size (optional). Possible values: A0, A1, A2, A3, A4, A5, A6, Letter. pageWidth: The width of the page (optional). pageHeight: The height of the page (optional). marginLeft: Left margin (optional). marginRight: Right margin (optional). marginTop: Top margin (optional). marginBottom: Bottom margin (optional). displayHeader: Header appearance (optional). Possible values: none: completely excluded space: only the content is excluded, the space is used content: the content is printed (default) displayFooter: Footer appearance (optional). Possible values: none: completely excluded space: only the content is excluded, the space is used content: the content is printed (default) headerHeight: Height of the header (optional). footerHeight: Height of the footer (optional). orientation: Page orientation, such as "portrait" or "landscape" (optional). backgroundColor: Page background color in RRGGBB or RRGGBBAA hexadecimal format (optional). Dimensions may be empty, 0 or specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
2424
2452
|
#
|
2425
2453
|
# * +json_string+ - The JSON string.
|
2426
2454
|
# * *Returns* - The converter object.
|
@@ -2553,11 +2581,11 @@ module Pdfcrowd
|
|
2553
2581
|
|
2554
2582
|
# Convert a web page.
|
2555
2583
|
#
|
2556
|
-
# * +url+ - The address of the web page to convert.
|
2584
|
+
# * +url+ - The address of the web page to convert. Supported protocols are http:// and https://.
|
2557
2585
|
# * *Returns* - Byte array containing the conversion output.
|
2558
2586
|
def convertUrl(url)
|
2559
2587
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
2560
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "html-to-image", "
|
2588
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "html-to-image", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
2561
2589
|
end
|
2562
2590
|
|
2563
2591
|
@fields['url'] = url
|
@@ -2566,11 +2594,11 @@ module Pdfcrowd
|
|
2566
2594
|
|
2567
2595
|
# Convert a web page and write the result to an output stream.
|
2568
2596
|
#
|
2569
|
-
# * +url+ - The address of the web page to convert.
|
2597
|
+
# * +url+ - The address of the web page to convert. Supported protocols are http:// and https://.
|
2570
2598
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
2571
2599
|
def convertUrlToStream(url, out_stream)
|
2572
2600
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
2573
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "html-to-image", "
|
2601
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "html-to-image", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
2574
2602
|
end
|
2575
2603
|
|
2576
2604
|
@fields['url'] = url
|
@@ -2579,7 +2607,7 @@ module Pdfcrowd
|
|
2579
2607
|
|
2580
2608
|
# Convert a web page and write the result to a local file.
|
2581
2609
|
#
|
2582
|
-
# * +url+ - The address of the web page to convert.
|
2610
|
+
# * +url+ - The address of the web page to convert. Supported protocols are http:// and https://.
|
2583
2611
|
# * +file_path+ - The output file path. The string must not be empty.
|
2584
2612
|
def convertUrlToFile(url, file_path)
|
2585
2613
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -2738,11 +2766,11 @@ module Pdfcrowd
|
|
2738
2766
|
|
2739
2767
|
# Set the output image width in pixels.
|
2740
2768
|
#
|
2741
|
-
# * +width+ - The
|
2769
|
+
# * +width+ - The accepted range is 96-65000.
|
2742
2770
|
# * *Returns* - The converter object.
|
2743
2771
|
def setScreenshotWidth(width)
|
2744
2772
|
if (!(Integer(width) >= 96 && Integer(width) <= 65000))
|
2745
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setScreenshotWidth", "html-to-image", "The
|
2773
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setScreenshotWidth", "html-to-image", "The accepted range is 96-65000.", "set_screenshot_width"), 470);
|
2746
2774
|
end
|
2747
2775
|
|
2748
2776
|
@fields['screenshot_width'] = width
|
@@ -2751,11 +2779,11 @@ module Pdfcrowd
|
|
2751
2779
|
|
2752
2780
|
# Set the output image height in pixels. If it is not specified, actual document height is used.
|
2753
2781
|
#
|
2754
|
-
# * +height+ - Must be a positive integer
|
2782
|
+
# * +height+ - Must be a positive integer.
|
2755
2783
|
# * *Returns* - The converter object.
|
2756
2784
|
def setScreenshotHeight(height)
|
2757
2785
|
if (!(Integer(height) > 0))
|
2758
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setScreenshotHeight", "html-to-image", "Must be a positive integer
|
2786
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setScreenshotHeight", "html-to-image", "Must be a positive integer.", "set_screenshot_height"), 470);
|
2759
2787
|
end
|
2760
2788
|
|
2761
2789
|
@fields['screenshot_height'] = height
|
@@ -2764,11 +2792,11 @@ module Pdfcrowd
|
|
2764
2792
|
|
2765
2793
|
# Set the scaling factor (zoom) for the output image.
|
2766
2794
|
#
|
2767
|
-
# * +factor+ - The percentage value. Must be a positive integer
|
2795
|
+
# * +factor+ - The percentage value. Must be a positive integer.
|
2768
2796
|
# * *Returns* - The converter object.
|
2769
2797
|
def setScaleFactor(factor)
|
2770
2798
|
if (!(Integer(factor) > 0))
|
2771
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-image", "Must be a positive integer
|
2799
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "html-to-image", "Must be a positive integer.", "set_scale_factor"), 470);
|
2772
2800
|
end
|
2773
2801
|
|
2774
2802
|
@fields['scale_factor'] = factor
|
@@ -3004,11 +3032,11 @@ module Pdfcrowd
|
|
3004
3032
|
|
3005
3033
|
# Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. Your API license defines the maximum wait time by "Max Delay" parameter.
|
3006
3034
|
#
|
3007
|
-
# * +delay+ - The number of milliseconds to wait. Must be a positive integer
|
3035
|
+
# * +delay+ - The number of milliseconds to wait. Must be a positive integer or 0.
|
3008
3036
|
# * *Returns* - The converter object.
|
3009
3037
|
def setJavascriptDelay(delay)
|
3010
3038
|
if (!(Integer(delay) >= 0))
|
3011
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(delay, "setJavascriptDelay", "html-to-image", "Must be a positive integer
|
3039
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(delay, "setJavascriptDelay", "html-to-image", "Must be a positive integer or 0.", "set_javascript_delay"), 470);
|
3012
3040
|
end
|
3013
3041
|
|
3014
3042
|
@fields['javascript_delay'] = delay
|
@@ -3259,11 +3287,11 @@ module Pdfcrowd
|
|
3259
3287
|
|
3260
3288
|
# Set the maximum time to load the page and its resources. After this time, all requests will be considered successful. This can be useful to ensure that the conversion does not timeout. Use this method if there is no other way to fix page loading.
|
3261
3289
|
#
|
3262
|
-
# * +max_time+ - The number of seconds to wait. The
|
3290
|
+
# * +max_time+ - The number of seconds to wait. The accepted range is 10-30.
|
3263
3291
|
# * *Returns* - The converter object.
|
3264
3292
|
def setMaxLoadingTime(max_time)
|
3265
3293
|
if (!(Integer(max_time) >= 10 && Integer(max_time) <= 30))
|
3266
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-image", "The
|
3294
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(max_time, "setMaxLoadingTime", "html-to-image", "The accepted range is 10-30.", "set_max_loading_time"), 470);
|
3267
3295
|
end
|
3268
3296
|
|
3269
3297
|
@fields['max_loading_time'] = max_time
|
@@ -3368,11 +3396,11 @@ module Pdfcrowd
|
|
3368
3396
|
|
3369
3397
|
# Convert an image.
|
3370
3398
|
#
|
3371
|
-
# * +url+ - The address of the image to convert.
|
3399
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
3372
3400
|
# * *Returns* - Byte array containing the conversion output.
|
3373
3401
|
def convertUrl(url)
|
3374
3402
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
3375
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "image-to-image", "
|
3403
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "image-to-image", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
3376
3404
|
end
|
3377
3405
|
|
3378
3406
|
@fields['url'] = url
|
@@ -3381,11 +3409,11 @@ module Pdfcrowd
|
|
3381
3409
|
|
3382
3410
|
# Convert an image and write the result to an output stream.
|
3383
3411
|
#
|
3384
|
-
# * +url+ - The address of the image to convert.
|
3412
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
3385
3413
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
3386
3414
|
def convertUrlToStream(url, out_stream)
|
3387
3415
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
3388
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "image-to-image", "
|
3416
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "image-to-image", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
3389
3417
|
end
|
3390
3418
|
|
3391
3419
|
@fields['url'] = url
|
@@ -3394,7 +3422,7 @@ module Pdfcrowd
|
|
3394
3422
|
|
3395
3423
|
# Convert an image and write the result to a local file.
|
3396
3424
|
#
|
3397
|
-
# * +url+ - The address of the image to convert.
|
3425
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
3398
3426
|
# * +file_path+ - The output file path. The string must not be empty.
|
3399
3427
|
def convertUrlToFile(url, file_path)
|
3400
3428
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -3567,11 +3595,11 @@ module Pdfcrowd
|
|
3567
3595
|
|
3568
3596
|
# Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
|
3569
3597
|
#
|
3570
|
-
# * +x+ - The value must be specified in inches
|
3598
|
+
# * +x+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3571
3599
|
# * *Returns* - The converter object.
|
3572
3600
|
def setCropAreaX(x)
|
3573
3601
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
|
3574
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "image-to-image", "The value must be specified in inches
|
3602
|
+
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);
|
3575
3603
|
end
|
3576
3604
|
|
3577
3605
|
@fields['crop_area_x'] = x
|
@@ -3580,11 +3608,11 @@ module Pdfcrowd
|
|
3580
3608
|
|
3581
3609
|
# Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
|
3582
3610
|
#
|
3583
|
-
# * +y+ - The value must be specified in inches
|
3611
|
+
# * +y+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3584
3612
|
# * *Returns* - The converter object.
|
3585
3613
|
def setCropAreaY(y)
|
3586
3614
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
|
3587
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "image-to-image", "The value must be specified in inches
|
3615
|
+
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);
|
3588
3616
|
end
|
3589
3617
|
|
3590
3618
|
@fields['crop_area_y'] = y
|
@@ -3593,11 +3621,11 @@ module Pdfcrowd
|
|
3593
3621
|
|
3594
3622
|
# Set the width of the content area. It should be at least 1 inch.
|
3595
3623
|
#
|
3596
|
-
# * +width+ - The value must be specified in inches
|
3624
|
+
# * +width+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3597
3625
|
# * *Returns* - The converter object.
|
3598
3626
|
def setCropAreaWidth(width)
|
3599
3627
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
|
3600
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "image-to-image", "The value must be specified in inches
|
3628
|
+
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);
|
3601
3629
|
end
|
3602
3630
|
|
3603
3631
|
@fields['crop_area_width'] = width
|
@@ -3606,11 +3634,11 @@ module Pdfcrowd
|
|
3606
3634
|
|
3607
3635
|
# Set the height of the content area. It should be at least 1 inch.
|
3608
3636
|
#
|
3609
|
-
# * +height+ - The value must be specified in inches
|
3637
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3610
3638
|
# * *Returns* - The converter object.
|
3611
3639
|
def setCropAreaHeight(height)
|
3612
3640
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
3613
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "image-to-image", "The value must be specified in inches
|
3641
|
+
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);
|
3614
3642
|
end
|
3615
3643
|
|
3616
3644
|
@fields['crop_area_height'] = height
|
@@ -3619,10 +3647,10 @@ module Pdfcrowd
|
|
3619
3647
|
|
3620
3648
|
# Set the content area position and size. The content area enables to specify the part to be converted.
|
3621
3649
|
#
|
3622
|
-
# * +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
|
3623
|
-
# * +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
|
3624
|
-
# * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches
|
3625
|
-
# * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches
|
3650
|
+
# * +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'.
|
3651
|
+
# * +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'.
|
3652
|
+
# * +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'.
|
3653
|
+
# * +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'.
|
3626
3654
|
# * *Returns* - The converter object.
|
3627
3655
|
def setCropArea(x, y, width, height)
|
3628
3656
|
setCropAreaX(x)
|
@@ -3656,11 +3684,11 @@ module Pdfcrowd
|
|
3656
3684
|
|
3657
3685
|
# Set the output canvas width.
|
3658
3686
|
#
|
3659
|
-
# * +width+ - The value must be specified in inches
|
3687
|
+
# * +width+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3660
3688
|
# * *Returns* - The converter object.
|
3661
3689
|
def setCanvasWidth(width)
|
3662
3690
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
|
3663
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCanvasWidth", "image-to-image", "The value must be specified in inches
|
3691
|
+
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);
|
3664
3692
|
end
|
3665
3693
|
|
3666
3694
|
@fields['canvas_width'] = width
|
@@ -3669,11 +3697,11 @@ module Pdfcrowd
|
|
3669
3697
|
|
3670
3698
|
# Set the output canvas height.
|
3671
3699
|
#
|
3672
|
-
# * +height+ - The value must be specified in inches
|
3700
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3673
3701
|
# * *Returns* - The converter object.
|
3674
3702
|
def setCanvasHeight(height)
|
3675
3703
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
3676
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCanvasHeight", "image-to-image", "The value must be specified in inches
|
3704
|
+
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);
|
3677
3705
|
end
|
3678
3706
|
|
3679
3707
|
@fields['canvas_height'] = height
|
@@ -3682,8 +3710,8 @@ module Pdfcrowd
|
|
3682
3710
|
|
3683
3711
|
# Set the output canvas dimensions. If no canvas size is specified, margins are applied as a border around the image.
|
3684
3712
|
#
|
3685
|
-
# * +width+ - Set the output canvas width. The value must be specified in inches
|
3686
|
-
# * +height+ - Set the output canvas height. The value must be specified in inches
|
3713
|
+
# * +width+ - Set the output canvas width. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3714
|
+
# * +height+ - Set the output canvas height. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3687
3715
|
# * *Returns* - The converter object.
|
3688
3716
|
def setCanvasDimensions(width, height)
|
3689
3717
|
setCanvasWidth(width)
|
@@ -3732,11 +3760,11 @@ module Pdfcrowd
|
|
3732
3760
|
|
3733
3761
|
# Set the output canvas top margin.
|
3734
3762
|
#
|
3735
|
-
# * +top+ - The value must be specified in inches
|
3763
|
+
# * +top+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3736
3764
|
# * *Returns* - The converter object.
|
3737
3765
|
def setMarginTop(top)
|
3738
3766
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
|
3739
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "image-to-image", "The value must be specified in inches
|
3767
|
+
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);
|
3740
3768
|
end
|
3741
3769
|
|
3742
3770
|
@fields['margin_top'] = top
|
@@ -3745,11 +3773,11 @@ module Pdfcrowd
|
|
3745
3773
|
|
3746
3774
|
# Set the output canvas right margin.
|
3747
3775
|
#
|
3748
|
-
# * +right+ - The value must be specified in inches
|
3776
|
+
# * +right+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3749
3777
|
# * *Returns* - The converter object.
|
3750
3778
|
def setMarginRight(right)
|
3751
3779
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
|
3752
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "image-to-image", "The value must be specified in inches
|
3780
|
+
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);
|
3753
3781
|
end
|
3754
3782
|
|
3755
3783
|
@fields['margin_right'] = right
|
@@ -3758,11 +3786,11 @@ module Pdfcrowd
|
|
3758
3786
|
|
3759
3787
|
# Set the output canvas bottom margin.
|
3760
3788
|
#
|
3761
|
-
# * +bottom+ - The value must be specified in inches
|
3789
|
+
# * +bottom+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3762
3790
|
# * *Returns* - The converter object.
|
3763
3791
|
def setMarginBottom(bottom)
|
3764
3792
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
|
3765
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "image-to-image", "The value must be specified in inches
|
3793
|
+
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);
|
3766
3794
|
end
|
3767
3795
|
|
3768
3796
|
@fields['margin_bottom'] = bottom
|
@@ -3771,11 +3799,11 @@ module Pdfcrowd
|
|
3771
3799
|
|
3772
3800
|
# Set the output canvas left margin.
|
3773
3801
|
#
|
3774
|
-
# * +left+ - The value must be specified in inches
|
3802
|
+
# * +left+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3775
3803
|
# * *Returns* - The converter object.
|
3776
3804
|
def setMarginLeft(left)
|
3777
3805
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
|
3778
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "image-to-image", "The value must be specified in inches
|
3806
|
+
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);
|
3779
3807
|
end
|
3780
3808
|
|
3781
3809
|
@fields['margin_left'] = left
|
@@ -3784,10 +3812,10 @@ module Pdfcrowd
|
|
3784
3812
|
|
3785
3813
|
# Set the output canvas margins.
|
3786
3814
|
#
|
3787
|
-
# * +top+ - Set the output canvas top margin. The value must be specified in inches
|
3788
|
-
# * +right+ - Set the output canvas right margin. The value must be specified in inches
|
3789
|
-
# * +bottom+ - Set the output canvas bottom margin. The value must be specified in inches
|
3790
|
-
# * +left+ - Set the output canvas left margin. The value must be specified in inches
|
3815
|
+
# * +top+ - Set the output canvas top margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3816
|
+
# * +right+ - Set the output canvas right margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3817
|
+
# * +bottom+ - Set the output canvas bottom margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3818
|
+
# * +left+ - Set the output canvas left margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
3791
3819
|
# * *Returns* - The converter object.
|
3792
3820
|
def setMargins(top, right, bottom, left)
|
3793
3821
|
setMarginTop(top)
|
@@ -4087,11 +4115,11 @@ module Pdfcrowd
|
|
4087
4115
|
|
4088
4116
|
# Load a file from the specified URL and apply the file as a watermark to each page of the output PDF. 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.
|
4089
4117
|
#
|
4090
|
-
# * +url+ -
|
4118
|
+
# * +url+ - Supported protocols are http:// and https://.
|
4091
4119
|
# * *Returns* - The converter object.
|
4092
4120
|
def setPageWatermarkUrl(url)
|
4093
4121
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
4094
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "pdf-to-pdf", "
|
4122
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "pdf-to-pdf", "Supported protocols are http:// and https://.", "set_page_watermark_url"), 470);
|
4095
4123
|
end
|
4096
4124
|
|
4097
4125
|
@fields['page_watermark_url'] = url
|
@@ -4113,11 +4141,11 @@ module Pdfcrowd
|
|
4113
4141
|
|
4114
4142
|
# Load a file from the specified URL and apply each page of the file as a watermark to the corresponding page of the output PDF. A watermark can be either a PDF or an image.
|
4115
4143
|
#
|
4116
|
-
# * +url+ -
|
4144
|
+
# * +url+ - Supported protocols are http:// and https://.
|
4117
4145
|
# * *Returns* - The converter object.
|
4118
4146
|
def setMultipageWatermarkUrl(url)
|
4119
4147
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
4120
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "pdf-to-pdf", "
|
4148
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "pdf-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_watermark_url"), 470);
|
4121
4149
|
end
|
4122
4150
|
|
4123
4151
|
@fields['multipage_watermark_url'] = url
|
@@ -4139,11 +4167,11 @@ module Pdfcrowd
|
|
4139
4167
|
|
4140
4168
|
# Load a file from the specified URL and apply the file as a background to each page of the output PDF. A background 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 background.
|
4141
4169
|
#
|
4142
|
-
# * +url+ -
|
4170
|
+
# * +url+ - Supported protocols are http:// and https://.
|
4143
4171
|
# * *Returns* - The converter object.
|
4144
4172
|
def setPageBackgroundUrl(url)
|
4145
4173
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
4146
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "pdf-to-pdf", "
|
4174
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "pdf-to-pdf", "Supported protocols are http:// and https://.", "set_page_background_url"), 470);
|
4147
4175
|
end
|
4148
4176
|
|
4149
4177
|
@fields['page_background_url'] = url
|
@@ -4165,11 +4193,11 @@ module Pdfcrowd
|
|
4165
4193
|
|
4166
4194
|
# Load a file from the specified URL and apply each page of the file as a background to the corresponding page of the output PDF. A background can be either a PDF or an image.
|
4167
4195
|
#
|
4168
|
-
# * +url+ -
|
4196
|
+
# * +url+ - Supported protocols are http:// and https://.
|
4169
4197
|
# * *Returns* - The converter object.
|
4170
4198
|
def setMultipageBackgroundUrl(url)
|
4171
4199
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
4172
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "pdf-to-pdf", "
|
4200
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "pdf-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_background_url"), 470);
|
4173
4201
|
end
|
4174
4202
|
|
4175
4203
|
@fields['multipage_background_url'] = url
|
@@ -4277,11 +4305,11 @@ module Pdfcrowd
|
|
4277
4305
|
|
4278
4306
|
# Use metadata (title, subject, author and keywords) from the n-th input PDF.
|
4279
4307
|
#
|
4280
|
-
# * +index+ - Set the index of the input PDF file from which to use the metadata. 0 means no metadata. Must be a positive integer
|
4308
|
+
# * +index+ - Set the index of the input PDF file from which to use the metadata. 0 means no metadata. Must be a positive integer or 0.
|
4281
4309
|
# * *Returns* - The converter object.
|
4282
4310
|
def setUseMetadataFrom(index)
|
4283
4311
|
if (!(Integer(index) >= 0))
|
4284
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(index, "setUseMetadataFrom", "pdf-to-pdf", "Must be a positive integer
|
4312
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(index, "setUseMetadataFrom", "pdf-to-pdf", "Must be a positive integer or 0.", "set_use_metadata_from"), 470);
|
4285
4313
|
end
|
4286
4314
|
|
4287
4315
|
@fields['use_metadata_from'] = index
|
@@ -4329,11 +4357,11 @@ module Pdfcrowd
|
|
4329
4357
|
|
4330
4358
|
# Display the specified page when the document is opened.
|
4331
4359
|
#
|
4332
|
-
# * +page+ - Must be a positive integer
|
4360
|
+
# * +page+ - Must be a positive integer.
|
4333
4361
|
# * *Returns* - The converter object.
|
4334
4362
|
def setInitialPage(page)
|
4335
4363
|
if (!(Integer(page) > 0))
|
4336
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "pdf-to-pdf", "Must be a positive integer
|
4364
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "pdf-to-pdf", "Must be a positive integer.", "set_initial_page"), 470);
|
4337
4365
|
end
|
4338
4366
|
|
4339
4367
|
@fields['initial_page'] = page
|
@@ -4342,11 +4370,11 @@ module Pdfcrowd
|
|
4342
4370
|
|
4343
4371
|
# Specify the initial page zoom in percents when the document is opened.
|
4344
4372
|
#
|
4345
|
-
# * +zoom+ - Must be a positive integer
|
4373
|
+
# * +zoom+ - Must be a positive integer.
|
4346
4374
|
# * *Returns* - The converter object.
|
4347
4375
|
def setInitialZoom(zoom)
|
4348
4376
|
if (!(Integer(zoom) > 0))
|
4349
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "pdf-to-pdf", "Must be a positive integer
|
4377
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "pdf-to-pdf", "Must be a positive integer.", "set_initial_zoom"), 470);
|
4350
4378
|
end
|
4351
4379
|
|
4352
4380
|
@fields['initial_zoom'] = zoom
|
@@ -4562,11 +4590,11 @@ module Pdfcrowd
|
|
4562
4590
|
|
4563
4591
|
# Convert an image.
|
4564
4592
|
#
|
4565
|
-
# * +url+ - The address of the image to convert.
|
4593
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
4566
4594
|
# * *Returns* - Byte array containing the conversion output.
|
4567
4595
|
def convertUrl(url)
|
4568
4596
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
4569
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "image-to-pdf", "
|
4597
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
4570
4598
|
end
|
4571
4599
|
|
4572
4600
|
@fields['url'] = url
|
@@ -4575,11 +4603,11 @@ module Pdfcrowd
|
|
4575
4603
|
|
4576
4604
|
# Convert an image and write the result to an output stream.
|
4577
4605
|
#
|
4578
|
-
# * +url+ - The address of the image to convert.
|
4606
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
4579
4607
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
4580
4608
|
def convertUrlToStream(url, out_stream)
|
4581
4609
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
4582
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "image-to-pdf", "
|
4610
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "image-to-pdf", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
4583
4611
|
end
|
4584
4612
|
|
4585
4613
|
@fields['url'] = url
|
@@ -4588,7 +4616,7 @@ module Pdfcrowd
|
|
4588
4616
|
|
4589
4617
|
# Convert an image and write the result to a local file.
|
4590
4618
|
#
|
4591
|
-
# * +url+ - The address of the image to convert.
|
4619
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
4592
4620
|
# * +file_path+ - The output file path. The string must not be empty.
|
4593
4621
|
def convertUrlToFile(url, file_path)
|
4594
4622
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -4748,11 +4776,11 @@ module Pdfcrowd
|
|
4748
4776
|
|
4749
4777
|
# Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
|
4750
4778
|
#
|
4751
|
-
# * +x+ - The value must be specified in inches
|
4779
|
+
# * +x+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4752
4780
|
# * *Returns* - The converter object.
|
4753
4781
|
def setCropAreaX(x)
|
4754
4782
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x)
|
4755
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "image-to-pdf", "The value must be specified in inches
|
4783
|
+
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);
|
4756
4784
|
end
|
4757
4785
|
|
4758
4786
|
@fields['crop_area_x'] = x
|
@@ -4761,11 +4789,11 @@ module Pdfcrowd
|
|
4761
4789
|
|
4762
4790
|
# Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
|
4763
4791
|
#
|
4764
|
-
# * +y+ - The value must be specified in inches
|
4792
|
+
# * +y+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4765
4793
|
# * *Returns* - The converter object.
|
4766
4794
|
def setCropAreaY(y)
|
4767
4795
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y)
|
4768
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "image-to-pdf", "The value must be specified in inches
|
4796
|
+
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);
|
4769
4797
|
end
|
4770
4798
|
|
4771
4799
|
@fields['crop_area_y'] = y
|
@@ -4774,11 +4802,11 @@ module Pdfcrowd
|
|
4774
4802
|
|
4775
4803
|
# Set the width of the content area. It should be at least 1 inch.
|
4776
4804
|
#
|
4777
|
-
# * +width+ - The value must be specified in inches
|
4805
|
+
# * +width+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4778
4806
|
# * *Returns* - The converter object.
|
4779
4807
|
def setCropAreaWidth(width)
|
4780
4808
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
|
4781
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "image-to-pdf", "The value must be specified in inches
|
4809
|
+
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);
|
4782
4810
|
end
|
4783
4811
|
|
4784
4812
|
@fields['crop_area_width'] = width
|
@@ -4787,11 +4815,11 @@ module Pdfcrowd
|
|
4787
4815
|
|
4788
4816
|
# Set the height of the content area. It should be at least 1 inch.
|
4789
4817
|
#
|
4790
|
-
# * +height+ - The value must be specified in inches
|
4818
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4791
4819
|
# * *Returns* - The converter object.
|
4792
4820
|
def setCropAreaHeight(height)
|
4793
4821
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
4794
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "image-to-pdf", "The value must be specified in inches
|
4822
|
+
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);
|
4795
4823
|
end
|
4796
4824
|
|
4797
4825
|
@fields['crop_area_height'] = height
|
@@ -4800,10 +4828,10 @@ module Pdfcrowd
|
|
4800
4828
|
|
4801
4829
|
# Set the content area position and size. The content area enables to specify the part to be converted.
|
4802
4830
|
#
|
4803
|
-
# * +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
|
4804
|
-
# * +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
|
4805
|
-
# * +width+ - Set the width of the content area. It should be at least 1 inch. The value must be specified in inches
|
4806
|
-
# * +height+ - Set the height of the content area. It should be at least 1 inch. The value must be specified in inches
|
4831
|
+
# * +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'.
|
4832
|
+
# * +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'.
|
4833
|
+
# * +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'.
|
4834
|
+
# * +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'.
|
4807
4835
|
# * *Returns* - The converter object.
|
4808
4836
|
def setCropArea(x, y, width, height)
|
4809
4837
|
setCropAreaX(x)
|
@@ -4837,11 +4865,11 @@ module Pdfcrowd
|
|
4837
4865
|
|
4838
4866
|
# Set the output page width.
|
4839
4867
|
#
|
4840
|
-
# * +width+ - The value must be specified in inches
|
4868
|
+
# * +width+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4841
4869
|
# * *Returns* - The converter object.
|
4842
4870
|
def setPageWidth(width)
|
4843
4871
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width)
|
4844
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setPageWidth", "image-to-pdf", "The value must be specified in inches
|
4872
|
+
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);
|
4845
4873
|
end
|
4846
4874
|
|
4847
4875
|
@fields['page_width'] = width
|
@@ -4850,11 +4878,11 @@ module Pdfcrowd
|
|
4850
4878
|
|
4851
4879
|
# Set the output page height.
|
4852
4880
|
#
|
4853
|
-
# * +height+ - The value must be specified in inches
|
4881
|
+
# * +height+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4854
4882
|
# * *Returns* - The converter object.
|
4855
4883
|
def setPageHeight(height)
|
4856
4884
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height)
|
4857
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setPageHeight", "image-to-pdf", "The value must be specified in inches
|
4885
|
+
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);
|
4858
4886
|
end
|
4859
4887
|
|
4860
4888
|
@fields['page_height'] = height
|
@@ -4863,8 +4891,8 @@ module Pdfcrowd
|
|
4863
4891
|
|
4864
4892
|
# Set the output page dimensions. If no page size is specified, margins are applied as a border around the image.
|
4865
4893
|
#
|
4866
|
-
# * +width+ - Set the output page width. The value must be specified in inches
|
4867
|
-
# * +height+ - Set the output page height. The value must be specified in inches
|
4894
|
+
# * +width+ - Set the output page width. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4895
|
+
# * +height+ - Set the output page height. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4868
4896
|
# * *Returns* - The converter object.
|
4869
4897
|
def setPageDimensions(width, height)
|
4870
4898
|
setPageWidth(width)
|
@@ -4913,11 +4941,11 @@ module Pdfcrowd
|
|
4913
4941
|
|
4914
4942
|
# Set the output page top margin.
|
4915
4943
|
#
|
4916
|
-
# * +top+ - The value must be specified in inches
|
4944
|
+
# * +top+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4917
4945
|
# * *Returns* - The converter object.
|
4918
4946
|
def setMarginTop(top)
|
4919
4947
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top)
|
4920
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(top, "setMarginTop", "image-to-pdf", "The value must be specified in inches
|
4948
|
+
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);
|
4921
4949
|
end
|
4922
4950
|
|
4923
4951
|
@fields['margin_top'] = top
|
@@ -4926,11 +4954,11 @@ module Pdfcrowd
|
|
4926
4954
|
|
4927
4955
|
# Set the output page right margin.
|
4928
4956
|
#
|
4929
|
-
# * +right+ - The value must be specified in inches
|
4957
|
+
# * +right+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4930
4958
|
# * *Returns* - The converter object.
|
4931
4959
|
def setMarginRight(right)
|
4932
4960
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right)
|
4933
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(right, "setMarginRight", "image-to-pdf", "The value must be specified in inches
|
4961
|
+
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);
|
4934
4962
|
end
|
4935
4963
|
|
4936
4964
|
@fields['margin_right'] = right
|
@@ -4939,11 +4967,11 @@ module Pdfcrowd
|
|
4939
4967
|
|
4940
4968
|
# Set the output page bottom margin.
|
4941
4969
|
#
|
4942
|
-
# * +bottom+ - The value must be specified in inches
|
4970
|
+
# * +bottom+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4943
4971
|
# * *Returns* - The converter object.
|
4944
4972
|
def setMarginBottom(bottom)
|
4945
4973
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom)
|
4946
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(bottom, "setMarginBottom", "image-to-pdf", "The value must be specified in inches
|
4974
|
+
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);
|
4947
4975
|
end
|
4948
4976
|
|
4949
4977
|
@fields['margin_bottom'] = bottom
|
@@ -4952,11 +4980,11 @@ module Pdfcrowd
|
|
4952
4980
|
|
4953
4981
|
# Set the output page left margin.
|
4954
4982
|
#
|
4955
|
-
# * +left+ - The value must be specified in inches
|
4983
|
+
# * +left+ - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4956
4984
|
# * *Returns* - The converter object.
|
4957
4985
|
def setMarginLeft(left)
|
4958
4986
|
unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left)
|
4959
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(left, "setMarginLeft", "image-to-pdf", "The value must be specified in inches
|
4987
|
+
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);
|
4960
4988
|
end
|
4961
4989
|
|
4962
4990
|
@fields['margin_left'] = left
|
@@ -4965,10 +4993,10 @@ module Pdfcrowd
|
|
4965
4993
|
|
4966
4994
|
# Set the output page margins.
|
4967
4995
|
#
|
4968
|
-
# * +top+ - Set the output page top margin. The value must be specified in inches
|
4969
|
-
# * +right+ - Set the output page right margin. The value must be specified in inches
|
4970
|
-
# * +bottom+ - Set the output page bottom margin. The value must be specified in inches
|
4971
|
-
# * +left+ - Set the output page left margin. The value must be specified in inches
|
4996
|
+
# * +top+ - Set the output page top margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4997
|
+
# * +right+ - Set the output page right margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4998
|
+
# * +bottom+ - Set the output page bottom margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4999
|
+
# * +left+ - Set the output page left margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.
|
4972
5000
|
# * *Returns* - The converter object.
|
4973
5001
|
def setPageMargins(top, right, bottom, left)
|
4974
5002
|
setMarginTop(top)
|
@@ -5015,11 +5043,11 @@ module Pdfcrowd
|
|
5015
5043
|
|
5016
5044
|
# Load a file from the specified URL and apply the file as a watermark to each page of the output PDF. 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.
|
5017
5045
|
#
|
5018
|
-
# * +url+ -
|
5046
|
+
# * +url+ - Supported protocols are http:// and https://.
|
5019
5047
|
# * *Returns* - The converter object.
|
5020
5048
|
def setPageWatermarkUrl(url)
|
5021
5049
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
5022
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "image-to-pdf", "
|
5050
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageWatermarkUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_page_watermark_url"), 470);
|
5023
5051
|
end
|
5024
5052
|
|
5025
5053
|
@fields['page_watermark_url'] = url
|
@@ -5041,11 +5069,11 @@ module Pdfcrowd
|
|
5041
5069
|
|
5042
5070
|
# Load a file from the specified URL and apply each page of the file as a watermark to the corresponding page of the output PDF. A watermark can be either a PDF or an image.
|
5043
5071
|
#
|
5044
|
-
# * +url+ -
|
5072
|
+
# * +url+ - Supported protocols are http:// and https://.
|
5045
5073
|
# * *Returns* - The converter object.
|
5046
5074
|
def setMultipageWatermarkUrl(url)
|
5047
5075
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
5048
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "image-to-pdf", "
|
5076
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageWatermarkUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_watermark_url"), 470);
|
5049
5077
|
end
|
5050
5078
|
|
5051
5079
|
@fields['multipage_watermark_url'] = url
|
@@ -5067,11 +5095,11 @@ module Pdfcrowd
|
|
5067
5095
|
|
5068
5096
|
# Load a file from the specified URL and apply the file as a background to each page of the output PDF. A background 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 background.
|
5069
5097
|
#
|
5070
|
-
# * +url+ -
|
5098
|
+
# * +url+ - Supported protocols are http:// and https://.
|
5071
5099
|
# * *Returns* - The converter object.
|
5072
5100
|
def setPageBackgroundUrl(url)
|
5073
5101
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
5074
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "image-to-pdf", "
|
5102
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setPageBackgroundUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_page_background_url"), 470);
|
5075
5103
|
end
|
5076
5104
|
|
5077
5105
|
@fields['page_background_url'] = url
|
@@ -5093,11 +5121,11 @@ module Pdfcrowd
|
|
5093
5121
|
|
5094
5122
|
# Load a file from the specified URL and apply each page of the file as a background to the corresponding page of the output PDF. A background can be either a PDF or an image.
|
5095
5123
|
#
|
5096
|
-
# * +url+ -
|
5124
|
+
# * +url+ - Supported protocols are http:// and https://.
|
5097
5125
|
# * *Returns* - The converter object.
|
5098
5126
|
def setMultipageBackgroundUrl(url)
|
5099
5127
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
5100
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "image-to-pdf", "
|
5128
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "setMultipageBackgroundUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_background_url"), 470);
|
5101
5129
|
end
|
5102
5130
|
|
5103
5131
|
@fields['multipage_background_url'] = url
|
@@ -5244,11 +5272,11 @@ module Pdfcrowd
|
|
5244
5272
|
|
5245
5273
|
# Display the specified page when the document is opened.
|
5246
5274
|
#
|
5247
|
-
# * +page+ - Must be a positive integer
|
5275
|
+
# * +page+ - Must be a positive integer.
|
5248
5276
|
# * *Returns* - The converter object.
|
5249
5277
|
def setInitialPage(page)
|
5250
5278
|
if (!(Integer(page) > 0))
|
5251
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "image-to-pdf", "Must be a positive integer
|
5279
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(page, "setInitialPage", "image-to-pdf", "Must be a positive integer.", "set_initial_page"), 470);
|
5252
5280
|
end
|
5253
5281
|
|
5254
5282
|
@fields['initial_page'] = page
|
@@ -5257,11 +5285,11 @@ module Pdfcrowd
|
|
5257
5285
|
|
5258
5286
|
# Specify the initial page zoom in percents when the document is opened.
|
5259
5287
|
#
|
5260
|
-
# * +zoom+ - Must be a positive integer
|
5288
|
+
# * +zoom+ - Must be a positive integer.
|
5261
5289
|
# * *Returns* - The converter object.
|
5262
5290
|
def setInitialZoom(zoom)
|
5263
5291
|
if (!(Integer(zoom) > 0))
|
5264
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "image-to-pdf", "Must be a positive integer
|
5292
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, "setInitialZoom", "image-to-pdf", "Must be a positive integer.", "set_initial_zoom"), 470);
|
5265
5293
|
end
|
5266
5294
|
|
5267
5295
|
@fields['initial_zoom'] = zoom
|
@@ -5488,11 +5516,11 @@ module Pdfcrowd
|
|
5488
5516
|
|
5489
5517
|
# Convert a PDF.
|
5490
5518
|
#
|
5491
|
-
# * +url+ - The address of the PDF to convert.
|
5519
|
+
# * +url+ - The address of the PDF to convert. Supported protocols are http:// and https://.
|
5492
5520
|
# * *Returns* - Byte array containing the conversion output.
|
5493
5521
|
def convertUrl(url)
|
5494
5522
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
5495
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-html", "
|
5523
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-html", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
5496
5524
|
end
|
5497
5525
|
|
5498
5526
|
@fields['url'] = url
|
@@ -5501,11 +5529,11 @@ module Pdfcrowd
|
|
5501
5529
|
|
5502
5530
|
# Convert a PDF and write the result to an output stream.
|
5503
5531
|
#
|
5504
|
-
# * +url+ - The address of the PDF to convert.
|
5532
|
+
# * +url+ - The address of the PDF to convert. Supported protocols are http:// and https://.
|
5505
5533
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
5506
5534
|
def convertUrlToStream(url, out_stream)
|
5507
5535
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
5508
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-html", "
|
5536
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-html", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
5509
5537
|
end
|
5510
5538
|
|
5511
5539
|
@fields['url'] = url
|
@@ -5514,7 +5542,7 @@ module Pdfcrowd
|
|
5514
5542
|
|
5515
5543
|
# Convert a PDF and write the result to a local file.
|
5516
5544
|
#
|
5517
|
-
# * +url+ - The address of the PDF to convert.
|
5545
|
+
# * +url+ - The address of the PDF to convert. Supported protocols are http:// and https://.
|
5518
5546
|
# * +file_path+ - The output file path. The string must not be empty. The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.
|
5519
5547
|
def convertUrlToFile(url, file_path)
|
5520
5548
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -5681,11 +5709,11 @@ module Pdfcrowd
|
|
5681
5709
|
|
5682
5710
|
# Set the scaling factor (zoom) for the main page area.
|
5683
5711
|
#
|
5684
|
-
# * +factor+ - The percentage value. Must be a positive integer
|
5712
|
+
# * +factor+ - The percentage value. Must be a positive integer.
|
5685
5713
|
# * *Returns* - The converter object.
|
5686
5714
|
def setScaleFactor(factor)
|
5687
5715
|
if (!(Integer(factor) > 0))
|
5688
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "pdf-to-html", "Must be a positive integer
|
5716
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(factor, "setScaleFactor", "pdf-to-html", "Must be a positive integer.", "set_scale_factor"), 470);
|
5689
5717
|
end
|
5690
5718
|
|
5691
5719
|
@fields['scale_factor'] = factor
|
@@ -6043,11 +6071,11 @@ module Pdfcrowd
|
|
6043
6071
|
|
6044
6072
|
# Convert a PDF.
|
6045
6073
|
#
|
6046
|
-
# * +url+ - The address of the PDF to convert.
|
6074
|
+
# * +url+ - The address of the PDF to convert. Supported protocols are http:// and https://.
|
6047
6075
|
# * *Returns* - Byte array containing the conversion output.
|
6048
6076
|
def convertUrl(url)
|
6049
6077
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
6050
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-text", "
|
6078
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-text", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
6051
6079
|
end
|
6052
6080
|
|
6053
6081
|
@fields['url'] = url
|
@@ -6056,11 +6084,11 @@ module Pdfcrowd
|
|
6056
6084
|
|
6057
6085
|
# Convert a PDF and write the result to an output stream.
|
6058
6086
|
#
|
6059
|
-
# * +url+ - The address of the PDF to convert.
|
6087
|
+
# * +url+ - The address of the PDF to convert. Supported protocols are http:// and https://.
|
6060
6088
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
6061
6089
|
def convertUrlToStream(url, out_stream)
|
6062
6090
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
6063
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-text", "
|
6091
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-text", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
6064
6092
|
end
|
6065
6093
|
|
6066
6094
|
@fields['url'] = url
|
@@ -6069,7 +6097,7 @@ module Pdfcrowd
|
|
6069
6097
|
|
6070
6098
|
# Convert a PDF and write the result to a local file.
|
6071
6099
|
#
|
6072
|
-
# * +url+ - The address of the PDF to convert.
|
6100
|
+
# * +url+ - The address of the PDF to convert. Supported protocols are http:// and https://.
|
6073
6101
|
# * +file_path+ - The output file path. The string must not be empty.
|
6074
6102
|
def convertUrlToFile(url, file_path)
|
6075
6103
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -6321,11 +6349,11 @@ module Pdfcrowd
|
|
6321
6349
|
|
6322
6350
|
# Set the top left X coordinate of the crop area in points.
|
6323
6351
|
#
|
6324
|
-
# * +x+ - Must be a positive integer
|
6352
|
+
# * +x+ - Must be a positive integer or 0.
|
6325
6353
|
# * *Returns* - The converter object.
|
6326
6354
|
def setCropAreaX(x)
|
6327
6355
|
if (!(Integer(x) >= 0))
|
6328
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "pdf-to-text", "Must be a positive integer
|
6356
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "pdf-to-text", "Must be a positive integer or 0.", "set_crop_area_x"), 470);
|
6329
6357
|
end
|
6330
6358
|
|
6331
6359
|
@fields['crop_area_x'] = x
|
@@ -6334,11 +6362,11 @@ module Pdfcrowd
|
|
6334
6362
|
|
6335
6363
|
# Set the top left Y coordinate of the crop area in points.
|
6336
6364
|
#
|
6337
|
-
# * +y+ - Must be a positive integer
|
6365
|
+
# * +y+ - Must be a positive integer or 0.
|
6338
6366
|
# * *Returns* - The converter object.
|
6339
6367
|
def setCropAreaY(y)
|
6340
6368
|
if (!(Integer(y) >= 0))
|
6341
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "pdf-to-text", "Must be a positive integer
|
6369
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "pdf-to-text", "Must be a positive integer or 0.", "set_crop_area_y"), 470);
|
6342
6370
|
end
|
6343
6371
|
|
6344
6372
|
@fields['crop_area_y'] = y
|
@@ -6347,11 +6375,11 @@ module Pdfcrowd
|
|
6347
6375
|
|
6348
6376
|
# Set the width of the crop area in points.
|
6349
6377
|
#
|
6350
|
-
# * +width+ - Must be a positive integer
|
6378
|
+
# * +width+ - Must be a positive integer or 0.
|
6351
6379
|
# * *Returns* - The converter object.
|
6352
6380
|
def setCropAreaWidth(width)
|
6353
6381
|
if (!(Integer(width) >= 0))
|
6354
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "pdf-to-text", "Must be a positive integer
|
6382
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "pdf-to-text", "Must be a positive integer or 0.", "set_crop_area_width"), 470);
|
6355
6383
|
end
|
6356
6384
|
|
6357
6385
|
@fields['crop_area_width'] = width
|
@@ -6360,11 +6388,11 @@ module Pdfcrowd
|
|
6360
6388
|
|
6361
6389
|
# Set the height of the crop area in points.
|
6362
6390
|
#
|
6363
|
-
# * +height+ - Must be a positive integer
|
6391
|
+
# * +height+ - Must be a positive integer or 0.
|
6364
6392
|
# * *Returns* - The converter object.
|
6365
6393
|
def setCropAreaHeight(height)
|
6366
6394
|
if (!(Integer(height) >= 0))
|
6367
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "pdf-to-text", "Must be a positive integer
|
6395
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "pdf-to-text", "Must be a positive integer or 0.", "set_crop_area_height"), 470);
|
6368
6396
|
end
|
6369
6397
|
|
6370
6398
|
@fields['crop_area_height'] = height
|
@@ -6373,10 +6401,10 @@ module Pdfcrowd
|
|
6373
6401
|
|
6374
6402
|
# Set the crop area. It allows to extract just a part of a PDF page.
|
6375
6403
|
#
|
6376
|
-
# * +x+ - Set the top left X coordinate of the crop area in points. Must be a positive integer
|
6377
|
-
# * +y+ - Set the top left Y coordinate of the crop area in points. Must be a positive integer
|
6378
|
-
# * +width+ - Set the width of the crop area in points. Must be a positive integer
|
6379
|
-
# * +height+ - Set the height of the crop area in points. Must be a positive integer
|
6404
|
+
# * +x+ - Set the top left X coordinate of the crop area in points. Must be a positive integer or 0.
|
6405
|
+
# * +y+ - Set the top left Y coordinate of the crop area in points. Must be a positive integer or 0.
|
6406
|
+
# * +width+ - Set the width of the crop area in points. Must be a positive integer or 0.
|
6407
|
+
# * +height+ - Set the height of the crop area in points. Must be a positive integer or 0.
|
6380
6408
|
# * *Returns* - The converter object.
|
6381
6409
|
def setCropArea(x, y, width, height)
|
6382
6410
|
setCropAreaX(x)
|
@@ -6545,11 +6573,11 @@ module Pdfcrowd
|
|
6545
6573
|
|
6546
6574
|
# Convert an image.
|
6547
6575
|
#
|
6548
|
-
# * +url+ - The address of the image to convert.
|
6576
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
6549
6577
|
# * *Returns* - Byte array containing the conversion output.
|
6550
6578
|
def convertUrl(url)
|
6551
6579
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
6552
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-image", "
|
6580
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-image", "Supported protocols are http:// and https://.", "convert_url"), 470);
|
6553
6581
|
end
|
6554
6582
|
|
6555
6583
|
@fields['url'] = url
|
@@ -6558,11 +6586,11 @@ module Pdfcrowd
|
|
6558
6586
|
|
6559
6587
|
# Convert an image and write the result to an output stream.
|
6560
6588
|
#
|
6561
|
-
# * +url+ - The address of the image to convert.
|
6589
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
6562
6590
|
# * +out_stream+ - The output stream that will contain the conversion output.
|
6563
6591
|
def convertUrlToStream(url, out_stream)
|
6564
6592
|
unless /(?i)^https?:\/\/.*$/.match(url)
|
6565
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-image", "
|
6593
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-image", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
|
6566
6594
|
end
|
6567
6595
|
|
6568
6596
|
@fields['url'] = url
|
@@ -6571,7 +6599,7 @@ module Pdfcrowd
|
|
6571
6599
|
|
6572
6600
|
# Convert an image and write the result to a local file.
|
6573
6601
|
#
|
6574
|
-
# * +url+ - The address of the image to convert.
|
6602
|
+
# * +url+ - The address of the image to convert. Supported protocols are http:// and https://.
|
6575
6603
|
# * +file_path+ - The output file path. The string must not be empty.
|
6576
6604
|
def convertUrlToFile(url, file_path)
|
6577
6605
|
if (!(!file_path.nil? && !file_path.empty?))
|
@@ -6781,11 +6809,11 @@ module Pdfcrowd
|
|
6781
6809
|
|
6782
6810
|
# Set the top left X coordinate of the crop area in points.
|
6783
6811
|
#
|
6784
|
-
# * +x+ - Must be a positive integer
|
6812
|
+
# * +x+ - Must be a positive integer or 0.
|
6785
6813
|
# * *Returns* - The converter object.
|
6786
6814
|
def setCropAreaX(x)
|
6787
6815
|
if (!(Integer(x) >= 0))
|
6788
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "pdf-to-image", "Must be a positive integer
|
6816
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "pdf-to-image", "Must be a positive integer or 0.", "set_crop_area_x"), 470);
|
6789
6817
|
end
|
6790
6818
|
|
6791
6819
|
@fields['crop_area_x'] = x
|
@@ -6794,11 +6822,11 @@ module Pdfcrowd
|
|
6794
6822
|
|
6795
6823
|
# Set the top left Y coordinate of the crop area in points.
|
6796
6824
|
#
|
6797
|
-
# * +y+ - Must be a positive integer
|
6825
|
+
# * +y+ - Must be a positive integer or 0.
|
6798
6826
|
# * *Returns* - The converter object.
|
6799
6827
|
def setCropAreaY(y)
|
6800
6828
|
if (!(Integer(y) >= 0))
|
6801
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "pdf-to-image", "Must be a positive integer
|
6829
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "pdf-to-image", "Must be a positive integer or 0.", "set_crop_area_y"), 470);
|
6802
6830
|
end
|
6803
6831
|
|
6804
6832
|
@fields['crop_area_y'] = y
|
@@ -6807,11 +6835,11 @@ module Pdfcrowd
|
|
6807
6835
|
|
6808
6836
|
# Set the width of the crop area in points.
|
6809
6837
|
#
|
6810
|
-
# * +width+ - Must be a positive integer
|
6838
|
+
# * +width+ - Must be a positive integer or 0.
|
6811
6839
|
# * *Returns* - The converter object.
|
6812
6840
|
def setCropAreaWidth(width)
|
6813
6841
|
if (!(Integer(width) >= 0))
|
6814
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "pdf-to-image", "Must be a positive integer
|
6842
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "pdf-to-image", "Must be a positive integer or 0.", "set_crop_area_width"), 470);
|
6815
6843
|
end
|
6816
6844
|
|
6817
6845
|
@fields['crop_area_width'] = width
|
@@ -6820,11 +6848,11 @@ module Pdfcrowd
|
|
6820
6848
|
|
6821
6849
|
# Set the height of the crop area in points.
|
6822
6850
|
#
|
6823
|
-
# * +height+ - Must be a positive integer
|
6851
|
+
# * +height+ - Must be a positive integer or 0.
|
6824
6852
|
# * *Returns* - The converter object.
|
6825
6853
|
def setCropAreaHeight(height)
|
6826
6854
|
if (!(Integer(height) >= 0))
|
6827
|
-
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "pdf-to-image", "Must be a positive integer
|
6855
|
+
raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "pdf-to-image", "Must be a positive integer or 0.", "set_crop_area_height"), 470);
|
6828
6856
|
end
|
6829
6857
|
|
6830
6858
|
@fields['crop_area_height'] = height
|
@@ -6833,10 +6861,10 @@ module Pdfcrowd
|
|
6833
6861
|
|
6834
6862
|
# Set the crop area. It allows to extract just a part of a PDF page.
|
6835
6863
|
#
|
6836
|
-
# * +x+ - Set the top left X coordinate of the crop area in points. Must be a positive integer
|
6837
|
-
# * +y+ - Set the top left Y coordinate of the crop area in points. Must be a positive integer
|
6838
|
-
# * +width+ - Set the width of the crop area in points. Must be a positive integer
|
6839
|
-
# * +height+ - Set the height of the crop area in points. Must be a positive integer
|
6864
|
+
# * +x+ - Set the top left X coordinate of the crop area in points. Must be a positive integer or 0.
|
6865
|
+
# * +y+ - Set the top left Y coordinate of the crop area in points. Must be a positive integer or 0.
|
6866
|
+
# * +width+ - Set the width of the crop area in points. Must be a positive integer or 0.
|
6867
|
+
# * +height+ - Set the height of the crop area in points. Must be a positive integer or 0.
|
6840
6868
|
# * *Returns* - The converter object.
|
6841
6869
|
def setCropArea(x, y, width, height)
|
6842
6870
|
setCropAreaX(x)
|