Skip to content

Commit ce47761

Browse files
authored
Merge pull request #54 from aspose-pdf-cloud/develop
update to 24.2.0
2 parents e7f66d4 + 0de4edd commit ce47761

File tree

5 files changed

+500
-472
lines changed

5 files changed

+500
-472
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@ 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.1
13-
- Add support to convert password protected PDF to SVG in PutPdfInRequestToSvg API.
14-
- Add support to convert password protected PDF to SVG in PutPdfInStorageToSvg API.
12+
## Enhancements in Version 24.2
13+
- Memory leak when converting PDF to DOCX.
1514
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
1615

1716
## Installation
1817
```
19-
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v23
18+
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v24
2019
```
2120

2221
## Getting Started
2322
Please follow the [installation](#installation) instruction and execute the following Go code:
2423

25-
## Get PDF Page Circle Annotations in Go
24+
## Get PDF Page Circle Annotations
2625
```
27-
import asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v23"
26+
import "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v24"
2827
2928
...
3029
@@ -36,6 +35,12 @@ Please follow the [installation](#installation) instruction and execute the foll
3635
return pdfApi.GetDocumentCircleAnnotations("PdfWithAnnotations.pdf", args)
3736
```
3837

38+
## SelfHost Aspose.PDF Cloud
39+
Instead of **NewPdfApiService** use **NewSelfHostPdfApiService** function to create PdfApiService instance:
40+
```
41+
pdfApi := asposepdfcloud.NewSelfHostPdfApiService(<base URL of SelfHost Aspose.PDF Cloud>)
42+
```
43+
3944
## Unit Tests
4045
Aspose PDF Cloud SDK includes a suite of unit tests within the "test" subdirectory. These Unit Tests also serves as examples of how to use the Aspose PDF Cloud SDK.
4146

api_client.go

Lines changed: 6 additions & 5 deletions
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.1.0"
179+
headerParams["x-aspose-client-version"] = "24.2.0"
180180

181181
// Detect postBody type and post.
182182
if postBody != nil {
@@ -268,10 +268,11 @@ func (c *APIClient) prepareRequest (
268268
// Add the user agent to the request.
269269
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
270270

271-
// Add auth
272-
err = c.addAuth(localVarRequest)
273-
if err != nil {
274-
return nil, err
271+
if !c.cfg.SelfHost {
272+
// Add auth
273+
if err := c.addAuth(localVarRequest); err != nil {
274+
return nil, err
275+
}
275276
}
276277

277278
for header, value := range c.cfg.DefaultHeader {

base_test.go

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ func getServercredsJson() string {
6868
}
6969

7070
type Creds struct {
71+
ProductUri string `json:"ProductUri"`
7172
AppSID string `json:"AppSID"`
7273
AppKey string `json:"AppKey"`
73-
ProductUri string `json:"ProductUri"`
74+
SelfHost bool `json:"SelfHost"`
7475
}
7576

7677
func getCreds() Creds {
@@ -82,27 +83,36 @@ func getCreds() Creds {
8283
if err := json.Unmarshal(bbCreds, &creds); err != nil {
8384
panic(err)
8485
}
85-
if len(creds.AppSID) == 0 {
86-
panic("no AppSID")
87-
}
88-
if len(creds.AppKey) == 0 {
89-
panic("no AppKey")
90-
}
91-
if len(creds.ProductUri) == 0 {
92-
panic("no ProductUri")
86+
if creds.SelfHost {
87+
if len(creds.ProductUri) == 0 {
88+
panic("no ProductUri")
89+
}
90+
} else {
91+
if len(creds.AppSID) == 0 {
92+
panic("no AppSID")
93+
}
94+
if len(creds.AppKey) == 0 {
95+
panic("no AppKey")
96+
}
9397
}
9498
return creds
9599
}
96100

97101
func NewBaseTest() *BaseTest {
98102
creds := getCreds()
99-
bt := BaseTest{
103+
var pdfApiService *PdfApiService
104+
if creds.SelfHost {
105+
pdfApiService = NewSelfHostPdfApiService(creds.ProductUri)
106+
} else {
107+
pdfApiService = NewPdfApiService(creds.AppSID, creds.AppKey, creds.ProductUri)
108+
}
109+
baseTest := BaseTest{
100110
remoteFolder: "TempPdfCloud",
101111
localTestDataFolder: "test_data",
102112
TestNumber: 0,
103-
PdfAPI: NewPdfApiService(creds.AppSID, creds.AppKey, creds.ProductUri),
113+
PdfAPI: pdfApiService,
104114
}
105-
return &bt
115+
return &baseTest
106116
}
107117

108118
func GetBaseTest() *BaseTest {

configuration.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,17 @@ type Configuration struct {
7171
AppKey string
7272
AppSid string
7373
AccessToken string
74+
SelfHost bool
7475
}
7576

76-
func NewConfiguration(appSid string, appKey string, basePath string) *Configuration {
77+
func NewConfiguration(appSid, appKey, basePath string, selfHost bool) *Configuration {
7778
cfg := &Configuration{
7879
BasePath: "https://api.aspose.cloud/v3.0",
7980
DefaultHeader: make(map[string]string),
8081
UserAgent: "aspose pdf cloud go sdk",
81-
AppKey: appKey,
82-
AppSid: appSid,
82+
AppKey: appKey,
83+
AppSid: appSid,
84+
SelfHost: selfHost,
8385
}
8486
if basePath != "" {
8587
cfg.BasePath = basePath

0 commit comments

Comments
 (0)