TestGem102 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/TestGem102.rb +3 -1
  2. data/lib/saaspose_pdf.rb +34 -0
  3. metadata +2 -1
data/lib/TestGem102.rb CHANGED
@@ -1 +1,3 @@
1
- puts "Hello from Test Gem 102"
1
+ puts "Hello from Test Gem 102"
2
+
3
+ include 'saaspose_pdf'
@@ -0,0 +1,34 @@
1
+ require_relative 'saaspose_storage'
2
+
3
+ # This module provide wrapper classes to work with Saaspose.Pdf resources
4
+ module Pdf
5
+ # This class provides functionality for converting PDF Documents to other supported formats.
6
+ class Convertor
7
+ # Constructor for the Convertor Class.
8
+ # * :name represents the name of the PDF Document on the Saaspose server
9
+ def initialize(name)
10
+ # Instance variables
11
+ @name = name
12
+ end
13
+ # Uploads file from the local path to the remote folder.
14
+ # * :localFile represents full local file path and name
15
+ # * :saveImageFormat represents the converted image format. For a list of supported image formats, please visit
16
+ # http://saaspose.com/docs/display/pdf/page
17
+ # * :pageNumber represents the page number in the PDF document
18
+ # * :height represents height of the converted image
19
+ # * :width represents width of the converted image
20
+ def convert(localFile,saveImageFormat,pageNumber,height,width)
21
+ urlDoc = $productURI + '/pdf/' + @name + '/pages/' + pageNumber + '?format=' + saveImageFormat + '&width=' + width + '&height=' + height
22
+ signedURL = Common::Utils.sign(urlDoc)
23
+ response = RestClient.get(signedURL, :accept => 'application/json')
24
+ Common::Utils.saveFile(response,localFile)
25
+ end
26
+ # Retruns the number of pages in a PDF document
27
+ def getPageCount
28
+ urlPage = $productURI + '/pdf/' + @name + '/pages'
29
+ signedURL = Common::Utils.sign(urlPage)
30
+ count = Common::Utils.getFieldCount(signedURL,'/SaaSposeResponse/Pages/Page')
31
+ return count
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TestGem102
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - lib/saaspose_pdf.rb
20
21
  - lib/TestGem102.rb
21
22
  homepage: http://testsite.com
22
23
  licenses: []