Skip to content

Commit 43f3ba1

Browse files
author
kirill.novinskiy@aspose.com
committed
PDFCLOUD-4780 Add method for adding Stamp per page in batch
1 parent c3b7d3b commit 43f3ba1

File tree

8 files changed

+436
-0
lines changed

8 files changed

+436
-0
lines changed

docs/ImageStampPageSpecified.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ImageStampPageSpecified
2+
Represents Pdf stamps.
3+
4+
*Inherited from [ImageStamp](ImageStamp.md)*
5+
## Properties
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**pageNumber** | **number** | Page number. |
9+
**fileName** | **string** | Gets or sets the file name.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
10+
**width** | **number** | Gets or sets image width. Setting this property allos to scal image horizontally.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
11+
**height** | **number** | Gets or sets image height. Setting this image allows to scale image vertically.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
12+
**verticalAlignment** | [**VerticalAlignment**](VerticalAlignment.md) | Gets or sets vertical alignment of stamp on page.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
13+
**bottomMargin** | **number** | Gets or sets bottom margin of stamp.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
14+
**leftMargin** | **number** | Gets or sets left margin of stamp.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
15+
**topMargin** | **number** | Gets or sets top margin of stamp.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
16+
**rightMargin** | **number** | Gets or sets right margin of stamp.<br />*Inherited from [ImageStamp](ImageStamp.md)* | [optional]
17+
**background** | **boolean** | Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
18+
**horizontalAlignment** | [**HorizontalAlignment**](HorizontalAlignment.md) | Gets or sets Horizontal alignment of stamp on the page. <br />*Inherited from [StampBase](StampBase.md)* | [optional]
19+
**opacity** | **number** | Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
20+
**rotate** | [**Rotation**](Rotation.md) | Sets or gets the rotation of stamp content according Rotation values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
21+
**rotateAngle** | **number** | Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle. <br />*Inherited from [StampBase](StampBase.md)* | [optional]
22+
**xIndent** | **number** | Horizontal stamp coordinate, starting from the left.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
23+
**yIndent** | **number** | Vertical stamp coordinate, starting from the bottom.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
24+
**zoom** | **number** | Zooming factor of the stamp. Allows to scale stamp.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
25+
**links** | [**Array&lt;Link&gt;**](Link.md) | Link to the document.<br />*Inherited from [LinkElement](LinkElement.md)* | [optional]
26+
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[View Source]](../src/models/imageStampPageSpecified.ts)
28+

