Skip to content

Commit b547775

Browse files
authored
Merge pull request #95 from aspose-pdf-cloud/develop
update 24.8
2 parents 85b19ad + 290ee0d commit b547775

10 files changed

+277
-17
lines changed

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
3030
## Read PDF Formats
3131
MHT, PCL, PS, XSLFO, MD
3232

33-
## Enhancements in Version 24.7
33+
## Enhancements in Version 24.8
34+
- Adding Text stamps to multiple pages.
35+
- Adding Image stamps to multiple pages.
3436
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3537

36-
## Bugs fixed in Version 24.7
37-
- PutPsInStorageToPdf throws: Cannot find resource ???Aspose.PDF.dependencies.ZapfDingbats.ttf.
38-
- Ocr method is not working.
39-
4038
## Installation
4139

4240
### NPM

docs/OptimizeOptions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ Represents Pdf optimize options.
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**password** | **string** | Specifies document password (if any) encoded with base-64. | [optional]
8-
**allowReusePageContent** | **boolean** | If true page contents will be reused when document is optimized for equal pages. | [optional]
8+
**allowReusePageContent** | **boolean** | If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true. | [optional]
99
**compressImages** | **boolean** | If this flag is set to true images will be compressed in the document. Compression level is specified with ImageQuality property. | [optional]
1010
**imageQuality** | **number** | Specifies level of image compression when CompressImages flag is used. | [optional]
1111
**linkDuplcateStreams** | **boolean** | If this flag is set to true, Resource streams will be analyzed. If duplicate streams are found (i.e. if stream contents is equal), then thees streams will be stored as one object. This allows to decrease document size in some cases (for example, when same document was concatenated multiple times). | [optional]
1212
**removeUnusedObjects** | **boolean** | If this flag is set to true, all document objects will be checked and unused objects (i.e. objects which does not have any reference) are removed from document. | [optional]
1313
**removeUnusedStreams** | **boolean** | If this flag set to true, every resource is checked on it's usage. If resource is never used, then resources is removed. This may decrease document size for example when pages were extracted from document. | [optional]
14-
**unembedFonts** | **boolean** | Make fonts not embedded if set to true. | [optional]
14+
**unembedFonts** | **boolean** | Make fonts not embedded if set to true. Unembedding a font means removing the embedded byte stream data of the font included in a PDF document. | [optional]
1515
**resizeImages** | **boolean** | If this flag set to true and CompressImages is true images will be resized if image resolution is greater then specified MaxResolution parameter. | [optional]
1616
**maxResolution** | **number** | Specifies maximum resolution of images. If image has higher resolution it will be scaled. | [optional]
17-
**subsetFonts** | **boolean** | Fonts will be converted into subsets if set to true. | [optional]
17+
**subsetFonts** | **boolean** | Fonts will be converted into subsets if set to true. Only those characters that are actually used in the layout are stored in the PDF. | [optional]
1818
**removePrivateInfo** | **boolean** | Remove private information (page piece info). | [optional]
1919
**imageEncoding** | [**ImageEncoding**](ImageEncoding.md) | Image encode which will be used. | [optional]
2020
**imageCompressionVersion** | [**ImageCompressionVersion**](ImageCompressionVersion.md) | Version of compression algorithm. Possible values are: "Standard" - standard compression, "Fast" - fast (improved compression which is faster then standard but may be applicable not for all images), "Mixed" - mixed (standard compression is applied to images which can not be compressed by faster algorithm, this may give best compression but more slow then "Fast" algorithm. Version "Fast" is not applicable for resizing images (standard method will be used). Default is "Standard". | [optional]

docs/PdfApi.md

+50
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ Method | HTTP request | Description
203203
*PdfApi* | [**postDecryptDocumentInStorage**](PdfApi.md#postDecryptDocumentInStorage) | **POST** /pdf/\{name}/decrypt | Decrypt document in storage.
204204
*PdfApi* | [**postDocumentImageFooter**](PdfApi.md#postDocumentImageFooter) | **POST** /pdf/\{name}/footer/image | Add document image footer.
205205
*PdfApi* | [**postDocumentImageHeader**](PdfApi.md#postDocumentImageHeader) | **POST** /pdf/\{name}/header/image | Add document image header.
206+
*PdfApi* | [**postDocumentImageStamps**](PdfApi.md#postDocumentImageStamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
206207
*PdfApi* | [**postDocumentPageNumberStamps**](PdfApi.md#postDocumentPageNumberStamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
207208
*PdfApi* | [**postDocumentTextFooter**](PdfApi.md#postDocumentTextFooter) | **POST** /pdf/\{name}/footer/text | Add document text footer.
208209
*PdfApi* | [**postDocumentTextHeader**](PdfApi.md#postDocumentTextHeader) | **POST** /pdf/\{name}/header/text | Add document text header.
209210
*PdfApi* | [**postDocumentTextReplace**](PdfApi.md#postDocumentTextReplace) | **POST** /pdf/\{name}/text/replace | Document's replace text method.
211+
*PdfApi* | [**postDocumentTextStamps**](PdfApi.md#postDocumentTextStamps) | **POST** /pdf/\{name}/stamps/text | Add document pages text stamps.
210212
*PdfApi* | [**postEncryptDocumentInStorage**](PdfApi.md#postEncryptDocumentInStorage) | **POST** /pdf/\{name}/encrypt | Encrypt document in storage.
211213
*PdfApi* | [**postFlattenDocument**](PdfApi.md#postFlattenDocument) | **POST** /pdf/\{name}/flatten | Flatten the document.
212214
*PdfApi* | [**postHtmlToPdf**](PdfApi.md#postHtmlToPdf) | **POST** /pdf/create/html | Convert HTML file (zip archive in request content) to PDF format and return resulting file in response.
@@ -5004,6 +5006,30 @@ Name | Type | Description | Notes
50045006

50055007
[**AsposeResponse**](AsposeResponse.md)
50065008

5009+
### HTTP request headers
5010+
5011+
- **Content-Type**: application/json
5012+
- **Accept**: application/json
5013+
5014+
<a name="postDocumentImageStamps"></a>
5015+
## **postDocumentImageStamps**
5016+
> postDocumentImageStamps(name, stamps, storage, folder, password)
5017+
5018+
Add document pages image stamps.
5019+
5020+
### Parameters
5021+
Name | Type | Description | Notes
5022+
------------- | ------------- | ------------- | -------------
5023+
**name** | **string** | The document name. |
5024+
**stamps** | [**Array&lt;ImageStamp&gt;**](ImageStamp.md) | The array of stamp. |
5025+
**storage** | **string** | The document storage. | [optional]
5026+
**folder** | **string** | The document folder. | [optional]
5027+
**password** | **string** | Base64 encoded password. | [optional]
5028+
5029+
### Return type
5030+
5031+
[**AsposeResponse**](AsposeResponse.md)
5032+
50075033
### HTTP request headers
50085034

50095035
- **Content-Type**: application/json
@@ -5103,6 +5129,30 @@ Name | Type | Description | Notes
51035129

51045130
[**TextReplaceResponse**](TextReplaceResponse.md)
51055131

5132+
### HTTP request headers
5133+
5134+
- **Content-Type**: application/json
5135+
- **Accept**: application/json
5136+
5137+
<a name="postDocumentTextStamps"></a>
5138+
## **postDocumentTextStamps**
5139+
> postDocumentTextStamps(name, stamps, storage, folder, password)
5140+
5141+
Add document pages text stamps.
5142+
5143+
### Parameters
5144+
Name | Type | Description | Notes
5145+
------------- | ------------- | ------------- | -------------
5146+
**name** | **string** | The document name. |
5147+
**stamps** | [**Array&lt;TextStamp&gt;**](TextStamp.md) | The array of stamp. |
5148+
**storage** | **string** | The document storage. | [optional]
5149+
**folder** | **string** | The document folder. | [optional]
5150+
**password** | **string** | Base64 encoded password. | [optional]
5151+
5152+
### Return type
5153+
5154+
[**AsposeResponse**](AsposeResponse.md)
5155+
51065156
### HTTP request headers
51075157

51085158
- **Content-Type**: application/json

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asposepdfcloud",
3-
"version": "24.7.0",
3+
"version": "24.8.0",
44
"description": "Aspose.PDF Cloud is a REST API for creating and editing PDF files. Most popular features proposed by Aspose.PDF Cloud: PDF to Word, Convert PDF to Image, Merge PDF, Split PDF, Add Images to PDF, Rotate PDF. It can also be used to convert PDF files to different formats like DOC, HTML, XPS, TIFF and many more. Aspose.PDF Cloud gives you control: create PDFs from scratch or from HTML, XML, template, database, XPS or an image. Render PDFs to image formats such as JPEG, PNG, GIF, BMP, TIFF and many others. Aspose.PDF Cloud helps you manipulate elements of a PDF file like text, annotations, watermarks, signatures, bookmarks, stamps and so on. Its REST API also allows you to manage PDF pages by using features like merging, splitting, and inserting. Add images to a PDF file or convert PDF pages to images.",
55
"homepage": "https://products.aspose.cloud/pdf/cloud",
66
"author": {

src/api/api.ts

+128
Original file line numberDiff line numberDiff line change
@@ -12384,6 +12384,70 @@ export class PdfApi {
1238412384
}
1238512385

1238612386

12387+
/**
12388+
*
12389+
* @summary Add document pages image stamps.
12390+
* @param name The document name.
12391+
* @param stamps The array of stamp.
12392+
* @param storage The document storage.
12393+
* @param folder The document folder.
12394+
* @param password Base64 encoded password.
12395+
*/
12396+
public async postDocumentImageStamps (name: string, stamps: Array<ImageStamp>, storage?: string, folder?: string, password?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
12397+
const localVarPath = this.basePath + '/pdf/{name}/stamps/image'
12398+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
12399+
let localVarQueryParameters: any = {};
12400+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
12401+
let localVarFormParams: any = {};
12402+
12403+
// verify required parameter 'name' is not null or undefined
12404+
if (name === null || name === undefined) {
12405+
throw new Error('Required parameter name was null or undefined when calling postDocumentImageStamps.');
12406+
}
12407+
12408+
// verify required parameter 'stamps' is not null or undefined
12409+
if (stamps === null || stamps === undefined) {
12410+
throw new Error('Required parameter stamps was null or undefined when calling postDocumentImageStamps.');
12411+
}
12412+
12413+
if (storage !== undefined && null !== storage) {
12414+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
12415+
}
12416+
12417+
if (folder !== undefined && null !== folder) {
12418+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
12419+
}
12420+
12421+
if (password !== undefined && null !== password) {
12422+
localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string");
12423+
}
12424+
12425+
12426+
let localVarUseFormData = false;
12427+
let fileData = null;
12428+
let localVarRequestOptions: localVarRequest.Options = {
12429+
method: 'POST',
12430+
qs: localVarQueryParameters,
12431+
headers: localVarHeaderParams,
12432+
uri: localVarPath,
12433+
useQuerystring: this._useQuerystring,
12434+
json: true,
12435+
body: ObjectSerializer.serialize(stamps, "Array<ImageStamp>")
12436+
};
12437+
12438+
if (Object.keys(localVarFormParams).length) {
12439+
if (localVarUseFormData) {
12440+
(<any>localVarRequestOptions).formData = localVarFormParams;
12441+
} else {
12442+
localVarRequestOptions.form = localVarFormParams;
12443+
}
12444+
}
12445+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
12446+
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
12447+
return Promise.resolve({body: result, response});
12448+
}
12449+
12450+
1238712451
/**
1238812452
*
1238912453
* @summary Add document page number stamps.
@@ -12655,6 +12719,70 @@ export class PdfApi {
1265512719
}
1265612720

1265712721

12722+
/**
12723+
*
12724+
* @summary Add document pages text stamps.
12725+
* @param name The document name.
12726+
* @param stamps The array of stamp.
12727+
* @param storage The document storage.
12728+
* @param folder The document folder.
12729+
* @param password Base64 encoded password.
12730+
*/
12731+
public async postDocumentTextStamps (name: string, stamps: Array<TextStamp>, storage?: string, folder?: string, password?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
12732+
const localVarPath = this.basePath + '/pdf/{name}/stamps/text'
12733+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
12734+
let localVarQueryParameters: any = {};
12735+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
12736+
let localVarFormParams: any = {};
12737+
12738+
// verify required parameter 'name' is not null or undefined
12739+
if (name === null || name === undefined) {
12740+
throw new Error('Required parameter name was null or undefined when calling postDocumentTextStamps.');
12741+
}
12742+
12743+
// verify required parameter 'stamps' is not null or undefined
12744+
if (stamps === null || stamps === undefined) {
12745+
throw new Error('Required parameter stamps was null or undefined when calling postDocumentTextStamps.');
12746+
}
12747+
12748+
if (storage !== undefined && null !== storage) {
12749+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
12750+
}
12751+
12752+
if (folder !== undefined && null !== folder) {
12753+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
12754+
}
12755+
12756+
if (password !== undefined && null !== password) {
12757+
localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string");
12758+
}
12759+
12760+
12761+
let localVarUseFormData = false;
12762+
let fileData = null;
12763+
let localVarRequestOptions: localVarRequest.Options = {
12764+
method: 'POST',
12765+
qs: localVarQueryParameters,
12766+
headers: localVarHeaderParams,
12767+
uri: localVarPath,
12768+
useQuerystring: this._useQuerystring,
12769+
json: true,
12770+
body: ObjectSerializer.serialize(stamps, "Array<TextStamp>")
12771+
};
12772+
12773+
if (Object.keys(localVarFormParams).length) {
12774+
if (localVarUseFormData) {
12775+
(<any>localVarRequestOptions).formData = localVarFormParams;
12776+
} else {
12777+
localVarRequestOptions.form = localVarFormParams;
12778+
}
12779+
}
12780+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
12781+
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
12782+
return Promise.resolve({body: result, response});
12783+
}
12784+
12785+
1265812786
/**
1265912787
*
1266012788
* @summary Encrypt document in storage.

src/auth.ts

+24-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,30 @@ export class OAuth implements IAuthentication {
8282
},
8383
};
8484

85-
const response = await invokeApiMethod(requestOptions, configuration, true);
86-
this.accessToken = response.body.access_token;
85+
try {
86+
const response = await invokeApiMethod(requestOptions, configuration, true);
87+
if (!response.body.access_token || response.body.access_token.trim() == "") {
88+
this._handleResponseError(response)
89+
}
90+
91+
this.accessToken = response.body.access_token;
92+
}
93+
catch(err) {
94+
if (err.response) {
95+
this._handleResponseError(err.response)
96+
} else {
97+
throw err
98+
}
99+
}
100+
87101
return Promise.resolve();
88102
}
103+
104+
private _handleResponseError(response: request.RequestResponse) {
105+
if (typeof response.body == 'string' && response.body.trim() != '') {
106+
throw new Error(response.body)
107+
} else {
108+
throw new Error(`empty token (${JSON.stringify(response.body)})`)
109+
}
110+
}
89111
}

src/models/optimizeOptions.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class OptimizeOptions {
3131
*/
3232
'password': string;
3333
/**
34-
* If true page contents will be reused when document is optimized for equal pages.
34+
* If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true.
3535
*/
3636
'allowReusePageContent': boolean;
3737
/**
@@ -55,7 +55,7 @@ export class OptimizeOptions {
5555
*/
5656
'removeUnusedStreams': boolean;
5757
/**
58-
* Make fonts not embedded if set to true.
58+
* Make fonts not embedded if set to true. Unembedding a font means removing the embedded byte stream data of the font included in a PDF document.
5959
*/
6060
'unembedFonts': boolean;
6161
/**
@@ -67,7 +67,7 @@ export class OptimizeOptions {
6767
*/
6868
'maxResolution': number;
6969
/**
70-
* Fonts will be converted into subsets if set to true.
70+
* Fonts will be converted into subsets if set to true. Only those characters that are actually used in the layout are stored in the PDF.
7171
*/
7272
'subsetFonts': boolean;
7373
/**

src/requestHelper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async function invokeApiMethodInternal(requestOptions: request.Options, confgura
9595
//headers
9696
sa.set("User-Agent", "pdf nodejs sdk");
9797
sa.set("x-aspose-client", "nodejs sdk");
98-
sa.set("x-aspose-client-version", "24.7.0");
98+
sa.set("x-aspose-client-version", "24.8.0");
9999

100100
if (!requestOptions.headers) {
101101
requestOptions.headers = {};

0 commit comments

Comments
 (0)