Skip to content

Commit

Permalink
Aspose.PDF for Go via C++: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrAndriienko committed Dec 9, 2024
1 parent 7cf1adb commit 1944761
Show file tree
Hide file tree
Showing 40 changed files with 1,850 additions and 0 deletions.
110 changes: 110 additions & 0 deletions english/go-cpp/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: "Aspose.PDF for Go via C++"
description: "Aspose.PDF for Go via C++"
keywords: "Go, Golang, PDF, PDF toolkit, pdf, convert, processing"
tags: ['pdf-to-jpg', 'pdf-to-png', 'pdf-convert', 'pdf-tools']
weight: 40
url: /go-cpp/
type: docs
is_root: true
---

> Aspose.PDF for Go via C++ allows developers manipulate them PDF files directly in the Go.
# Types

## Document
Document represents a PDF-document.

```go
type Document struct {
}
```

# Functions

## Convert from PDF functions

| Function | Description |
| -------- | ----------- |
| [ExtractText](./convert/extracttext/) | Return the PDF-document contents as plain text. |
| [SaveDocX](./convert/savedocx/) | Convert and save the previously opened PDF-document as DocX-document. |
| [SaveDoc](./convert/savedoc/) | Convert and save the previously opened PDF-document as Doc-document. |
| [SaveXlsX](./convert/savexlsx/) | Convert and save the previously opened PDF-document as XlsX-document. |
| [SaveTxt](./convert/savetxt/) | Convert and save the previously opened PDF-document as Txt-document. |
| [SavePptX](./convert/savepptx/) | Convert and save the previously opened PDF-document as PptX-document. |
| [SaveXps](./convert/savexps/) | Convert and save the previously opened PDF-document as Xps-document. |
| [SaveTeX](./convert/savetex/) | Convert and save the previously opened PDF-document as TeX-document. |
| [SaveEpub](./convert/saveepub/) | Convert and save the previously opened PDF-document as Epub-document. |
| [PageToJpg](./convert/pagetojpg/) | Convert and save the specified page as Jpg-image. |
| [PageToPng](./convert/pagetopng/) | Convert and save the specified page as Png-image. |
| [PageToBmp](./convert/pagetobmp/) | Convert and save the specified page as Bmp-image. |
| [PageToTiff](./convert/pagetotiff/) | Convert and save the specified page as Tiff-image. |
| [PageToSvg](./convert/pagetosvg/) | Convert and save the specified page as Svg-image. |
| [PageToPdf](./convert/pagetopdf/) | Convert and save the specified page as Pdf. |
| [PageToDICOM](./convert/pagetodicom/) | Convert and save the specified page as DICOM-image. |


## Organize PDF functions

| Function | Description |
| -------- | ----------- |
| [Optimize](./organize/optimize/) | Optimize PDF-document content. |
| [OptimizeResource](./organize/optimizeresource/) | Optimize resources of PDF-document. |
| [Grayscale](./organize/grayscale/) | Convert PDF-document to black and white. |
| [Rotate](./organize/rotate/) | Rotate PDF-document. |
| [SetBackground](./organize/setbackground/) | Set PDF-document background color. |
| [Repair](./organize/repair/) | Repaire PDF-document. |
| [PageRotate](./organize/pagerotate/) | Rotate page. |
| [PageSetSize](./organize/pagesetsize/) | Set size of page. |
| [PageGrayscale](./organize/pagegrayscale/) | Convert page to black and white. |
| [PageAddText](./organize/pageaddtext/) | Add text on page. |


## Core PDF functions

| Function | Description |
| -------- | ----------- |
| [New](./core/new/) | Create a new PDF-document. |
| [Open](./core/open/) | Open a PDF-document with filename. |
| [Save](./core/save/) | Save the previously opened PDF-document. |
| [SaveAs](./core/saveas/) | Save the previously opened PDF-document with new filename. |
| [Close](./core/close/) | Release allocated resources for PDF-document. |
| [SetLicense](./core/setlicense/) | Set license with filename. |
| [PageAdd](./core/pageadd/) | Add new page in PDF-document. |
| [PageInsert](./core/pageinsert/) | Insert new page at the specified position in PDF-document. |
| [PageDelete](./core/pagedelete/) | Delete specified page in PDF-document. |
| [PageCount](./core/pagecount/) | Return page count in PDF-document. |


