@@ -81,79 +81,51 @@ Please, add the following [nmp package](https://www.npmjs.com/package/@asposeclo
8181Please follow the [ installation] ( #installation ) instruction and execute the following JS code:
8282
8383NOTE: Use the helper from /test/helper.js for an upload and save data.
84-
85- ``` javascript
86-
87- // Get keys from aspose site.
88- // There is free quota available.
89- // For more details, see https://purchase.aspose.cloud/pricing
90-
91- var conf = {
92- " basePath" : " https://api.aspose.cloud/v3.0" ,
93- " authPath" : " https://api.aspose.cloud/connect/token" ,
94- " apiKey" : " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
95- " appSID" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
96- " testResult" : " /testresult/" ,
97- " testData" : " /testdata/" ,
98- " remoteFolder" : " HtmlTestDoc" ,
99- " defaultUserAgent" : " Webkit"
100- };
101-
102- // Create storage api for upload to server
103- var api = require (' @asposecloud/aspose-html-cloud' );
104- var fs = require (' fs' );
105- var storageApi = new api.StorageApi (conf);
106-
107-
108- // Setup local folder for source and result
109- var local_dst_folder = __dirname + " /../" + conf[' testResult' ];
110- var local_src_folder = __dirname + " /../" + conf[' testData' ];
111-
112- // Create Conversion Api object
113- var conversionApi = new api.ConversionApi (conf);
114-
115-
116- var filename = " test_data.html" ; // {String} Document name.
117-
118- // Get upload folder from config (or write manually)
119- var folder = conf[' remoteFolder' ];
120- var versionId = null ;
121- var storage= null ;
122-
123- var file = local_src_folder + " /" + filename;
124-
125- // Upload file to storage
126- var opts = {versionId: versionId, storage: null };
127-
128- storageApi .uploadFile (folder + " /" + filename, file, opts, callback);
129-
130- // Setup output format
131- var outFormat = " png" ; // {String} Resulting image format.
132-
133- // Setup various option for result image
134- var opts = {
135- ' width' : 800 , // {Number} Resulting image width.
136- ' height' : 1000 , // {Number} Resulting image height.
137- ' leftMargin' : 10 , // {Number} Left resulting image margin.
138- ' rightMargin' : 10 , // {Number} Right resulting image margin.
139- ' topMargin' : 20 , // {Number} Top resulting image margin.
140- ' bottomMargin' : 20 , // {Number} Bottom resulting image margin.
141- ' resolution' : 300 , // {Number} Resolution of resulting image.
142- ' folder' : folder, // {String} The source document folder.
143- ' storage' : storage // {String} The source document storage.
144- };
145-
146- var callback = function (error , data , response ) {
147- if (error) {
148- console .error (error);
149- } else {
150- var dst = local_dst_folder + " /" + " ResultConvertToPng.zip" ;
151- var fd = fs .openSync (dst, ' w' );
152- var len = fs .writeSync (fd, data);
153- }
154- };
155- conversionApi .GetConvertDocumentToImage (filename, outFormat, opts, callback);
156-
84+ ## Convert HTML to PNG in Node.Js
85+
86+ ``` js
87+ // Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
88+
89+ var conf = {
90+ " appSID" : " MY_CLIENT_ID" ,
91+ " apiKey" : " MY_CLIENT_SECRET" ,
92+ " basePath" : " https://api.aspose.cloud/v3.0" ,
93+ " authPath" : " https://api.aspose.cloud/connect/token" ,
94+ " testResult" : " /testresult/" ,
95+ " testData" : " /testdata/" ,
96+ " remoteFolder" : " HtmlTestDoc" ,
97+ " defaultUserAgent" : " Webkit"
98+ };
99+
100+ var api = require (' @asposecloud/aspose-html-cloud' );
101+ var conversionApi = new api.ConversionApi (conf);
102+
103+ var filename = " sample.html" ;
104+ var outFormat = " png" ; // {String} Resulting image format.
105+ // Setup various option for result image
106+ var opts = {
107+ ' width' : 800 , // {Number} Resulting image width.
108+ ' height' : 1000 , // {Number} Resulting image height.
109+ ' leftMargin' : 10 , // {Number} Left resulting image margin.
110+ ' rightMargin' : 10 , // {Number} Right resulting image margin.
111+ ' topMargin' : 20 , // {Number} Top resulting image margin.
112+ ' bottomMargin' : 20 , // {Number} Bottom resulting image margin.
113+ ' resolution' : 300 , // {Number} Resolution of resulting image.
114+ ' folder' : ' My_Folder' , // {String} The source document folder.
115+ ' storage' : ' My_Storage_Name' // {String} The source document storage.
116+ };
117+
118+ var callback = function (error , data , response ) {
119+ if (error) {
120+ console .error (error);
121+ } else {
122+ var dst = local_dst_folder + " /" + " ResultConvertToPng.zip" ;
123+ var fd = fs .openSync (dst, ' w' );
124+ var len = fs .writeSync (fd, data);
125+ }
126+ };
127+
128+ conversionApi .GetConvertDocumentToImage (filename, outFormat, opts, callback);
157129```
158130
159131##### Local development
@@ -210,23 +182,6 @@ module: {
210182}
211183```
212184
213- ### Sample usage
214- Before fill all fields in configuration object (see tests)
215-
216- Example:
217- ``` javascript
218- var conf = {
219- " basePath" : " https://api.aspose.cloud/v3.0" ,
220- " authPath" : " https://api.aspose.cloud/connect/token" ,
221- " apiKey" : " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
222- " appSID" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
223- " testResult" : " /testresult/" ,
224- " testData" : " /testdata/" ,
225- " remoteFolder" : " HtmlTestDoc" ,
226- " defaultUserAgent" : " Webkit"
227- }
228- ```
229-
230185## Documentation for API Endpoints
231186All URIs are relative to * https://api.aspose.cloud/v3.0 *
232187
0 commit comments