Skip to content

Commit 197152f

Browse files
authored
Merge pull request #75 from aspose-pdf-cloud/develop
update 24.8
2 parents 6386a81 + f88e6f9 commit 197152f

File tree

9 files changed

+552
-19
lines changed

9 files changed

+552
-19
lines changed

Exampls/src/main/java/com/aspose/pdf/android/examples/PdfApiExamples.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,39 @@ public void postPageTextStampsExample()throws ApiException
320320

321321
}
322322

323+
324+
public void postDocumentTextStampsExample()throws ApiException
325+
{
326+
String name = "PageNumberStamp.pdf";
327+
uploadFile(name);
328+
329+
TextState textState = new TextState().fontSize(14.);
330+
331+
TextStamp stamp = new TextStamp()
332+
.textAlignment(HorizontalAlignment.CENTER)
333+
.value("Text Stamp")
334+
.textState(textState);
335+
stamp.background(true)
336+
.leftMargin(1.)
337+
.rightMargin(2.)
338+
.topMargin(3.)
339+
.bottomMargin(4.)
340+
.horizontalAlignment(HorizontalAlignment.CENTER)
341+
.verticalAlignment(VerticalAlignment.CENTER)
342+
.opacity(1.)
343+
.rotate(Rotation.NONE)
344+
.rotateAngle(0.)
345+
.xindent(0.)
346+
.yindent(0.)
347+
.zoom(1.);
348+
349+
List<TextStamp> stamps = new ArrayList<>();
350+
stamps.add(stamp);
351+
352+
AsposeResponse response = pdfApi.postDocumentTextStamps(name, stamps, null, tempFolder);
353+
354+
}
355+
323356

324357
public void postPageImageStampsExample()throws ApiException
325358
{
@@ -353,6 +386,37 @@ public void postPageImageStampsExample()throws ApiException
353386
}
354387

355388

389+
public void postDocumentImageStampsExample()throws ApiException
390+
{
391+
String name = "PageNumberStamp.pdf";
392+
uploadFile(name);
393+
394+
String image = "Koala.jpg";
395+
uploadFile(image);
396+
397+
ImageStamp stamp = new ImageStamp().fileName(tempFolder + '/' + image);
398+
stamp.background(true)
399+
.leftMargin(1.)
400+
.rightMargin(2.)
401+
.topMargin(3.)
402+
.bottomMargin(4.)
403+
.horizontalAlignment(HorizontalAlignment.CENTER)
404+
.verticalAlignment(VerticalAlignment.CENTER)
405+
.opacity(1.)
406+
.rotate(Rotation.NONE)
407+
.rotateAngle(0.)
408+
.xindent(0.)
409+
.yindent(0.)
410+
.zoom(1.);
411+
412+
List<ImageStamp> stamps = new ArrayList<>();
413+
stamps.add(stamp);
414+
415+
AsposeResponse response = pdfApi.postDocumentImageStamps(name, stamps, null, tempFolder);
416+
417+
}
418+
419+
356420
public void postPagePdfPageStampsExample()throws ApiException
357421
{
358422
String name = "PageNumberStamp.pdf";

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ 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.7
32+
## Enhancements in Version 24.8
33+
- Adding Text stamps to multiple pages.
34+
- Adding Image stamps to multiple pages.
3335
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3436

35-
## Bugs fixed in Version 24.7
36-
- PutPsInStorageToPdf throws: Cannot find resource ‘Aspose.PDF.dependencies.ZapfDingbats.ttf.
37-
- Ocr method is not working.
38-
3937
## Requirements
4038
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
4139

sdk/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ apply plugin: 'idea'
2020
apply plugin: 'eclipse'
2121

2222
group = 'com.aspose'
23-
version = '24.7.0'
23+
version = '24.8.0'
2424

2525
buildscript {
2626
repositories {
@@ -100,7 +100,7 @@ dependencies {
100100
publish {
101101
groupId = 'com.aspose'
102102
artifactId = 'aspose-cloud-pdf-android'
103-
publishVersion = '24.7.0'
103+
publishVersion = '24.8.0'
104104
desc = 'Aspose.PDF Cloud is a REST API for creating and editing PDF files. 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.'
105105
licences = ['MIT']
106106
website = 'https://products.aspose.cloud/pdf/cloud'

sdk/docs/OptimizeOptions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ Represents Pdf optimize options.
66
Name | Type | Description | Notes
77
------------ | ------------- | ------------- | -------------
88
**password** | **String** | Specifies document password (if any) encoded with base-64. | [optional]
9-
**allowReusePageContent** | **Boolean** | If true page contents will be reused when document is optimized for equal pages. | [optional]
9+
**allowReusePageContent** | **Boolean** | If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true. | [optional]
1010
**compressImages** | **Boolean** | If this flag is set to true images will be compressed in the document. Compression level is specified with ImageQuality property. | [optional]
1111
**imageQuality** | **Integer** | Specifies level of image compression when CompressImages flag is used. | [optional]
1212
**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]
1313
**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]
1414
**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]
15-
**unembedFonts** | **Boolean** | Make fonts not embedded if set to true. | [optional]
15+
**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]
1616
**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]
1717
**maxResolution** | **Integer** | Specifies maximum resolution of images. If image has higher resolution it will be scaled. | [optional]
18-
**subsetFonts** | **Boolean** | Fonts will be converted into subsets if set to true. | [optional]
18+
**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]
1919
**removePrivateInfo** | **Boolean** | Remove private information (page piece info). | [optional]
2020
**imageEncoding** | [**ImageEncoding**](ImageEncoding.md) | Image encode which will be used. | [optional]
2121
**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]

