Skip to content

Commit 8d7ea4b

Browse files
authored
Merge pull request #87 from aspose-pdf-cloud/develop
update to 25.7
2 parents 0ab0477 + 381763c commit 8d7ea4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1141
-280
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ 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 25.6
13-
- Develop Rotate Document Pages method.
12+
## Enhancements in Version 25.7
13+
- Add possibility to hide subject field in signature appearance.
1414
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
1515

16+
## Bugs fixed in Version 25.7
17+
- PostDeleteStamps removing stamps from PDF page is incorrect.
18+
1619
## Installation
1720
```
1821
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25

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"] = "25.6.0"
179+
headerParams["x-aspose-client-version"] = "25.7.0"
180180

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

docs/SignatureCustomAppearance.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ An abstract class which represents signature custom appearance object.
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**FontFamilyName** | **string** | Gets/sets font family name. It should be existed in the document. Default value: Arial. | [optional] [default to null]
8-
**FontSize** | **float64** | Gets/sets font size. Default value: 10. | [default to null]
8+
**FontSize** | **float64** | Gets/sets font size. Default value: 10. | [optional] [default to null]
9+
**Rotation** | [***Rotation**](Rotation.md) | Gets or sets signature rotation. | [default to null]
910
**ShowContactInfo** | **bool** | Gets/sets contact info visibility. Default value: true. | [default to null]
1011
**ShowReason** | **bool** | Gets/sets reason visibility. Default value: true. | [default to null]
1112
**ShowLocation** | **bool** | Gets/sets location visibility. Default value: true. | [default to null]
@@ -16,6 +17,10 @@ Name | Type | Description | Notes
1617
**DateSignedAtLabel** | **string** | Gets/sets date signed label. Default value: "Date". | [optional] [default to null]
1718
**DateTimeLocalFormat** | **string** | Gets/sets datetime local format. Default value: "yyyy.MM.dd HH:mm:ss zzz". | [optional] [default to null]
1819
**DateTimeFormat** | **string** | Gets/sets datetime format. Default value: "yyyy.MM.dd HH:mm:ss". | [optional] [default to null]
20+
**BackgroundColor** | [***Color**](Color.md) | Gets/sets background color. | [optional] [default to null]
21+
**ForegroundColor** | [***Color**](Color.md) | Gets/sets foreground color. | [optional] [default to null]
22+
**UseDigitalSubjectFormat** | **bool** | Gets/sets subject format usage. | [default to null]
23+
**DigitalSubjectFormat** | [**[]SignatureSubjectNameElements**](SignatureSubjectNameElements.md) | Gets/sets subject format. | [optional] [default to null]
1924

2025
[[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]](../signature_custom_appearance.go)
2126

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SignatureSubjectNameElements
2+
Represents an enumeration of available SubjectNameElements.
3+
4+
## Enum
5+
Name | Type | Value | Description
6+
------------ | ------------- | ------------- | -------------
7+
**SignatureSubjectNameElementsCN** | **string** | "CN" | Common Name.
8+
**SignatureSubjectNameElementsO** | **string** | "O" | Organization.
9+
**SignatureSubjectNameElementsL** | **string** | "L" | Locality.
10+
**SignatureSubjectNameElementsOU** | **string** | "OU" | Organizational Unit.
11+
**SignatureSubjectNameElementsS** | **string** | "S" | State or Province Name.
12+
**SignatureSubjectNameElementsC** | **string** | "C" | Common Name.
13+
**SignatureSubjectNameElementsE** | **string** | "E" | Email.
14+
15+
[[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]](../signature_subject_name_elements.go)
16+
17+

signature_custom_appearance.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ type SignatureCustomAppearance struct {
2626
// Gets/sets font family name. It should be existed in the document. Default value: Arial.
2727
FontFamilyName string `json:"FontFamilyName,omitempty"`
2828
// Gets/sets font size. Default value: 10.
29-
FontSize float64 `json:"FontSize"`
29+
FontSize float64 `json:"FontSize,omitempty"`
30+
// Gets or sets signature rotation.
31+
Rotation Rotation `json:"Rotation"`
3032
// Gets/sets contact info visibility. Default value: true.
3133
ShowContactInfo bool `json:"ShowContactInfo"`
3234
// Gets/sets reason visibility. Default value: true.
@@ -47,4 +49,12 @@ type SignatureCustomAppearance struct {
4749
DateTimeLocalFormat string `json:"DateTimeLocalFormat,omitempty"`
4850
// Gets/sets datetime format. Default value: \"yyyy.MM.dd HH:mm:ss\".
4951
DateTimeFormat string `json:"DateTimeFormat,omitempty"`
52+
// Gets/sets background color.
53+
BackgroundColor *Color `json:"BackgroundColor,omitempty"`
54+
// Gets/sets foreground color.
55+
ForegroundColor *Color `json:"ForegroundColor,omitempty"`
56+
// Gets/sets subject format usage.
57+
UseDigitalSubjectFormat bool `json:"UseDigitalSubjectFormat"`
58+
// Gets/sets subject format.
59+
DigitalSubjectFormat []SignatureSubjectNameElements `json:"DigitalSubjectFormat,omitempty"`
5060
}

signature_subject_name_elements.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
*
3+
* Copyright (c) 2025 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+
// SignatureSubjectNameElements : Represents an enumeration of available SubjectNameElements.
24+
type SignatureSubjectNameElements string
25+
26+
// List of SignatureSubjectNameElements
27+
const (
28+
SignatureSubjectNameElementsCN SignatureSubjectNameElements = "CN"
29+
SignatureSubjectNameElementsO SignatureSubjectNameElements = "O"
30+
SignatureSubjectNameElementsL SignatureSubjectNameElements = "L"
31+
SignatureSubjectNameElementsOU SignatureSubjectNameElements = "OU"
32+
SignatureSubjectNameElementsS SignatureSubjectNameElements = "S"
33+
SignatureSubjectNameElementsC SignatureSubjectNameElements = "C"
34+
SignatureSubjectNameElementsE SignatureSubjectNameElements = "E"
35+
)
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"path"
7+
"path/filepath"
8+
9+
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
10+
)
11+
12+
const (
13+
LOCAL_FOLDER = "C:\\Samples"
14+
REMOTE_FOLDER = "Your_Temp_Pdf_Cloud"
15+
PDF_DOCUMENT_NAME = "sample.pdf"
16+
PDF_OUTPUT = "output_sample.pdf"
17+
PAGE_NUMBER = 1
18+
19+
ANNOTATION_ID = "GE5TAOZTHA2CYMRZGUWDIMBZFQZTEMA"
20+
21+
NEW_HL_ANNOTATION_TEXT = "NEW HIGHLIGHT TEXT ANNOTATION"
22+
NEW_HL_ANNOTATION_DESCRIPTION = "This is a sample highlight annotation"
23+
NEW_HL_ANNOTATION_SUBJECT = "Highlight Text Box Subject"
24+
NEW_HL_ANNOTATION_CONTENTS = "Highlight annotation sample contents"
25+
26+
NEW_SO_ANNOTATION_TEXT = "NEW STRIKEOUT TEXT ANNOTATION"
27+
NEW_SO_ANNOTATION_DESCRIPTION = "This is a sample strikeout annotation"
28+
NEW_SO_ANNOTATION_SUBJECT = "Strikeout Text Box Subject"
29+
NEW_SO_ANNOTATION_CONTENTS = "Strikeout annotation sample contents"
30+
31+
NEW_UL_ANNOTATION_TEXT = "NEW UNDERLINE TEXT ANNOTATION"
32+
NEW_UL_ANNOTATION_DESCRIPTION = "This is a sample underline annotation"
33+
NEW_UL_ANNOTATION_SUBJECT = "Underline Text Box Subject"
34+
NEW_UL_ANNOTATION_CONTENTS = "Underline annotation sample contents"
35+
36+
NEW_FT_ANNOTATION_TEXT = "NEW FREE TEXT ANNOTATION"
37+
NEW_FT_ANNOTATION_DESCRIPTION = "This is a sample annotation"
38+
NEW_FT_ANNOTATION_SUBJECT = "Free Text Box Subject"
39+
NEW_FT_ANNOTATION_CONTENTS = "Free Text annotation sample contents"
40+
41+
REPLACED_CONTENT = "This is a replaced sample annotation"
42+
)
43+
44+
func InitPdfApi() *asposepdfcloud.PdfApiService {
45+
// Initialize Credentials and create Pdf.Cloud service object
46+
AppSID := "*********" // Your Application SID
47+
AppKey := "*********" // Your Application Key
48+
49+
pdfApi := asposepdfcloud.NewPdfApiService(AppSID, AppKey, "")
50+
return pdfApi
51+
}
52+
53+
func UploadFile(pdf_api *asposepdfcloud.PdfApiService, name string) {
54+
// Upload local file to the Pdf.Cloud folder
55+
args := map[string]interface{}{
56+
"folder": REMOTE_FOLDER,
57+
}
58+
file, _ := os.Open(filepath.Join(LOCAL_FOLDER, name))
59+
_, httpResponse, err := pdf_api.UploadFile(filepath.Join(REMOTE_FOLDER, name), file, args)
60+
if err != nil {
61+
fmt.Println(err.Error())
62+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
63+
fmt.Println("Unexpected error!")
64+
} else {
65+
fmt.Println("Result file'" + name + "' successfully uploaded!")
66+
}
67+
}
68+
69+
func SaveByteArrayToFile(local_folder string, file_name string, data []byte) {
70+
// Save byte array data to the local folder
71+
fileName := path.Join(local_folder, file_name)
72+
f, err := os.Create(fileName)
73+
if err != nil {
74+
fmt.Println(err)
75+
} else {
76+
size, err := f.Write(data)
77+
if err != nil || size == 0 {
78+
fmt.Println("Failures in downloading result!")
79+
} else {
80+
fmt.Println("Result file'" + fileName + "' successfully downloaded!")
81+
}
82+
}
83+
}
84+
85+
func DownloadFile(pdf_api *asposepdfcloud.PdfApiService, name string, output_name string, prefix string) {
86+
// Download modified Pdf document to local folder from the Pdf.Cloud folder
87+
args := map[string]interface{}{
88+
"folder": REMOTE_FOLDER,
89+
}
90+
result_data, _, _ := pdf_api.DownloadFile(path.Join(REMOTE_FOLDER, name), args)
91+
SaveByteArrayToFile(LOCAL_FOLDER, prefix+output_name, result_data)
92+
}
93+
94+
func DeletePopupAnnotations(pdf_api *asposepdfcloud.PdfApiService, document_name string, parent_annotation string) {
95+
// Delete popup annotations for typed parent annotation in the page in the PDF document.
96+
args := map[string]interface{}{
97+
"folder": REMOTE_FOLDER,
98+
}
99+
result, httpResponse, err := pdf_api.GetDocumentPopupAnnotations(document_name, args)
100+
if err != nil {
101+
fmt.Println(err.Error())
102+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
103+
fmt.Println("Unexpected error!")
104+
} else {
105+
for _, annotation := range result.Annotations.List {
106+
if annotation.Parent.Id == parent_annotation {
107+
_, response, err2 := pdf_api.DeleteAnnotation(document_name, annotation.Id, args)
108+
if err2 != nil {
109+
fmt.Println(err2)
110+
} else if response.StatusCode < 200 || response.StatusCode > 299 {
111+
fmt.Println("delete_popup_annotations(): Failed to delete popup annotation in the document.")
112+
} else {
113+
fmt.Println("delete_popup_annotations(): popup annotation id = '" + annotation.Id + "' for '" + annotation.Contents + "' deleted in the document '" + PDF_DOCUMENT_NAME + "'.")
114+
}
115+
}
116+
}
117+
}
118+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package main
2+
3+
func main() {
4+
pdfApi := InitPdfApi()
5+
6+
AppendHighlightAnnotation(pdfApi, PDF_DOCUMENT_NAME, PAGE_NUMBER, PDF_OUTPUT, "add_highlight_annotation_", REMOTE_FOLDER)
7+
8+
AppendStrikeoutAnnotation(pdfApi, PDF_DOCUMENT_NAME, PAGE_NUMBER, PDF_OUTPUT, "add_strikeout_annotation_", REMOTE_FOLDER)
9+
10+
AppendTextAnnotation(pdfApi, PDF_DOCUMENT_NAME, PAGE_NUMBER, PDF_OUTPUT, "add_freetext_annotation_", REMOTE_FOLDER)
11+
12+
AppendUnderlineAnnotation(pdfApi, PDF_DOCUMENT_NAME, PAGE_NUMBER, PDF_OUTPUT, "add_underline_annotation_", REMOTE_FOLDER)
13+
14+
annotation_id := RequestAnnotations(pdfApi, PDF_DOCUMENT_NAME, PAGE_NUMBER, REMOTE_FOLDER)
15+
RequestAnnotationById(pdfApi, PDF_DOCUMENT_NAME, annotation_id, REMOTE_FOLDER)
16+
17+
DeleteAnnotation(pdfApi, PDF_DOCUMENT_NAME, ANNOTATION_ID, PDF_OUTPUT)
18+
19+
DeletePageAnnotations(pdfApi, PDF_DOCUMENT_NAME, PAGE_NUMBER, PDF_OUTPUT)
20+
21+
ModifyAnnotation(pdfApi, PDF_DOCUMENT_NAME, PDF_OUTPUT, ANNOTATION_ID, REMOTE_FOLDER)
22+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
7+
)
8+
9+
func DeletePageAnnotations(pdf_api *asposepdfcloud.PdfApiService, document_name string, page_num int32, output_name string) {
10+
// Delete annotation from the PDF document.
11+
UploadFile(pdf_api, document_name)
12+
args := map[string]interface{}{
13+
"folder": REMOTE_FOLDER,
14+
}
15+
16+
_, httpResponse, err := pdf_api.DeletePageAnnotations(document_name, page_num, args)
17+
if err != nil {
18+
fmt.Println(err.Error())
19+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
20+
fmt.Println("DeletePageAnnotations(): Failed to delete annotation from the document.")
21+
} else {
22+
fmt.Println("DeletePageAnnotations(): annotations on page '", page_num, "' deleted from the document '"+document_name+"'.")
23+
DownloadFile(pdf_api, document_name, output_name, "del_page_annotations_")
24+
}
25+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
7+
)
8+
9+
func DeleteAnnotation(pdf_api *asposepdfcloud.PdfApiService, document_name string, annotation_id string, output_name string) {
10+
// Delete annotation from the PDF document.
11+
UploadFile(pdf_api, document_name)
12+
args := map[string]interface{}{
13+
"folder": REMOTE_FOLDER,
14+
}
15+
16+
_, httpResponse, err := pdf_api.DeleteAnnotation(document_name, annotation_id, args)
17+
if err != nil {
18+
fmt.Println(err.Error())
19+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
20+
fmt.Println("DeleteAnnotation(): Failed to delete annotation from the document page.")
21+
} else {
22+
DeletePopupAnnotations(pdf_api, document_name, annotation_id)
23+
fmt.Println("DdeleteAnnotation(): annotation '" + annotation_id + "' deleted from the document '" + document_name + "'.")
24+
DownloadFile(pdf_api, document_name, output_name, "del_annotation_")
25+
}
26+
}

0 commit comments

Comments
 (0)