docs/PdfApi.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,13 @@ Method | HTTP request | Description
209209
*PdfApi* | [**postDocumentImageFooter**](PdfApi.md#postDocumentImageFooter) | **POST** /pdf/\{name}/footer/image | Add document image footer.
210210
*PdfApi* | [**postDocumentImageHeader**](PdfApi.md#postDocumentImageHeader) | **POST** /pdf/\{name}/header/image | Add document image header.
211211
*PdfApi* | [**postDocumentImageStamps**](PdfApi.md#postDocumentImageStamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
212+
*PdfApi* | [**postDocumentImageStampsPageSpecified**](PdfApi.md#postDocumentImageStampsPageSpecified) | **POST** /pdf/\{name}/stamps/image/pagespecified | Add document image stamps to specified pages.
212213
*PdfApi* | [**postDocumentPageNumberStamps**](PdfApi.md#postDocumentPageNumberStamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
213214
*PdfApi* | [**postDocumentTextFooter**](PdfApi.md#postDocumentTextFooter) | **POST** /pdf/\{name}/footer/text | Add document text footer.
214215
*PdfApi* | [**postDocumentTextHeader**](PdfApi.md#postDocumentTextHeader) | **POST** /pdf/\{name}/header/text | Add document text header.
215216
*PdfApi* | [**postDocumentTextReplace**](PdfApi.md#postDocumentTextReplace) | **POST** /pdf/\{name}/text/replace | Document's replace text method.
216217
*PdfApi* | [**postDocumentTextStamps**](PdfApi.md#postDocumentTextStamps) | **POST** /pdf/\{name}/stamps/text | Add document pages text stamps.
218+
*PdfApi* | [**postDocumentTextStampsPageSpecified**](PdfApi.md#postDocumentTextStampsPageSpecified) | **POST** /pdf/\{name}/stamps/text/pagespecified | Add document text stamps to specified pages.
217219
*PdfApi* | [**postEncryptDocumentInStorage**](PdfApi.md#postEncryptDocumentInStorage) | **POST** /pdf/\{name}/encrypt | Encrypt document in storage.
218220
*PdfApi* | [**postFlattenDocument**](PdfApi.md#postFlattenDocument) | **POST** /pdf/\{name}/flatten | Flatten the document.
219221
*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.
@@ -5155,6 +5157,30 @@ Name | Type | Description | Notes
51555157

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

5160+
### HTTP request headers
5161+
5162+
- **Content-Type**: application/json
5163+
- **Accept**: application/json
5164+
5165+
<a name="postDocumentImageStampsPageSpecified"></a>
5166+
## **postDocumentImageStampsPageSpecified**
5167+
> postDocumentImageStampsPageSpecified(name, stamps, storage, folder, password)
5168+
5169+
Add document image stamps to specified pages.
5170+
5171+
### Parameters
5172+
Name | Type | Description | Notes
5173+
------------- | ------------- | ------------- | -------------
5174+
**name** | **string** | The document name. |
5175+
**stamps** | [**Array&lt;ImageStampPageSpecified&gt;**](ImageStampPageSpecified.md) | The array of stamps. |
5176+
**storage** | **string** | The document storage. | [optional]
5177+
**folder** | **string** | The document folder. | [optional]
5178+
**password** | **string** | Base64 encoded password. | [optional]
5179+
5180+
### Return type
5181+
5182+
[**AsposeResponse**](AsposeResponse.md)
5183+
51585184
### HTTP request headers
51595185

51605186
- **Content-Type**: application/json
@@ -5278,6 +5304,30 @@ Name | Type | Description | Notes
52785304

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

5307+
### HTTP request headers
5308+
5309+
- **Content-Type**: application/json
5310+
- **Accept**: application/json
5311+
5312+
<a name="postDocumentTextStampsPageSpecified"></a>
5313+
## **postDocumentTextStampsPageSpecified**
5314+
> postDocumentTextStampsPageSpecified(name, stamps, storage, folder, password)
5315+
5316+
Add document text stamps to specified pages.
5317+
5318+
### Parameters
5319+
Name | Type | Description | Notes
5320+
------------- | ------------- | ------------- | -------------
5321+
**name** | **string** | The document name. |
5322+
**stamps** | [**Array&lt;TextStampPageSpecified&gt;**](TextStampPageSpecified.md) | The array of stamps. |
5323+
**storage** | **string** | The document storage. | [optional]
5324+
**folder** | **string** | The document folder. | [optional]
5325+
**password** | **string** | Base64 encoded password. | [optional]
5326+
5327+
### Return type
5328+
5329+
[**AsposeResponse**](AsposeResponse.md)
5330+
52815331
### HTTP request headers
52825332

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

docs/TextStampPageSpecified.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# TextStampPageSpecified
2+
Represents Pdf stamps.
3+
4+
*Inherited from [TextStamp](TextStamp.md)*
5+
## Properties
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**pageNumber** | **number** | Page number. |
9+
**textAlignment** | [**HorizontalAlignment**](HorizontalAlignment.md) | Alignment of the text inside the stamp.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
10+
**value** | **string** | Gets or sets string value which is used as stamp on the page.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
11+
**textState** | [**TextState**](TextState.md) | Gets text properties of the stamp. See TextState for details.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
12+
**verticalAlignment** | [**VerticalAlignment**](VerticalAlignment.md) | Gets or sets vertical alignment of stamp on page.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
13+
**bottomMargin** | **number** | Gets or sets bottom margin of stamp.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
14+
**leftMargin** | **number** | Gets or sets left margin of stamp.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
15+
**topMargin** | **number** | Gets or sets top margin of stamp.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
16+
**rightMargin** | **number** | Gets or sets right margin of stamp.<br />*Inherited from [TextStamp](TextStamp.md)* | [optional]
17+
**background** | **boolean** | Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
18+
**horizontalAlignment** | [**HorizontalAlignment**](HorizontalAlignment.md) | Gets or sets Horizontal alignment of stamp on the page. <br />*Inherited from [StampBase](StampBase.md)* | [optional]
19+
**opacity** | **number** | Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
20+
**rotate** | [**Rotation**](Rotation.md) | Sets or gets the rotation of stamp content according Rotation values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
21+
**rotateAngle** | **number** | Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle. <br />*Inherited from [StampBase](StampBase.md)* | [optional]
22+
**xIndent** | **number** | Horizontal stamp coordinate, starting from the left.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
23+
**yIndent** | **number** | Vertical stamp coordinate, starting from the bottom.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
24+
**zoom** | **number** | Zooming factor of the stamp. Allows to scale stamp.<br />*Inherited from [StampBase](StampBase.md)* | [optional]
25+
**links** | [**Array&lt;Link&gt;**](Link.md) | Link to the document.<br />*Inherited from [LinkElement](LinkElement.md)* | [optional]
26+
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[View Source]](../src/models/textStampPageSpecified.ts)
28+

src/api/api.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ import { CommonFigureAnnotation } from "../models/commonFigureAnnotation";
293293
import { FileAttachmentAnnotation } from "../models/fileAttachmentAnnotation";
294294
import { FreeTextAnnotation } from "../models/freeTextAnnotation";
295295
import { HighlightAnnotation } from "../models/highlightAnnotation";
296+
import { ImageStampPageSpecified } from "../models/imageStampPageSpecified";
296297
import { InkAnnotation } from "../models/inkAnnotation";
297298
import { LineAnnotation } from "../models/lineAnnotation";
298299
import { ListBoxField } from "../models/listBoxField";
@@ -304,6 +305,7 @@ import { SquigglyAnnotation } from "../models/squigglyAnnotation";
304305
import { StampAnnotation } from "../models/stampAnnotation";
305306
import { StrikeOutAnnotation } from "../models/strikeOutAnnotation";
306307
import { TextAnnotation } from "../models/textAnnotation";
308+
import { TextStampPageSpecified } from "../models/textStampPageSpecified";
307309
import { UnderlineAnnotation } from "../models/underlineAnnotation";
308310
import { CircleAnnotation } from "../models/circleAnnotation";
309311
import { PolyLineAnnotation } from "../models/polyLineAnnotation";
@@ -12765,6 +12767,70 @@ export class PdfApi {
1276512767
}
1276612768

1276712769

12770+
/**
12771+
*
12772+
* @summary Add document image stamps to specified pages.
12773+
* @param name The document name.
12774+
* @param stamps The array of stamps.
12775+
* @param storage The document storage.
12776+
* @param folder The document folder.
12777+
* @param password Base64 encoded password.
12778+
*/
12779+
public async postDocumentImageStampsPageSpecified (name: string, stamps: Array<ImageStampPageSpecified>, storage?: string, folder?: string, password?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
12780+
const localVarPath = this.basePath + '/pdf/{name}/stamps/image/pagespecified'
12781+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
12782+
let localVarQueryParameters: any = {};
12783+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
12784+
let localVarFormParams: any = {};
12785+
12786+
// verify required parameter 'name' is not null or undefined
12787+
if (name === null || name === undefined) {
12788+
throw new Error('Required parameter name was null or undefined when calling postDocumentImageStampsPageSpecified.');
12789+
}
12790+
12791+
// verify required parameter 'stamps' is not null or undefined
12792+
if (stamps === null || stamps === undefined) {
12793+
throw new Error('Required parameter stamps was null or undefined when calling postDocumentImageStampsPageSpecified.');
12794+
}
12795+
12796+
if (storage !== undefined && null !== storage) {
12797+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
12798+
}
12799+
12800+
if (folder !== undefined && null !== folder) {
12801+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
12802+
}
12803+
12804+
if (password !== undefined && null !== password) {
12805+
localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string");
12806+
}
12807+
12808+
12809+
let localVarUseFormData = false;
12810+
let fileData = null;
12811+
let localVarRequestOptions: localVarRequest.Options = {
12812+
method: 'POST',
12813+
qs: localVarQueryParameters,
12814+
headers: localVarHeaderParams,
12815+
uri: localVarPath,
12816+
useQuerystring: this._useQuerystring,
12817+
json: true,
12818+
body: ObjectSerializer.serialize(stamps, "Array<ImageStampPageSpecified>")
12819+
};
12820+
12821+
if (Object.keys(localVarFormParams).length) {
12822+
if (localVarUseFormData) {
12823+
(<any>localVarRequestOptions).formData = localVarFormParams;
12824+
} else {
12825+
localVarRequestOptions.form = localVarFormParams;
12826+
}
12827+
}
12828+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
12829+
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
12830+
return Promise.resolve({body: result, response});
12831+
}
12832+
12833+
1276812834
/**
1276912835
*
1277012836
* @summary Add document page number stamps.
@@ -13100,6 +13166,70 @@ export class PdfApi {
1310013166
}
1310113167

1310213168

13169+
/**
13170+
*
13171+
* @summary Add document text stamps to specified pages.
13172+
* @param name The document name.
13173+
* @param stamps The array of stamps.
13174+
* @param storage The document storage.
13175+
* @param folder The document folder.
13176+
* @param password Base64 encoded password.
13177+
*/
13178+
public async postDocumentTextStampsPageSpecified (name: string, stamps: Array<TextStampPageSpecified>, storage?: string, folder?: string, password?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
13179+
const localVarPath = this.basePath + '/pdf/{name}/stamps/text/pagespecified'
13180+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
13181+
let localVarQueryParameters: any = {};
13182+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
13183+
let localVarFormParams: any = {};
13184+
13185+
// verify required parameter 'name' is not null or undefined
13186+
if (name === null || name === undefined) {
13187+
throw new Error('Required parameter name was null or undefined when calling postDocumentTextStampsPageSpecified.');
13188+
}
13189+
13190+
// verify required parameter 'stamps' is not null or undefined
13191+
if (stamps === null || stamps === undefined) {
13192+
throw new Error('Required parameter stamps was null or undefined when calling postDocumentTextStampsPageSpecified.');
13193+
}
13194+
13195+
if (storage !== undefined && null !== storage) {
13196+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
13197+
}
13198+
13199+
if (folder !== undefined && null !== folder) {
13200+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
13201+
}
13202+
13203+
if (password !== undefined && null !== password) {
13204+
localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string");
13205+
}
13206+
13207+
13208+
let localVarUseFormData = false;
13209+
let fileData = null;
13210+
let localVarRequestOptions: localVarRequest.Options = {
13211+
method: 'POST',
13212+
qs: localVarQueryParameters,
13213+
headers: localVarHeaderParams,
13214+
uri: localVarPath,
13215+
useQuerystring: this._useQuerystring,
13216+
json: true,
13217+
body: ObjectSerializer.serialize(stamps, "Array<TextStampPageSpecified>")
13218+
};
13219+
13220+
if (Object.keys(localVarFormParams).length) {
13221+
if (localVarUseFormData) {
13222+
(<any>localVarRequestOptions).formData = localVarFormParams;
13223+
} else {
13224+
localVarRequestOptions.form = localVarFormParams;
13225+
}
13226+
}
13227+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
13228+
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
13229+
return Promise.resolve({body: result, response});
13230+
}
13231+
13232+
1310313233
/**
1310413234
*
1310513235
* @summary Encrypt document in storage.

src/models/imageStampPageSpecified.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
 /**
2+
*
3+
* Copyright (c) 2025 Aspose.PDF Cloud
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
* The above copyright notice and this permission notice shall be included in all
11+
* copies or substantial portions of the Software.
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
* SOFTWARE.
19+
*
20+
*/
21+
22+
import { ImageStamp } from "./imageStamp";
23+
24+
/**
25+
* Represents Pdf stamps.
26+
*/
27+
export class ImageStampPageSpecified extends ImageStamp {
28+
/**
29+
* Page number.
30+
*/
31+
'pageNumber': number;
32+
33+
static discriminator = undefined;
34+
35+
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
36+
{
37+
"name": "pageNumber",
38+
"baseName": "PageNumber",
39+
"type": "number"
40+
} ];
41+
42+
static getAttributeTypeMap() {
43+
return super.getAttributeTypeMap().concat(ImageStampPageSpecified.attributeTypeMap);
44+
}
45+
}
46+
47+

0 commit comments

Comments
 (0)