22
33Asposehtmlcloud - JavaScript client for asposehtmlcloud
44
5- - API version: 1.0.1
6- - Package version: 1.0.1
5+ - API version: 1.0.3
6+ - Package version: 1.0.3
77
88## Installation
99
@@ -104,11 +104,11 @@ module: {
104104
105105### Sample usage
106106
107- Before fill all fields in /setting/config.json
107+ Before fill all fields in configuration object (see tests)
108108
109109Example:
110110``` json
111- {
111+ var conf = {
112112 "basePath" :" https://api.aspose.cloud/v1.1" ,
113113 "authPath" :" https://api.aspose.cloud/oauth2/token" ,
114114 "apiKey" :" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
@@ -129,27 +129,29 @@ Please follow the [installation](#installation) instruction and execute the foll
129129NOTE: Use the helper from /test/helper.js for upload and save data.
130130
131131``` javascript
132- // Load configurations data
133- var fs = require (' fs' );
134- var conf = JSON .parse (fs .readFileSync (__dirname + ' /../setting/config.json' , ' utf8' ));
132+ var conf = {
133+ " basePath" : " https://api.aspose.cloud/v1.1" ,
134+ " authPath" : " https://api.aspose.cloud/oauth2/token" ,
135+ " apiKey" : " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
136+ " appSID" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
137+ " testResult" : " /testresult/" ,
138+ " testData" : " /testdata/" ,
139+ " remoteFolder" : " HtmlTestDoc/" ,
140+ " defaultUserAgent" : " Webkit"
141+ };
135142
136143// Create storage api for upload to server
137- var StorageApi = require (' asposestoragecloud' );
138- var storageApi = new StorageApi ({
139- ' baseURI' : conf[' basePath' ],
140- ' appSid' : conf[' appSID' ],
141- ' apiKey' : conf[' apiKey' ]});
144+ var api = require (' asposehtmlcloud' );
145+ var fs = require (' fs' );
146+ var storageApi = new api.StorageApi (conf);
142147
143148
144149// Setup local folder for source and result
145150var local_dst_folder = __dirname + " /../" + conf[' testResult' ];
146151var local_src_folder = __dirname + " /../" + conf[' testData' ];
147152
148-
149- var Asposehtmlcloud = require (' ../src/index' );
150-
151153// Create Conversion Api object
152- var api = new Asposehtmlcloud .ConversionApi ();
154+ var conversionApi = new api .ConversionApi (conf );
153155
154156
155157var filename = " test_data.html" ; // {String} Document name.
@@ -162,12 +164,13 @@ var storage=null;
162164var file = local_src_folder + " /" + filename;
163165
164166// Upload file to storage
165- storageApi .PutCreate (folder + " /" + filename, versionId, storage, file, callback);
167+ var opts = {versionId: versionId, storage: null };
168+
169+ storageApi .putCreate (folder + " /" + filename, file, opts, callback);
166170
167171// Setup output format
168172var outFormat = " png" ; // {String} Resulting image format.
169173
170-
171174// Setup various option for result image
172175var opts = {
173176 ' width' : 800 , // {Number} Resulting image width.
@@ -176,8 +179,7 @@ var opts = {
176179 ' rightMargin' : 10 , // {Number} Right resulting image margin.
177180 ' topMargin' : 20 , // {Number} Top resulting image margin.
178181 ' bottomMargin' : 20 , // {Number} Bottom resulting image margin.
179- ' xResolution' : 300 , // {Number} Horizontal resolution of resulting image.
180- ' yResolution' : 300 , // {Number} Vertical resolution of resulting image.
182+ ' resolution' : 300 , // {Number} Resolution of resulting image.
181183 ' folder' : folder, // {String} The source document folder.
182184 ' storage' : storage // {String} The source document storage.
183185};
@@ -191,7 +193,7 @@ var callback = function(error, data, response) {
191193 var len = fs .writeSync (fd, data);
192194 }
193195};
194- api .GetConvertDocumentToImage (filename, outFormat, opts, callback);
196+ conversionApi .GetConvertDocumentToImage (filename, outFormat, opts, callback);
195197
196198```
197199
@@ -286,5 +288,3 @@ node.exe ./node_modules/mocha/bin/_mocha --ui bdd ./test
286288## Documentation for Authorization
287289
288290Please follow the [ installation] ( #installation ) instruction for write config file:
289-
290- [ Authorization] ( https://docs.aspose.cloud/display/totalcloud/Authenticating+API+Requests )
0 commit comments