Skip to content

Commit 0f0fd6f

Browse files
authored
Merge pull request #62 from aspose-pdf-cloud/develop
update to 24.11
2 parents a93502e + 19c2144 commit 0f0fd6f

File tree

10 files changed

+196
-8
lines changed

10 files changed

+196
-8
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,10 @@ These SDKs are now fully supported. If you have any questions, see any bugs or h
99

1010
Extract Text & Images of a PDF document online https://products.aspose.app/pdf/parser.
1111

12-
## Enhancements in Version 24.10
13-
- Develop a method to add XMP metadata.
14-
- Develop a method to obtain XMP metadata in the XML form.
15-
- Develop a method to obtain XMP metadata in the JSON form.
12+
## Enhancements in Version 24.11
13+
- Add DocRecognitionMode EnhancedFlow mode.
1614
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
1715

18-
## Bugs fixed in Version 24.10
19-
- PDF XFA form to Acro from conversion API results corrupt PDF.
20-
2116
## Installation
2217
```
2318
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v24

api_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (c *APIClient) prepareRequest (
176176

177177
// set custom header
178178
headerParams["x-aspose-client"] = "go sdk"
179-
headerParams["x-aspose-client-version"] = "24.10.0"
179+
headerParams["x-aspose-client-version"] = "24.11.0"
180180

181181
// Detect postBody type and post.
182182
if postBody != nil {

doc_recognition_mode.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ type DocRecognitionMode string
2727
const (
2828
DocRecognitionModeTextbox DocRecognitionMode = "Textbox"
2929
DocRecognitionModeFlow DocRecognitionMode = "Flow"
30+
DocRecognitionModeEnhancedFlow DocRecognitionMode = "EnhancedFlow"
3031
)

docs/DocRecognitionMode.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Name | Type | Value | Description
66
------------ | ------------- | ------------- | -------------
77
**DocRecognitionModeTextbox** | **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.
88
**DocRecognitionModeFlow** | **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+
**DocRecognitionModeEnhancedFlow** | **string** | "EnhancedFlow" | An alternative Flow mode that supports the recognition of tables.
910

1011
[[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]](../doc_recognition_mode.go)
1112

docs/PdfApi.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Method | HTTP request | Description
9595
[**GetImageExtractAsPng**](PdfApi.md#GetImageExtractAsPng) | **Get** /pdf/{name}/images/{imageId}/extract/png | Extract document image in PNG format
9696
[**GetImageExtractAsTiff**](PdfApi.md#GetImageExtractAsTiff) | **Get** /pdf/{name}/images/{imageId}/extract/tiff | Extract document image in TIFF format
9797
[**GetImages**](PdfApi.md#GetImages) | **Get** /pdf/{name}/pages/{pageNumber}/images | Read document images.
98+
[**GetImagesExtractSvg**](PdfApi.md#GetImagesExtractSvg) | **Get** /pdf/{name}/pages/{pageNumber}/images/extract/svg | Extract SVG images from document page.
9899
[**GetImportFieldsFromFdfInStorage**](PdfApi.md#GetImportFieldsFromFdfInStorage) | **Get** /pdf/{name}/import/fdf | Update fields from FDF file in storage.
99100
[**GetImportFieldsFromXfdfInStorage**](PdfApi.md#GetImportFieldsFromXfdfInStorage) | **Get** /pdf/{name}/import/xfdf | Update fields from XFDF file in storage.
100101
[**GetImportFieldsFromXmlInStorage**](PdfApi.md#GetImportFieldsFromXmlInStorage) | **Get** /pdf/{name}/import/xml | Import from XML file (located on storage) to PDF format and return resulting file in response.
@@ -3300,6 +3301,40 @@ Name | Type | Description | Notes
33003301

33013302
[[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)
33023303

3304+
# **GetImagesExtractSvg**
3305+
> SvgImages GetImagesExtractSvg(name, pageNumber, optional)
3306+
Extract SVG images from document page.
3307+
3308+
### Required Parameters
3309+
3310+
Name | Type | Description | Notes
3311+
------------- | ------------- | ------------- | -------------
3312+
**name** | **string**| The document name. |
3313+
**pageNumber** | **int32**| The page number. |
3314+
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
3315+
3316+
### Optional Parameters
3317+
Optional parameters are passed through a map[string]interface{}.
3318+
3319+
Name | Type | Description | Notes
3320+
------------- | ------------- | ------------- | -------------
3321+
**name** | **string**| The document name. |
3322+
**pageNumber** | **int32**| The page number. |
3323+
**storage** | **string**| The document storage. |
3324+
**folder** | **string**| The document folder. |
3325+
**passBase64** | **string**| The password (Base64). |
3326+
3327+
### Return type
3328+
3329+
[**SvgImages**](SvgImages.md)
3330+
3331+
### HTTP request headers
3332+
3333+
- **Content-Type**: application/json
3334+
- **Accept**: application/json
3335+
3336+
[[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)
3337+
33033338
# **GetImportFieldsFromFdfInStorage**
33043339
> []byte GetImportFieldsFromFdfInStorage(name, fdfFilePath, optional)
33053340
Update fields from FDF file in storage.

docs/SvgImages.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SvgImages
2+
SvgImages class
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Code** | **int32** | Response status code. | [default to null]
8+
**Status** | **string** | Response status. | [optional] [default to null]
9+
**List** | **[]string** | List of SVG images | [optional] [default to null]
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]](../svg_images.go)
12+
13+

images_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,3 +545,28 @@ func TestGetImageExtractAsPng(t *testing.T) {
545545
fmt.Printf("%d\tTestGetImageExtractAsPng - %db\n", GetBaseTest().GetTestNumber(), len(response))
546546
}
547547
}
548+
549+
func TestGetImagesExtractSvg(t *testing.T) {
550+
551+
name := "Alfa.pdf"
552+
pageNumber := int32(1)
553+
554+
if err := GetBaseTest().UploadFile(name); err != nil {
555+
t.Error(err)
556+
}
557+
558+
args := map[string]interface{}{
559+
"folder": GetBaseTest().remoteFolder,
560+
}
561+
562+
response, httpResponse, err := GetBaseTest().PdfAPI.GetImagesExtractSvg(name, pageNumber, args)
563+
if err != nil {
564+
t.Error(err)
565+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
566+
t.Fail()
567+
} else if len(response.List) == 0 {
568+
t.Fail()
569+
} else {
570+
fmt.Printf("%d\tTestGetImagesExtractSvg - %db\n", GetBaseTest().GetTestNumber(), len(response.List))
571+
}
572+
}

pdf_api.go

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7292,6 +7292,92 @@ func (a *PdfApiService) GetImages(name string, pageNumber int32, localVarOptiona
72927292
return successPayload, localVarHttpResponse, err
72937293
}
72947294

7295+
/* PdfApiService Extract SVG images from document page.
7296+
@param name The document name.
7297+
@param pageNumber The page number.
7298+
@param optional (nil or map[string]interface{}) with one or more of:
7299+
@param "storage" (string) The document storage.
7300+
@param "folder" (string) The document folder.
7301+
@param "passBase64" (string) The password (Base64).
7302+
@return SvgImages*/
7303+
func (a *PdfApiService) GetImagesExtractSvg(name string, pageNumber int32, localVarOptionals map[string]interface{}) (SvgImages, *http.Response, error) {
7304+
var (
7305+
localVarHttpMethod = strings.ToUpper("Get")
7306+
localVarPostBody interface{}
7307+
localVarFileName string
7308+
localVarFileBytes []byte
7309+
successPayload SvgImages
7310+
)
7311+
7312+
// create path and map variables
7313+
localVarPath := a.client.cfg.BasePath + "/pdf/{name}/pages/{pageNumber}/images/extract/svg"
7314+
localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
7315+
localVarPath = strings.Replace(localVarPath, "{"+"pageNumber"+"}", fmt.Sprintf("%v", pageNumber), -1)
7316+
7317+
localVarHeaderParams := make(map[string]string)
7318+
localVarQueryParams := _url.Values{}
7319+
localVarFormParams := _url.Values{}
7320+
7321+
if err := typeCheckParameter(localVarOptionals["storage"], "string", "storage"); err != nil {
7322+
return successPayload, nil, err
7323+
}
7324+
if err := typeCheckParameter(localVarOptionals["folder"], "string", "folder"); err != nil {
7325+
return successPayload, nil, err
7326+
}
7327+
if err := typeCheckParameter(localVarOptionals["passBase64"], "string", "passBase64"); err != nil {
7328+
return successPayload, nil, err
7329+
}
7330+
7331+
if localVarTempParam, localVarOk := localVarOptionals["storage"].(string); localVarOk {
7332+
localVarQueryParams.Add("storage", parameterToString(localVarTempParam, ""))
7333+
}
7334+
if localVarTempParam, localVarOk := localVarOptionals["folder"].(string); localVarOk {
7335+
localVarQueryParams.Add("folder", parameterToString(localVarTempParam, ""))
7336+
}
7337+
if localVarTempParam, localVarOk := localVarOptionals["passBase64"].(string); localVarOk {
7338+
localVarQueryParams.Add("passBase64", parameterToString(localVarTempParam, ""))
7339+
}
7340+
// to determine the Content-Type header
7341+
localVarHttpContentTypes := []string{ "application/json", }
7342+
7343+
// set Content-Type header
7344+
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
7345+
if localVarHttpContentType != "" {
7346+
localVarHeaderParams["Content-Type"] = localVarHttpContentType
7347+
}
7348+
7349+
// to determine the Accept header
7350+
localVarHttpHeaderAccepts := []string{
7351+
"application/json",
7352+
}
7353+
7354+
// set Accept header
7355+
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
7356+
if localVarHttpHeaderAccept != "" {
7357+
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
7358+
}
7359+
r, err := a.client.prepareRequest(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
7360+
if err != nil {
7361+
return successPayload, nil, err
7362+
}
7363+
7364+
localVarHttpResponse, err := a.client.callAPI(r)
7365+
if err != nil || localVarHttpResponse == nil {
7366+
return successPayload, localVarHttpResponse, err
7367+
}
7368+
defer localVarHttpResponse.Body.Close()
7369+
if localVarHttpResponse.StatusCode >= 300 {
7370+
bodyBytes, _ := io.ReadAll(localVarHttpResponse.Body)
7371+
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
7372+
}
7373+
7374+
if err = deserializeDTO(localVarHttpResponse.Body, &successPayload); err != nil {
7375+
return successPayload, localVarHttpResponse, err
7376+
}
7377+
7378+
return successPayload, localVarHttpResponse, err
7379+
}
7380+
72957381
/* PdfApiService Update fields from FDF file in storage.
72967382
@param name The document name.
72977383
@param fdfFilePath The Fdf file path.

svg_images.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
package asposepdfcloud
23+
24+
// SvgImages class
25+
type SvgImages struct {
26+
// Response status code.
27+
Code int32 `json:"Code"`
28+
// Response status.
29+
Status string `json:"Status,omitempty"`
30+
// List of SVG images
31+
List []string `json:"List,omitempty"`
32+
}

test_data/alfa.pdf

290 KB
Binary file not shown.

0 commit comments

Comments
 (0)