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
Convert a local file.
-
#convertFileToFile(file, file_path) ⇒ Object
Convert a local file and write the result to a local file.
-
#convertFileToStream(file, out_stream) ⇒ Object
Convert a local file and write the result to an output stream.
-
#convertRawData(data) ⇒ Object
Convert raw data.
-
#convertRawDataToFile(data, file_path) ⇒ Object
Convert raw data to a file.
-
#convertRawDataToStream(data, out_stream) ⇒ Object
Convert raw data and write the result to an output stream.
-
#convertStream(in_stream) ⇒ Object
Convert the contents of an input stream.
-
#convertStreamToFile(in_stream, file_path) ⇒ Object
Convert the contents of an input stream and write the result to a local file.
-
#convertStreamToStream(in_stream, out_stream) ⇒ Object
Convert the contents of an input stream and write the result to an output stream.
-
#convertUrl(url) ⇒ Object
Convert an image.
-
#convertUrlToFile(url, file_path) ⇒ Object
Convert an image and write the result to a local file.
-
#convertUrlToStream(url, out_stream) ⇒ Object
Convert an image and write the result to an output stream.
-
#getConsumedCreditCount ⇒ Object
Get the number of credits consumed by the last conversion.
-
#getDebugLogUrl ⇒ Object
Get the URL of the debug log for the last conversion.
-
#getJobId ⇒ Object
Get the job id.
-
#getOutputSize ⇒ Object
Get the size of the output in bytes.
-
#getRemainingCreditCount ⇒ Object
Get the number of conversion credits available in your account.
-
#getVersion ⇒ Object
Get the version details.
-
#initialize(user_name, api_key) ⇒ ImageToPdfClient
constructor
Constructor for the Pdfcrowd API client.
-
#setAuthor(author) ⇒ Object
Set the author of the PDF.
-
#setCenterWindow(value) ⇒ Object
Specify whether to position the document’s window in the center of the screen.
-
#setClientUserAgent(agent) ⇒ Object
Specifies the User-Agent HTTP header that the client library will use when interacting with the API.
-
#setConverterVersion(version) ⇒ Object
Set the converter version.
-
#setCropArea(x, y, width, height) ⇒ Object
Set the content area position and size.
-
#setCropAreaHeight(height) ⇒ Object
Set the height of the content area.
-
#setCropAreaWidth(width) ⇒ Object
Set the width of the content area.
-
#setCropAreaX(x) ⇒ Object
Set the top left X coordinate of the content area.
-
#setCropAreaY(y) ⇒ Object
Set the top left Y coordinate of the content area.
-
#setDebugLog(value) ⇒ Object
Turn on the debug logging.
-
#setDisplayTitle(value) ⇒ Object
Specify whether the window’s title bar should display the document title.
-
#setDpi(dpi) ⇒ Object
Set the DPI resolution of the input image.
-
#setEncrypt(value) ⇒ Object
Encrypt the PDF.
-
#setFitWindow(value) ⇒ Object
Specify whether to resize the document’s window to fit the size of the first displayed page.
-
#setHideMenubar(value) ⇒ Object
Specify whether to hide the viewer application’s menu bar when the document is active.
-
#setHideToolbar(value) ⇒ Object
Specify whether to hide the viewer application’s tool bars when the document is active.
-
#setHideWindowUi(value) ⇒ Object
Specify whether to hide user interface elements in the document’s window (such as scroll bars and navigation controls), leaving only the document’s contents displayed.
-
#setHttpProxy(proxy) ⇒ Object
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme.
-
#setHttpsProxy(proxy) ⇒ Object
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme.
-
#setInitialPage(page) ⇒ Object
Display the specified page when the document is opened.
-
#setInitialZoom(zoom) ⇒ Object
Specify the initial page zoom in percents when the document is opened.
-
#setInitialZoomType(zoom_type) ⇒ Object
Specify how the page should be displayed when opened.
-
#setKeywords(keywords) ⇒ Object
Associate keywords with the document.
-
#setLinearize(value) ⇒ Object
Create linearized PDF.
-
#setMarginBottom(bottom) ⇒ Object
Set the output page bottom margin.
-
#setMarginLeft(left) ⇒ Object
Set the output page left margin.
-
#setMarginRight(right) ⇒ Object
Set the output page right margin.
-
#setMarginTop(top) ⇒ Object
Set the output page top margin.
-
#setMultipageBackground(background) ⇒ Object
Apply each page of a background to the corresponding page of the output PDF.
-
#setMultipageBackgroundUrl(url) ⇒ Object
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.
-
#setMultipageWatermark(watermark) ⇒ Object
Apply each page of a watermark to the corresponding page of the output PDF.
-
#setMultipageWatermarkUrl(url) ⇒ Object
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.
-
#setNoCopy(value) ⇒ Object
Disallow text and graphics extraction from the output PDF.
-
#setNoModify(value) ⇒ Object
Disallow modification of the output PDF.
-
#setNoPrint(value) ⇒ Object
Disallow printing of the output PDF.
-
#setOrientation(orientation) ⇒ Object
Set the output page orientation.
-
#setOwnerPassword(password) ⇒ Object
Protect the PDF with an owner password.
-
#setPageBackground(background) ⇒ Object
Apply a background to each page of the output PDF file.
-
#setPageBackgroundColor(color) ⇒ Object
The page background color in RGB or RGBA hexadecimal format.
-
#setPageBackgroundUrl(url) ⇒ Object
Load a file from the specified URL and apply the file as a background to each page of the output PDF.
-
#setPageDimensions(width, height) ⇒ Object
Set the output page dimensions.
-
#setPageHeight(height) ⇒ Object
Set the output page height.
-
#setPageLayout(layout) ⇒ Object
Specify the page layout to be used when the document is opened.
-
#setPageMargins(top, right, bottom, left) ⇒ Object
Set the output page margins.
-
#setPageMode(mode) ⇒ Object
Specify how the document should be displayed when opened.
-
#setPageSize(size) ⇒ Object
Set the output page size.
-
#setPageWatermark(watermark) ⇒ Object
Apply a watermark to each page of the output PDF file.
-
#setPageWatermarkUrl(url) ⇒ Object
Load a file from the specified URL and apply the file as a watermark to each page of the output PDF.
-
#setPageWidth(width) ⇒ Object
Set the output page width.
-
#setPosition(position) ⇒ Object
Set the image position on the page.
-
#setPrintPageMode(mode) ⇒ Object
Set the mode to print the image on the content area of the page.
-
#setProxy(host, port, user_name, password) ⇒ Object
Specifies an HTTP proxy that the API client library will use to connect to the internet.
-
#setRemoveBorders(value) ⇒ Object
Remove borders of an image which does not change in color.
-
#setResize(resize) ⇒ Object
Resize the image.
-
#setRetryCount(count) ⇒ Object
Specifies the number of automatic retries when the 502 or 503 HTTP status code is received.
-
#setRotate(rotate) ⇒ Object
Rotate the image.
-
#setSubject(subject) ⇒ Object
Set the subject of the PDF.
-
#setTag(tag) ⇒ Object
Tag the conversion with a custom value.
-
#setTitle(title) ⇒ Object
Set the title of the PDF.
-
#setUseHttp(value) ⇒ Object
Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
-
#setUserAgent(agent) ⇒ Object
Set a custom user agent HTTP header.
-
#setUserPassword(password) ⇒ Object
Protect the PDF with a user password.
Constructor Details
#initialize(user_name, api_key) ⇒ ImageToPdfClient
Constructor for the Pdfcrowd API client.
-
user_name- Your username at Pdfcrowd. -
api_key- Your API key.
4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 |
# File 'lib/pdfcrowd.rb', line 4552 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
Convert a local file.
-
file- The path to a local file to convert. The file must exist and not be empty. -
Returns - Byte array containing the conversion output.
4613 4614 4615 4616 4617 4618 4619 4620 |
# File 'lib/pdfcrowd.rb', line 4613 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
Convert a local file and write the result to a local file.
-
file- The path to a local file to convert. The file must exist and not be empty. -
file_path- The output file path. The string must not be empty.
4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 |
# File 'lib/pdfcrowd.rb', line 4639 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
Convert a local file and write the result to an output stream.
-
file- The path to a local file to convert. The file must exist and not be empty. -
out_stream- The output stream that will contain the conversion output.
4626 4627 4628 4629 4630 4631 4632 4633 |
# File 'lib/pdfcrowd.rb', line 4626 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
Convert raw data.
-
data- The raw content to be converted. -
Returns - Byte array with the output.
4659 4660 4661 4662 |
# File 'lib/pdfcrowd.rb', line 4659 def convertRawData(data) @raw_data['file'] = data @helper.post(@fields, @files, @raw_data) end |
#convertRawDataToFile(data, file_path) ⇒ Object
Convert raw data to a file.
-
data- The raw content to be converted. -
file_path- The output file path. The string must not be empty.
4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 |
# File 'lib/pdfcrowd.rb', line 4677 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
Convert raw data and write the result to an output stream.
-
data- The raw content to be converted. -
out_stream- The output stream that will contain the conversion output.
4668 4669 4670 4671 |
# File 'lib/pdfcrowd.rb', line 4668 def convertRawDataToStream(data, out_stream) @raw_data['file'] = data @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertStream(in_stream) ⇒ Object
Convert the contents of an input stream.
-
in_stream- The input stream with source data. -
Returns - Byte array containing the conversion output.
4697 4698 4699 4700 |
# File 'lib/pdfcrowd.rb', line 4697 def convertStream(in_stream) @raw_data['stream'] = in_stream.read @helper.post(@fields, @files, @raw_data) end |
#convertStreamToFile(in_stream, file_path) ⇒ Object
Convert the contents of an input stream and write the result to a local file.
-
in_stream- The input stream with source data. -
file_path- The output file path. The string must not be empty.
4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 |
# File 'lib/pdfcrowd.rb', line 4715 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
Convert the contents of an input stream and write the result to an output stream.
-
in_stream- The input stream with source data. -
out_stream- The output stream that will contain the conversion output.
4706 4707 4708 4709 |
# File 'lib/pdfcrowd.rb', line 4706 def convertStreamToStream(in_stream, out_stream) @raw_data['stream'] = in_stream.read @helper.post(@fields, @files, @raw_data, out_stream) end |
#convertUrl(url) ⇒ Object
Convert an image.
-
url- The address of the image to convert. The supported protocols are http:// and https://. -
Returns - Byte array containing the conversion output.
4567 4568 4569 4570 4571 4572 4573 4574 |
# File 'lib/pdfcrowd.rb', line 4567 def convertUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "convertUrl", "image-to-pdf", "The 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
Convert an image and write the result to a local file.
-
url- The address of the image to convert. The supported protocols are http:// and https://. -
file_path- The output file path. The string must not be empty.
4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 |
# File 'lib/pdfcrowd.rb', line 4593 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
Convert an image and write the result to an output stream.
-
url- The address of the image to convert. The supported protocols are http:// and https://. -
out_stream- The output stream that will contain the conversion output.
4580 4581 4582 4583 4584 4585 4586 4587 |
# File 'lib/pdfcrowd.rb', line 4580 def convertUrlToStream(url, out_stream) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "convertUrlToStream::url", "image-to-pdf", "The 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
Get the number of credits consumed by the last conversion.
-
Returns - The number of credits.
5351 5352 5353 |
# File 'lib/pdfcrowd.rb', line 5351 def getConsumedCreditCount() return @helper.getConsumedCreditCount() end |
#getDebugLogUrl ⇒ Object
Get the URL of the debug log for the last conversion.
-
Returns - The link to the debug log.
5336 5337 5338 |
# File 'lib/pdfcrowd.rb', line 5336 def getDebugLogUrl() return @helper.getDebugLogUrl() end |
#getJobId ⇒ Object
Get the job id.
-
Returns - The unique job identifier.
5357 5358 5359 |
# File 'lib/pdfcrowd.rb', line 5357 def getJobId() return @helper.getJobId() end |
#getOutputSize ⇒ Object
Get the size of the output in bytes.
-
Returns - The count of bytes.
5363 5364 5365 |
# File 'lib/pdfcrowd.rb', line 5363 def getOutputSize() return @helper.getOutputSize() end |
#getRemainingCreditCount ⇒ Object
Get the number of conversion credits available in your account. This method can only be called after a call to one of the convertXtoY methods. The returned value can differ from the actual count if you run parallel conversions. The special value 999999 is returned if the information is not available.
-
Returns - The number of credits.
5345 5346 5347 |
# File 'lib/pdfcrowd.rb', line 5345 def getRemainingCreditCount() return @helper.getRemainingCreditCount() end |
#getVersion ⇒ Object
Get the version details.
-
Returns - API version, converter version, and client version.
5369 5370 5371 |
# File 'lib/pdfcrowd.rb', line 5369 def getVersion() return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion() end |
#setAuthor(author) ⇒ Object
Set the author of the PDF.
-
author- The author. -
Returns - The converter object.
5192 5193 5194 5195 |
# File 'lib/pdfcrowd.rb', line 5192 def setAuthor() @fields['author'] = self end |
#setCenterWindow(value) ⇒ Object
Specify whether to position the document’s window in the center of the screen.
-
value- Set to true to center the window. -
Returns - The converter object.
5311 5312 5313 5314 |
# File 'lib/pdfcrowd.rb', line 5311 def setCenterWindow(value) @fields['center_window'] = value self end |
#setClientUserAgent(agent) ⇒ Object
Specifies the User-Agent HTTP header that the client library will use when interacting with the API.
-
agent- The user agent string. -
Returns - The converter object.
5435 5436 5437 5438 |
# File 'lib/pdfcrowd.rb', line 5435 def setClientUserAgent(agent) @helper.setUserAgent(agent) self end |
#setConverterVersion(version) ⇒ Object
Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
-
version- The version identifier. Allowed values are 24.04, 20.10, 18.10, latest. -
Returns - The converter object.
5412 5413 5414 5415 5416 5417 5418 5419 |
# File 'lib/pdfcrowd.rb', line 5412 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
Set the content area position and size. The content area enables to specify the part to be converted.
-
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”. -
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”. -
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”. -
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”. -
Returns - The converter object.
4808 4809 4810 4811 4812 4813 4814 |
# File 'lib/pdfcrowd.rb', line 4808 def setCropArea(x, y, width, height) setCropAreaX(x) setCropAreaY(y) setCropAreaWidth(width) setCropAreaHeight(height) self end |
#setCropAreaHeight(height) ⇒ Object
Set the height of the content area. It should be at least 1 inch.
-
height- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4792 4793 4794 4795 4796 4797 4798 4799 |
# File 'lib/pdfcrowd.rb', line 4792 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
Set the width of the content area. It should be at least 1 inch.
-
width- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4779 4780 4781 4782 4783 4784 4785 4786 |
# File 'lib/pdfcrowd.rb', line 4779 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
Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area.
-
x- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4753 4754 4755 4756 4757 4758 4759 4760 |
# File 'lib/pdfcrowd.rb', line 4753 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
Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area.
-
y- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4766 4767 4768 4769 4770 4771 4772 4773 |
# File 'lib/pdfcrowd.rb', line 4766 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
Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method or available in conversion statistics.
-
value- Set to true to enable the debug logging. -
Returns - The converter object.
5329 5330 5331 5332 |
# File 'lib/pdfcrowd.rb', line 5329 def setDebugLog(value) @fields['debug_log'] = value self end |
#setDisplayTitle(value) ⇒ Object
Specify whether the window’s title bar should display the document title. If false , the title bar should instead display the name of the PDF file containing the document.
-
value- Set to true to display the title. -
Returns - The converter object.
5320 5321 5322 5323 |
# File 'lib/pdfcrowd.rb', line 5320 def setDisplayTitle(value) @fields['display_title'] = value self end |
#setDpi(dpi) ⇒ Object
Set the DPI resolution of the input image. The DPI affects margin options specified in points too (e.g. 1 point is equal to 1 pixel in 96 DPI).
-
dpi- The DPI value. -
Returns - The converter object.
4998 4999 5000 5001 |
# File 'lib/pdfcrowd.rb', line 4998 def setDpi(dpi) @fields['dpi'] = dpi self end |
#setEncrypt(value) ⇒ Object
Encrypt the PDF. This prevents search engines from indexing the contents.
-
value- Set to true to enable PDF encryption. -
Returns - The converter object.
5120 5121 5122 5123 |
# File 'lib/pdfcrowd.rb', line 5120 def setEncrypt(value) @fields['encrypt'] = value self end |
#setFitWindow(value) ⇒ Object
Specify whether to resize the document’s window to fit the size of the first displayed page.
-
value- Set to true to resize the window. -
Returns - The converter object.
5302 5303 5304 5305 |
# File 'lib/pdfcrowd.rb', line 5302 def setFitWindow(value) @fields['fit_window'] = value self end |
#setHideMenubar(value) ⇒ Object
Specify whether to hide the viewer application’s menu bar when the document is active.
-
value- Set to true to hide the menu bar. -
Returns - The converter object.
5284 5285 5286 5287 |
# File 'lib/pdfcrowd.rb', line 5284 def (value) @fields['hide_menubar'] = value self end |
#setHideToolbar(value) ⇒ Object
Specify whether to hide the viewer application’s tool bars when the document is active.
-
value- Set to true to hide tool bars. -
Returns - The converter object.
5275 5276 5277 5278 |
# File 'lib/pdfcrowd.rb', line 5275 def (value) @fields['hide_toolbar'] = value self end |
#setHideWindowUi(value) ⇒ Object
Specify whether to hide user interface elements in the document’s window (such as scroll bars and navigation controls), leaving only the document’s contents displayed.
-
value- Set to true to hide ui elements. -
Returns - The converter object.
5293 5294 5295 5296 |
# File 'lib/pdfcrowd.rb', line 5293 def setHideWindowUi(value) @fields['hide_window_ui'] = value self end |
#setHttpProxy(proxy) ⇒ Object
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
-
proxy- The value must have format DOMAIN_OR_IP_ADDRESS:PORT. -
Returns - The converter object.
5386 5387 5388 5389 5390 5391 5392 5393 |
# File 'lib/pdfcrowd.rb', line 5386 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
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
-
proxy- The value must have format DOMAIN_OR_IP_ADDRESS:PORT. -
Returns - The converter object.
5399 5400 5401 5402 5403 5404 5405 5406 |
# File 'lib/pdfcrowd.rb', line 5399 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
Display the specified page when the document is opened.
-
page- Must be a positive integer number. -
Returns - The converter object.
5249 5250 5251 5252 5253 5254 5255 5256 |
# File 'lib/pdfcrowd.rb', line 5249 def setInitialPage(page) if (!(Integer(page) > 0)) raise Error.new(Pdfcrowd.(page, "setInitialPage", "image-to-pdf", "Must be a positive integer number.", "set_initial_page"), 470); end @fields['initial_page'] = page self end |
#setInitialZoom(zoom) ⇒ Object
Specify the initial page zoom in percents when the document is opened.
-
zoom- Must be a positive integer number. -
Returns - The converter object.
5262 5263 5264 5265 5266 5267 5268 5269 |
# File 'lib/pdfcrowd.rb', line 5262 def setInitialZoom(zoom) if (!(Integer(zoom) > 0)) raise Error.new(Pdfcrowd.(zoom, "setInitialZoom", "image-to-pdf", "Must be a positive integer number.", "set_initial_zoom"), 470); end @fields['initial_zoom'] = zoom self end |
#setInitialZoomType(zoom_type) ⇒ Object
Specify how the page should be displayed when opened.
-
zoom_type- Allowed values are fit-width, fit-height, fit-page. -
Returns - The converter object.
5236 5237 5238 5239 5240 5241 5242 5243 |
# File 'lib/pdfcrowd.rb', line 5236 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
Associate keywords with the document.
-
keywords- The string with the keywords. -
Returns - The converter object.
5201 5202 5203 5204 |
# File 'lib/pdfcrowd.rb', line 5201 def setKeywords(keywords) @fields['keywords'] = keywords self end |
#setLinearize(value) ⇒ Object
Create linearized PDF. This is also known as Fast Web View.
-
value- Set to true to create linearized PDF. -
Returns - The converter object.
5111 5112 5113 5114 |
# File 'lib/pdfcrowd.rb', line 5111 def setLinearize(value) @fields['linearize'] = value self end |
#setMarginBottom(bottom) ⇒ Object
Set the output page bottom margin.
-
bottom- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4944 4945 4946 4947 4948 4949 4950 4951 |
# File 'lib/pdfcrowd.rb', line 4944 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
Set the output page left margin.
-
left- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4957 4958 4959 4960 4961 4962 4963 4964 |
# File 'lib/pdfcrowd.rb', line 4957 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
Set the output page right margin.
-
right- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4931 4932 4933 4934 4935 4936 4937 4938 |
# File 'lib/pdfcrowd.rb', line 4931 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
Set the output page top margin.
-
top- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4918 4919 4920 4921 4922 4923 4924 4925 |
# File 'lib/pdfcrowd.rb', line 4918 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
Apply each page of a background to the corresponding page of the output PDF. A background can be either a PDF or an image.
-
background- The file path to a local file. The file must exist and not be empty. -
Returns - The converter object.
5085 5086 5087 5088 5089 5090 5091 5092 |
# File 'lib/pdfcrowd.rb', line 5085 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
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.
-
url- The supported protocols are http:// and https://. -
Returns - The converter object.
5098 5099 5100 5101 5102 5103 5104 5105 |
# File 'lib/pdfcrowd.rb', line 5098 def setMultipageBackgroundUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setMultipageBackgroundUrl", "image-to-pdf", "The supported protocols are http:// and https://.", "set_multipage_background_url"), 470); end @fields['multipage_background_url'] = url self end |
#setMultipageWatermark(watermark) ⇒ Object
Apply each page of a watermark to the corresponding page of the output PDF. A watermark can be either a PDF or an image.
-
watermark- The file path to a local file. The file must exist and not be empty. -
Returns - The converter object.
5033 5034 5035 5036 5037 5038 5039 5040 |
# File 'lib/pdfcrowd.rb', line 5033 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
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.
-
url- The supported protocols are http:// and https://. -
Returns - The converter object.
5046 5047 5048 5049 5050 5051 5052 5053 |
# File 'lib/pdfcrowd.rb', line 5046 def setMultipageWatermarkUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setMultipageWatermarkUrl", "image-to-pdf", "The supported protocols are http:// and https://.", "set_multipage_watermark_url"), 470); end @fields['multipage_watermark_url'] = url self end |
#setNoCopy(value) ⇒ Object
Disallow text and graphics extraction from the output PDF.
-
value- Set to true to set the no-copy flag in the output PDF. -
Returns - The converter object.
5165 5166 5167 5168 |
# File 'lib/pdfcrowd.rb', line 5165 def setNoCopy(value) @fields['no_copy'] = value self end |
#setNoModify(value) ⇒ Object
Disallow modification of the output PDF.
-
value- Set to true to set the read-only only flag in the output PDF. -
Returns - The converter object.
5156 5157 5158 5159 |
# File 'lib/pdfcrowd.rb', line 5156 def setNoModify(value) @fields['no_modify'] = value self end |
#setNoPrint(value) ⇒ Object
Disallow printing of the output PDF.
-
value- Set to true to set the no-print flag in the output PDF. -
Returns - The converter object.
5147 5148 5149 5150 |
# File 'lib/pdfcrowd.rb', line 5147 def setNoPrint(value) @fields['no_print'] = value self end |
#setOrientation(orientation) ⇒ Object
Set the output page orientation.
-
orientation- Allowed values are landscape, portrait. -
Returns - The converter object.
4879 4880 4881 4882 4883 4884 4885 4886 |
# File 'lib/pdfcrowd.rb', line 4879 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
Protect the PDF with an owner password. Supplying an owner password grants unlimited access to the PDF including changing the passwords and access permissions.
-
password- The owner password. -
Returns - The converter object.
5138 5139 5140 5141 |
# File 'lib/pdfcrowd.rb', line 5138 def setOwnerPassword(password) @fields['owner_password'] = password self end |
#setPageBackground(background) ⇒ Object
Apply a background to each page of the output PDF file. 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.
-
background- The file path to a local file. The file must exist and not be empty. -
Returns - The converter object.
5059 5060 5061 5062 5063 5064 5065 5066 |
# File 'lib/pdfcrowd.rb', line 5059 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
The page background color in RGB or RGBA hexadecimal format. The color fills the entire page regardless of the margins. If not page size is specified and the image format supports background (e.g. PDF, PNG), the background color is applied too.
-
color- The value must be in RRGGBB or RRGGBBAA hexadecimal format. -
Returns - The converter object.
4985 4986 4987 4988 4989 4990 4991 4992 |
# File 'lib/pdfcrowd.rb', line 4985 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
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.
-
url- The supported protocols are http:// and https://. -
Returns - The converter object.
5072 5073 5074 5075 5076 5077 5078 5079 |
# File 'lib/pdfcrowd.rb', line 5072 def setPageBackgroundUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setPageBackgroundUrl", "image-to-pdf", "The supported protocols are http:// and https://.", "set_page_background_url"), 470); end @fields['page_background_url'] = url self end |
#setPageDimensions(width, height) ⇒ Object
Set the output page dimensions. If no page size is specified, margins are applied as a border around the image.
-
width- Set the output page width. The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
height- Set the output page height. The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4869 4870 4871 4872 4873 |
# File 'lib/pdfcrowd.rb', line 4869 def setPageDimensions(width, height) setPageWidth(width) setPageHeight(height) self end |
#setPageHeight(height) ⇒ Object
Set the output page height.
-
height- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4855 4856 4857 4858 4859 4860 4861 4862 |
# File 'lib/pdfcrowd.rb', line 4855 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
Specify the page layout to be used when the document is opened.
-
layout- Allowed values are single-page, one-column, two-column-left, two-column-right. -
Returns - The converter object.
5210 5211 5212 5213 5214 5215 5216 5217 |
# File 'lib/pdfcrowd.rb', line 5210 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
Set the output page margins.
-
top- Set the output page top margin. The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
right- Set the output page right margin. The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
bottom- Set the output page bottom margin. The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
left- Set the output page left margin. The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4973 4974 4975 4976 4977 4978 4979 |
# File 'lib/pdfcrowd.rb', line 4973 def setPageMargins(top, right, bottom, left) setMarginTop(top) setMarginRight(right) setMarginBottom(bottom) setMarginLeft(left) self end |
#setPageMode(mode) ⇒ Object
Specify how the document should be displayed when opened.
-
mode- Allowed values are full-screen, thumbnails, outlines. -
Returns - The converter object.
5223 5224 5225 5226 5227 5228 5229 5230 |
# File 'lib/pdfcrowd.rb', line 5223 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
Set the output page size.
-
size- Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter. -
Returns - The converter object.
4829 4830 4831 4832 4833 4834 4835 4836 |
# File 'lib/pdfcrowd.rb', line 4829 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
Apply a watermark to each page of the output PDF file. A watermark can be either a PDF or an image. If a multi-page file (PDF or TIFF) is used, the first page is used as the watermark.
-
watermark- The file path to a local file. The file must exist and not be empty. -
Returns - The converter object.
5007 5008 5009 5010 5011 5012 5013 5014 |
# File 'lib/pdfcrowd.rb', line 5007 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
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.
-
url- The supported protocols are http:// and https://. -
Returns - The converter object.
5020 5021 5022 5023 5024 5025 5026 5027 |
# File 'lib/pdfcrowd.rb', line 5020 def setPageWatermarkUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setPageWatermarkUrl", "image-to-pdf", "The supported protocols are http:// and https://.", "set_page_watermark_url"), 470); end @fields['page_watermark_url'] = url self end |
#setPageWidth(width) ⇒ Object
Set the output page width.
-
width- The value must be specified in inches “in”, millimeters “mm”, centimeters “cm”, pixels “px”, or points “pt”. -
Returns - The converter object.
4842 4843 4844 4845 4846 4847 4848 4849 |
# File 'lib/pdfcrowd.rb', line 4842 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
Set the image position on the page.
-
position- Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right. -
Returns - The converter object.
4892 4893 4894 4895 4896 4897 4898 4899 |
# File 'lib/pdfcrowd.rb', line 4892 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
Set the mode to print the image on the content area of the page.
-
mode- Allowed values are default, fit, stretch. -
Returns - The converter object.
4905 4906 4907 4908 4909 4910 4911 4912 |
# File 'lib/pdfcrowd.rb', line 4905 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
Specifies an HTTP proxy that the API client library will use to connect to the internet.
-
host- The proxy hostname. -
port- The proxy port. -
user_name- The username. -
password- The password. -
Returns - The converter object.
5456 5457 5458 5459 |
# File 'lib/pdfcrowd.rb', line 5456 def setProxy(host, port, user_name, password) @helper.setProxy(host, port, user_name, password) self end |
#setRemoveBorders(value) ⇒ Object
Remove borders of an image which does not change in color.
-
value- Set to true to remove borders. -
Returns - The converter object.
4820 4821 4822 4823 |
# File 'lib/pdfcrowd.rb', line 4820 def setRemoveBorders(value) @fields['remove_borders'] = value self end |
#setResize(resize) ⇒ Object
Resize the image.
-
resize- The resize percentage or new image dimensions. -
Returns - The converter object.
4735 4736 4737 4738 |
# File 'lib/pdfcrowd.rb', line 4735 def setResize(resize) @fields['resize'] = resize self end |
#setRetryCount(count) ⇒ Object
Specifies the number of automatic retries when the 502 or 503 HTTP status code is received. The status code indicates a temporary network issue. This feature can be disabled by setting to 0.
-
count- Number of retries. -
Returns - The converter object.
5465 5466 5467 5468 |
# File 'lib/pdfcrowd.rb', line 5465 def setRetryCount(count) @helper.setRetryCount(count) self end |
#setRotate(rotate) ⇒ Object
Rotate the image.
-
rotate- The rotation specified in degrees. -
Returns - The converter object.
4744 4745 4746 4747 |
# File 'lib/pdfcrowd.rb', line 4744 def setRotate(rotate) @fields['rotate'] = rotate self end |
#setSubject(subject) ⇒ Object
Set the subject of the PDF.
-
subject- The subject. -
Returns - The converter object.
5183 5184 5185 5186 |
# File 'lib/pdfcrowd.rb', line 5183 def setSubject(subject) @fields['subject'] = subject self end |
#setTag(tag) ⇒ Object
Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
-
tag- A string with the custom tag. -
Returns - The converter object.
5377 5378 5379 5380 |
# File 'lib/pdfcrowd.rb', line 5377 def setTag(tag) @fields['tag'] = tag self end |
#setTitle(title) ⇒ Object
Set the title of the PDF.
-
title- The title. -
Returns - The converter object.
5174 5175 5176 5177 |
# File 'lib/pdfcrowd.rb', line 5174 def setTitle(title) @fields['title'] = title self end |
#setUseHttp(value) ⇒ Object
Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API. Warning: Using HTTP is insecure as data sent over HTTP is not encrypted. Enable this option only if you know what you are doing.
-
value- Set to true to use HTTP. -
Returns - The converter object.
5426 5427 5428 5429 |
# File 'lib/pdfcrowd.rb', line 5426 def setUseHttp(value) @helper.setUseHttp(value) self end |
#setUserAgent(agent) ⇒ Object
Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
-
agent- The user agent string. -
Returns - The converter object.
5444 5445 5446 5447 |
# File 'lib/pdfcrowd.rb', line 5444 def setUserAgent(agent) @helper.setUserAgent(agent) self end |
#setUserPassword(password) ⇒ Object
Protect the PDF with a user password. When a PDF has a user password, it must be supplied in order to view the document and to perform operations allowed by the access permissions.
-
password- The user password. -
Returns - The converter object.
5129 5130 5131 5132 |
# File 'lib/pdfcrowd.rb', line 5129 def setUserPassword(password) @fields['user_password'] = password self end |