Class: Saaspose::Pdf

Inherits:
Object
  • Object
show all
Defined in:
lib/saaspose/pdf.rb

Class Method Summary collapse

Class Method Details

.convert(name, local_file, save_image_format, page_number, height, width) ⇒ Object



6
7
8
9
10
11
# File 'lib/saaspose/pdf.rb', line 6

def convert(name, local_file, save_image_format, page_number, height, width)
  url_doc = Configuration.product_uri + '/pdf/' + name + '/pages/' + page_number + '?format=' + save_image_format + '&width=' + width + '&height=' + height
  signed_url = Utils.sign(url_doc)
  response = RestClient.get(signed_url, :accept => 'application/json')
  Utils.save_file(response, local_file)
end

.page_count(name) ⇒ Object



13
14
15
16
17
18
# File 'lib/saaspose/pdf.rb', line 13

def page_count(name)
  url_page = Configuration.product_uri + '/pdf/' + name + '/pages'
  signed_url = Utils.sign(url_page)
  response = RestClient.get(signed_url, :accept => 'application/xml')
  REXML::Document.new(response.body).elements.size
end