Class: Pdfcrowd::ImageToPdfClient
- Inherits:
-
Object
- Object
- Pdfcrowd::ImageToPdfClient
- Defined in:
- lib/pdfcrowd.rb
Overview
Conversion from an image to PDF.
Instance Method Summary collapse
- #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.
3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 |
# File 'lib/pdfcrowd.rb', line 3585 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
#convertFile(file) ⇒ Object
3634 3635 3636 3637 3638 3639 3640 3641 |
# File 'lib/pdfcrowd.rb', line 3634 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
3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 |
# File 'lib/pdfcrowd.rb', line 3654 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
3644 3645 3646 3647 3648 3649 3650 3651 |
# File 'lib/pdfcrowd.rb', line 3644 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
3671 3672 3673 3674 |
# File 'lib/pdfcrowd.rb', line 3671 def convertRawData(data) @raw_data['file'] = data @helper.post(@fields, @files, @raw_data) end |
#convertRawDataToFile(data, file_path) ⇒ Object
3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 |
# File 'lib/pdfcrowd.rb', line 3683 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
3677 3678 3679 3680 |
# File 'lib/pdfcrowd.rb', line 3677 def convertRawDataToStream(data, out_stream) @raw_data['file'] = data @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertStream(in_stream) ⇒ Object
3700 3701 3702 3703 |
# File 'lib/pdfcrowd.rb', line 3700 def convertStream(in_stream) @raw_data['stream'] = in_stream.read @helper.post(@fields, @files, @raw_data) end |
#convertStreamToFile(in_stream, 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 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
3706 3707 3708 3709 |
# File 'lib/pdfcrowd.rb', line 3706 def convertStreamToStream(in_stream, out_stream) @raw_data['stream'] = in_stream.read @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertUrl(url) ⇒ Object
3597 3598 3599 3600 3601 3602 3603 3604 |
# File 'lib/pdfcrowd.rb', line 3597 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
3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 |
# File 'lib/pdfcrowd.rb', line 3617 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
3607 3608 3609 3610 3611 3612 3613 3614 |
# File 'lib/pdfcrowd.rb', line 3607 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
4176 4177 4178 |
# File 'lib/pdfcrowd.rb', line 4176 def getConsumedCreditCount() return @helper.getConsumedCreditCount() end |
#getDebugLogUrl ⇒ Object
4166 4167 4168 |
# File 'lib/pdfcrowd.rb', line 4166 def getDebugLogUrl() return @helper.getDebugLogUrl() end |
#getJobId ⇒ Object
4181 4182 4183 |
# File 'lib/pdfcrowd.rb', line 4181 def getJobId() return @helper.getJobId() end |
#getOutputSize ⇒ Object
4186 4187 4188 |
# File 'lib/pdfcrowd.rb', line 4186 def getOutputSize() return @helper.getOutputSize() end |
#getRemainingCreditCount ⇒ Object
4171 4172 4173 |
# File 'lib/pdfcrowd.rb', line 4171 def getRemainingCreditCount() return @helper.getRemainingCreditCount() end |
#getVersion ⇒ Object
4191 4192 4193 |
# File 'lib/pdfcrowd.rb', line 4191 def getVersion() return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion() end |
#setAuthor(author) ⇒ Object
4062 4063 4064 4065 |
# File 'lib/pdfcrowd.rb', line 4062 def setAuthor() @fields['author'] = self end |
#setCenterWindow(value) ⇒ Object
4148 4149 4150 4151 |
# File 'lib/pdfcrowd.rb', line 4148 def setCenterWindow(value) @fields['center_window'] = value self end |
#setClientUserAgent(agent) ⇒ Object
4238 4239 4240 4241 |
# File 'lib/pdfcrowd.rb', line 4238 def setClientUserAgent(agent) @helper.setUserAgent(agent) self end |
#setConverterVersion(version) ⇒ Object
4222 4223 4224 4225 4226 4227 4228 4229 |
# File 'lib/pdfcrowd.rb', line 4222 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
3781 3782 3783 3784 3785 3786 3787 |
# File 'lib/pdfcrowd.rb', line 3781 def setCropArea(x, y, width, height) setCropAreaX(x) setCropAreaY(y) setCropAreaWidth(width) setCropAreaHeight(height) self end |
#setCropAreaHeight(height) ⇒ Object
3771 3772 3773 3774 3775 3776 3777 3778 |
# File 'lib/pdfcrowd.rb', line 3771 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
3761 3762 3763 3764 3765 3766 3767 3768 |
# File 'lib/pdfcrowd.rb', line 3761 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
3741 3742 3743 3744 3745 3746 3747 3748 |
# File 'lib/pdfcrowd.rb', line 3741 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
3751 3752 3753 3754 3755 3756 3757 3758 |
# File 'lib/pdfcrowd.rb', line 3751 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
4160 4161 4162 4163 |
# File 'lib/pdfcrowd.rb', line 4160 def setDebugLog(value) @fields['debug_log'] = value self end |
#setDisplayTitle(value) ⇒ Object
4154 4155 4156 4157 |
# File 'lib/pdfcrowd.rb', line 4154 def setDisplayTitle(value) @fields['display_title'] = value self end |
#setDpi(dpi) ⇒ Object
3922 3923 3924 3925 |
# File 'lib/pdfcrowd.rb', line 3922 def setDpi(dpi) @fields['dpi'] = dpi self end |
#setEncrypt(value) ⇒ Object
4014 4015 4016 4017 |
# File 'lib/pdfcrowd.rb', line 4014 def setEncrypt(value) @fields['encrypt'] = value self end |
#setFitWindow(value) ⇒ Object
4142 4143 4144 4145 |
# File 'lib/pdfcrowd.rb', line 4142 def setFitWindow(value) @fields['fit_window'] = value self end |
#setHideMenubar(value) ⇒ Object
4130 4131 4132 4133 |
# File 'lib/pdfcrowd.rb', line 4130 def (value) @fields['hide_menubar'] = value self end |
#setHideToolbar(value) ⇒ Object
4124 4125 4126 4127 |
# File 'lib/pdfcrowd.rb', line 4124 def (value) @fields['hide_toolbar'] = value self end |
#setHideWindowUi(value) ⇒ Object
4136 4137 4138 4139 |
# File 'lib/pdfcrowd.rb', line 4136 def setHideWindowUi(value) @fields['hide_window_ui'] = value self end |
#setHttpProxy(proxy) ⇒ Object
4202 4203 4204 4205 4206 4207 4208 4209 |
# File 'lib/pdfcrowd.rb', line 4202 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
4212 4213 4214 4215 4216 4217 4218 4219 |
# File 'lib/pdfcrowd.rb', line 4212 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
4104 4105 4106 4107 4108 4109 4110 4111 |
# File 'lib/pdfcrowd.rb', line 4104 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
4114 4115 4116 4117 4118 4119 4120 4121 |
# File 'lib/pdfcrowd.rb', line 4114 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
4094 4095 4096 4097 4098 4099 4100 4101 |
# File 'lib/pdfcrowd.rb', line 4094 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
4068 4069 4070 4071 |
# File 'lib/pdfcrowd.rb', line 4068 def setKeywords(keywords) @fields['keywords'] = keywords self end |
#setLinearize(value) ⇒ Object
4008 4009 4010 4011 |
# File 'lib/pdfcrowd.rb', line 4008 def setLinearize(value) @fields['linearize'] = value self end |
#setMarginBottom(bottom) ⇒ Object
3883 3884 3885 3886 3887 3888 3889 3890 |
# File 'lib/pdfcrowd.rb', line 3883 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
3893 3894 3895 3896 3897 3898 3899 3900 |
# File 'lib/pdfcrowd.rb', line 3893 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
3873 3874 3875 3876 3877 3878 3879 3880 |
# File 'lib/pdfcrowd.rb', line 3873 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
3863 3864 3865 3866 3867 3868 3869 3870 |
# File 'lib/pdfcrowd.rb', line 3863 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
3988 3989 3990 3991 3992 3993 3994 3995 |
# File 'lib/pdfcrowd.rb', line 3988 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
3998 3999 4000 4001 4002 4003 4004 4005 |
# File 'lib/pdfcrowd.rb', line 3998 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
3948 3949 3950 3951 3952 3953 3954 3955 |
# File 'lib/pdfcrowd.rb', line 3948 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
3958 3959 3960 3961 3962 3963 3964 3965 |
# File 'lib/pdfcrowd.rb', line 3958 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
4044 4045 4046 4047 |
# File 'lib/pdfcrowd.rb', line 4044 def setNoCopy(value) @fields['no_copy'] = value self end |
#setNoModify(value) ⇒ Object
4038 4039 4040 4041 |
# File 'lib/pdfcrowd.rb', line 4038 def setNoModify(value) @fields['no_modify'] = value self end |
#setNoPrint(value) ⇒ Object
4032 4033 4034 4035 |
# File 'lib/pdfcrowd.rb', line 4032 def setNoPrint(value) @fields['no_print'] = value self end |
#setOrientation(orientation) ⇒ Object
3833 3834 3835 3836 3837 3838 3839 3840 |
# File 'lib/pdfcrowd.rb', line 3833 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
4026 4027 4028 4029 |
# File 'lib/pdfcrowd.rb', line 4026 def setOwnerPassword(password) @fields['owner_password'] = password self end |
#setPageBackground(background) ⇒ Object
3968 3969 3970 3971 3972 3973 3974 3975 |
# File 'lib/pdfcrowd.rb', line 3968 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
3912 3913 3914 3915 3916 3917 3918 3919 |
# File 'lib/pdfcrowd.rb', line 3912 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
3978 3979 3980 3981 3982 3983 3984 3985 |
# File 'lib/pdfcrowd.rb', line 3978 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
3826 3827 3828 3829 3830 |
# File 'lib/pdfcrowd.rb', line 3826 def setPageDimensions(width, height) setPageWidth(width) setPageHeight(height) self end |
#setPageHeight(height) ⇒ Object
3816 3817 3818 3819 3820 3821 3822 3823 |
# File 'lib/pdfcrowd.rb', line 3816 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
4074 4075 4076 4077 4078 4079 4080 4081 |
# File 'lib/pdfcrowd.rb', line 4074 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
3903 3904 3905 3906 3907 3908 3909 |
# File 'lib/pdfcrowd.rb', line 3903 def setPageMargins(top, right, bottom, left) setMarginTop(top) setMarginRight(right) setMarginBottom(bottom) setMarginLeft(left) self end |
#setPageMode(mode) ⇒ Object
4084 4085 4086 4087 4088 4089 4090 4091 |
# File 'lib/pdfcrowd.rb', line 4084 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
3796 3797 3798 3799 3800 3801 3802 3803 |
# File 'lib/pdfcrowd.rb', line 3796 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
3928 3929 3930 3931 3932 3933 3934 3935 |
# File 'lib/pdfcrowd.rb', line 3928 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
3938 3939 3940 3941 3942 3943 3944 3945 |
# File 'lib/pdfcrowd.rb', line 3938 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
3806 3807 3808 3809 3810 3811 3812 3813 |
# File 'lib/pdfcrowd.rb', line 3806 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
3843 3844 3845 3846 3847 3848 3849 3850 |
# File 'lib/pdfcrowd.rb', line 3843 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
3853 3854 3855 3856 3857 3858 3859 3860 |
# File 'lib/pdfcrowd.rb', line 3853 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
4250 4251 4252 4253 |
# File 'lib/pdfcrowd.rb', line 4250 def setProxy(host, port, user_name, password) @helper.setProxy(host, port, user_name, password) self end |
#setRemoveBorders(value) ⇒ Object
3790 3791 3792 3793 |
# File 'lib/pdfcrowd.rb', line 3790 def setRemoveBorders(value) @fields['remove_borders'] = value self end |
#setResize(resize) ⇒ Object
3729 3730 3731 3732 |
# File 'lib/pdfcrowd.rb', line 3729 def setResize(resize) @fields['resize'] = resize self end |
#setRetryCount(count) ⇒ Object
4256 4257 4258 4259 |
# File 'lib/pdfcrowd.rb', line 4256 def setRetryCount(count) @helper.setRetryCount(count) self end |
#setRotate(rotate) ⇒ Object
3735 3736 3737 3738 |
# File 'lib/pdfcrowd.rb', line 3735 def setRotate(rotate) @fields['rotate'] = rotate self end |
#setSubject(subject) ⇒ Object
4056 4057 4058 4059 |
# File 'lib/pdfcrowd.rb', line 4056 def setSubject(subject) @fields['subject'] = subject self end |
#setTag(tag) ⇒ Object
4196 4197 4198 4199 |
# File 'lib/pdfcrowd.rb', line 4196 def setTag(tag) @fields['tag'] = tag self end |
#setTitle(title) ⇒ Object
4050 4051 4052 4053 |
# File 'lib/pdfcrowd.rb', line 4050 def setTitle(title) @fields['title'] = title self end |
#setUseHttp(value) ⇒ Object
4232 4233 4234 4235 |
# File 'lib/pdfcrowd.rb', line 4232 def setUseHttp(value) @helper.setUseHttp(value) self end |
#setUserAgent(agent) ⇒ Object
4244 4245 4246 4247 |
# File 'lib/pdfcrowd.rb', line 4244 def setUserAgent(agent) @helper.setUserAgent(agent) self end |
#setUserPassword(password) ⇒ Object
4020 4021 4022 4023 |
# File 'lib/pdfcrowd.rb', line 4020 def setUserPassword(password) @fields['user_password'] = password self end |