SelectPdf Online REST API - Ruby Client

HTML To PDF API - Ruby Client

SelectPdf HTML To PDF Online REST API is a professional solution that lets you create PDF from web pages and raw HTML code in your applications. The API is easy to use and the integration takes only a few lines of code.

Features

  • Create PDF from any web page or html string.
  • Full html5/css3/javascript support.
  • Set PDF options such as page size and orientation, margins, security, web page settings.
  • Set PDF viewer options and PDF document information.
  • Create custom headers and footers for the pdf document.
  • Hide web page elements during the conversion.
  • Automatically generate bookmarks during the html to pdf conversion.
  • Support for partial page conversion.
  • Easy integration, no third party libraries needed.
  • Works in all programming languages.
  • No installation required.

Sign up for for free to get instant API access to SelectPdf HTML to PDF API.

Sample Code

require 'selectpdf'
print "This is SelectPdf-#{SelectPdf::CLIENT_VERSION}\n"

url = 'https://selectpdf.com'
local_file = 'Test.pdf'
api_key = 'Your API key here'

begin
    api = SelectPdf::HtmlToPdfClient.new(api_key)

    api.page_size = SelectPdf::PageSize::A4
    api.margins = 0
    api.page_numbers = FALSE
    api.page_breaks_enhanced_algorithm = TRUE

    api.convert_url_to_file(url, local_file)
rescue SelectPdf::ApiException => e
    print("An error occurred: #{e}")
end