Skip to content

Commit abdcef7

Browse files
author
kirill.novinskiy@aspose.com
committed
#PDFCLOUD-4491 ClientSDK: Add XmpMetadata methods
1 parent 9cb8a08 commit abdcef7

File tree

8 files changed

+502
-1
lines changed

8 files changed

+502
-1
lines changed

docs/PdfApi.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ Method | HTTP request | Description
189189
*PdfApi* | [**getWordsPerPage**](PdfApi.md#getWordsPerPage) | **GET** /pdf/\{name}/pages/wordCount | Get number of words per document page.
190190
*PdfApi* | [**getXfaPdfInStorageToAcroForm**](PdfApi.md#getXfaPdfInStorageToAcroForm) | **GET** /pdf/\{name}/convert/xfatoacroform | Converts PDF document which contains XFA form (located on storage) to PDF with AcroForm and returns resulting file response content
191191
*PdfApi* | [**getXmlInStorageToPdf**](PdfApi.md#getXmlInStorageToPdf) | **GET** /pdf/create/xml | Convert XML file (located on storage) to PDF format and return resulting file in response.
192+
*PdfApi* | [**getXmpMetadataJson**](PdfApi.md#getXmpMetadataJson) | **GET** /pdf/\{name}/xmpmetadata/json | Gets document XMP Metadata as JSON.
193+
*PdfApi* | [**getXmpMetadataXml**](PdfApi.md#getXmpMetadataXml) | **GET** /pdf/\{name}/xmpmetadata/xml | Gets document XMP Metadata as XML file.
192194
*PdfApi* | [**getXpsInStorageToPdf**](PdfApi.md#getXpsInStorageToPdf) | **GET** /pdf/create/xps | Convert XPS file (located on storage) to PDF format and return resulting file in response.
193195
*PdfApi* | [**getXslFoInStorageToPdf**](PdfApi.md#getXslFoInStorageToPdf) | **GET** /pdf/create/xslfo | Convert XslFo file (located on storage) to PDF format and return resulting file in response.
194196
*PdfApi* | [**moveFile**](PdfApi.md#moveFile) | **PUT** /pdf/storage/file/move/\{srcPath} | Move file
@@ -258,6 +260,7 @@ Method | HTTP request | Description
258260
*PdfApi* | [**postSplitDocument**](PdfApi.md#postSplitDocument) | **POST** /pdf/\{name}/split | Split document to parts.
259261
*PdfApi* | [**postSplitRangePdfDocument**](PdfApi.md#postSplitRangePdfDocument) | **POST** /pdf/\{name}/splitrangepdf | Split document into ranges.
260262
*PdfApi* | [**postTextBoxFields**](PdfApi.md#postTextBoxFields) | **POST** /pdf/\{name}/fields/textbox | Add document text box fields.
263+
*PdfApi* | [**postXmpMetadata**](PdfApi.md#postXmpMetadata) | **POST** /pdf/\{name}/xmpmetadata | Add or remove XMP Metadata properties.
261264
*PdfApi* | [**putAddNewPage**](PdfApi.md#putAddNewPage) | **PUT** /pdf/\{name}/pages | Add new page to end of the document.
262265
*PdfApi* | [**putAddText**](PdfApi.md#putAddText) | **PUT** /pdf/\{name}/pages/\{pageNumber}/text | Add text to PDF document page.
263266
*PdfApi* | [**putAnnotationsFlatten**](PdfApi.md#putAnnotationsFlatten) | **PUT** /pdf/\{name}/annotations/flatten | Flattens the annotations of the specified types
@@ -4682,6 +4685,52 @@ Name | Type | Description | Notes
46824685

46834686
**Buffer**
46844687

4688+
### HTTP request headers
4689+
4690+
- **Content-Type**: application/json
4691+
- **Accept**: multipart/form-data
4692+
4693+
<a name="getXmpMetadataJson"></a>
4694+
## **getXmpMetadataJson**
4695+
> getXmpMetadataJson(name, folder, storage, passBase64)
4696+
4697+
Gets document XMP Metadata as JSON.
4698+
4699+
### Parameters
4700+
Name | Type | Description | Notes
4701+
------------- | ------------- | ------------- | -------------
4702+
**name** | **string** | The document name. |
4703+
**folder** | **string** | The document folder. | [optional]
4704+
**storage** | **string** | The document storage. | [optional]
4705+
**passBase64** | **string** | The password (Base64). | [optional]
4706+
4707+
### Return type
4708+
4709+
[**XmpMetadata**](XmpMetadata.md)
4710+
4711+
### HTTP request headers
4712+
4713+
- **Content-Type**: application/json
4714+
- **Accept**: application/json
4715+
4716+
<a name="getXmpMetadataXml"></a>
4717+
## **getXmpMetadataXml**
4718+
> getXmpMetadataXml(name, folder, storage, passBase64)
4719+
4720+
Gets document XMP Metadata as XML file.
4721+
4722+
### Parameters
4723+
Name | Type | Description | Notes
4724+
------------- | ------------- | ------------- | -------------
4725+
**name** | **string** | The document name. |
4726+
**folder** | **string** | The document folder. | [optional]
4727+
**storage** | **string** | The document storage. | [optional]
4728+
**passBase64** | **string** | The password (Base64). | [optional]
4729+
4730+
### Return type
4731+
4732+
**Buffer**
4733+
46854734
### HTTP request headers
46864735

46874736
- **Content-Type**: application/json
@@ -6340,6 +6389,30 @@ Name | Type | Description | Notes
63406389

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

6392+
### HTTP request headers
6393+
6394+
- **Content-Type**: application/json
6395+
- **Accept**: application/json
6396+
6397+
<a name="postXmpMetadata"></a>
6398+
## **postXmpMetadata**
6399+
> postXmpMetadata(name, metadata, folder, storage, passBase64)
6400+
6401+
Add or remove XMP Metadata properties.
6402+
6403+
### Parameters
6404+
Name | Type | Description | Notes
6405+
------------- | ------------- | ------------- | -------------
6406+
**name** | **string** | The document name. |
6407+
**metadata** | [**XmpMetadata**](XmpMetadata.md) | XmpMetadata instance. |
6408+
**folder** | **string** | The document folder. | [optional]
6409+
**storage** | **string** | The document storage. | [optional]
6410+
**passBase64** | **string** | The password (Base64). | [optional]
6411+
6412+
### Return type
6413+
6414+
[**AsposeResponse**](AsposeResponse.md)
6415+
63436416
### HTTP request headers
63446417

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

docs/XmpMetadata.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# XmpMetadata
2+
Document Xmp Metadata.
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**properties** | [**Array&lt;XmpMetadataProperty&gt;**](XmpMetadataProperty.md) | List of document Xmp Metadata default properties. | [optional]
8+
9+
[[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/xmpMetadata.ts)
10+

docs/XmpMetadataProperty.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# XmpMetadataProperty
2+
Xmp Metadata Property.
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**key** | **string** | Xmp Metadata Property Key. Can take the form for default keys: xmp:DefaultKeyName or DefaultKeyName. Form for user defined properties: customNamespace:UserPropertyName. |
8+
**value** | **string** | Xmp Metadata Property Value. Null for delete property. | [optional]
9+
**namespaceUri** | **string** | Namespace Uri. For user defined properties only. | [optional]
10+
11+
[[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/xmpMetadataProperty.ts)
12+

src/api/api.ts

Lines changed: 181 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
 /**
1+
/**
22
*
33
* Copyright (c) 2024 Aspose.PDF Cloud
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -135,6 +135,8 @@ import { TimestampSettings } from "../models/timestampSettings";
135135
import { VerticalAlignment } from "../models/verticalAlignment";
136136
import { WordCount } from "../models/wordCount";
137137
import { WrapMode } from "../models/wrapMode";
138+
import { XmpMetadata } from "../models/xmpMetadata";
139+
import { XmpMetadataProperty } from "../models/xmpMetadataProperty";
138140
import { Annotation } from "../models/annotation";
139141
import { AnnotationsInfo } from "../models/annotationsInfo";
140142
import { AnnotationsInfoResponse } from "../models/annotationsInfoResponse";
@@ -11509,6 +11511,120 @@ export class PdfApi {
1150911511
}
1151011512

1151111513

11514+
/**
11515+
*
11516+
* @summary Gets document XMP Metadata as JSON.
11517+
* @param name The document name.
11518+
* @param folder The document folder.
11519+
* @param storage The document storage.
11520+
* @param passBase64 The password (Base64).
11521+
*/
11522+
public async getXmpMetadataJson (name: string, folder?: string, storage?: string, passBase64?: string) : Promise<{ response: http.IncomingMessage; body: XmpMetadata; }> {
11523+
const localVarPath = this.basePath + '/pdf/{name}/xmpmetadata/json'
11524+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
11525+
let localVarQueryParameters: any = {};
11526+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
11527+
let localVarFormParams: any = {};
11528+
11529+
// verify required parameter 'name' is not null or undefined
11530+
if (name === null || name === undefined) {
11531+
throw new Error('Required parameter name was null or undefined when calling getXmpMetadataJson.');
11532+
}
11533+
11534+
if (folder !== undefined && null !== folder) {
11535+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
11536+
}
11537+
11538+
if (storage !== undefined && null !== storage) {
11539+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
11540+
}
11541+
11542+
if (passBase64 !== undefined && null !== passBase64) {
11543+
localVarQueryParameters['passBase64'] = ObjectSerializer.serialize(passBase64, "string");
11544+
}
11545+
11546+
11547+
let localVarUseFormData = false;
11548+
let fileData = null;
11549+
let localVarRequestOptions: localVarRequest.Options = {
11550+
method: 'GET',
11551+
qs: localVarQueryParameters,
11552+
headers: localVarHeaderParams,
11553+
uri: localVarPath,
11554+
useQuerystring: this._useQuerystring,
11555+
json: true,
11556+
};
11557+
11558+
if (Object.keys(localVarFormParams).length) {
11559+
if (localVarUseFormData) {
11560+
(<any>localVarRequestOptions).formData = localVarFormParams;
11561+
} else {
11562+
localVarRequestOptions.form = localVarFormParams;
11563+
}
11564+
}
11565+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
11566+
const result = ObjectSerializer.deserialize(response.body, "XmpMetadata");
11567+
return Promise.resolve({body: result, response});
11568+
}
11569+
11570+
11571+
/**
11572+
*
11573+
* @summary Gets document XMP Metadata as XML file.
11574+
* @param name The document name.
11575+
* @param folder The document folder.
11576+
* @param storage The document storage.
11577+
* @param passBase64 The password (Base64).
11578+
*/
11579+
public async getXmpMetadataXml (name: string, folder?: string, storage?: string, passBase64?: string) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
11580+
const localVarPath = this.basePath + '/pdf/{name}/xmpmetadata/xml'
11581+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
11582+
let localVarQueryParameters: any = {};
11583+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
11584+
let localVarFormParams: any = {};
11585+
11586+
// verify required parameter 'name' is not null or undefined
11587+
if (name === null || name === undefined) {
11588+
throw new Error('Required parameter name was null or undefined when calling getXmpMetadataXml.');
11589+
}
11590+
11591+
if (folder !== undefined && null !== folder) {
11592+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
11593+
}
11594+
11595+
if (storage !== undefined && null !== storage) {
11596+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
11597+
}
11598+
11599+
if (passBase64 !== undefined && null !== passBase64) {
11600+
localVarQueryParameters['passBase64'] = ObjectSerializer.serialize(passBase64, "string");
11601+
}
11602+
11603+
11604+
let localVarUseFormData = false;
11605+
let fileData = null;
11606+
let localVarRequestOptions: localVarRequest.Options = {
11607+
method: 'GET',
11608+
qs: localVarQueryParameters,
11609+
headers: localVarHeaderParams,
11610+
uri: localVarPath,
11611+
useQuerystring: this._useQuerystring,
11612+
encoding: null,
11613+
};
11614+
11615+
if (Object.keys(localVarFormParams).length) {
11616+
if (localVarUseFormData) {
11617+
(<any>localVarRequestOptions).formData = localVarFormParams;
11618+
} else {
11619+
localVarRequestOptions.form = localVarFormParams;
11620+
}
11621+
}
11622+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
11623+
const result = ObjectSerializer.deserialize(response.body, "Buffer");
11624+
return Promise.resolve({body: result, response});
11625+
}
11626+
11627+
1151211628
/**
1151311629
*
1151411630
* @summary Convert XPS file (located on storage) to PDF format and return resulting file in response.
@@ -16074,6 +16190,70 @@ export class PdfApi {
1607416190
}
1607516191

1607616192

16193+
/**
16194+
*
16195+
* @summary Add or remove XMP Metadata properties.
16196+
* @param name The document name.
16197+
* @param metadata XmpMetadata instance.
16198+
* @param folder The document folder.
16199+
* @param storage The document storage.
16200+
* @param passBase64 The password (Base64).
16201+
*/
16202+
public async postXmpMetadata (name: string, metadata: XmpMetadata, folder?: string, storage?: string, passBase64?: string) : Promise<{ response: http.IncomingMessage; body: AsposeResponse; }> {
16203+
const localVarPath = this.basePath + '/pdf/{name}/xmpmetadata'
16204+
.replace('{' + 'name' + '}', encodeURIComponent(String(name)).replace('%2F', '/'));
16205+
let localVarQueryParameters: any = {};
16206+
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
16207+
let localVarFormParams: any = {};
16208+
16209+
// verify required parameter 'name' is not null or undefined
16210+
if (name === null || name === undefined) {
16211+
throw new Error('Required parameter name was null or undefined when calling postXmpMetadata.');
16212+
}
16213+
16214+
// verify required parameter 'metadata' is not null or undefined
16215+
if (metadata === null || metadata === undefined) {
16216+
throw new Error('Required parameter metadata was null or undefined when calling postXmpMetadata.');
16217+
}
16218+
16219+
if (folder !== undefined && null !== folder) {
16220+
localVarQueryParameters['folder'] = ObjectSerializer.serialize(folder, "string");
16221+
}
16222+
16223+
if (storage !== undefined && null !== storage) {
16224+
localVarQueryParameters['storage'] = ObjectSerializer.serialize(storage, "string");
16225+
}
16226+
16227+
if (passBase64 !== undefined && null !== passBase64) {
16228+
localVarQueryParameters['passBase64'] = ObjectSerializer.serialize(passBase64, "string");
16229+
}
16230+
16231+
16232+
let localVarUseFormData = false;
16233+
let fileData = null;
16234+
let localVarRequestOptions: localVarRequest.Options = {
16235+
method: 'POST',
16236+
qs: localVarQueryParameters,
16237+
headers: localVarHeaderParams,
16238+
uri: localVarPath,
16239+
useQuerystring: this._useQuerystring,
16240+
json: true,
16241+
body: ObjectSerializer.serialize(metadata, "XmpMetadata")
16242+
};
16243+
16244+
if (Object.keys(localVarFormParams).length) {
16245+
if (localVarUseFormData) {
16246+
(<any>localVarRequestOptions).formData = localVarFormParams;
16247+
} else {
16248+
localVarRequestOptions.form = localVarFormParams;
16249+
}
16250+
}
16251+
const response = await invokeApiMethod(localVarRequestOptions, this.configuration, false, fileData);
16252+
const result = ObjectSerializer.deserialize(response.body, "AsposeResponse");
16253+
return Promise.resolve({body: result, response});
16254+
}
16255+
16256+
1607716257
/**
1607816258
*
1607916259
* @summary Add new page to end of the document.

src/models/xmpMetadata.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
 /**
2+
*
3+
* Copyright (c) 2024 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 { XmpMetadataProperty } from "./xmpMetadataProperty";
23+
24+
/**
25+
* Document Xmp Metadata.
26+
*/
27+
export class XmpMetadata {
28+
/**
29+
* List of document Xmp Metadata default properties.
30+
*/
31+
'properties': Array<XmpMetadataProperty>;
32+
33+
static discriminator = undefined;
34+
35+
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
36+
{
37+
"name": "properties",
38+
"baseName": "Properties",
39+
"type": "Array<XmpMetadataProperty>"
40+
} ];
41+
42+
static getAttributeTypeMap() {
43+
return XmpMetadata.attributeTypeMap;
44+
}
45+
}
46+
47+

0 commit comments

Comments
 (0)