Skip to content

Commit f1b8482

Browse files
authored
Merge pull request #103 from aspose-pdf-cloud/develop
update to 24.10
2 parents 6d558cc + 8493fdd commit f1b8482

16 files changed

+1697
-421
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
2929
## Read PDF Formats
3030
MHT, PCL, PS, XSLFO, MD
3131

32-
## Enhancements in Version 24.9
33-
- Develop DeleteDocumentLayer Method.
34-
- Develop GetDocumentLayers Method.
35-
- How to extract PDF layer elements and create a new PDF
32+
## Enhancements in Version 24.10
33+
- Develop a method to add XMP metadata.
34+
- Develop a method to obtain XMP metadata in the XML form.
35+
- Develop a method to obtain XMP metadata in the JSON form.
3636
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3737

38+
## Bugs fixed in Version 24.10
39+
- PDF XFA form to Acro from conversion API results corrupt PDF.
40+
3841
## Unit Tests
3942
Aspose PDF SDK includes a suite of unit tests. These Unit Tests also serves as examples of how to use the Aspose PDF SDK.
4043

docs/PdfApi.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ Method | HTTP request | Description
189189
[**GetWordsPerPage**](PdfApi.md#getwordsperpage) | **GET** /pdf/\{name}/pages/wordCount | Get number of words per document page.
190190
[**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
[**GetXmlInStorageToPdf**](PdfApi.md#getxmlinstoragetopdf) | **GET** /pdf/create/xml | Convert XML file (located on storage) to PDF format and return resulting file in response.
192+
[**GetXmpMetadataJson**](PdfApi.md#getxmpmetadatajson) | **GET** /pdf/\{name}/xmpmetadata/json | Gets document XMP Metadata as JSON.
193+
[**GetXmpMetadataXml**](PdfApi.md#getxmpmetadataxml) | **GET** /pdf/\{name}/xmpmetadata/xml | Gets document XMP Metadata as XML file.
192194
[**GetXpsInStorageToPdf**](PdfApi.md#getxpsinstoragetopdf) | **GET** /pdf/create/xps | Convert XPS file (located on storage) to PDF format and return resulting file in response.
193195
[**GetXslFoInStorageToPdf**](PdfApi.md#getxslfoinstoragetopdf) | **GET** /pdf/create/xslfo | Convert XslFo file (located on storage) to PDF format and return resulting file in response.
194196
[**MoveFile**](PdfApi.md#movefile) | **PUT** /pdf/storage/file/move/\{srcPath} | Move file
@@ -258,6 +260,7 @@ Method | HTTP request | Description
258260
[**PostSplitDocument**](PdfApi.md#postsplitdocument) | **POST** /pdf/\{name}/split | Split document to parts.
259261
[**PostSplitRangePdfDocument**](PdfApi.md#postsplitrangepdfdocument) | **POST** /pdf/\{name}/splitrangepdf | Split document into ranges.
260262
[**PostTextBoxFields**](PdfApi.md#posttextboxfields) | **POST** /pdf/\{name}/fields/textbox | Add document text box fields.
263+
[**PostXmpMetadata**](PdfApi.md#postxmpmetadata) | **POST** /pdf/\{name}/xmpmetadata | Add or remove XMP Metadata properties.
261264
[**PutAddNewPage**](PdfApi.md#putaddnewpage) | **PUT** /pdf/\{name}/pages | Add new page to end of the document.
262265
[**PutAddText**](PdfApi.md#putaddtext) | **PUT** /pdf/\{name}/pages/\{pageNumber}/text | Add text to PDF document page.
263266
[**PutAnnotationsFlatten**](PdfApi.md#putannotationsflatten) | **PUT** /pdf/\{name}/annotations/flatten | Flattens the annotations of the specified types
@@ -5429,6 +5432,60 @@ Name | Type | Description | Notes
54295432

54305433
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
54315434

5435+
<a name="getxmpmetadatajson"></a>
5436+
# **GetXmpMetadataJson**
5437+
> XmpMetadata GetXmpMetadataJson (string name, string folder = null, string storage = null, string passBase64 = null)
5438+
5439+
Gets document XMP Metadata as JSON.
5440+
5441+
5442+
### Parameters
5443+
5444+
Name | Type | Description | Notes
5445+
------------- | ------------- | ------------- | -------------
5446+
**name** | **string**| The document name. |
5447+
**folder** | **string**| The document folder. | [optional]
5448+
**storage** | **string**| The document storage. | [optional]
5449+
**passBase64** | **string**| The password (Base64). | [optional]
5450+
5451+
### Return type
5452+
5453+
[**XmpMetadata**](XmpMetadata.md)
5454+
5455+
### HTTP request headers
5456+
5457+
- **Content-Type**: application/json
5458+
- **Accept**: application/json
5459+
5460+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
5461+
5462+
<a name="getxmpmetadataxml"></a>
5463+
# **GetXmpMetadataXml**
5464+
> System.IO.Stream GetXmpMetadataXml (string name, string folder = null, string storage = null, string passBase64 = null)
5465+
5466+
Gets document XMP Metadata as XML file.
5467+
5468+
5469+
### Parameters
5470+
5471+
Name | Type | Description | Notes
5472+
------------- | ------------- | ------------- | -------------
5473+
**name** | **string**| The document name. |
5474+
**folder** | **string**| The document folder. | [optional]
5475+
**storage** | **string**| The document storage. | [optional]
5476+
**passBase64** | **string**| The password (Base64). | [optional]
5477+
5478+
### Return type
5479+
5480+
**System.IO.Stream**
5481+
5482+
### HTTP request headers
5483+
5484+
- **Content-Type**: application/json
5485+
- **Accept**: multipart/form-data
5486+
5487+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
5488+
54325489
<a name="getxpsinstoragetopdf"></a>
54335490
# **GetXpsInStorageToPdf**
54345491
> System.IO.Stream GetXpsInStorageToPdf (string srcPath, string storage = null)
@@ -7363,6 +7420,34 @@ Name | Type | Description | Notes
73637420

73647421
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
73657422

7423+
<a name="postxmpmetadata"></a>
7424+
# **PostXmpMetadata**
7425+
> AsposeResponse PostXmpMetadata (string name, XmpMetadata metadata, string folder = null, string storage = null, string passBase64 = null)
7426+
7427+
Add or remove XMP Metadata properties.
7428+
7429+
7430+
### Parameters
7431+
7432+
Name | Type | Description | Notes
7433+
------------- | ------------- | ------------- | -------------
7434+
**name** | **string**| The document name. |
7435+
**metadata** | [**XmpMetadata**](XmpMetadata.md)| XmpMetadata instance. |
7436+
**folder** | **string**| The document folder. | [optional]
7437+
**storage** | **string**| The document storage. | [optional]
7438+
**passBase64** | **string**| The password (Base64). | [optional]
7439+
7440+
### Return type
7441+
7442+
[**AsposeResponse**](AsposeResponse.md)
7443+
7444+
### HTTP request headers
7445+
7446+
- **Content-Type**: application/json
7447+
- **Accept**: application/json
7448+
7449+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
7450+
73667451
<a name="putaddnewpage"></a>
73677452
# **PutAddNewPage**
73687453
> DocumentPagesResponse PutAddNewPage (string name, string storage = null, string folder = null)

docs/XmpMetadata.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Aspose.Pdf.Cloud.Sdk.Model.XmpMetadata
2+
Document Xmp Metadata.
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**Properties** | [**List&lt;XmpMetadataProperty&gt;**](XmpMetadataProperty.md) | List of document Xmp Metadata default properties. | [optional]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+

docs/XmpMetadataProperty.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Aspose.Pdf.Cloud.Sdk.Model.XmpMetadataProperty
2+
Xmp Metadata Property.
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**Key** | **string** | Xmp Metadata Property Key. Can take the form for default keys: xmp:DefaultKeyName or DefaultKeyName. Form for user defined properties: customNamespace:UserPropertyName. |
9+
**Value** | **string** | Xmp Metadata Property Value. Null for delete property. | [optional]
10+
**NamespaceUri** | **string** | Namespace Uri. For user defined properties only. | [optional]
11+
12+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
13+

src/Aspose.Pdf.Cloud.Sdk.Test/Aspose.Pdf.Cloud.Sdk.Test.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<Compile Include="SignTests.cs" />
8181
<Compile Include="TestBase.cs" />
8282
<Compile Include="UnderlineAnnotationsTests.cs" />
83+
<Compile Include="XmpMetadataTests.cs" />
8384
<Compile Include="StorageTests.cs" />
8485
</ItemGroup>
8586

src/Aspose.Pdf.Cloud.Sdk.Test/Aspose.Pdf.Cloud.Sdk.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ OpenAPI spec version: 1.1
105105
<Compile Include="SignTests.cs" />
106106
<Compile Include="TestBase.cs" />
107107
<Compile Include="UnderlineAnnotationsTests.cs" />
108+
<Compile Include="XmpMetadataTests.cs" />
108109
<Compile Include="StorageTests.cs" />
109110
</ItemGroup>
110111
<ItemGroup>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System.Collections.Generic;
2+
using Aspose.Pdf.Cloud.Sdk.Model;
3+
using NUnit.Framework;
4+
5+
namespace Aspose.Pdf.Cloud.Sdk.Test
6+
{
7+
[TestFixture]
8+
public class XmpMetadataTests : TestsBase
9+
{
10+
private const string Name = "4pages.pdf";
11+
12+
/// <summary>
13+
/// Test GetXmpMetadataJson
14+
/// </summary>
15+
[Test]
16+
public void GetXmpMetadataJsonTest()
17+
{
18+
UploadFile(Name, Name);
19+
20+
var response = PdfApi.GetXmpMetadataJson(Name, TempFolder);
21+
Assert.That(response.Properties.Count, Is.EqualTo(9));
22+
}
23+
24+
/// <summary>
25+
/// Test GetXmpMetadataXml
26+
/// </summary>
27+
[Test]
28+
public void GetXmpMetadataXmlTest()
29+
{
30+
UploadFile(Name, Name);
31+
32+
var response = PdfApi.GetXmpMetadataXml(Name, TempFolder);
33+
Assert.That(response.Length, Is.GreaterThan(0));
34+
}
35+
36+
/// <summary>
37+
/// Test GetXmpMetadataXml
38+
/// </summary>
39+
[Test]
40+
public void PostXmpMetadataTest()
41+
{
42+
UploadFile(Name, Name);
43+
44+
const string date = "2024-10-27T09:59:52+02:00";
45+
var metadata = new XmpMetadata {
46+
Properties = new List<XmpMetadataProperty> {
47+
// Modify Default property without prefix
48+
new XmpMetadataProperty
49+
(
50+
Key: "ModifyDate",
51+
Value: date
52+
),
53+
// Modify Default property with prefix
54+
new XmpMetadataProperty
55+
(
56+
Key: "xmp:CreateDate",
57+
Value: date
58+
),
59+
//Remove Default property
60+
new XmpMetadataProperty
61+
(
62+
Key: "CreatorTool",
63+
Value: null
64+
),
65+
//Add Default property
66+
new XmpMetadataProperty
67+
(
68+
Key: "BaseURL",
69+
Value: "http://www.somename.com/path"
70+
),
71+
72+
//Remove User defined property
73+
new XmpMetadataProperty
74+
(
75+
Key: "dc:title",
76+
Value: null
77+
),
78+
79+
// Update user defined property
80+
new XmpMetadataProperty
81+
(
82+
Key: "pdf:Producer",
83+
Value: "Aspose.PDF Cloud",
84+
NamespaceUri: "http://ns.adobe.com/pdf/1.3/"
85+
),
86+
87+
// Add user defined property
88+
new XmpMetadataProperty
89+
(
90+
Key: "pdf:Prop",
91+
Value: "PropValue",
92+
NamespaceUri: "http://ns.adobe.com/pdf/1.3/"
93+
)
94+
}
95+
};
96+
var response = PdfApi.PostXmpMetadata(Name, metadata, TempFolder);
97+
Assert.That(response.Code, Is.EqualTo(200));
98+
99+
var xmp = PdfApi.GetXmpMetadataJson(Name, TempFolder);
100+
Assert.That(xmp.Properties.Count, Is.EqualTo(9));
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)