Skip to content

Commit 79aaad5

Browse files
authored
Merge pull request #76 from aspose-pdf-cloud/develop
update 24.8
2 parents 244069a + bfe1587 commit 79aaad5

File tree

8 files changed

+300
-16
lines changed

8 files changed

+300
-16
lines changed

README.md

Lines changed: 6 additions & 8 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
## Installation
4038

4139
### Build a gem
@@ -49,15 +47,15 @@ gem build aspose_pdf_cloud.gemspec
4947
Then either install the gem locally:
5048

5149
```shell
52-
gem install ./aspose_pdf_cloud-24.5.0.gem
50+
gem install ./aspose_pdf_cloud-24.8.0.gem
5351
```
54-
(for development, run `gem install --dev ./aspose_pdf_cloud-24.5.0.gem` to install the development dependencies)
52+
(for development, run `gem install --dev ./aspose_pdf_cloud-24.8.0.gem` to install the development dependencies)
5553

5654
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
5755

5856
Finally add this to the Gemfile:
5957

60-
gem 'aspose_pdf_cloud', '~> 24.5.0'
58+
gem 'aspose_pdf_cloud', '~> 24.8.0'
6159

6260
### Install from Git
6361

docs/OptimizeOptions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ Represents Pdf optimize options.
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**password** | **String** | Specifies document password (if any) encoded with base-64. | [optional]
8-
**allow_reuse_page_content** | **BOOLEAN** | If true page contents will be reused when document is optimized for equal pages. | [optional]
8+
**allow_reuse_page_content** | **BOOLEAN** | If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true. | [optional]
99
**compress_images** | **BOOLEAN** | If this flag is set to true images will be compressed in the document. Compression level is specified with ImageQuality property. | [optional]
1010
**image_quality** | **Integer** | Specifies level of image compression when CompressImages flag is used. | [optional]
1111
**link_duplcate_streams** | **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]
1212
**remove_unused_objects** | **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]
1313
**remove_unused_streams** | **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]
14-
**unembed_fonts** | **BOOLEAN** | Make fonts not embedded if set to true. | [optional]
14+
**unembed_fonts** | **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]
1515
**resize_images** | **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]
1616
**max_resolution** | **Integer** | Specifies maximum resolution of images. If image has higher resolution it will be scaled. | [optional]
17-
**subset_fonts** | **BOOLEAN** | Fonts will be converted into subsets if set to true. | [optional]
17+
**subset_fonts** | **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]
1818
**remove_private_info** | **BOOLEAN** | Remove private information (page piece info). | [optional]
1919
**image_encoding** | [**ImageEncoding**](ImageEncoding.md) | Image encode which will be used. | [optional]
2020
**image_compression_version** | [**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]