sdk/docs/PdfApi.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ Method | HTTP request | Description
203203
[**postDecryptDocumentInStorage**](PdfApi.md#postDecryptDocumentInStorage) | **POST** /pdf/\{name}/decrypt | Decrypt document in storage.
204204
[**postDocumentImageFooter**](PdfApi.md#postDocumentImageFooter) | **POST** /pdf/\{name}/footer/image | Add document image footer.
205205
[**postDocumentImageHeader**](PdfApi.md#postDocumentImageHeader) | **POST** /pdf/\{name}/header/image | Add document image header.
206+
[**postDocumentImageStamps**](PdfApi.md#postDocumentImageStamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
206207
[**postDocumentPageNumberStamps**](PdfApi.md#postDocumentPageNumberStamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
207208
[**postDocumentTextFooter**](PdfApi.md#postDocumentTextFooter) | **POST** /pdf/\{name}/footer/text | Add document text footer.
208209
[**postDocumentTextHeader**](PdfApi.md#postDocumentTextHeader) | **POST** /pdf/\{name}/header/text | Add document text header.
209210
[**postDocumentTextReplace**](PdfApi.md#postDocumentTextReplace) | **POST** /pdf/\{name}/text/replace | Document&#39;s replace text method.
211+
[**postDocumentTextStamps**](PdfApi.md#postDocumentTextStamps) | **POST** /pdf/\{name}/stamps/text | Add document pages text stamps.
210212
[**postEncryptDocumentInStorage**](PdfApi.md#postEncryptDocumentInStorage) | **POST** /pdf/\{name}/encrypt | Encrypt document in storage.
211213
[**postFlattenDocument**](PdfApi.md#postFlattenDocument) | **POST** /pdf/\{name}/flatten | Flatten the document.
212214
[**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.
@@ -5205,6 +5207,31 @@ Name | Type | Description | Notes
52055207

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

5210+
### HTTP request headers
5211+
5212+
- **Content-Type**: application/json
5213+
- **Accept**: application/json
5214+
5215+
<a name="postDocumentImageStamps"></a>
5216+
# **postDocumentImageStamps**
5217+
> AsposeResponse postDocumentImageStamps(name, stamps, storage, folder, password)
5218+
5219+
Add document pages image stamps.
5220+
5221+
### Parameters
5222+
5223+
Name | Type | Description | Notes
5224+
------------- | ------------- | ------------- | -------------
5225+
**name** | **String**| The document name. |
5226+
**stamps** | [**List&lt;ImageStamp&gt;**](ImageStamp.md)| The array of stamp. |
5227+
**storage** | **String**| The document storage. | [optional]
5228+
**folder** | **String**| The document folder. | [optional]
5229+
**password** | **String**| Base64 encoded password. | [optional]
5230+
5231+
### Return type
5232+
5233+
[**AsposeResponse**](AsposeResponse.md)
5234+
52085235
### HTTP request headers
52095236

52105237
- **Content-Type**: application/json
@@ -5308,6 +5335,31 @@ Name | Type | Description | Notes
53085335

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

5338+
### HTTP request headers
5339+
5340+
- **Content-Type**: application/json
5341+
- **Accept**: application/json
5342+
5343+
<a name="postDocumentTextStamps"></a>
5344+
# **postDocumentTextStamps**
5345+
> AsposeResponse postDocumentTextStamps(name, stamps, storage, folder, password)
5346+
5347+
Add document pages text stamps.
5348+
5349+
### Parameters
5350+
5351+
Name | Type | Description | Notes
5352+
------------- | ------------- | ------------- | -------------
5353+
**name** | **String**| The document name. |
5354+
**stamps** | [**List&lt;TextStamp&gt;**](TextStamp.md)| The array of stamp. |
5355+
**storage** | **String**| The document storage. | [optional]
5356+
**folder** | **String**| The document folder. | [optional]
5357+
**password** | **String**| Base64 encoded password. | [optional]
5358+
5359+
### Return type
5360+
5361+
[**AsposeResponse**](AsposeResponse.md)
5362+
53115363
### HTTP request headers
53125364

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

sdk/src/main/java/com/aspose/asposecloudpdfandroid/ApiClient.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.gson.JsonElement;
2626
import com.google.gson.JsonObject;
2727
import com.google.gson.JsonParser;
28+
import com.google.gson.JsonSyntaxException;
2829
import com.squareup.okhttp.*;
2930
import com.squareup.okhttp.internal.http.HttpMethod;
3031
import com.squareup.okhttp.logging.HttpLoggingInterceptor;
@@ -93,7 +94,7 @@ public ApiClient() {
9394

9495
// Add custom headers
9596
addDefaultHeader("x-aspose-client", "android sdk");
96-
addDefaultHeader("x-aspose-client-version", "24.7.0");
97+
addDefaultHeader("x-aspose-client-version", "24.8.0");
9798

9899
// PDFCLOUD-418 Set default Connect Timeout
99100
setConnectTimeout(5 * 60 * 1000);
@@ -1049,8 +1050,25 @@ public void requestToken() throws ApiException
10491050
.build();
10501051

10511052
Response response = httpClient.newCall(request).execute();
1052-
GetAccessTokenResult result = json.deserialize(response.body().string(), GetAccessTokenResult.class);
1053-
setAccessToken(result.access_token);
1053+
String responseJson = response.body().string();
1054+
try
1055+
{
1056+
GetAccessTokenResult result = json.deserialize(responseJson, GetAccessTokenResult.class);
1057+
if (result == null || result.access_token == null || result.access_token.trim().isEmpty())
1058+
{
1059+
throw new ApiException(String.format("empty token (%s)", responseJson));
1060+
}
1061+
1062+
setAccessToken(result.access_token);
1063+
}
1064+
catch (JsonSyntaxException ex)
1065+
{
1066+
throw new ApiException(responseJson);
1067+
}
1068+
}
1069+
catch (ApiException apiException)
1070+
{
1071+
throw apiException;
10541072
}
10551073
catch (Exception ex)
10561074
{

0 commit comments

Comments
 (0)