Skip to content

Commit 2b7fa8b

Browse files
SDK regenerated by CI server [ci skip]
1 parent a53cfe4 commit 2b7fa8b

File tree

10 files changed

+524
-3
lines changed

10 files changed

+524
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Feel free to explore the [Developer's Guide](https://docs.aspose.cloud/display/w
1919
## Enhancements in Version 22.7
2020

2121
- Expand 'AppendDocument' API method to support 'ImageEntryList' for directly appending images to documents and another images.
22+
- Added 'CompressDocument' API method to support compression and resizing images inside the document for reduce the size of the document.
2223

2324

2425
## Enhancements in Version 22.6
232 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asposewordscloud",
3-
"version": "22.6.0",
3+
"version": "22.7.0",
44
"description": "Aspose.Words Cloud SDK for Node.js",
55
"homepage": "https://products.aspose.cloud/words/cloud",
66
"author": {

src/api.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,42 @@ export class WordsApi implements Encryptor {
339339
return Promise.resolve(result);
340340
}
341341

342+
/**
343+
* The default settings allows to reduce the size of the document without any visible degradation of images quality.
344+
* @param requestObj contains request parameters
345+
*/
346+
public async compressDocument(requestObj: model.CompressDocumentRequest): Promise< model.WordsIncomingMessage< model.CompressResponse > > {
347+
if (requestObj === null || requestObj === undefined) {
348+
throw new Error('Required parameter "request" was null or undefined when calling compressDocument.');
349+
}
350+
351+
const requestOptions = await requestObj.createRequestOptions(this.configuration, this);
352+
353+
const response = await invokeApiMethod(requestOptions, this.configuration);
354+
const result = new model.WordsIncomingMessage< model.CompressResponse >();
355+
result.response = response;
356+
result.body = requestObj.createResponse(response.body, response.headers);
357+
return Promise.resolve(result);
358+
}
359+
360+
/**
361+
* Compress and resize images inside the document.
362+
* @param requestObj contains request parameters
363+
*/
364+
public async compressDocumentOnline(requestObj: model.CompressDocumentOnlineRequest): Promise< model.WordsIncomingMessage< model.CompressDocumentOnlineResponse > > {
365+
if (requestObj === null || requestObj === undefined) {
366+
throw new Error('Required parameter "request" was null or undefined when calling compressDocumentOnline.');
367+
}
368+
369+
const requestOptions = await requestObj.createRequestOptions(this.configuration, this);
370+
371+
const response = await invokeApiMethod(requestOptions, this.configuration);
372+
const result = new model.WordsIncomingMessage< model.CompressDocumentOnlineResponse >();
373+
result.response = response;
374+
result.body = requestObj.createResponse(response.body, response.headers);
375+
return Promise.resolve(result);
376+
}
377+
342378
/**
343379
* Converts a document on a local drive to the specified format.
344380
* @param requestObj contains request parameters

src/internal/requestHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async function invokeApiMethodInternal(requestOptions: request.OptionsWithUri, c
131131
requestOptions.timeout = 1000 * confguration.timeout;
132132

133133
requestOptions.headers["x-aspose-client"] = "nodejs sdk";
134-
requestOptions.headers["x-aspose-client-version"] = "22.6";
134+
requestOptions.headers["x-aspose-client-version"] = "22.7";
135135

136136
requestOptions.uri = encodeURI(requestOptions.uri.toString());
137137

src/model/compressOptions.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="compressOptions.ts">
4+
* Copyright (c) 2022 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
import { AttributeInfo } from '../internal/attributeInfo';
29+
30+
export const importsMapCompressOptions = {
31+
};
32+
33+
/**
34+
* Options of document compress.
35+
*/
36+
export class CompressOptions {
37+
/**
38+
* Attribute type map
39+
*/
40+
public static attributeTypeMap: Array<AttributeInfo> = [
41+
{
42+
name: "imagesQuality",
43+
baseName: "ImagesQuality",
44+
type: "number",
45+
},
46+
{
47+
name: "imagesReduceSizeFactor",
48+
baseName: "ImagesReduceSizeFactor",
49+
type: "number",
50+
}
51+
];
52+
53+
/**
54+
* Returns attribute type map
55+
*/
56+
public static getAttributeTypeMap() {
57+
return CompressOptions.attributeTypeMap;
58+
}
59+
60+
/**
61+
* Gets or sets the quality level of images from 0 to 100. Default value is 75.
62+
*/
63+
public imagesQuality: number;
64+
65+
/**
66+
* Gets or sets the resize factor of images.
67+
* This value determines how many times the size of the images in the document will be reduced.
68+
* The parameter value must be greater than 1 for resizing. Default value is 1 and has no effect on images size.
69+
*/
70+
public imagesReduceSizeFactor: number;
71+
72+
public constructor(init?: Partial< CompressOptions >) {
73+
Object.assign(this, init);
74+
}
75+
}
76+

src/model/compressResponse.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="compressResponse.ts">
4+
* Copyright (c) 2022 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
import { AttributeInfo } from '../internal/attributeInfo';
29+
import { Document } from './document';
30+
import { WordsResponse } from './wordsResponse';
31+
32+
export const importsMapCompressResponse = {
33+
Document,
34+
WordsResponse,
35+
};
36+
37+
/**
38+
* The REST response of compressed document.
39+
*/
40+
export class CompressResponse extends WordsResponse {
41+
/**
42+
* Attribute type map
43+
*/
44+
public static attributeTypeMap: Array<AttributeInfo> = [
45+
{
46+
name: "document",
47+
baseName: "Document",
48+
type: "Document",
49+
}
50+
];
51+
52+
/**
53+
* Returns attribute type map
54+
*/
55+
public static getAttributeTypeMap() {
56+
return super.getAttributeTypeMap().concat(CompressResponse.attributeTypeMap);
57+
}
58+
59+
/**
60+
* Gets or sets the destination document info.
61+
*/
62+
public document: Document;
63+
64+
public constructor(init?: Partial< CompressResponse >) {
65+
super(init);
66+
Object.assign(this, init);
67+
}
68+
}
69+

0 commit comments

Comments
 (0)