# Constants

## Enumeration of possible rotation values.
```go
const (
RotationNone int32 = 0 // Non-rotated.
RotationOn90 int32 = 1 // Rotated on 90 degrees clockwise.
RotationOn180 int32 = 2 // Rotated on 180 degrees.
RotationOn270 int32 = 3 // Rotated on 270 degrees clockwise.
RotationOn360 int32 = 4 // Rotated on 360 degrees clockwise.
)
```

## Enumeration of possible page size values.
```go
const (
PageSizeA0 int32 = 0 // A0 size.
PageSizeA1 int32 = 1 // A1 size.
PageSizeA2 int32 = 2 // A2 size.
PageSizeA3 int32 = 3 // A3 size.
PageSizeA4 int32 = 4 // A4 size.
PageSizeA5 int32 = 5 // A5 size.
PageSizeA6 int32 = 6 // A6 size.
PageSizeB5 int32 = 7 // B5 size.
PageSizePageLetter int32 = 8 // PageLetter size.
PageSizePageLegal int32 = 9 // PageLegal size.
PageSizePageLedger int32 = 10 // PageLedger size.
PageSizeP11x17 int32 = 11 // P11x17 size.
)
```

34 changes: 34 additions & 0 deletions english/go-cpp/convert/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Convert from PDF functions"
second_title: Aspose.PDF for Go via C++
description: "Functions for converting from PDF files."
type: docs
url: /go-cpp/convert/
---

## Convert from PDF functions

| Name | Description |
| -------------- | -------------- |
| [ExtractText](./convert/extracttext/) | Return the PDF-document contents as plain text. |
| [SaveDocX](./convert/savedocx/) | Convert and save the previously opened PDF-document as DocX-document. |
| [SaveDoc](./convert/savedoc/) | Convert and save the previously opened PDF-document as Doc-document. |
| [SaveXlsX](./convert/savexlsx/) | Convert and save the previously opened PDF-document as XlsX-document. |
| [SaveTxt](./convert/savetxt/) | Convert and save the previously opened PDF-document as Txt-document. |
| [SavePptX](./convert/savepptx/) | Convert and save the previously opened PDF-document as PptX-document. |
| [SaveXps](./convert/savexps/) | Convert and save the previously opened PDF-document as Xps-document. |
| [SaveTeX](./convert/savetex/) | Convert and save the previously opened PDF-document as TeX-document. |
| [SaveEpub](./convert/saveepub/) | Convert and save the previously opened PDF-document as Epub-document. |
| [PageToJpg](./convert/pagetojpg/) | Convert and save the specified page as Jpg-image. |
| [PageToPng](./convert/pagetopng/) | Convert and save the specified page as Png-image. |
| [PageToBmp](./convert/pagetobmp/) | Convert and save the specified page as Bmp-image. |
| [PageToTiff](./convert/pagetotiff/) | Convert and save the specified page as Tiff-image. |
| [PageToSvg](./convert/pagetosvg/) | Convert and save the specified page as Svg-image. |
| [PageToPdf](./convert/pagetopdf/) | Convert and save the specified page as Pdf. |
| [PageToDICOM](./convert/pagetodicom/) | Convert and save the specified page as DICOM-image. |


## Detailed Description

Functions for converting from PDF files.

47 changes: 47 additions & 0 deletions english/go-cpp/convert/extracttext/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "ExtractText"
second_title: Aspose.PDF for Go via C++
description: "Return the PDF-document contents as plain text."
type: docs
url: /go-cpp/convert/extracttext/
---

_Return the PDF-document contents as plain text._

```go
func (document *Document) ExtractText() (string, error)
```

**Parameters**:

**Return**:
* **string** - PDF-document contents as plain text
* **error** - contains an error or nil if absent


