Skip to content

Commit bc239a3

Browse files
Aspose.PDF for Go via C++ 25.9
1 parent 48d367e commit bc239a3

13 files changed

+182
-16
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ Contains unique features for converting PDF to other formats.
2121

2222
- **Microsoft Office:** DOC, DOCX, XLSX, PPTX, DOCX with Enhanced Recognition Mode (fully editable tables and paragraphs)
2323
- **Images:** JPEG, PNG, BMP, TIFF
24-
- **Others:** EPUB, DICOM, SVG, XPS, TEX, TXT, MD, N-UP PDF, BOOKLET PDF
24+
- **Others:** EPUB, DICOM, SVG, SVG(ZIP), XPS, TEX, TXT, MD, N-UP PDF, BOOKLET PDF
2525
- **Export with AcroForm:** FDF, XFDF, XML
2626

27+
### Metadata
28+
29+
- **Product Info:** JSON with product name, version, release date, and license status
30+
2731
## Platforms
2832

2933
Implemented support for Linux x64, macOS x86_64, macOS arm64 and Windows x64 platforms. Used [cgo](https://go.dev/wiki/cgo).
@@ -258,4 +262,4 @@ Applying a license to enable full functionality of the Aspose.PDF for Go using a
258262
}
259263
```
260264
261-
[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/pdf/go-cpp/) | [Docs](https://docs.aspose.com/pdf/go-cpp/) | [Demos](https://products.aspose.app/pdf/family) | [API Reference](https://reference.aspose.com/pdf/go-cpp/) | [Examples](https://github.com/aspose-pdf/aspose-pdf-go-cpp/) | [Blog](https://blog.aspose.com/category/pdf/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf) | [Temporary License](https://purchase.aspose.com/temporary-license)
265+
[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/pdf/go-cpp/) | [Docs](https://docs.aspose.com/pdf/go-cpp/) | [Demos](https://products.aspose.app/pdf/family) | [API Reference](https://reference.aspose.com/pdf/go-cpp/) | [Examples](https://github.com/aspose-pdf/aspose-pdf-go-cpp/) | [Blog](https://blog.aspose.com/category/pdf/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf) | [Temporary License](https://purchase.aspose.com/temporary-license) | [GitHub.com](https://github.com/aspose-pdf/aspose-pdf-go-cpp) | [pkg.go.dev](https://pkg.go.dev/github.com/aspose-pdf/aspose-pdf-go-cpp)

asposepdf_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,32 @@ func TestAppendPages(t *testing.T) {
334334
}
335335
}
336336

337+
func TestAbout(t *testing.T) {
338+
// Create a new document instance
339+
doc, err := New()
340+
if err != nil {
341+
t.Fatalf("New(): %v", err)
342+
}
343+
defer doc.Close()
344+
345+
// Call About()
346+
info, err := doc.About()
347+
if err != nil {
348+
t.Fatalf("About(): %v", err)
349+
}
350+
351+
// Validate required fields (basic presence checks)
352+
if info.Product == "" {
353+
t.Errorf("Product field is empty")
354+
}
355+
if info.Version == "" {
356+
t.Errorf("Version field is empty")
357+
}
358+
359+
// Log full structure
360+
t.Logf("About result: %+v", info)
361+
}
362+
337363
func TestExtractText(t *testing.T) {
338364
// Create a new document
339365
doc, err := New()
@@ -392,6 +418,7 @@ func TestConvertFromPDF(t *testing.T) {
392418
{"SaveMarkdown", func(doc *Document, path string) error { return doc.SaveMarkdown(path) }},
393419
{"SaveTiff", func(doc *Document, path string) error { return doc.SaveTiff(path) }},
394420
{"SaveTiffWithDPI", func(doc *Document, path string) error { return doc.SaveTiff(path, 150) }},
421+
{"SaveSvgZip", func(doc *Document, path string) error { return doc.SaveSvgZip(path) }},
395422
{"ExportFdf", func(doc *Document, path string) error { return doc.ExportFdf(path) }},
396423
{"ExportXfdf", func(doc *Document, path string) error { return doc.ExportXfdf(path) }},
397424
{"ExportXml", func(doc *Document, path string) error { return doc.ExportXml(path) }},

doc.go

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@
55
// Features
66
//
77
// PDF Processing
8-
// Core operation: New, Open, Save, SaveAs, Close, SetLicense, WordCount, CharacterCount
9-
// Page core operation: Add, Insert, Delete, Count, WordCount, CharacterCount, IsBlank
10-
// Organize: Optimize, OptimizeResource, Grayscale, Rotate, SetBackground, Repair
8+
// Main core operation: New, Open, Save, SaveAs, Close, SetLicense, Append, AppendPages, MergeDocuments, SplitDocument, SplitAtPage
9+
// Other core operation: WordCount, CharacterCount, Bytes
10+
// Page main core operation: Add, Insert, Delete, Count
11+
// Page other core operation: WordCount, CharacterCount, IsBlank
12+
// Organize: Optimize, OptimizeResource, Grayscale, Rotate, SetBackground, Repair, Flatten
1113
// Page organize: Rotate, SetSize, Grayscale, AddText
14+
// Remove operation: RemoveAnnotations, RemoveAttachments, RemoveBlankPages, RemoveBookmarks, RemoveHiddenText, RemoveImages, RemoveJavaScripts
15+
// Page remove operation: PageRemoveAnnotations, PageRemoveHiddenText, PageRemoveImages
1216
// Others: Get contents as plain text
1317
//
1418
// PDF converting and saving
15-
// Microsoft Office: DOC, DOCX, XLSX, PPTX
19+
// Microsoft Office: DOC, DOCX, XLSX, PPTX, DOCX with Enhanced Recognition Mode (fully editable tables and paragraphs)
1620
// Images: JPEG, PNG, BMP, TIFF
17-
// Others: EPUB, DICOM, SVG, XPS, TEX, TXT
21+
// Others: EPUB, DICOM, SVG, SVG(ZIP), XPS, TEX, TXT, MD, N-UP PDF, BOOKLET PDF
22+
// Export with AcroForm: FDF, XFDF, XML
23+
//
24+
// Metadata
25+
// Product Info: JSON with product name, version, release date, and license status
1826
//
1927
// Platforms
2028
//
@@ -107,11 +115,31 @@
107115
// The test run from the root package folder:
108116
// go test -v
109117
//
110-
// Aspose home
118+
// License
119+
//
120+
// - The Go source code is licensed under the MIT License.
121+
//
122+
// - The shared native libraries (DLL, SO, DYLIB) are proprietary and require a commercial license.
123+
//
124+
// Evaluation version limitations:
125+
//
126+
// - Documents created with an evaluation watermark.
127+
//
128+
// - Limit on number of pages processed (first 4 pages).
111129
//
112-
// https://www.aspose.com
130+
// For production use, a commercial license is required.
113131
//
114-
// GitHub.com
132+
// Resources
115133
//
116-
// https://github.com/aspose-pdf/aspose-pdf-go-cpp
134+
// Aspose home: https://www.aspose.com
135+
// Product Page: https://products.aspose.com/pdf/go-cpp/
136+
// Docs: https://docs.aspose.com/pdf/go-cpp/
137+
// Demos: https://products.aspose.app/pdf/family
138+
// API Reference: https://reference.aspose.com/pdf/go-cpp/
139+
// Examples: https://github.com/aspose-pdf/aspose-pdf-go-cpp/
140+
// Blog: https://blog.aspose.com/category/pdf/
141+
// Free Support: https://forum.aspose.com/c/pdf
142+
// Temporary License: https://purchase.aspose.com/temporary-license
143+
// GitHub.com: https://github.com/aspose-pdf/aspose-pdf-go-cpp
144+
// pkg.go.dev: https://pkg.go.dev/github.com/aspose-pdf/aspose-pdf-go-cpp
117145
package asposepdf

document.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package asposepdf
88
import "C"
99

1010
import (
11+
"encoding/json"
1112
"errors"
1213
"fmt"
1314
"strings"
@@ -205,6 +206,33 @@ func (document *Document) Close() error {
205206
}
206207
}
207208

209+
// About returns metadata information about the Aspose.PDF for Go via C++.
210+
//
211+
// The metadata is returned as a ProductInfo struct, deserialized from a JSON string.
212+
// It includes product name, version, release date, licensing status, and related details.
213+
//
214+
// See also: product_info.go
215+
//
216+
// Example:
217+
//
218+
// info, err := pdf.About()
219+
func (document *Document) About() (*ProductInfo, error) {
220+
var err *C.char
221+
jsonStr := C.PDFDocument_About(document.pdf, &err)
222+
err_str := C.GoString(err)
223+
C.c_free_string(err)
224+
if err_str != ERR_OK {
225+
return nil, errors.New(err_str)
226+
}
227+
defer C.c_free_string(jsonStr)
228+
goJSON := C.GoString(jsonStr)
229+
var info ProductInfo
230+
if e := json.Unmarshal([]byte(goJSON), &info); e != nil {
231+
return nil, e
232+
}
233+
return &info, nil
234+
}
235+
208236
// Save saves previously opened PDF-document.
209237
//
210238
// Example:
@@ -876,6 +904,25 @@ func (document *Document) SaveTiff(filename string, resolution_dpi ...int32) err
876904
}
877905
}
878906

907+
// SaveSvgZip saves previously opened PDF-document as SVG-archive with filename.
908+
//
909+
// Example:
910+
//
911+
// err := pdf.SaveSvgZip("filename.zip")
912+
func (document *Document) SaveSvgZip(filename string) error {
913+
var err *C.char
914+
_filename := C.CString(filename)
915+
defer C.free(unsafe.Pointer(_filename))
916+
C.PDFDocument_Save_SvgZip(document.pdf, _filename, &err)
917+
err_str := C.GoString(err)
918+
C.c_free_string(err)
919+
if err_str != ERR_OK {
920+
return errors.New(err_str)
921+
} else {
922+
return nil
923+
}
924+
}
925+
879926
// ExportFdf exports from previously opened PDF-document with AcroForm to FDF-document with filename.
880927
//
881928
// Example:

extern_c.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern "C" {
1818
ASPOSE_PDF_RUST_SHARED_API void* PDFDocument_New(const char** error);
1919
ASPOSE_PDF_RUST_SHARED_API void* PDFDocument_Open(const char* filename, const char** error);
2020
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Release(void* pdfdocumentclass, const char** error);
21+
ASPOSE_PDF_RUST_SHARED_API const char* PDFDocument_About(void* pdfdocumentclass, const char** error);
2122
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_set_License(void* pdfdocumentclass, const char* filename, const char** error);
2223
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Save(void* pdfdocumentclass, const char** error);
2324
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Save_As(void* pdfdocumentclass, const char* filename, const char** error);
@@ -55,6 +56,7 @@ extern "C" {
5556
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Save_NUp(void* pdfdocumentclass, const char* filename, int columns, int rows, const char** error);
5657
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Save_Tiff(void* pdfdocumentclass, int resolutionDPI, const char* filename, const char** error);
5758
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Save_DocXEnhanced(void* pdfdocumentclass, const char* filename, const char** error);
59+
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Save_SvgZip(void* pdfdocumentclass, const char* filename, const char** error);
5860
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Export_Fdf(void* pdfdocumentclass, const char* filename, const char** error);
5961
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Export_Xfdf(void* pdfdocumentclass, const char* filename, const char** error);
6062
ASPOSE_PDF_RUST_SHARED_API void PDFDocument_Export_Xml(void* pdfdocumentclass, const char* filename, const char** error);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8cea1f259c6337290a230541bf7e3e09b291bcc0260abc64f77e32f82a0f1e6c
1+
c50ee5edf4311e4cc4b967a7ad4fcb82b3f8453910f0f2129ba7cd2bef42775e
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
606a7be4cbeb77f1fa65f3737d32b40cf78dcaa9b107468e3601bf8eacd9e7cd
1+
9e763de09a67deb8cbc55ab56e0918db782721e9310c7f7b7adcb114853af754
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24ae016ba017499296f2dcc755a3909aa5bfda7fa3694682bfde5aacb60bd494
1+
ffcd7967054ddfe774da4250c2aa8c69251adf076a107b3397e4bd6fa482f08f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
23e30d13c5616ca14a35be5847dc8bf3fd1feaa3eec062c64f33ed3ba1b6df20
1+
02d8d80bb0d7df348a473dfb166f756355810ea1fd3beaad2f8a4ad456d7413f

product_info.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package asposepdf
2+
3+
// ProductInfo contains metadata about the Aspose.PDF for Go via C++.
4+
type ProductInfo struct {
5+
Product string `json:"product"` // Name
6+
Family string `json:"family"` // Family (e.g., "Aspose.PDF")
7+
Version string `json:"version"` // Version
8+
ReleaseDate string `json:"releasedate"` // Release date in ISO format (YYYY-MM-DD)
9+
Producer string `json:"producer"` // Producer
10+
IsLicensed bool `json:"islicensed"` // License status (true if licensed)
11+
}

0 commit comments

Comments
 (0)