Skip to content

Commit a6d93f4

Browse files
v20.8.0
1 parent e1ab392 commit a6d93f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1221
-962
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.idea/
22
node_modules/
3-
testresult/
3+
testresult/*.*

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Aspose Pty Ltd
3+
Copyright (c) 2020 Aspose Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 87 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Asposehtmlcloud - JavaScript client for asposehtmlcloud
44

5-
- API version: 19.7.0
6-
- Package version: 19.7.0
5+
- API version: 20.8.0
6+
- Package version: 20.8.0
77

88
## Installation
99

10-
# Aspose.HTML Cloud SDK for Node.js
10+
## Aspose.HTML Cloud SDK for Node.js
1111
This repository contains Aspose.HTML Cloud SDK for Node.js source code.
1212
This SDK allows you to work with Aspose.HTML Cloud REST APIs in your Node.js applications quickly and easily.
1313

@@ -18,23 +18,97 @@ The complete source code is available in this repository folder, you can either
1818
it in your project via npm package manager.
1919

2020
### Prerequisites
21-
To use Aspose HTML for Cloud Node.js SDK you need to register an account with [Aspose Cloud](https://www.aspose.cloud/) and lookup/create App Key and SID at [Cloud Dashboard](https://dashboard.aspose.cloud/#/apps). There is free quota available. For more details, see [Aspose Cloud Pricing](https://purchase.aspose.cloud/pricing).
21+
To use Aspose HTML for Cloud Node.js SDK you need to register an account with [Aspose Cloud](https://www.aspose.cloud/) and lookup/create App Key and SID at [Cloud Dashboard](https://dashboard.aspose.cloud/#/apps). There is a free quota available. For more details, see [Aspose Cloud Pricing](https://purchase.aspose.cloud/pricing).
2222

2323
### Installation
2424

2525
#### Install Aspose.HTML Cloud
2626
### For [Node.js](https://nodejs.org/)
2727

2828
#### npm
29-
To publish the library as a [npm](https://www.npmjs.com/),
30-
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
31-
32-
Then install it via:
33-
3429
```shell
3530
npm install asposehtmlcloud --save
3631
```
3732

33+
## Getting Started
34+
Please follow the [installation](#installation) instruction and execute the following JS code:
35+
36+
NOTE: Use the helper from /test/helper.js for an upload and save data.
37+
38+
```javascript
39+
40+
// Get keys from aspose site.
41+
// There is free quota available.
42+
// For more details, see https://purchase.aspose.cloud/pricing
43+
44+
var conf = {
45+
"basePath":"https://api.aspose.cloud/v3.0",
46+
"authPath":"https://api.aspose.cloud/connect/token",
47+
"apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
48+
"appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
49+
"testResult":"/testresult/",
50+
"testData":"/testdata/",
51+
"remoteFolder":"HtmlTestDoc",
52+
"defaultUserAgent":"Webkit"
53+
};
54+
55+
//Create storage api for upload to server
56+
var api = require('asposehtmlcloud');
57+
var fs = require('fs');
58+
var storageApi = new api.StorageApi(conf);
59+
60+
61+
// Setup local folder for source and result
62+
var local_dst_folder = __dirname + "/../"+ conf['testResult'];
63+
var local_src_folder = __dirname + "/../"+ conf['testData'];
64+
65+
// Create Conversion Api object
66+
var conversionApi = new api.ConversionApi(conf);
67+
68+
69+
var filename = "test_data.html"; // {String} Document name.
70+
71+
// Get upload folder from config (or write manually)
72+
var folder = conf['remoteFolder'];
73+
var versionId = null;
74+
var storage=null;
75+
76+
var file = local_src_folder + "/" + filename;
77+
78+
//Upload file to storage
79+
var opts = {versionId:versionId, storage:null};
80+
81+
storageApi.uploadFile(folder + "/" + filename, file, opts, callback);
82+
83+
//Setup output format
84+
var outFormat = "png"; // {String} Resulting image format.
85+
86+
//Setup various option for result image
87+
var opts = {
88+
'width': 800, // {Number} Resulting image width.
89+
'height': 1000, // {Number} Resulting image height.
90+
'leftMargin': 10, // {Number} Left resulting image margin.
91+
'rightMargin': 10, // {Number} Right resulting image margin.
92+
'topMargin': 20, // {Number} Top resulting image margin.
93+
'bottomMargin': 20, // {Number} Bottom resulting image margin.
94+
'resolution': 300, // {Number} Resolution of resulting image.
95+
'folder': folder, // {String} The source document folder.
96+
'storage': storage // {String} The source document storage.
97+
};
98+
99+
var callback = function(error, data, response) {
100+
if (error) {
101+
console.error(error);
102+
} else {
103+
var dst = local_dst_folder + "/" + "ResultConvertToPng.zip";
104+
var fd = fs.openSync(dst, 'w');
105+
var len = fs.writeSync(fd, data);
106+
}
107+
};
108+
conversionApi.GetConvertDocumentToImage(filename, outFormat, opts, callback);
109+
110+
```
111+
38112
##### Local development
39113

40114
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
@@ -60,12 +134,9 @@ You should now be able to `require('asposehtmlcloud')` in javascript files from
60134
command above from.
61135

62136
#### git
63-
If the library is hosted at a git repository, e.g.
64-
https://github.com/GIT_USER_ID/GIT_REPO_ID
65-
then install it via:
66-
137+
Install it via:
67138
```shell
68-
npm install GIT_USER_ID/GIT_REPO_ID --save
139+
git install https://github.com/aspose-html-cloud/aspose-html-cloud-nodejs --save
69140
```
70141

71142
### For browser
@@ -101,24 +172,6 @@ module: {
101172
Before fill all fields in configuration object (see tests)
102173

103174
Example:
104-
```json
105-
var conf = {
106-
"basePath":"https://api.aspose.cloud/v3.0",
107-
"authPath":"https://api.aspose.cloud/connect/token",
108-
"apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
109-
"appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
110-
"testResult":"/testresult/",
111-
"testData":"/testdata/",
112-
"remoteFolder":"HtmlTestDoc/",
113-
"defaultUserAgent":"Webkit"
114-
}
115-
```
116-
117-
## Getting Started
118-
Please follow the [installation](#installation) instruction and execute the following JS code:
119-
120-
NOTE: Use the helper from /test/helper.js for upload and save data.
121-
122175
```javascript
123176
var conf = {
124177
"basePath":"https://api.aspose.cloud/v3.0",
@@ -127,65 +180,9 @@ var conf = {
127180
"appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
128181
"testResult":"/testresult/",
129182
"testData":"/testdata/",
130-
"remoteFolder":"HtmlTestDoc/",
183+
"remoteFolder":"HtmlTestDoc",
131184
"defaultUserAgent":"Webkit"
132-
};
133-
134-
//Create storage api for upload to server
135-
var api = require('asposehtmlcloud');
136-
var fs = require('fs');
137-
var storageApi = new api.StorageApi(conf);
138-
139-
140-
// Setup local folder for source and result
141-
var local_dst_folder = __dirname + "/../"+ conf['testResult'];
142-
var local_src_folder = __dirname + "/../"+ conf['testData'];
143-
144-
// Create Conversion Api object
145-
var conversionApi = new api.ConversionApi(conf);
146-
147-
148-
var filename = "test_data.html"; // {String} Document name.
149-
150-
// Get upload folder from config (or write manually)
151-
var folder = conf['remoteFolder'];
152-
var versionId = null;
153-
var storage=null;
154-
155-
var file = local_src_folder + "/" + filename;
156-
157-
//Upload file to storage
158-
var opts = {versionId:versionId, storage:null};
159-
160-
storageApi.uploadFile(folder + "/" + filename, file, opts, callback);
161-
162-
//Setup output format
163-
var outFormat = "png"; // {String} Resulting image format.
164-
165-
//Setup various option for result image
166-
var opts = {
167-
'width': 800, // {Number} Resulting image width.
168-
'height': 1000, // {Number} Resulting image height.
169-
'leftMargin': 10, // {Number} Left resulting image margin.
170-
'rightMargin': 10, // {Number} Right resulting image margin.
171-
'topMargin': 20, // {Number} Top resulting image margin.
172-
'bottomMargin': 20, // {Number} Bottom resulting image margin.
173-
'resolution': 300, // {Number} Resolution of resulting image.
174-
'folder': folder, // {String} The source document folder.
175-
'storage': storage // {String} The source document storage.
176-
};
177-
178-
var callback = function(error, data, response) {
179-
if (error) {
180-
console.error(error);
181-
} else {
182-
var dst = local_dst_folder + "/" + "ResultConvertToPng.png";
183-
var fd = fs.openSync(dst, 'w');
184-
var len = fs.writeSync(fd, data);
185-
}
186-
};
187-
conversionApi.GetConvertDocumentToImage(filename, outFormat, opts, callback);
188-
185+
}
189186
```
190187

191188
## Documentation for API Endpoints

0 commit comments

Comments
 (0)