Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
## Read PDF Formats
MHT, PCL, PS, XSLFO, MD

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

## Bugs fixed in Version 24.7
- PutPsInStorageToPdf throws: Cannot find resource ???Aspose.PDF.dependencies.ZapfDingbats.ttf.
- Ocr method is not working.

## Installation

### NPM
Expand Down
6 changes: 3 additions & 3 deletions docs/OptimizeOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Represents Pdf optimize options.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**password** | **string** | Specifies document password (if any) encoded with base-64. | [optional]
**allowReusePageContent** | **boolean** | If true page contents will be reused when document is optimized for equal pages. | [optional]
**allowReusePageContent** | **boolean** | If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true. | [optional]
**compressImages** | **boolean** | If this flag is set to true images will be compressed in the document. Compression level is specified with ImageQuality property. | [optional]
**imageQuality** | **number** | Specifies level of image compression when CompressImages flag is used. | [optional]
**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]
**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]
**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]
**unembedFonts** | **boolean** | Make fonts not embedded if set to true. | [optional]
**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]
**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]
**maxResolution** | **number** | Specifies maximum resolution of images. If image has higher resolution it will be scaled. | [optional]
**subsetFonts** | **boolean** | Fonts will be converted into subsets if set to true. | [optional]
**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]
**removePrivateInfo** | **boolean** | Remove private information (page piece info). | [optional]
**imageEncoding** | [**ImageEncoding**](ImageEncoding.md) | Image encode which will be used. | [optional]
**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]
Expand Down
50 changes: 50 additions & 0 deletions docs/PdfApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ Method | HTTP request | Description
*PdfApi* | [**postDecryptDocumentInStorage**](PdfApi.md#postDecryptDocumentInStorage) | **POST** /pdf/\{name}/decrypt | Decrypt document in storage.
*PdfApi* | [**postDocumentImageFooter**](PdfApi.md#postDocumentImageFooter) | **POST** /pdf/\{name}/footer/image | Add document image footer.
*PdfApi* | [**postDocumentImageHeader**](PdfApi.md#postDocumentImageHeader) | **POST** /pdf/\{name}/header/image | Add document image header.
*PdfApi* | [**postDocumentImageStamps**](PdfApi.md#postDocumentImageStamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
*PdfApi* | [**postDocumentPageNumberStamps**](PdfApi.md#postDocumentPageNumberStamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
*PdfApi* | [**postDocumentTextFooter**](PdfApi.md#postDocumentTextFooter) | **POST** /pdf/\{name}/footer/text | Add document text footer.
*PdfApi* | [**postDocumentTextHeader**](PdfApi.md#postDocumentTextHeader) | **POST** /pdf/\{name}/header/text | Add document text header.
*PdfApi* | [**postDocumentTextReplace**](PdfApi.md#postDocumentTextReplace) | **POST** /pdf/\{name}/text/replace | Document's replace text method.
*PdfApi* | [**postDocumentTextStamps**](PdfApi.md#postDocumentTextStamps) | **POST** /pdf/\{name}/stamps/text | Add document pages text stamps.
*PdfApi* | [**postEncryptDocumentInStorage**](PdfApi.md#postEncryptDocumentInStorage) | **POST** /pdf/\{name}/encrypt | Encrypt document in storage.
*PdfApi* | [**postFlattenDocument**](PdfApi.md#postFlattenDocument) | **POST** /pdf/\{name}/flatten | Flatten the document.
*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.
Expand Down Expand Up @@ -5004,6 +5006,30 @@ Name | Type | Description | Notes

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

### HTTP request headers

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

<a name="postDocumentImageStamps"></a>
## **postDocumentImageStamps**
> postDocumentImageStamps(name, stamps, storage, folder, password)

Add document pages image stamps.

### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **string** | The document name. |
**stamps** | [**Array&lt;ImageStamp&gt;**](ImageStamp.md) | The array of stamp. |
**storage** | **string** | The document storage. | [optional]
**folder** | **string** | The document folder. | [optional]
**password** | **string** | Base64 encoded password. | [optional]

### Return type

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

### HTTP request headers

- **Content-Type**: application/json
Expand Down Expand Up @@ -5103,6 +5129,30 @@ Name | Type | Description | Notes

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

### HTTP request headers

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

<a name="postDocumentTextStamps"></a>
## **postDocumentTextStamps**
> postDocumentTextStamps(name, stamps, storage, folder, password)

Add document pages text stamps.

### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **string** | The document name. |
**stamps** | [**Array&lt;TextStamp&gt;**](TextStamp.md) | The array of stamp. |
**storage** | **string** | The document storage. | [optional]
**folder** | **string** | The document folder. | [optional]
**password** | **string** | Base64 encoded password. | [optional]

### Return type

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

### HTTP request headers

- **Content-Type**: application/json
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asposepdfcloud",
"version": "24.7.0",
"version": "24.8.0",
"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.",
"homepage": "https://products.aspose.cloud/pdf/cloud",
"author": {
Expand Down
128 changes: 128 additions & 0 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12384,6 +12384,70 @@ export class PdfApi {
}


/**
*
* @summary Add document pages image stamps.
* @param name The document name.
* @param stamps The array of stamp.
* @param storage The document storage.
* @param folder The document folder.
* @param password Base64 encoded password.
*/
public async postDocumentImageStamps (name: string, stamps: Array<ImageStamp>, storage?: string, folder?: string, password?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
const localVarPath = this.basePath + '/pdf/{name}/stamps/image'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};

// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling postDocumentImageStamps.');
}

// verify required parameter 'stamps' is not null or undefined
if (stamps === null || stamps === undefined) {
throw new Error('Required parameter stamps was null or undefined when calling postDocumentImageStamps.');
}

if (storage !== undefined && null !== storage) {
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
}

if (folder !== undefined && null !== folder) {
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
}

if (password !== undefined && null !== password) {
localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string");
}


let localVarUseFormData = false;
let fileData = null;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(stamps, "Array<ImageStamp>")
};

if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
return Promise.resolve({body: result, response});
}


/**
*
* @summary Add document page number stamps.
Expand Down Expand Up @@ -12655,6 +12719,70 @@ export class PdfApi {
}


/**
*
* @summary Add document pages text stamps.
* @param name The document name.
* @param stamps The array of stamp.
* @param storage The document storage.
* @param folder The document folder.
* @param password Base64 encoded password.
*/
public async postDocumentTextStamps (name: string, stamps: Array<TextStamp>, storage?: string, folder?: string, password?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
const localVarPath = this.basePath + '/pdf/{name}/stamps/text'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};

// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling postDocumentTextStamps.');
}

// verify required parameter 'stamps' is not null or undefined
if (stamps === null || stamps === undefined) {
throw new Error('Required parameter stamps was null or undefined when calling postDocumentTextStamps.');
}

if (storage !== undefined && null !== storage) {
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
}

if (folder !== undefined && null !== folder) {
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
}

if (password !== undefined && null !== password) {
localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string");
}


let localVarUseFormData = false;
let fileData = null;
let localVarRequestOptions: localVarRequest.Options = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(stamps, "Array<TextStamp>")
};

if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
return Promise.resolve({body: result, response});
}


/**
*
* @summary Encrypt document in storage.
Expand Down
26 changes: 24 additions & 2 deletions src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,30 @@ export class OAuth implements IAuthentication {
},
};

const response = await invokeApiMethod(requestOptions, configuration, true);
this.accessToken = response.body.access_token;
try {
const response = await invokeApiMethod(requestOptions, configuration, true);
if (!response.body.access_token || response.body.access_token.trim() == "") {
this._handleResponseError(response)
}

this.accessToken = response.body.access_token;
}
catch(err) {
if (err.response) {
this._handleResponseError(err.response)
} else {
throw err
}
}

return Promise.resolve();
}

private _handleResponseError(response: request.RequestResponse) {
if (typeof response.body == 'string' && response.body.trim() != '') {
throw new Error(response.body)
} else {
throw new Error(`empty token (${JSON.stringify(response.body)})`)
}
}
}
6 changes: 3 additions & 3 deletions src/models/optimizeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class OptimizeOptions {
*/
'password': string;
/**
* If true page contents will be reused when document is optimized for equal pages.
* If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true.
*/
'allowReusePageContent': boolean;
/**
Expand All @@ -55,7 +55,7 @@ export class OptimizeOptions {
*/
'removeUnusedStreams': boolean;
/**
* Make fonts not embedded if set to true.
* 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.
*/
'unembedFonts': boolean;
/**
Expand All @@ -67,7 +67,7 @@ export class OptimizeOptions {
*/
'maxResolution': number;
/**
* Fonts will be converted into subsets if set to true.
* 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.
*/
'subsetFonts': boolean;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/requestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function invokeApiMethodInternal(requestOptions: request.Options, confgura
//headers
sa.set("User-Agent", "pdf nodejs sdk");
sa.set("x-aspose-client", "nodejs sdk");
sa.set("x-aspose-client-version", "24.7.0");
sa.set("x-aspose-client-version", "24.8.0");

if (!requestOptions.headers) {
requestOptions.headers = {};
Expand Down
Loading