aspose_pdf_cloud 24.10.0 → 24.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -10
- data/docs/DocRecognitionMode.md +4 -3
- data/docs/PdfApi.md +27 -0
- data/docs/SvgImages.md +11 -0
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +87 -6
- data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +1 -0
- data/lib/aspose_pdf_cloud/models/svg_images.rb +226 -0
- data/lib/aspose_pdf_cloud/version.rb +1 -1
- data/lib/aspose_pdf_cloud.rb +1 -0
- data/test/pdf_tests.rb +16 -3
- data/test_data/alfa.pdf +0 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 969a0f11b81e490f18023f371ba7e5e2d88e6f5e72375561b81f38dbb7177089
|
4
|
+
data.tar.gz: 0df9bf3712af4bbf0bb56aeeb60046e14100ebd1565bd64e4bac508e1709c1f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56dd2d651a376f8dc3dfa7c8cd1fb71d976eb6ff05ba8d765a5e5ec08e31b63804904ec208faf761a6ec06a9f27648cf9991d4c5562fef3f1ce1f46070d9a0b0
|
7
|
+
data.tar.gz: 67e7eb8e0aa070ba84324f799c28a57f6fbddba5f0c357b72bf6ad9ce7c7009eed152f16a4ee29583c5b461cc78840d909b3e2a35e03dd1e9f2c9e272757ad3b
|
data/README.md
CHANGED
@@ -29,15 +29,10 @@ XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
|
|
29
29
|
## Read PDF Formats
|
30
30
|
MHT, PCL, PS, XSLFO, MD
|
31
31
|
|
32
|
-
## Enhancements in Version 24.
|
33
|
-
-
|
34
|
-
- Develop a method to obtain XMP metadata in the XML form.
|
35
|
-
- Develop a method to obtain XMP metadata in the JSON form.
|
32
|
+
## Enhancements in Version 24.11
|
33
|
+
- Add DocRecognitionMode EnhancedFlow mode.
|
36
34
|
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
|
37
35
|
|
38
|
-
## Bugs fixed in Version 24.10
|
39
|
-
- PDF XFA form to Acro from conversion API results corrupt PDF.
|
40
|
-
|
41
36
|
## Installation
|
42
37
|
|
43
38
|
### Build a gem
|
@@ -51,15 +46,15 @@ gem build aspose_pdf_cloud.gemspec
|
|
51
46
|
Then either install the gem locally:
|
52
47
|
|
53
48
|
```shell
|
54
|
-
gem install ./aspose_pdf_cloud-24.
|
49
|
+
gem install ./aspose_pdf_cloud-24.11.0.gem
|
55
50
|
```
|
56
|
-
(for development, run `gem install --dev ./aspose_pdf_cloud-24.
|
51
|
+
(for development, run `gem install --dev ./aspose_pdf_cloud-24.11.0.gem` to install the development dependencies)
|
57
52
|
|
58
53
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
59
54
|
|
60
55
|
Finally add this to the Gemfile:
|
61
56
|
|
62
|
-
gem 'aspose_pdf_cloud', '~> 24.
|
57
|
+
gem 'aspose_pdf_cloud', '~> 24.11.0'
|
63
58
|
|
64
59
|
### Install from Git
|
65
60
|
|
data/docs/DocRecognitionMode.md
CHANGED
@@ -3,9 +3,10 @@ Allows to control how a PDF document is converted into a word processing documen
|
|
3
3
|
|
4
4
|
## Enum
|
5
5
|
Name | Type | Value | Description
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**TEXTBOX** | **String** | 'Textbox' | This mode is fast and good for maximally preserving original look of the PDF file, but editability of the resulting document could be limited.Every visually grouped block of text int the original PDF file is converted into a textbox in the resulting document. This achieves maximal resemblance of the output document to the original PDF file. The output document will look good, but it will consist entirely of textboxes and it could makes further editing of the document in Microsoft Word quite hard.This is the default mode.
|
8
|
-
**FLOW** | **String** | 'Flow' | Full recognition mode, the engine performs grouping and multi-level analysis to restore the original document author's intent and produce a maximally editable document. The downside is that the output document might look different from the original PDF file.
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**TEXTBOX** | **String** | 'Textbox' | This mode is fast and good for maximally preserving original look of the PDF file, but editability of the resulting document could be limited.Every visually grouped block of text int the original PDF file is converted into a textbox in the resulting document. This achieves maximal resemblance of the output document to the original PDF file. The output document will look good, but it will consist entirely of textboxes and it could makes further editing of the document in Microsoft Word quite hard.This is the default mode.
|
8
|
+
**FLOW** | **String** | 'Flow' | Full recognition mode, the engine performs grouping and multi-level analysis to restore the original document author's intent and produce a maximally editable document. The downside is that the output document might look different from the original PDF file.
|
9
|
+
**ENHANCED_FLOW** | **String** | 'EnhancedFlow' | An alternative Flow mode that supports the recognition of tables.
|
9
10
|
|
10
11
|
|
11
12
|
|
data/docs/PdfApi.md
CHANGED
@@ -95,6 +95,7 @@ Method | HTTP request | Description
|
|
95
95
|
[**get_image_extract_as_png**](PdfApi.md#get_image_extract_as_png) | **GET** /pdf/\{name}/images/\{imageId}/extract/png | Extract document image in PNG format
|
96
96
|
[**get_image_extract_as_tiff**](PdfApi.md#get_image_extract_as_tiff) | **GET** /pdf/\{name}/images/\{imageId}/extract/tiff | Extract document image in TIFF format
|
97
97
|
[**get_images**](PdfApi.md#get_images) | **GET** /pdf/\{name}/pages/\{pageNumber}/images | Read document images.
|
98
|
+
[**get_images_extract_svg**](PdfApi.md#get_images_extract_svg) | **GET** /pdf/\{name}/pages/\{pageNumber}/images/extract/svg | Extract SVG images from document page.
|
98
99
|
[**get_import_fields_from_fdf_in_storage**](PdfApi.md#get_import_fields_from_fdf_in_storage) | **GET** /pdf/\{name}/import/fdf | Update fields from FDF file in storage.
|
99
100
|
[**get_import_fields_from_xfdf_in_storage**](PdfApi.md#get_import_fields_from_xfdf_in_storage) | **GET** /pdf/\{name}/import/xfdf | Update fields from XFDF file in storage.
|
100
101
|
[**get_import_fields_from_xml_in_storage**](PdfApi.md#get_import_fields_from_xml_in_storage) | **GET** /pdf/\{name}/import/xml | Import from XML file (located on storage) to PDF format and return resulting file in response.
|
@@ -2626,6 +2627,32 @@ Name | Type | Description | Notes
|
|
2626
2627
|
|
2627
2628
|
|
2628
2629
|
|
2630
|
+
# **get_images_extract_svg**
|
2631
|
+
> SvgImages get_images_extract_svg(name, page_number, opts)
|
2632
|
+
|
2633
|
+
Extract SVG images from document page.
|
2634
|
+
|
2635
|
+
### Parameters
|
2636
|
+
|
2637
|
+
Name | Type | Description | Notes
|
2638
|
+
------------- | ------------- | ------------- | -------------
|
2639
|
+
**name** | **String**| The document name. |
|
2640
|
+
**page_number** | **Integer**| The page number. |
|
2641
|
+
**storage** | **String**| The document storage. | [optional]
|
2642
|
+
**folder** | **String**| The document folder. | [optional]
|
2643
|
+
**pass_base64** | **String**| The password (Base64). | [optional]
|
2644
|
+
|
2645
|
+
### Return type
|
2646
|
+
|
2647
|
+
[**SvgImages**](SvgImages.md)
|
2648
|
+
|
2649
|
+
### HTTP request headers
|
2650
|
+
|
2651
|
+
- **Content-Type**: application/json
|
2652
|
+
- **Accept**: application/json
|
2653
|
+
|
2654
|
+
|
2655
|
+
|
2629
2656
|
# **get_import_fields_from_fdf_in_storage**
|
2630
2657
|
> File get_import_fields_from_fdf_in_storage(name, fdf_file_path, opts)
|
2631
2658
|
|
data/docs/SvgImages.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# AsposePdfCloud::SvgImages
|
2
|
+
SvgImages class
|
3
|
+
|
4
|
+
## Properties
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**code** | **Integer** | Response status code. |
|
8
|
+
**status** | **String** | Response status. | [optional]
|
9
|
+
**list** | **Array<String>** | List of SVG images | [optional]
|
10
|
+
|
11
|
+
|
@@ -6893,6 +6893,87 @@ module AsposePdfCloud
|
|
6893
6893
|
return data, status_code, headers
|
6894
6894
|
end
|
6895
6895
|
|
6896
|
+
# Extract SVG images from document page.
|
6897
|
+
#
|
6898
|
+
# @param name The document name.
|
6899
|
+
# @param page_number The page number.
|
6900
|
+
# @param [Hash] opts the optional parameters
|
6901
|
+
# @option opts [String] :storage The document storage.
|
6902
|
+
# @option opts [String] :folder The document folder.
|
6903
|
+
# @option opts [String] :pass_base64 The password (Base64).
|
6904
|
+
# @return [SvgImages]
|
6905
|
+
def get_images_extract_svg(name, page_number, opts = {})
|
6906
|
+
@api_client.request_token_if_needed
|
6907
|
+
data, _status_code, _headers = get_images_extract_svg_with_http_info(name, page_number, opts)
|
6908
|
+
rescue ApiError => error
|
6909
|
+
if error.code == 401
|
6910
|
+
@api_client.request_token_if_needed
|
6911
|
+
data, _status_code, _headers = get_images_extract_svg_with_http_info(name, page_number, opts)
|
6912
|
+
else
|
6913
|
+
raise
|
6914
|
+
end
|
6915
|
+
return data
|
6916
|
+
end
|
6917
|
+
|
6918
|
+
# Extract SVG images from document page.
|
6919
|
+
#
|
6920
|
+
# @param name The document name.
|
6921
|
+
# @param page_number The page number.
|
6922
|
+
# @param [Hash] opts the optional parameters
|
6923
|
+
# @option opts [String] :storage The document storage.
|
6924
|
+
# @option opts [String] :folder The document folder.
|
6925
|
+
# @option opts [String] :pass_base64 The password (Base64).
|
6926
|
+
# @return [Array<(SvgImages, Fixnum, Hash)>] SvgImages data, response status code and response headers
|
6927
|
+
def get_images_extract_svg_with_http_info(name, page_number, opts = {})
|
6928
|
+
if @api_client.config.debugging
|
6929
|
+
@api_client.config.logger.debug "Calling API: PdfApi.get_images_extract_svg ..."
|
6930
|
+
end
|
6931
|
+
# verify the required parameter 'name' is set
|
6932
|
+
if @api_client.config.client_side_validation && name.nil?
|
6933
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling PdfApi.get_images_extract_svg"
|
6934
|
+
end
|
6935
|
+
# verify the required parameter 'page_number' is set
|
6936
|
+
if @api_client.config.client_side_validation && page_number.nil?
|
6937
|
+
fail ArgumentError, "Missing the required parameter 'page_number' when calling PdfApi.get_images_extract_svg"
|
6938
|
+
end
|
6939
|
+
# resource path
|
6940
|
+
local_var_path = "/pdf/{name}/pages/{pageNumber}/images/extract/svg".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)
|
6941
|
+
|
6942
|
+
# query parameters
|
6943
|
+
query_params = {}
|
6944
|
+
query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
|
6945
|
+
query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
|
6946
|
+
query_params[:'passBase64'] = opts[:'pass_base64'] if !opts[:'pass_base64'].nil?
|
6947
|
+
|
6948
|
+
# header parameters
|
6949
|
+
header_params = {}
|
6950
|
+
# HTTP header 'Accept' (if needed)
|
6951
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
6952
|
+
# HTTP header 'Content-Type'
|
6953
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
6954
|
+
|
6955
|
+
# form parameters
|
6956
|
+
form_params = {}
|
6957
|
+
# Fix header in file
|
6958
|
+
post_body = nil
|
6959
|
+
|
6960
|
+
# http body (model)
|
6961
|
+
# Fix header in file
|
6962
|
+
# post_body = nil
|
6963
|
+
auth_names = ['JWT']
|
6964
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
6965
|
+
:header_params => header_params,
|
6966
|
+
:query_params => query_params,
|
6967
|
+
:form_params => form_params,
|
6968
|
+
:body => post_body,
|
6969
|
+
:auth_names => auth_names,
|
6970
|
+
:return_type => 'SvgImages')
|
6971
|
+
if @api_client.config.debugging
|
6972
|
+
@api_client.config.logger.debug "API called: PdfApi#get_images_extract_svg\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
6973
|
+
end
|
6974
|
+
return data, status_code, headers
|
6975
|
+
end
|
6976
|
+
|
6896
6977
|
# Update fields from FDF file in storage.
|
6897
6978
|
#
|
6898
6979
|
# @param name The document name.
|
@@ -11073,8 +11154,8 @@ module AsposePdfCloud
|
|
11073
11154
|
if @api_client.config.client_side_validation && opts[:'format'] && !['Doc', 'DocX'].include?(opts[:'format'])
|
11074
11155
|
fail ArgumentError, 'invalid value for "format", must be one of Doc, DocX'
|
11075
11156
|
end
|
11076
|
-
if @api_client.config.client_side_validation && opts[:'mode'] && !['Textbox', 'Flow'].include?(opts[:'mode'])
|
11077
|
-
fail ArgumentError, 'invalid value for "mode", must be one of Textbox, Flow'
|
11157
|
+
if @api_client.config.client_side_validation && opts[:'mode'] && !['Textbox', 'Flow', 'EnhancedFlow'].include?(opts[:'mode'])
|
11158
|
+
fail ArgumentError, 'invalid value for "mode", must be one of Textbox, Flow, EnhancedFlow'
|
11078
11159
|
end
|
11079
11160
|
# resource path
|
11080
11161
|
local_var_path = "/pdf/{name}/convert/doc".sub('{' + 'name' + '}', name.to_s)
|
@@ -24932,8 +25013,8 @@ module AsposePdfCloud
|
|
24932
25013
|
if @api_client.config.client_side_validation && opts[:'format'] && !['Doc', 'DocX'].include?(opts[:'format'])
|
24933
25014
|
fail ArgumentError, 'invalid value for "format", must be one of Doc, DocX'
|
24934
25015
|
end
|
24935
|
-
if @api_client.config.client_side_validation && opts[:'mode'] && !['Textbox', 'Flow'].include?(opts[:'mode'])
|
24936
|
-
fail ArgumentError, 'invalid value for "mode", must be one of Textbox, Flow'
|
25016
|
+
if @api_client.config.client_side_validation && opts[:'mode'] && !['Textbox', 'Flow', 'EnhancedFlow'].include?(opts[:'mode'])
|
25017
|
+
fail ArgumentError, 'invalid value for "mode", must be one of Textbox, Flow, EnhancedFlow'
|
24937
25018
|
end
|
24938
25019
|
# resource path
|
24939
25020
|
local_var_path = "/pdf/convert/doc"
|
@@ -26166,8 +26247,8 @@ module AsposePdfCloud
|
|
26166
26247
|
if @api_client.config.client_side_validation && opts[:'format'] && !['Doc', 'DocX'].include?(opts[:'format'])
|
26167
26248
|
fail ArgumentError, 'invalid value for "format", must be one of Doc, DocX'
|
26168
26249
|
end
|
26169
|
-
if @api_client.config.client_side_validation && opts[:'mode'] && !['Textbox', 'Flow'].include?(opts[:'mode'])
|
26170
|
-
fail ArgumentError, 'invalid value for "mode", must be one of Textbox, Flow'
|
26250
|
+
if @api_client.config.client_side_validation && opts[:'mode'] && !['Textbox', 'Flow', 'EnhancedFlow'].include?(opts[:'mode'])
|
26251
|
+
fail ArgumentError, 'invalid value for "mode", must be one of Textbox, Flow, EnhancedFlow'
|
26171
26252
|
end
|
26172
26253
|
# resource path
|
26173
26254
|
local_var_path = "/pdf/{name}/convert/doc".sub('{' + 'name' + '}', name.to_s)
|
@@ -0,0 +1,226 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
21
|
+
|
22
|
+
require 'date'
|
23
|
+
require 'time'
|
24
|
+
|
25
|
+
module AsposePdfCloud
|
26
|
+
# SvgImages class
|
27
|
+
class SvgImages
|
28
|
+
# Response status code.
|
29
|
+
attr_accessor :code
|
30
|
+
|
31
|
+
# Response status.
|
32
|
+
attr_accessor :status
|
33
|
+
|
34
|
+
# List of SVG images
|
35
|
+
attr_accessor :list
|
36
|
+
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
+
def self.attribute_map
|
40
|
+
{
|
41
|
+
:'code' => :'Code',
|
42
|
+
:'status' => :'Status',
|
43
|
+
:'list' => :'List'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.swagger_types
|
49
|
+
{
|
50
|
+
:'code' => :'Integer',
|
51
|
+
:'status' => :'String',
|
52
|
+
:'list' => :'Array<String>'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
63
|
+
|
64
|
+
if attributes.has_key?(:'Code')
|
65
|
+
self.code = attributes[:'Code']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'Status')
|
69
|
+
self.status = attributes[:'Status']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'List')
|
73
|
+
if (value = attributes[:'List']).is_a?(Array)
|
74
|
+
self.list = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properies with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
if @code.nil?
|
85
|
+
invalid_properties.push("invalid value for 'code', code cannot be nil.")
|
86
|
+
end
|
87
|
+
|
88
|
+
return invalid_properties
|
89
|
+
end
|
90
|
+
|
91
|
+
# Check to see if the all the properties in the model are valid
|
92
|
+
# @return true if the model is valid
|
93
|
+
def valid?
|
94
|
+
return false if @code.nil?
|
95
|
+
return true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Checks equality by comparing each attribute.
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def ==(o)
|
101
|
+
return true if self.equal?(o)
|
102
|
+
self.class == o.class &&
|
103
|
+
code == o.code &&
|
104
|
+
status == o.status &&
|
105
|
+
list == o.list
|
106
|
+
end
|
107
|
+
|
108
|
+
# @see the `==` method
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def eql?(o)
|
111
|
+
self == o
|
112
|
+
end
|
113
|
+
|
114
|
+
# Calculates hash code according to all attributes.
|
115
|
+
# @return [Fixnum] Hash code
|
116
|
+
def hash
|
117
|
+
[code, status, list].hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
self.class.swagger_types.each_pair do |key, type|
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :DateTime
|
147
|
+
DateTime.parse(value)
|
148
|
+
when :Date
|
149
|
+
Date.parse(value)
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :BOOLEAN
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
178
|
+
temp_model.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
next if value.nil?
|
201
|
+
hash[param] = _to_hash(value)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map{ |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to? :to_hash
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
data/lib/aspose_pdf_cloud.rb
CHANGED
@@ -257,6 +257,7 @@ require_relative 'aspose_pdf_cloud/models/stamps_info_response'
|
|
257
257
|
require_relative 'aspose_pdf_cloud/models/strike_out_annotation_response'
|
258
258
|
require_relative 'aspose_pdf_cloud/models/strike_out_annotations'
|
259
259
|
require_relative 'aspose_pdf_cloud/models/strike_out_annotations_response'
|
260
|
+
require_relative 'aspose_pdf_cloud/models/svg_images'
|
260
261
|
require_relative 'aspose_pdf_cloud/models/table'
|
261
262
|
require_relative 'aspose_pdf_cloud/models/table_recognized'
|
262
263
|
require_relative 'aspose_pdf_cloud/models/table_recognized_response'
|
data/test/pdf_tests.rb
CHANGED
@@ -30,7 +30,7 @@ class PdfTests < Minitest::Test
|
|
30
30
|
include AsposePdfCloud
|
31
31
|
|
32
32
|
def setup
|
33
|
-
servercreds_json = File.read('
|
33
|
+
servercreds_json = File.read('../../Settings/servercreds.json')
|
34
34
|
creds = JSON.parse(servercreds_json)
|
35
35
|
self_host = creds.has_key?("SelfHost") ? creds["SelfHost"] : false
|
36
36
|
app_key = creds.has_key?("AppKey") ? creds["AppKey"] : ""
|
@@ -38,7 +38,7 @@ class PdfTests < Minitest::Test
|
|
38
38
|
product_uri = creds.has_key?("ProductUri") ? creds["ProductUri"] : ""
|
39
39
|
@pdf_api = PdfApi.new(app_key, app_sid, product_uri, self_host)
|
40
40
|
@temp_folder = 'TempPdfCloud'
|
41
|
-
@test_data_folder = '
|
41
|
+
@test_data_folder = 'test_data/'
|
42
42
|
config = @pdf_api.api_client.config
|
43
43
|
config.scheme = 'https'
|
44
44
|
end
|
@@ -5188,6 +5188,19 @@ class PdfTests < Minitest::Test
|
|
5188
5188
|
assert(response, 'Failed to extract images as png.')
|
5189
5189
|
end
|
5190
5190
|
|
5191
|
+
def test_get_images_extract_svg
|
5192
|
+
name = "alfa.pdf"
|
5193
|
+
upload_file(name)
|
5194
|
+
|
5195
|
+
opts = {
|
5196
|
+
:folder => @temp_folder
|
5197
|
+
}
|
5198
|
+
|
5199
|
+
page_number = 1
|
5200
|
+
response = @pdf_api.get_images_extract_svg(name, page_number, opts)
|
5201
|
+
assert(response, 'Failed to extract images as svg.')
|
5202
|
+
end
|
5203
|
+
|
5191
5204
|
|
5192
5205
|
# Link Annotations Tests
|
5193
5206
|
|
@@ -6014,7 +6027,7 @@ class PdfTests < Minitest::Test
|
|
6014
6027
|
urx = 0
|
6015
6028
|
ury = 0
|
6016
6029
|
opts = {
|
6017
|
-
:format => ['First Page', 'Second
|
6030
|
+
:format => ['First Page', 'Second&Page'],
|
6018
6031
|
# :format => 'First Page',
|
6019
6032
|
:folder => @temp_folder
|
6020
6033
|
}
|
data/test_data/alfa.pdf
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aspose_pdf_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 24.
|
4
|
+
version: 24.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aspose PDF Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -433,6 +433,7 @@ files:
|
|
433
433
|
- docs/StrikeOutAnnotationResponse.md
|
434
434
|
- docs/StrikeOutAnnotations.md
|
435
435
|
- docs/StrikeOutAnnotationsResponse.md
|
436
|
+
- docs/SvgImages.md
|
436
437
|
- docs/Table.md
|
437
438
|
- docs/TableBroken.md
|
438
439
|
- docs/TableRecognized.md
|
@@ -727,6 +728,7 @@ files:
|
|
727
728
|
- lib/aspose_pdf_cloud/models/strike_out_annotation_response.rb
|
728
729
|
- lib/aspose_pdf_cloud/models/strike_out_annotations.rb
|
729
730
|
- lib/aspose_pdf_cloud/models/strike_out_annotations_response.rb
|
731
|
+
- lib/aspose_pdf_cloud/models/svg_images.rb
|
730
732
|
- lib/aspose_pdf_cloud/models/table.rb
|
731
733
|
- lib/aspose_pdf_cloud/models/table_broken.rb
|
732
734
|
- lib/aspose_pdf_cloud/models/table_recognized.rb
|
@@ -812,6 +814,7 @@ files:
|
|
812
814
|
- test_data/Typography.PS
|
813
815
|
- test_data/XslfoExample.xslfo
|
814
816
|
- test_data/adbe.x509.rsa_sha1.valid.pdf
|
817
|
+
- test_data/alfa.pdf
|
815
818
|
- test_data/butterfly.jpg
|
816
819
|
- test_data/marketing.pdf
|
817
820
|
- test_data/mixed.md
|