Class: Pdfcrowd::PdfToPdfClient
- Inherits:
-
Object
- Object
- Pdfcrowd::PdfToPdfClient
- Defined in:
- lib/pdfcrowd.rb
Overview
Conversion from PDF to PDF.
Instance Method Summary collapse
-
#addPdfFile(file_path) ⇒ Object
Add a PDF file to the list of the input PDFs.
-
#addPdfRawData(data) ⇒ Object
Add in-memory raw PDF data to the list of the input PDFs.Typical usage is for adding PDF created by another Pdfcrowd converter.
-
#convert ⇒ Object
Perform an action on the input files.
-
#convertToFile(file_path) ⇒ Object
Perform an action on the input files and write the output PDF to a file.
-
#convertToStream(out_stream) ⇒ Object
Perform an action on the input files and write the output PDF 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.
-
#getPageCount ⇒ Object
Get the total number of pages in the output document.
-
#getRemainingCreditCount ⇒ Object
Get the number of conversion credits available in your account.
-
#getVersion ⇒ Object
Get the version details.
-
#initialize(user_name, api_key) ⇒ PdfToPdfClient
constructor
Constructor for the Pdfcrowd API client.
-
#setAction(action) ⇒ Object
Specifies the action to be performed on the input PDFs.
-
#setCenterWindow(value) ⇒ Object
Specify whether to position the document’s window in the center of the screen.
-
#setConverterVersion(version) ⇒ Object
Set the converter version.
-
#setDebugLog(value) ⇒ Object
Turn on the debug logging.
-
#setDisplayTitle(value) ⇒ Object
Specify whether the window’s title bar should display the document title.
-
#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.
-
#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.
-
#setLinearize(value) ⇒ Object
Create linearized PDF.
-
#setMultipageBackground(background) ⇒ Object
Apply each page of the specified PDF to the background of the corresponding page of the output PDF.
-
#setMultipageBackgroundUrl(url) ⇒ Object
Load a background PDF from the specified URL and apply each page of the specified background PDF to the corresponding page of the output PDF.
-
#setMultipageWatermark(watermark) ⇒ Object
Apply each page of the specified watermark PDF to the corresponding page of the output PDF.
-
#setMultipageWatermarkUrl(url) ⇒ Object
Load a watermark PDF from the specified URL and apply each page of the specified watermark PDF 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.
-
#setOwnerPassword(password) ⇒ Object
Protect the PDF with an owner password.
-
#setPageBackground(background) ⇒ Object
Apply the first page of the specified PDF to the background of every page of the output PDF.
-
#setPageBackgroundUrl(url) ⇒ Object
Load a background PDF from the specified URL and apply the first page of the background PDF to every page of the output PDF.
-
#setPageLayout(layout) ⇒ Object
Specify the page layout to be used when the document is opened.
-
#setPageMode(mode) ⇒ Object
Specify how the document should be displayed when opened.
-
#setPageWatermark(watermark) ⇒ Object
Apply the first page of the watermark PDF to every page of the output PDF.
-
#setPageWatermarkUrl(url) ⇒ Object
Load a watermark PDF from the specified URL and apply the first page of the watermark PDF to every page of the output PDF.
-
#setProxy(host, port, user_name, password) ⇒ Object
Specifies an HTTP proxy that the API client library will use to connect to the internet.
-
#setRetryCount(count) ⇒ Object
Specifies the number of retries when the 502 HTTP status code is received.
-
#setRightToLeft(value) ⇒ Object
Set the predominant reading order for text to right-to-left.
-
#setTag(tag) ⇒ Object
Tag the conversion with a custom value.
-
#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) ⇒ PdfToPdfClient
Constructor for the Pdfcrowd API client.
-
user_name
- Your username at Pdfcrowd. -
api_key
- Your API key.
3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 |
# File 'lib/pdfcrowd.rb', line 3426 def initialize(user_name, api_key) @helper = ConnectionHelper.new(user_name, api_key) @fields = { 'input_format'=>'pdf', 'output_format'=>'pdf' } @file_id = 1 @files = {} @raw_data = {} end |
Instance Method Details
#addPdfFile(file_path) ⇒ Object
Add a PDF file to the list of the input PDFs.
-
file_path
- The file path to a local PDF file. The file must exist and not be empty. -
Returns - The converter object.
3480 3481 3482 3483 3484 3485 3486 3487 3488 |
# File 'lib/pdfcrowd.rb', line 3480 def addPdfFile(file_path) if (!(File.file?(file_path) && !File.zero?(file_path))) raise Error.new(Pdfcrowd.(file_path, "addPdfFile", "pdf-to-pdf", "The file must exist and not be empty.", "add_pdf_file"), 470); end @files['f_%s' % @file_id] = file_path @file_id += 1 self end |
#addPdfRawData(data) ⇒ Object
Add in-memory raw PDF data to the list of the input PDFs.Typical usage is for adding PDF created by another Pdfcrowd converter. Example in PHP: $clientPdf2Pdf->addPdfRawData($clientHtml2Pdf->convertUrl(‘www.example.com’));
-
data
- The raw PDF data. The input data must be PDF content. -
Returns - The converter object.
3494 3495 3496 3497 3498 3499 3500 3501 3502 |
# File 'lib/pdfcrowd.rb', line 3494 def addPdfRawData(data) if (!(!data.nil? && data.length > 300 and data[0...4] == '%PDF')) raise Error.new(Pdfcrowd.("raw PDF data", "addPdfRawData", "pdf-to-pdf", "The input data must be PDF content.", "add_pdf_raw_data"), 470); end @raw_data['f_%s' % @file_id] = data @file_id += 1 self end |
#convert ⇒ Object
Perform an action on the input files.
-
Returns - Byte array containing the output PDF.
3452 3453 3454 |
# File 'lib/pdfcrowd.rb', line 3452 def convert() @helper.post(@fields, @files, @raw_data) end |
#convertToFile(file_path) ⇒ Object
Perform an action on the input files and write the output PDF to a file.
-
file_path
- The output file path. The string must not be empty.
3466 3467 3468 3469 3470 3471 3472 3473 3474 |
# File 'lib/pdfcrowd.rb', line 3466 def convertToFile(file_path) if (!(!file_path.nil? && !file_path.empty?)) raise Error.new(Pdfcrowd.(file_path, "convertToFile", "pdf-to-pdf", "The string must not be empty.", "convert_to_file"), 470); end output_file = open(file_path, "wb") convertToStream(output_file) output_file.close() end |
#convertToStream(out_stream) ⇒ Object
Perform an action on the input files and write the output PDF to an output stream.
-
out_stream
- The output stream that will contain the output PDF.
3459 3460 3461 |
# File 'lib/pdfcrowd.rb', line 3459 def convertToStream(out_stream) @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.
3825 3826 3827 |
# File 'lib/pdfcrowd.rb', line 3825 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.
3810 3811 3812 |
# File 'lib/pdfcrowd.rb', line 3810 def getDebugLogUrl() return @helper.getDebugLogUrl() end |
#getJobId ⇒ Object
Get the job id.
-
Returns - The unique job identifier.
3831 3832 3833 |
# File 'lib/pdfcrowd.rb', line 3831 def getJobId() return @helper.getJobId() end |
#getOutputSize ⇒ Object
Get the size of the output in bytes.
-
Returns - The count of bytes.
3843 3844 3845 |
# File 'lib/pdfcrowd.rb', line 3843 def getOutputSize() return @helper.getOutputSize() end |
#getPageCount ⇒ Object
Get the total number of pages in the output document.
-
Returns - The page count.
3837 3838 3839 |
# File 'lib/pdfcrowd.rb', line 3837 def getPageCount() return @helper.getPageCount() 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 convertXYZ 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.
3819 3820 3821 |
# File 'lib/pdfcrowd.rb', line 3819 def getRemainingCreditCount() return @helper.getRemainingCreditCount() end |
#getVersion ⇒ Object
Get the version details.
-
Returns - API version, converter version, and client version.
3849 3850 3851 |
# File 'lib/pdfcrowd.rb', line 3849 def getVersion() return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion() end |
#setAction(action) ⇒ Object
Specifies the action to be performed on the input PDFs.
-
action
- Allowed values are join, shuffle. -
Returns - The converter object.
3441 3442 3443 3444 3445 3446 3447 3448 |
# File 'lib/pdfcrowd.rb', line 3441 def setAction(action) unless /(?i)^(join|shuffle)$/.match(action) raise Error.new(Pdfcrowd.(action, "setAction", "pdf-to-pdf", "Allowed values are join, shuffle.", "set_action"), 470); end @fields['action'] = action 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.
3776 3777 3778 3779 |
# File 'lib/pdfcrowd.rb', line 3776 def setCenterWindow(value) @fields['center_window'] = value 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 latest, 20.10, 18.10. -
Returns - The converter object.
3866 3867 3868 3869 3870 3871 3872 3873 |
# File 'lib/pdfcrowd.rb', line 3866 def setConverterVersion(version) unless /(?i)^(latest|20.10|18.10)$/.match(version) raise Error.new(Pdfcrowd.(version, "setConverterVersion", "pdf-to-pdf", "Allowed values are latest, 20.10, 18.10.", "set_converter_version"), 470); end @helper.setConverterVersion(version) 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.
3803 3804 3805 3806 |
# File 'lib/pdfcrowd.rb', line 3803 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.
3785 3786 3787 3788 |
# File 'lib/pdfcrowd.rb', line 3785 def setDisplayTitle(value) @fields['display_title'] = value 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.
3621 3622 3623 3624 |
# File 'lib/pdfcrowd.rb', line 3621 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.
3767 3768 3769 3770 |
# File 'lib/pdfcrowd.rb', line 3767 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.
3749 3750 3751 3752 |
# File 'lib/pdfcrowd.rb', line 3749 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.
3740 3741 3742 3743 |
# File 'lib/pdfcrowd.rb', line 3740 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.
3758 3759 3760 3761 |
# File 'lib/pdfcrowd.rb', line 3758 def setHideWindowUi(value) @fields['hide_window_ui'] = value 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.
3714 3715 3716 3717 3718 3719 3720 3721 |
# File 'lib/pdfcrowd.rb', line 3714 def setInitialPage(page) if (!(Integer(page) > 0)) raise Error.new(Pdfcrowd.(page, "setInitialPage", "pdf-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.
3727 3728 3729 3730 3731 3732 3733 3734 |
# File 'lib/pdfcrowd.rb', line 3727 def setInitialZoom(zoom) if (!(Integer(zoom) > 0)) raise Error.new(Pdfcrowd.(zoom, "setInitialZoom", "pdf-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.
3701 3702 3703 3704 3705 3706 3707 3708 |
# File 'lib/pdfcrowd.rb', line 3701 def setInitialZoomType(zoom_type) unless /(?i)^(fit-width|fit-height|fit-page)$/.match(zoom_type) raise Error.new(Pdfcrowd.(zoom_type, "setInitialZoomType", "pdf-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 |
#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.
3612 3613 3614 3615 |
# File 'lib/pdfcrowd.rb', line 3612 def setLinearize(value) @fields['linearize'] = value self end |
#setMultipageBackground(background) ⇒ Object
Apply each page of the specified PDF to the background of the corresponding page of the output PDF.
-
background
- The file path to a local background PDF file. The file must exist and not be empty. -
Returns - The converter object.
3586 3587 3588 3589 3590 3591 3592 3593 |
# File 'lib/pdfcrowd.rb', line 3586 def setMultipageBackground(background) if (!(File.file?(background) && !File.zero?(background))) raise Error.new(Pdfcrowd.(background, "setMultipageBackground", "pdf-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 background PDF from the specified URL and apply each page of the specified background PDF to the corresponding page of the output PDF.
-
url
- The supported protocols are http:// and https://. -
Returns - The converter object.
3599 3600 3601 3602 3603 3604 3605 3606 |
# File 'lib/pdfcrowd.rb', line 3599 def setMultipageBackgroundUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setMultipageBackgroundUrl", "pdf-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 the specified watermark PDF to the corresponding page of the output PDF.
-
watermark
- The file path to a local watermark PDF file. The file must exist and not be empty. -
Returns - The converter object.
3534 3535 3536 3537 3538 3539 3540 3541 |
# File 'lib/pdfcrowd.rb', line 3534 def setMultipageWatermark(watermark) if (!(File.file?(watermark) && !File.zero?(watermark))) raise Error.new(Pdfcrowd.(watermark, "setMultipageWatermark", "pdf-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 watermark PDF from the specified URL and apply each page of the specified watermark PDF to the corresponding page of the output PDF.
-
url
- The supported protocols are http:// and https://. -
Returns - The converter object.
3547 3548 3549 3550 3551 3552 3553 3554 |
# File 'lib/pdfcrowd.rb', line 3547 def setMultipageWatermarkUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setMultipageWatermarkUrl", "pdf-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.
3666 3667 3668 3669 |
# File 'lib/pdfcrowd.rb', line 3666 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.
3657 3658 3659 3660 |
# File 'lib/pdfcrowd.rb', line 3657 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.
3648 3649 3650 3651 |
# File 'lib/pdfcrowd.rb', line 3648 def setNoPrint(value) @fields['no_print'] = value 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.
3639 3640 3641 3642 |
# File 'lib/pdfcrowd.rb', line 3639 def setOwnerPassword(password) @fields['owner_password'] = password self end |
#setPageBackground(background) ⇒ Object
Apply the first page of the specified PDF to the background of every page of the output PDF.
-
background
- The file path to a local background PDF file. The file must exist and not be empty. -
Returns - The converter object.
3560 3561 3562 3563 3564 3565 3566 3567 |
# File 'lib/pdfcrowd.rb', line 3560 def setPageBackground(background) if (!(File.file?(background) && !File.zero?(background))) raise Error.new(Pdfcrowd.(background, "setPageBackground", "pdf-to-pdf", "The file must exist and not be empty.", "set_page_background"), 470); end @files['page_background'] = background self end |
#setPageBackgroundUrl(url) ⇒ Object
Load a background PDF from the specified URL and apply the first page of the background PDF to every page of the output PDF.
-
url
- The supported protocols are http:// and https://. -
Returns - The converter object.
3573 3574 3575 3576 3577 3578 3579 3580 |
# File 'lib/pdfcrowd.rb', line 3573 def setPageBackgroundUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setPageBackgroundUrl", "pdf-to-pdf", "The supported protocols are http:// and https://.", "set_page_background_url"), 470); end @fields['page_background_url'] = url 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.
3675 3676 3677 3678 3679 3680 3681 3682 |
# File 'lib/pdfcrowd.rb', line 3675 def setPageLayout(layout) unless /(?i)^(single-page|one-column|two-column-left|two-column-right)$/.match(layout) raise Error.new(Pdfcrowd.(layout, "setPageLayout", "pdf-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 |
#setPageMode(mode) ⇒ Object
Specify how the document should be displayed when opened.
-
mode
- Allowed values are full-screen, thumbnails, outlines. -
Returns - The converter object.
3688 3689 3690 3691 3692 3693 3694 3695 |
# File 'lib/pdfcrowd.rb', line 3688 def setPageMode(mode) unless /(?i)^(full-screen|thumbnails|outlines)$/.match(mode) raise Error.new(Pdfcrowd.(mode, "setPageMode", "pdf-to-pdf", "Allowed values are full-screen, thumbnails, outlines.", "set_page_mode"), 470); end @fields['page_mode'] = mode self end |
#setPageWatermark(watermark) ⇒ Object
Apply the first page of the watermark PDF to every page of the output PDF.
-
watermark
- The file path to a local watermark PDF file. The file must exist and not be empty. -
Returns - The converter object.
3508 3509 3510 3511 3512 3513 3514 3515 |
# File 'lib/pdfcrowd.rb', line 3508 def setPageWatermark(watermark) if (!(File.file?(watermark) && !File.zero?(watermark))) raise Error.new(Pdfcrowd.(watermark, "setPageWatermark", "pdf-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 watermark PDF from the specified URL and apply the first page of the watermark PDF to every page of the output PDF.
-
url
- The supported protocols are http:// and https://. -
Returns - The converter object.
3521 3522 3523 3524 3525 3526 3527 3528 |
# File 'lib/pdfcrowd.rb', line 3521 def setPageWatermarkUrl(url) unless /(?i)^https?:\/\/.*$/.match(url) raise Error.new(Pdfcrowd.(url, "setPageWatermarkUrl", "pdf-to-pdf", "The supported protocols are http:// and https://.", "set_page_watermark_url"), 470); end @fields['page_watermark_url'] = url 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.
3901 3902 3903 3904 |
# File 'lib/pdfcrowd.rb', line 3901 def setProxy(host, port, user_name, password) @helper.setProxy(host, port, user_name, password) self end |
#setRetryCount(count) ⇒ Object
Specifies the number of retries when the 502 HTTP status code is received. The 502 status code indicates a temporary network issue. This feature can be disabled by setting to 0.
-
count
- Number of retries wanted. -
Returns - The converter object.
3910 3911 3912 3913 |
# File 'lib/pdfcrowd.rb', line 3910 def setRetryCount(count) @helper.setRetryCount(count) self end |
#setRightToLeft(value) ⇒ Object
Set the predominant reading order for text to right-to-left. This option has no direct effect on the document’s contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up
-
value
- Set to true to set right-to-left reading order. -
Returns - The converter object.
3794 3795 3796 3797 |
# File 'lib/pdfcrowd.rb', line 3794 def setRightToLeft(value) @fields['right_to_left'] = value 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.
3857 3858 3859 3860 |
# File 'lib/pdfcrowd.rb', line 3857 def setTag(tag) @fields['tag'] = tag 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.
3880 3881 3882 3883 |
# File 'lib/pdfcrowd.rb', line 3880 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 some proxy or firewall.
-
agent
- The user agent string. -
Returns - The converter object.
3889 3890 3891 3892 |
# File 'lib/pdfcrowd.rb', line 3889 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.
3630 3631 3632 3633 |
# File 'lib/pdfcrowd.rb', line 3630 def setUserPassword(password) @fields['user_password'] = password self end |