Class: Pdfcrowd::ImageToPdfClient
- Inherits:
-
Object
- Object
- Pdfcrowd::ImageToPdfClient
- Defined in:
- lib/pdfcrowd.rb
Overview
Conversion from an image to PDF.
Instance Method Summary collapse
- #addAttachment(attachment) ⇒ Object
- #convertFile(file) ⇒ Object
- #convertFileToFile(file, file_path) ⇒ Object
- #convertFileToStream(file, out_stream) ⇒ Object
- #convertRawData(data) ⇒ Object
- #convertRawDataToFile(data, file_path) ⇒ Object
- #convertRawDataToStream(data, out_stream) ⇒ Object
- #convertStream(in_stream) ⇒ Object
- #convertStreamToFile(in_stream, file_path) ⇒ Object
- #convertStreamToStream(in_stream, out_stream) ⇒ Object
- #convertUrl(url) ⇒ Object
- #convertUrlToFile(url, file_path) ⇒ Object
- #convertUrlToStream(url, out_stream) ⇒ Object
- #getConsumedCreditCount ⇒ Object
- #getDebugLogUrl ⇒ Object
- #getJobId ⇒ Object
- #getOutputSize ⇒ Object
- #getRemainingCreditCount ⇒ Object
- #getVersion ⇒ Object
-
#initialize(user_name, api_key) ⇒ ImageToPdfClient
constructor
A new instance of ImageToPdfClient.
- #setAuthor(author) ⇒ Object
- #setCenterWindow(value) ⇒ Object
- #setClientUserAgent(agent) ⇒ Object
- #setConverterVersion(version) ⇒ Object
- #setCropArea(x, y, width, height) ⇒ Object
- #setCropAreaHeight(height) ⇒ Object
- #setCropAreaWidth(width) ⇒ Object
- #setCropAreaX(x) ⇒ Object
- #setCropAreaY(y) ⇒ Object
- #setDebugLog(value) ⇒ Object
- #setDisplayTitle(value) ⇒ Object
- #setDpi(dpi) ⇒ Object
- #setEncrypt(value) ⇒ Object
- #setFitWindow(value) ⇒ Object
- #setHideMenubar(value) ⇒ Object
- #setHideToolbar(value) ⇒ Object
- #setHideWindowUi(value) ⇒ Object
- #setHttpProxy(proxy) ⇒ Object
- #setHttpsProxy(proxy) ⇒ Object
- #setInitialPage(page) ⇒ Object
- #setInitialZoom(zoom) ⇒ Object
- #setInitialZoomType(zoom_type) ⇒ Object
- #setKeywords(keywords) ⇒ Object
- #setLinearize(value) ⇒ Object
- #setMarginBottom(bottom) ⇒ Object
- #setMarginLeft(left) ⇒ Object
- #setMarginRight(right) ⇒ Object
- #setMarginTop(top) ⇒ Object
- #setMultipageBackground(background) ⇒ Object
- #setMultipageBackgroundUrl(url) ⇒ Object
- #setMultipageWatermark(watermark) ⇒ Object
- #setMultipageWatermarkUrl(url) ⇒ Object
- #setNoCopy(value) ⇒ Object
- #setNoModify(value) ⇒ Object
- #setNoPrint(value) ⇒ Object
- #setOrientation(orientation) ⇒ Object
- #setOwnerPassword(password) ⇒ Object
- #setPageBackground(background) ⇒ Object
- #setPageBackgroundColor(color) ⇒ Object
- #setPageBackgroundUrl(url) ⇒ Object
- #setPageDimensions(width, height) ⇒ Object
- #setPageHeight(height) ⇒ Object
- #setPageLayout(layout) ⇒ Object
- #setPageMargins(top, right, bottom, left) ⇒ Object
- #setPageMode(mode) ⇒ Object
- #setPageSize(size) ⇒ Object
- #setPageWatermark(watermark) ⇒ Object
- #setPageWatermarkUrl(url) ⇒ Object
- #setPageWidth(width) ⇒ Object
- #setPosition(position) ⇒ Object
- #setPrintPageMode(mode) ⇒ Object
- #setProxy(host, port, user_name, password) ⇒ Object
- #setRemoveBorders(value) ⇒ Object
- #setResize(resize) ⇒ Object
- #setRetryCount(count) ⇒ Object
- #setRotate(rotate) ⇒ Object
- #setSubject(subject) ⇒ Object
- #setTag(tag) ⇒ Object
- #setTitle(title) ⇒ Object
- #setUseHttp(value) ⇒ Object
- #setUserAgent(agent) ⇒ Object
- #setUserPassword(password) ⇒ Object
Constructor Details
#initialize(user_name, api_key) ⇒ ImageToPdfClient
Returns a new instance of ImageToPdfClient.
3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 |
# File 'lib/pdfcrowd.rb', line 3643 def initialize(user_name, api_key) @helper = ConnectionHelper.new(user_name, api_key) @fields = { 'input_format'=>'image', 'output_format'=>'pdf' } @file_id = 1 @files = {} @raw_data = {} end |
Instance Method Details
#addAttachment(attachment) ⇒ Object
4132 4133 4134 4135 4136 4137 4138 4139 4140 |
# File 'lib/pdfcrowd.rb', line 4132 def addAttachment() if (!(File.file?() && !File.zero?())) raise Error.new(Pdfcrowd.(, "addAttachment", "image-to-pdf", "The file must exist and not be empty.", "add_attachment"), 470); end @files['attachment_%s' % @file_id] = @file_id += 1 self end |
#convertFile(file) ⇒ Object
3692 3693 3694 3695 3696 3697 3698 3699 |
# File 'lib/pdfcrowd.rb', line 3692 def convertFile(file) if (!(File.file?(file) && !File.zero?(file))) raise Error.new(Pdfcrowd.(file, "convertFile", "image-to-pdf", "The file must exist and not be empty.", "convert_file"), 470); end @files['file'] = file @helper.post(@fields, @files, @raw_data) end |
#convertFileToFile(file, file_path) ⇒ Object
3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 |
# File 'lib/pdfcrowd.rb', line 3712 def convertFileToFile(file, file_path) if (!(!file_path.nil? && !file_path.empty?)) raise Error.new(Pdfcrowd.(file_path, "convertFileToFile::file_path", "image-to-pdf", "The string must not be empty.", "convert_file_to_file"), 470); end output_file = open(file_path, "wb") begin convertFileToStream(file, output_file) output_file.close() rescue Error => why output_file.close() FileUtils.rm(file_path) raise end end |
#convertFileToStream(file, out_stream) ⇒ Object
3702 3703 3704 3705 3706 3707 3708 3709 |
# File 'lib/pdfcrowd.rb', line 3702 def convertFileToStream(file, out_stream) if (!(File.file?(file) && !File.zero?(file))) raise Error.new(Pdfcrowd.(file, "convertFileToStream::file", "image-to-pdf", "The file must exist and not be empty.", "convert_file_to_stream"), 470); end @files['file'] = file @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertRawData(data) ⇒ Object
3729 3730 3731 3732 |
# File 'lib/pdfcrowd.rb', line 3729 def convertRawData(data) @raw_data['file'] = data @helper.post(@fields, @files, @raw_data) end |
#convertRawDataToFile(data, file_path) ⇒ Object
3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 |
# File 'lib/pdfcrowd.rb', line 3741 def convertRawDataToFile(data, file_path) if (!(!file_path.nil? && !file_path.empty?)) raise Error.new(Pdfcrowd.(file_path, "convertRawDataToFile::file_path", "image-to-pdf", "The string must not be empty.", "convert_raw_data_to_file"), 470); end output_file = open(file_path, "wb") begin convertRawDataToStream(data, output_file) output_file.close() rescue Error => why output_file.close() FileUtils.rm(file_path) raise end end |
#convertRawDataToStream(data, out_stream) ⇒ Object
3735 3736 3737 3738 |
# File 'lib/pdfcrowd.rb', line 3735 def convertRawDataToStream(data, out_stream) @raw_data['file'] = data @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertStream(in_stream) ⇒ Object
3758 3759 3760 3761 |
# File 'lib/pdfcrowd.rb', line 3758 def convertStream(in_stream) @raw_data['stream'] = in_stream.read @helper.post(@fields, @files, @raw_data) end |
#convertStreamToFile(in_stream, file_path) ⇒ Object
3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 |
# File 'lib/pdfcrowd.rb', line 3770 def convertStreamToFile(in_stream, file_path) if (!(!file_path.nil? && !file_path.empty?)) raise Error.new(Pdfcrowd.(file_path, "convertStreamToFile::file_path", "image-to-pdf", "The string must not be empty.", "convert_stream_to_file"), 470); end output_file = open(file_path, "wb") begin convertStreamToStream(in_stream, output_file) output_file.close() rescue Error => why output_file.close() FileUtils.rm(file_path) raise end end |
#convertStreamToStream(in_stream, out_stream) ⇒ Object
3764 3765 3766 3767 |
# File 'lib/pdfcrowd.rb', line 3764 def convertStreamToStream(in_stream, out_stream) @raw_data['stream'] = in_stream.read @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertUrl(url) ⇒ Object
3655 3656 3657 3658 3659 3660 3661 3662 |
# File 'lib/pdfcrowd.rb', line 3655 def convertUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "convertUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "convert_url"), 470); end @fields['url'] = url @helper.post(@fields, @files, @raw_data) end |
#convertUrlToFile(url, file_path) ⇒ Object
3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 |
# File 'lib/pdfcrowd.rb', line 3675 def convertUrlToFile(url, file_path) if (!(!file_path.nil? && !file_path.empty?)) raise Error.new(Pdfcrowd.(file_path, "convertUrlToFile::file_path", "image-to-pdf", "The string must not be empty.", "convert_url_to_file"), 470); end output_file = open(file_path, "wb") begin convertUrlToStream(url, output_file) output_file.close() rescue Error => why output_file.close() FileUtils.rm(file_path) raise end end |
#convertUrlToStream(url, out_stream) ⇒ Object
3665 3666 3667 3668 3669 3670 3671 3672 |
# File 'lib/pdfcrowd.rb', line 3665 def convertUrlToStream(url, out_stream) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "convertUrlToStream::url", "image-to-pdf", "Supported protocols are http:// and https://.", "convert_url_to_stream"), 470); end @fields['url'] = url @helper.post(@fields, @files, @raw_data, out_stream) end |
#getConsumedCreditCount ⇒ Object
4245 4246 4247 |
# File 'lib/pdfcrowd.rb', line 4245 def getConsumedCreditCount() return @helper.getConsumedCreditCount() end |
#getDebugLogUrl ⇒ Object
4235 4236 4237 |
# File 'lib/pdfcrowd.rb', line 4235 def getDebugLogUrl() return @helper.getDebugLogUrl() end |
#getJobId ⇒ Object
4250 4251 4252 |
# File 'lib/pdfcrowd.rb', line 4250 def getJobId() return @helper.getJobId() end |
#getOutputSize ⇒ Object
4255 4256 4257 |
# File 'lib/pdfcrowd.rb', line 4255 def getOutputSize() return @helper.getOutputSize() end |
#getRemainingCreditCount ⇒ Object
4240 4241 4242 |
# File 'lib/pdfcrowd.rb', line 4240 def getRemainingCreditCount() return @helper.getRemainingCreditCount() end |
#getVersion ⇒ Object
4260 4261 4262 |
# File 'lib/pdfcrowd.rb', line 4260 def getVersion() return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion() end |
#setAuthor(author) ⇒ Object
4120 4121 4122 4123 |
# File 'lib/pdfcrowd.rb', line 4120 def setAuthor() @fields['author'] = self end |
#setCenterWindow(value) ⇒ Object
4217 4218 4219 4220 |
# File 'lib/pdfcrowd.rb', line 4217 def setCenterWindow(value) @fields['center_window'] = value self end |
#setClientUserAgent(agent) ⇒ Object
4307 4308 4309 4310 |
# File 'lib/pdfcrowd.rb', line 4307 def setClientUserAgent(agent) @helper.setUserAgent(agent) self end |
#setConverterVersion(version) ⇒ Object
4291 4292 4293 4294 4295 4296 4297 4298 |
# File 'lib/pdfcrowd.rb', line 4291 def setConverterVersion(version) unless /(?i)^(24.04|20.10|18.10|latest)$/.match(version) raise Error.new(Pdfcrowd.(version, "setConverterVersion", "image-to-pdf", "Allowed values are 24.04, 20.10, 18.10, latest.", "set_converter_version"), 470); end @helper.setConverterVersion(version) self end |
#setCropArea(x, y, width, height) ⇒ Object
3839 3840 3841 3842 3843 3844 3845 |
# File 'lib/pdfcrowd.rb', line 3839 def setCropArea(x, y, width, height) setCropAreaX(x) setCropAreaY(y) setCropAreaWidth(width) setCropAreaHeight(height) self end |
#setCropAreaHeight(height) ⇒ Object
3829 3830 3831 3832 3833 3834 3835 3836 |
# File 'lib/pdfcrowd.rb', line 3829 def setCropAreaHeight(height) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height) raise Error.new(Pdfcrowd.(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); end @fields['crop_area_height'] = height self end |
#setCropAreaWidth(width) ⇒ Object
3819 3820 3821 3822 3823 3824 3825 3826 |
# File 'lib/pdfcrowd.rb', line 3819 def setCropAreaWidth(width) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width) raise Error.new(Pdfcrowd.(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); end @fields['crop_area_width'] = width self end |
#setCropAreaX(x) ⇒ Object
3799 3800 3801 3802 3803 3804 3805 3806 |
# File 'lib/pdfcrowd.rb', line 3799 def setCropAreaX(x) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(x) raise Error.new(Pdfcrowd.(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); end @fields['crop_area_x'] = x self end |
#setCropAreaY(y) ⇒ Object
3809 3810 3811 3812 3813 3814 3815 3816 |
# File 'lib/pdfcrowd.rb', line 3809 def setCropAreaY(y) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(y) raise Error.new(Pdfcrowd.(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); end @fields['crop_area_y'] = y self end |
#setDebugLog(value) ⇒ Object
4229 4230 4231 4232 |
# File 'lib/pdfcrowd.rb', line 4229 def setDebugLog(value) @fields['debug_log'] = value self end |
#setDisplayTitle(value) ⇒ Object
4223 4224 4225 4226 |
# File 'lib/pdfcrowd.rb', line 4223 def setDisplayTitle(value) @fields['display_title'] = value self end |
#setDpi(dpi) ⇒ Object
3980 3981 3982 3983 |
# File 'lib/pdfcrowd.rb', line 3980 def setDpi(dpi) @fields['dpi'] = dpi self end |
#setEncrypt(value) ⇒ Object
4072 4073 4074 4075 |
# File 'lib/pdfcrowd.rb', line 4072 def setEncrypt(value) @fields['encrypt'] = value self end |
#setFitWindow(value) ⇒ Object
4211 4212 4213 4214 |
# File 'lib/pdfcrowd.rb', line 4211 def setFitWindow(value) @fields['fit_window'] = value self end |
#setHideMenubar(value) ⇒ Object
4199 4200 4201 4202 |
# File 'lib/pdfcrowd.rb', line 4199 def (value) @fields['hide_menubar'] = value self end |
#setHideToolbar(value) ⇒ Object
4193 4194 4195 4196 |
# File 'lib/pdfcrowd.rb', line 4193 def (value) @fields['hide_toolbar'] = value self end |
#setHideWindowUi(value) ⇒ Object
4205 4206 4207 4208 |
# File 'lib/pdfcrowd.rb', line 4205 def setHideWindowUi(value) @fields['hide_window_ui'] = value self end |
#setHttpProxy(proxy) ⇒ Object
4271 4272 4273 4274 4275 4276 4277 4278 |
# File 'lib/pdfcrowd.rb', line 4271 def setHttpProxy(proxy) unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy) raise Error.new(Pdfcrowd.(proxy, "setHttpProxy", "image-to-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470); end @fields['http_proxy'] = proxy self end |
#setHttpsProxy(proxy) ⇒ Object
4281 4282 4283 4284 4285 4286 4287 4288 |
# File 'lib/pdfcrowd.rb', line 4281 def setHttpsProxy(proxy) unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy) raise Error.new(Pdfcrowd.(proxy, "setHttpsProxy", "image-to-pdf", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470); end @fields['https_proxy'] = proxy self end |
#setInitialPage(page) ⇒ Object
4173 4174 4175 4176 4177 4178 4179 4180 |
# File 'lib/pdfcrowd.rb', line 4173 def setInitialPage(page) if (!(Integer(page) > 0)) raise Error.new(Pdfcrowd.(page, "setInitialPage", "image-to-pdf", "Must be a positive integer.", "set_initial_page"), 470); end @fields['initial_page'] = page self end |
#setInitialZoom(zoom) ⇒ Object
4183 4184 4185 4186 4187 4188 4189 4190 |
# File 'lib/pdfcrowd.rb', line 4183 def setInitialZoom(zoom) if (!(Integer(zoom) > 0)) raise Error.new(Pdfcrowd.(zoom, "setInitialZoom", "image-to-pdf", "Must be a positive integer.", "set_initial_zoom"), 470); end @fields['initial_zoom'] = zoom self end |
#setInitialZoomType(zoom_type) ⇒ Object
4163 4164 4165 4166 4167 4168 4169 4170 |
# File 'lib/pdfcrowd.rb', line 4163 def setInitialZoomType(zoom_type) unless /(?i)^(fit-width|fit-height|fit-page)$/.match(zoom_type) raise Error.new(Pdfcrowd.(zoom_type, "setInitialZoomType", "image-to-pdf", "Allowed values are fit-width, fit-height, fit-page.", "set_initial_zoom_type"), 470); end @fields['initial_zoom_type'] = zoom_type self end |
#setKeywords(keywords) ⇒ Object
4126 4127 4128 4129 |
# File 'lib/pdfcrowd.rb', line 4126 def setKeywords(keywords) @fields['keywords'] = keywords self end |
#setLinearize(value) ⇒ Object
4066 4067 4068 4069 |
# File 'lib/pdfcrowd.rb', line 4066 def setLinearize(value) @fields['linearize'] = value self end |
#setMarginBottom(bottom) ⇒ Object
3941 3942 3943 3944 3945 3946 3947 3948 |
# File 'lib/pdfcrowd.rb', line 3941 def setMarginBottom(bottom) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(bottom) raise Error.new(Pdfcrowd.(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); end @fields['margin_bottom'] = bottom self end |
#setMarginLeft(left) ⇒ Object
3951 3952 3953 3954 3955 3956 3957 3958 |
# File 'lib/pdfcrowd.rb', line 3951 def setMarginLeft(left) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(left) raise Error.new(Pdfcrowd.(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); end @fields['margin_left'] = left self end |
#setMarginRight(right) ⇒ Object
3931 3932 3933 3934 3935 3936 3937 3938 |
# File 'lib/pdfcrowd.rb', line 3931 def setMarginRight(right) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(right) raise Error.new(Pdfcrowd.(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); end @fields['margin_right'] = right self end |
#setMarginTop(top) ⇒ Object
3921 3922 3923 3924 3925 3926 3927 3928 |
# File 'lib/pdfcrowd.rb', line 3921 def setMarginTop(top) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(top) raise Error.new(Pdfcrowd.(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); end @fields['margin_top'] = top self end |
#setMultipageBackground(background) ⇒ Object
4046 4047 4048 4049 4050 4051 4052 4053 |
# File 'lib/pdfcrowd.rb', line 4046 def setMultipageBackground(background) if (!(File.file?(background) && !File.zero?(background))) raise Error.new(Pdfcrowd.(background, "setMultipageBackground", "image-to-pdf", "The file must exist and not be empty.", "set_multipage_background"), 470); end @files['multipage_background'] = background self end |
#setMultipageBackgroundUrl(url) ⇒ Object
4056 4057 4058 4059 4060 4061 4062 4063 |
# File 'lib/pdfcrowd.rb', line 4056 def setMultipageBackgroundUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setMultipageBackgroundUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_background_url"), 470); end @fields['multipage_background_url'] = url self end |
#setMultipageWatermark(watermark) ⇒ Object
4006 4007 4008 4009 4010 4011 4012 4013 |
# File 'lib/pdfcrowd.rb', line 4006 def setMultipageWatermark(watermark) if (!(File.file?(watermark) && !File.zero?(watermark))) raise Error.new(Pdfcrowd.(watermark, "setMultipageWatermark", "image-to-pdf", "The file must exist and not be empty.", "set_multipage_watermark"), 470); end @files['multipage_watermark'] = watermark self end |
#setMultipageWatermarkUrl(url) ⇒ Object
4016 4017 4018 4019 4020 4021 4022 4023 |
# File 'lib/pdfcrowd.rb', line 4016 def setMultipageWatermarkUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setMultipageWatermarkUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_multipage_watermark_url"), 470); end @fields['multipage_watermark_url'] = url self end |
#setNoCopy(value) ⇒ Object
4102 4103 4104 4105 |
# File 'lib/pdfcrowd.rb', line 4102 def setNoCopy(value) @fields['no_copy'] = value self end |
#setNoModify(value) ⇒ Object
4096 4097 4098 4099 |
# File 'lib/pdfcrowd.rb', line 4096 def setNoModify(value) @fields['no_modify'] = value self end |
#setNoPrint(value) ⇒ Object
4090 4091 4092 4093 |
# File 'lib/pdfcrowd.rb', line 4090 def setNoPrint(value) @fields['no_print'] = value self end |
#setOrientation(orientation) ⇒ Object
3891 3892 3893 3894 3895 3896 3897 3898 |
# File 'lib/pdfcrowd.rb', line 3891 def setOrientation(orientation) unless /(?i)^(landscape|portrait)$/.match(orientation) raise Error.new(Pdfcrowd.(orientation, "setOrientation", "image-to-pdf", "Allowed values are landscape, portrait.", "set_orientation"), 470); end @fields['orientation'] = orientation self end |
#setOwnerPassword(password) ⇒ Object
4084 4085 4086 4087 |
# File 'lib/pdfcrowd.rb', line 4084 def setOwnerPassword(password) @fields['owner_password'] = password self end |
#setPageBackground(background) ⇒ Object
4026 4027 4028 4029 4030 4031 4032 4033 |
# File 'lib/pdfcrowd.rb', line 4026 def setPageBackground(background) if (!(File.file?(background) && !File.zero?(background))) raise Error.new(Pdfcrowd.(background, "setPageBackground", "image-to-pdf", "The file must exist and not be empty.", "set_page_background"), 470); end @files['page_background'] = background self end |
#setPageBackgroundColor(color) ⇒ Object
3970 3971 3972 3973 3974 3975 3976 3977 |
# File 'lib/pdfcrowd.rb', line 3970 def setPageBackgroundColor(color) unless /^[0-9a-fA-F]{6,8}$/.match(color) raise Error.new(Pdfcrowd.(color, "setPageBackgroundColor", "image-to-pdf", "The value must be in RRGGBB or RRGGBBAA hexadecimal format.", "set_page_background_color"), 470); end @fields['page_background_color'] = color self end |
#setPageBackgroundUrl(url) ⇒ Object
4036 4037 4038 4039 4040 4041 4042 4043 |
# File 'lib/pdfcrowd.rb', line 4036 def setPageBackgroundUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setPageBackgroundUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_page_background_url"), 470); end @fields['page_background_url'] = url self end |
#setPageDimensions(width, height) ⇒ Object
3884 3885 3886 3887 3888 |
# File 'lib/pdfcrowd.rb', line 3884 def setPageDimensions(width, height) setPageWidth(width) setPageHeight(height) self end |
#setPageHeight(height) ⇒ Object
3874 3875 3876 3877 3878 3879 3880 3881 |
# File 'lib/pdfcrowd.rb', line 3874 def setPageHeight(height) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(height) raise Error.new(Pdfcrowd.(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); end @fields['page_height'] = height self end |
#setPageLayout(layout) ⇒ Object
4143 4144 4145 4146 4147 4148 4149 4150 |
# File 'lib/pdfcrowd.rb', line 4143 def setPageLayout(layout) unless /(?i)^(single-page|one-column|two-column-left|two-column-right)$/.match(layout) raise Error.new(Pdfcrowd.(layout, "setPageLayout", "image-to-pdf", "Allowed values are single-page, one-column, two-column-left, two-column-right.", "set_page_layout"), 470); end @fields['page_layout'] = layout self end |
#setPageMargins(top, right, bottom, left) ⇒ Object
3961 3962 3963 3964 3965 3966 3967 |
# File 'lib/pdfcrowd.rb', line 3961 def setPageMargins(top, right, bottom, left) setMarginTop(top) setMarginRight(right) setMarginBottom(bottom) setMarginLeft(left) self end |
#setPageMode(mode) ⇒ Object
4153 4154 4155 4156 4157 4158 4159 4160 |
# File 'lib/pdfcrowd.rb', line 4153 def setPageMode(mode) unless /(?i)^(full-screen|thumbnails|outlines)$/.match(mode) raise Error.new(Pdfcrowd.(mode, "setPageMode", "image-to-pdf", "Allowed values are full-screen, thumbnails, outlines.", "set_page_mode"), 470); end @fields['page_mode'] = mode self end |
#setPageSize(size) ⇒ Object
3854 3855 3856 3857 3858 3859 3860 3861 |
# File 'lib/pdfcrowd.rb', line 3854 def setPageSize(size) unless /(?i)^(A0|A1|A2|A3|A4|A5|A6|Letter)$/.match(size) raise Error.new(Pdfcrowd.(size, "setPageSize", "image-to-pdf", "Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.", "set_page_size"), 470); end @fields['page_size'] = size self end |
#setPageWatermark(watermark) ⇒ Object
3986 3987 3988 3989 3990 3991 3992 3993 |
# File 'lib/pdfcrowd.rb', line 3986 def setPageWatermark(watermark) if (!(File.file?(watermark) && !File.zero?(watermark))) raise Error.new(Pdfcrowd.(watermark, "setPageWatermark", "image-to-pdf", "The file must exist and not be empty.", "set_page_watermark"), 470); end @files['page_watermark'] = watermark self end |
#setPageWatermarkUrl(url) ⇒ Object
3996 3997 3998 3999 4000 4001 4002 4003 |
# File 'lib/pdfcrowd.rb', line 3996 def setPageWatermarkUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setPageWatermarkUrl", "image-to-pdf", "Supported protocols are http:// and https://.", "set_page_watermark_url"), 470); end @fields['page_watermark_url'] = url self end |
#setPageWidth(width) ⇒ Object
3864 3865 3866 3867 3868 3869 3870 3871 |
# File 'lib/pdfcrowd.rb', line 3864 def setPageWidth(width) unless /(?i)^0$|^[0-9]*\.?[0-9]+(pt|px|mm|cm|in)$/.match(width) raise Error.new(Pdfcrowd.(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); end @fields['page_width'] = width self end |
#setPosition(position) ⇒ Object
3901 3902 3903 3904 3905 3906 3907 3908 |
# File 'lib/pdfcrowd.rb', line 3901 def setPosition(position) unless /(?i)^(center|top|bottom|left|right|top-left|top-right|bottom-left|bottom-right)$/.match(position) raise Error.new(Pdfcrowd.(position, "setPosition", "image-to-pdf", "Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.", "set_position"), 470); end @fields['position'] = position self end |
#setPrintPageMode(mode) ⇒ Object
3911 3912 3913 3914 3915 3916 3917 3918 |
# File 'lib/pdfcrowd.rb', line 3911 def setPrintPageMode(mode) unless /(?i)^(default|fit|stretch)$/.match(mode) raise Error.new(Pdfcrowd.(mode, "setPrintPageMode", "image-to-pdf", "Allowed values are default, fit, stretch.", "set_print_page_mode"), 470); end @fields['print_page_mode'] = mode self end |
#setProxy(host, port, user_name, password) ⇒ Object
4319 4320 4321 4322 |
# File 'lib/pdfcrowd.rb', line 4319 def setProxy(host, port, user_name, password) @helper.setProxy(host, port, user_name, password) self end |
#setRemoveBorders(value) ⇒ Object
3848 3849 3850 3851 |
# File 'lib/pdfcrowd.rb', line 3848 def setRemoveBorders(value) @fields['remove_borders'] = value self end |
#setResize(resize) ⇒ Object
3787 3788 3789 3790 |
# File 'lib/pdfcrowd.rb', line 3787 def setResize(resize) @fields['resize'] = resize self end |
#setRetryCount(count) ⇒ Object
4325 4326 4327 4328 |
# File 'lib/pdfcrowd.rb', line 4325 def setRetryCount(count) @helper.setRetryCount(count) self end |
#setRotate(rotate) ⇒ Object
3793 3794 3795 3796 |
# File 'lib/pdfcrowd.rb', line 3793 def setRotate(rotate) @fields['rotate'] = rotate self end |
#setSubject(subject) ⇒ Object
4114 4115 4116 4117 |
# File 'lib/pdfcrowd.rb', line 4114 def setSubject(subject) @fields['subject'] = subject self end |
#setTag(tag) ⇒ Object
4265 4266 4267 4268 |
# File 'lib/pdfcrowd.rb', line 4265 def setTag(tag) @fields['tag'] = tag self end |
#setTitle(title) ⇒ Object
4108 4109 4110 4111 |
# File 'lib/pdfcrowd.rb', line 4108 def setTitle(title) @fields['title'] = title self end |
#setUseHttp(value) ⇒ Object
4301 4302 4303 4304 |
# File 'lib/pdfcrowd.rb', line 4301 def setUseHttp(value) @helper.setUseHttp(value) self end |
#setUserAgent(agent) ⇒ Object
4313 4314 4315 4316 |
# File 'lib/pdfcrowd.rb', line 4313 def setUserAgent(agent) @helper.setUserAgent(agent) self end |
#setUserPassword(password) ⇒ Object
4078 4079 4080 4081 |
# File 'lib/pdfcrowd.rb', line 4078 def setUserPassword(password) @fields['user_password'] = password self end |