**Example**:
```go
package main

import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"
import "fmt"

func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)

}
// ExtractText() returns PDF-document contents as plain text
txt, err := pdf.ExtractText()
if err != nil {
log.Fatal(err)
}
// Print
fmt.Println("Extracted text:\n", txt)
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
```
44 changes: 44 additions & 0 deletions english/go-cpp/convert/pagetobmp/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "PageToBmp"
second_title: Aspose.PDF for Go via C++
description: "Convert and save the specified page as Bmp-image."
type: docs
url: /go-cpp/convert/pagetobmp/
---

_Convert and save the specified page as Bmp-image._

```go
func (document *Document) PageToBmp(num int32, resolution_dpi int32, filename string) error
```

**Parameters**:
* **num** - page number of the PDF-document
* **resolution_dpi** - resolution in DPI of the resulting file

**Return**:
* **error** - contains an error or nil if absent


**Example**:
```go
package main

import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"

func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)
}
// PageToBmp(num int32, resolution_dpi int32, filename string) saves the specified page as Bmp-image file
err = pdf.PageToBmp(1, 100, "sample_page1.bmp")
if err != nil {
log.Fatal(err)
}
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
```
44 changes: 44 additions & 0 deletions english/go-cpp/convert/pagetodicom/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "PageToDICOM"
second_title: Aspose.PDF for Go via C++
description: "Convert and save the specified page as DICOM-image."
type: docs
url: /go-cpp/convert/pagetodicom/
---

_Convert and save the specified page as DICOM-image._

```go
func (document *Document) PageToDICOM(num int32, resolution_dpi int32, filename string) error
```

**Parameters**:
* **num** - page number of the PDF-document
* **resolution_dpi** - resolution in DPI of the resulting file

**Return**:
* **error** - contains an error or nil if absent


**Example**:
```go
package main

import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"

func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)
}
// PageToDICOM(num int32, resolution_dpi int32, filename string) saves the specified page as DICOM-image file
err = pdf.PageToDICOM(1, 100, "sample_page1.dcm")
if err != nil {
log.Fatal(err)
}
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
```
44 changes: 44 additions & 0 deletions english/go-cpp/convert/pagetojpg/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "PageToJpg"
second_title: Aspose.PDF for Go via C++
description: "Convert and save the specified page as Jpg-image."
type: docs
url: /go-cpp/convert/pagetojpg/
---

_Convert and save the specified page as Jpg-image._

```go
func (document *Document) PageToJpg(num int32, resolution_dpi int32, filename string) error
```

**Parameters**:
* **num** - page number of the PDF-document
* **resolution_dpi** - resolution in DPI of the resulting file

**Return**:
* **error** - contains an error or nil if absent


**Example**:
```go
package main

import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"

func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)
}
// PageToJpg(num int32, resolution_dpi int32, filename string) saves the specified page as Jpg-image file
err = pdf.PageToJpg(1, 100, "sample_page1.jpg")
if err != nil {
log.Fatal(err)
}
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
```
43 changes: 43 additions & 0 deletions english/go-cpp/convert/pagetopdf/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: "PageToPdf"
second_title: Aspose.PDF for Go via C++
description: "Convert and save the specified page as Pdf."
type: docs
url: /go-cpp/convert/pagetopdf/
---

_Convert and save the specified page as Pdf._

```go
func (document *Document) PageToPdf(num int32, filename string) error
```

**Parameters**:
* **num** - page number of the PDF-document

**Return**:
* **error** - contains an error or nil if absent


**Example**:
```go
package main

import "github.com/aspose-pdf/aspose-pdf-go-cpp"
import "log"

func main() {
// Open(filename string) opens a PDF-document with filename
pdf, err := asposepdf.Open("sample.pdf")
if err != nil {
log.Fatal(err)
}
// PageToPdf(num int32, filename string) saves the specified page as Pdf-file
err = pdf.PageToPdf(1, "sample_page1.pdf")
if err != nil {
log.Fatal(err)
}
// Close() releases allocated resources for PDF-document
defer pdf.Close()
}
```
Loading

0 comments on commit 1944761

Please sign in to comment.