docs/PdfApi.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ Method | HTTP request | Description
203203
[**post_decrypt_document_in_storage**](PdfApi.md#post_decrypt_document_in_storage) | **POST** /pdf/\{name}/decrypt | Decrypt document in storage.
204204
[**post_document_image_footer**](PdfApi.md#post_document_image_footer) | **POST** /pdf/\{name}/footer/image | Add document image footer.
205205
[**post_document_image_header**](PdfApi.md#post_document_image_header) | **POST** /pdf/\{name}/header/image | Add document image header.
206+
[**post_document_image_stamps**](PdfApi.md#post_document_image_stamps) | **POST** /pdf/\{name}/stamps/image | Add document pages image stamps.
206207
[**post_document_page_number_stamps**](PdfApi.md#post_document_page_number_stamps) | **POST** /pdf/\{name}/stamps/pagenumber | Add document page number stamps.
207208
[**post_document_text_footer**](PdfApi.md#post_document_text_footer) | **POST** /pdf/\{name}/footer/text | Add document text footer.
208209
[**post_document_text_header**](PdfApi.md#post_document_text_header) | **POST** /pdf/\{name}/header/text | Add document text header.
209210
[**post_document_text_replace**](PdfApi.md#post_document_text_replace) | **POST** /pdf/\{name}/text/replace | Document's replace text method.
211+
[**post_document_text_stamps**](PdfApi.md#post_document_text_stamps) | **POST** /pdf/\{name}/stamps/text | Add document pages text stamps.
210212
[**post_encrypt_document_in_storage**](PdfApi.md#post_encrypt_document_in_storage) | **POST** /pdf/\{name}/encrypt | Encrypt document in storage.
211213
[**post_flatten_document**](PdfApi.md#post_flatten_document) | **POST** /pdf/\{name}/flatten | Flatten the document.
212214
[**post_html_to_pdf**](PdfApi.md#post_html_to_pdf) | **POST** /pdf/create/html | Convert HTML file (zip archive in request content) to PDF format and return resulting file in response.
@@ -5409,6 +5411,32 @@ Name | Type | Description | Notes
54095411

54105412

54115413

5414+
# **post_document_image_stamps**
5415+
> AsposeResponse post_document_image_stamps(name, stamps, opts)
5416+
5417+
Add document pages image stamps.
5418+
5419+
### Parameters
5420+
5421+
Name | Type | Description | Notes
5422+
------------- | ------------- | ------------- | -------------
5423+
**name** | **String**| The document name. |
5424+
**stamps** | [**Array<ImageStamp>**](ImageStamp.md)| The array of stamp. |
5425+
**storage** | **String**| The document storage. | [optional]
5426+
**folder** | **String**| The document folder. | [optional]
5427+
**password** | **String**| Base64 encoded password. | [optional]
5428+
5429+
### Return type
5430+
5431+
[**AsposeResponse**](AsposeResponse.md)
5432+
5433+
### HTTP request headers
5434+
5435+
- **Content-Type**: application/json
5436+
- **Accept**: application/json
5437+
5438+
5439+
54125440
# **post_document_page_number_stamps**
54135441
> AsposeResponse post_document_page_number_stamps(name, stamp, opts)
54145442
@@ -5516,6 +5544,32 @@ Name | Type | Description | Notes
55165544

55175545

55185546

5547+
# **post_document_text_stamps**
5548+
> AsposeResponse post_document_text_stamps(name, stamps, opts)
5549+
5550+
Add document pages text stamps.
5551+
5552+
### Parameters
5553+
5554+
Name | Type | Description | Notes
5555+
------------- | ------------- | ------------- | -------------
5556+
**name** | **String**| The document name. |
5557+
**stamps** | [**Array<TextStamp>**](TextStamp.md)| The array of stamp. |
5558+
**storage** | **String**| The document storage. | [optional]
5559+
**folder** | **String**| The document folder. | [optional]
5560+
**password** | **String**| Base64 encoded password. | [optional]
5561+
5562+
### Return type
5563+
5564+
[**AsposeResponse**](AsposeResponse.md)
5565+
5566+
### HTTP request headers
5567+
5568+
- **Content-Type**: application/json
5569+
- **Accept**: application/json
5570+
5571+
5572+
55195573
# **post_encrypt_document_in_storage**
55205574
> AsposeResponse post_encrypt_document_in_storage(name, user_password, owner_password, crypto_algorithm, opts)
55215575

lib/aspose_pdf_cloud/api/pdf_api.rb

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15608,6 +15608,86 @@ def post_document_image_header_with_http_info(name, image_header, opts = {})
1560815608
return data, status_code, headers
1560915609
end
1561015610

15611+
# Add document pages image stamps.
15612+
#
15613+
# @param name The document name.
15614+
# @param stamps The array of stamp.
15615+
# @param [Hash] opts the optional parameters
15616+
# @option opts [String] :storage The document storage.
15617+
# @option opts [String] :folder The document folder.
15618+
# @option opts [String] :password Base64 encoded password.
15619+
# @return [AsposeResponse]
15620+
def post_document_image_stamps(name, stamps, opts = {})
15621+
@api_client.request_token_if_needed
15622+
data, _status_code, _headers = post_document_image_stamps_with_http_info(name, stamps, opts)
15623+
rescue ApiError => error
15624+
if error.code == 401
15625+
@api_client.request_token_if_needed
15626+
data, _status_code, _headers = post_document_image_stamps_with_http_info(name, stamps, opts)
15627+
else
15628+
raise
15629+
end
15630+
return data
15631+
end
15632+
15633+
# Add document pages image stamps.
15634+
#
15635+
# @param name The document name.
15636+
# @param stamps The array of stamp.
15637+
# @param [Hash] opts the optional parameters
15638+
# @option opts [String] :storage The document storage.
15639+
# @option opts [String] :folder The document folder.
15640+
# @option opts [String] :password Base64 encoded password.
15641+
# @return [Array<(AsposeResponse, Fixnum, Hash)>] AsposeResponse data, response status code and response headers
15642+
def post_document_image_stamps_with_http_info(name, stamps, opts = {})
15643+
if @api_client.config.debugging
15644+
@api_client.config.logger.debug "Calling API: PdfApi.post_document_image_stamps ..."
15645+
end
15646+
# verify the required parameter 'name' is set
15647+
if @api_client.config.client_side_validation && name.nil?
15648+
fail ArgumentError, "Missing the required parameter 'name' when calling PdfApi.post_document_image_stamps"
15649+
end
15650+
# verify the required parameter 'stamps' is set
15651+
if @api_client.config.client_side_validation && stamps.nil?
15652+
fail ArgumentError, "Missing the required parameter 'stamps' when calling PdfApi.post_document_image_stamps"
15653+
end
15654+
# resource path
15655+
local_var_path = "/pdf/{name}/stamps/image".sub('{' + 'name' + '}', name.to_s)
15656+
15657+
# query parameters
15658+
query_params = {}
15659+
query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
15660+
query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
15661+
query_params[:'password'] = opts[:'password'] if !opts[:'password'].nil?
15662+
15663+
# header parameters
15664+
header_params = {}
15665+
# HTTP header 'Accept' (if needed)
15666+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
15667+
# HTTP header 'Content-Type'
15668+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
15669+
15670+
# form parameters
15671+
form_params = {}
15672+
# Fix header in file
15673+
post_body = nil
15674+
15675+
# http body (model)
15676+
post_body = @api_client.object_to_http_body(stamps)
15677+
auth_names = ['JWT']
15678+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
15679+
:header_params => header_params,
15680+
:query_params => query_params,
15681+
:form_params => form_params,
15682+
:body => post_body,
15683+
:auth_names => auth_names,
15684+
:return_type => 'AsposeResponse')
15685+
if @api_client.config.debugging
15686+
@api_client.config.logger.debug "API called: PdfApi#post_document_image_stamps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
15687+
end
15688+
return data, status_code, headers
15689+
end
15690+
1561115691
# Add document page number stamps.
1561215692
#
1561315693
# @param name The document name.
@@ -15937,6 +16017,86 @@ def post_document_text_replace_with_http_info(name, text_replace, opts = {})
1593716017
return data, status_code, headers
1593816018
end
1593916019

16020+
# Add document pages text stamps.
16021+
#
16022+
# @param name The document name.
16023+
# @param stamps The array of stamp.
16024+
# @param [Hash] opts the optional parameters
16025+
# @option opts [String] :storage The document storage.
16026+
# @option opts [String] :folder The document folder.
16027+
# @option opts [String] :password Base64 encoded password.
16028+
# @return [AsposeResponse]
16029+
def post_document_text_stamps(name, stamps, opts = {})
16030+
@api_client.request_token_if_needed
16031+
data, _status_code, _headers = post_document_text_stamps_with_http_info(name, stamps, opts)
16032+
rescue ApiError => error
16033+
if error.code == 401
16034+
@api_client.request_token_if_needed
16035+
data, _status_code, _headers = post_document_text_stamps_with_http_info(name, stamps, opts)
16036+
else
16037+
raise
16038+
end
16039+
return data
16040+
end
16041+
16042+
# Add document pages text stamps.
16043+
#
16044+
# @param name The document name.
16045+
# @param stamps The array of stamp.
16046+
# @param [Hash] opts the optional parameters
16047+
# @option opts [String] :storage The document storage.
16048+
# @option opts [String] :folder The document folder.
16049+
# @option opts [String] :password Base64 encoded password.
16050+
# @return [Array<(AsposeResponse, Fixnum, Hash)>] AsposeResponse data, response status code and response headers
16051+
def post_document_text_stamps_with_http_info(name, stamps, opts = {})
16052+
if @api_client.config.debugging
16053+
@api_client.config.logger.debug "Calling API: PdfApi.post_document_text_stamps ..."
16054+
end
16055+
# verify the required parameter 'name' is set
16056+
if @api_client.config.client_side_validation && name.nil?
16057+
fail ArgumentError, "Missing the required parameter 'name' when calling PdfApi.post_document_text_stamps"
16058+
end
16059+
# verify the required parameter 'stamps' is set
16060+
if @api_client.config.client_side_validation && stamps.nil?
16061+
fail ArgumentError, "Missing the required parameter 'stamps' when calling PdfApi.post_document_text_stamps"
16062+
end
16063+
# resource path
16064+
local_var_path = "/pdf/{name}/stamps/text".sub('{' + 'name' + '}', name.to_s)
16065+
16066+
# query parameters
16067+
query_params = {}
16068+
query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
16069+
query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
16070+
query_params[:'password'] = opts[:'password'] if !opts[:'password'].nil?
16071+
16072+
# header parameters
16073+
header_params = {}
16074+
# HTTP header 'Accept' (if needed)
16075+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
16076+
# HTTP header 'Content-Type'
16077+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
16078+
16079+
# form parameters
16080+
form_params = {}
16081+
# Fix header in file
16082+
post_body = nil
16083+
16084+
# http body (model)
16085+
post_body = @api_client.object_to_http_body(stamps)
16086+
auth_names = ['JWT']
16087+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
16088+
:header_params => header_params,
16089+
:query_params => query_params,
16090+
:form_params => form_params,
16091+
:body => post_body,
16092+
:auth_names => auth_names,
16093+
:return_type => 'AsposeResponse')
16094+
if @api_client.config.debugging
16095+
@api_client.config.logger.debug "API called: PdfApi#post_document_text_stamps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
16096+
end
16097+
return data, status_code, headers
16098+
end
16099+
1594016100
# Encrypt document in storage.
1594116101
#
1594216102
# @param name Document name.

lib/aspose_pdf_cloud/api_client.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,16 @@ def request_token_if_needed
464464
end
465465

466466
response = conn.post tokenUrl, form_params, req_opts[:body]
467-
data = JSON.parse("[#{response.body}]", :symbolize_names => true)[0]
467+
468+
begin
469+
data = JSON.parse("[#{response.body}]", :symbolize_names => true)[0]
470+
rescue Exception => exception
471+
raise ApiError.new(response.body)
472+
end
468473

474+
if data.nil? || data[:access_token].nil? || data[:access_token] == ""
475+
raise("empty token (#{response.body})")
476+
end
469477
@config.access_token = data[:access_token]
470478
end
471479

lib/aspose_pdf_cloud/models/optimize_options.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class OptimizeOptions
2828
# Specifies document password (if any) encoded with base-64.
2929
attr_accessor :password
3030

31-
# If true page contents will be reused when document is optimized for equal pages.
31+
# If true page contents will be reused when document is optimized for equal pages. LinkDuplcateStreams option must be set to true.
3232
attr_accessor :allow_reuse_page_content
3333

3434
# If this flag is set to true images will be compressed in the document. Compression level is specified with ImageQuality property.
@@ -46,7 +46,7 @@ class OptimizeOptions
4646
# 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.
4747
attr_accessor :remove_unused_streams
4848

49-
# Make fonts not embedded if set to true.
49+
# 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.
5050
attr_accessor :unembed_fonts
5151

5252
# If this flag set to true and CompressImages is true images will be resized if image resolution is greater then specified MaxResolution parameter.
@@ -55,7 +55,7 @@ class OptimizeOptions
5555
# Specifies maximum resolution of images. If image has higher resolution it will be scaled.
5656
attr_accessor :max_resolution
5757

58-
# Fonts will be converted into subsets if set to true.
58+
# 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.
5959
attr_accessor :subset_fonts
6060

6161
# Remove private information (page piece info).

lib/aspose_pdf_cloud/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
=end
2121

2222
module AsposePdfCloud
23-
VERSION = "24.7.0"
23+
VERSION = "24.8.0"
2424
end

0 commit comments

Comments
 (0)