asposepdf

package module
v1.25.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2025 License: MIT Imports: 5 Imported by: 0

README

Aspose.PDF for Go via C++

The package asposepdf is a powerful toolkit that allows developers to manipulate PDF files directly and helps do various tasks for PDF. Contains unique features for converting PDF to other formats.

Features

PDF Processing
  • Main core operation: New, Open, Save, SaveAs, Close, SetLicense, Append, AppendPages, MergeDocuments, SplitDocument, SplitAtPage
  • Other core operation: WordCount, CharacterCount, Bytes
  • Page main core operation: Add, Insert, Delete, Count
  • Page other core operation: WordCount, CharacterCount, IsBlank
  • Organize: Optimize, OptimizeResource, Grayscale, Rotate, SetBackground, Repair, Flatten
  • Page organize: Rotate, SetSize, Grayscale, AddText
  • Remove operation: RemoveAnnotations, RemoveAttachments, RemoveBlankPages, RemoveBookmarks, RemoveHiddenText, RemoveImages, RemoveJavaScripts
  • Page remove operation: PageRemoveAnnotations, PageRemoveHiddenText, PageRemoveImages
  • Others: Get contents as plain text
PDF converting and saving
  • Microsoft Office: DOC, DOCX, XLSX, PPTX
  • Images: JPEG, PNG, BMP, TIFF
  • Others: EPUB, DICOM, SVG, XPS, TEX, TXT, MD, N-UP PDF, BOOKLET PDF
  • Export with AcroForm: FDF, XFDF, XML

Platforms

Implemented support for Linux x64, macOS x86_64, macOS arm64 and Windows x64 platforms. Used cgo.

The platform-specific version of the dynamic library from the 'lib'-folder in the package's root directory is required for distributing the resulting application:

  • libAsposePDFforGo_linux_amd64.so for Linux x64 platform
  • libAsposePDFforGo_darwin_arm64.dylib for macOS arm64 platform
  • libAsposePDFforGo_darwin_amd64.dylib for macOS x86_64 platform
  • AsposePDFforGo_windows_amd64.dll for Windows x64 platform.

Windows x64 platform requires MinGW-W64 installed.

Installation

This package includes a large file which is stored as a bzip2 archive.

  1. Add the asposepdf package to Your Project:

    go get github.com/aspose-pdf/aspose-pdf-go-cpp@latest
    
  2. Generate the large file:

  • macOS and linux
  1. Open Terminal

  2. List the folders of the github.com/aspose-pdf within the Go module cache:

    ls $(go env GOMODCACHE)/github.com/aspose-pdf/
    
  3. Change curent folder to the specific version folder of the package obtained in the previous step:

    cd $(go env GOMODCACHE)/github.com/aspose-pdf/aspose-pdf-go-cpp@vx.x.x
    

    Replace @vx.x.x with the actual package version.

  4. Run go generate with superuser privileges:

    sudo go generate
    
  • Windows
  1. Open Command Prompt

  2. List the folders of the github.com/aspose-pdf within the Go module cache:

    for /f "delims=" %G in ('go env GOMODCACHE') do for /d %a in ("%G\github.com\aspose-pdf\*") do echo %~fa
    
  3. Change curent folder to the specific version folder of the package obtained in the previous step:

    cd <specific version folder of the package>
    
  4. Run go generate:

    go generate
    
  5. Add specific version folder of the package to the %PATH% environment variable:

    setx PATH "%PATH%;<specific version folder of the package>\lib\"
    

    Replace <specific version folder of the package> with the actual path obtained from step 2.

Quick Start

All code snippets are contained in the snippet.

Hello World!
package main

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

func main() {
	// Create new PDF-document
	pdf, err := asposepdf.New()
	if err != nil {
		log.Fatal(err)
	}
	// Add new page
	err = pdf.PageAdd()
	if err != nil {
		log.Fatal(err)
	}
	// Set page size A4
	err = pdf.PageSetSize(1, asposepdf.PageSizeA4)
	if err != nil {
		log.Fatal(err)
	}
	// Add text on first page
	err = pdf.PageAddText(1, "Hello World!")
	if err != nil {
		log.Fatal(err)
	}
	// Save PDF-document with "hello.pdf" name
	err = pdf.SaveAs("hello.pdf")
	if err != nil {
		log.Fatal(err)
	}
	// Release allocated resources
	defer pdf.Close()
}
Save PDF as Office Formats

One of the most popular features of Aspose.PDF for Go via C++ is to convert PDF documents to other formats without needing to understand the underlying structure of the resultant format.

Give the following snippet a try with your samples:

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)
	}
	// SaveDocX(filename string) saves previously opened PDF-document as DocX-document with filename
	err = pdf.SaveDocX("sample.docx")
	if err != nil {
		log.Fatal(err)
	}
	// Close() releases allocated resources for PDF-document
	defer pdf.Close()
}
Extract Text From Whole PDF
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()
}

Testing

The test run from the root package folder:

go test -v

License

  • The Go source code is licensed under the MIT License.
  • The shared library (AsposePDFforGo_windows_amd64.dll, libAsposePDFforGo_linux_amd64.so, libAsposePDFforGo_darwin_amd64.dylib, libAsposePDFforGo_darwin_arm64.dylib) is proprietary and requires a commercial license. To use the full functionality, you must obtain a license.
Evaluation version

You can use Aspose.PDF for Go via C++ free of cost for evaluation.The evaluation version provides almost all functionality of the product with certain limitations. The same evaluation version becomes licensed when you purchase a license and add a couple of lines of code to apply the license.

If you want to test Aspose.PDF for Go without the evaluation version limitations, you can also request a 30-day Temporary License. Please refer to How to get a Temporary License?

Limitation of an evaluation version

We want our customers to test our components thoroughly before buying so the evaluation version allows you to use it as you would normally.

  • Documents created with an evaluation watermark. The evaluation version of Aspose.PDF for Go provides full product functionality, but all pages in the generated files are watermarked with the text "Evaluation Only. Created with Aspose.PDF. Copyright 2002-2025 Aspose Pty Ltd." at the top.
  • Limit the number of pages that can be processed. In the evaluation version, you can only process the first four pages of a document.
Use in production

A commercial license key is required in a production environment. Please contact us to purchase a commercial license.

Apply license

Applying a license to enable full functionality of the Aspose.PDF for Go using a license file (Aspose.PDF.GoViaCPP.lic).


    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)
        }
        // SetLicense(filename string) licenses with filename
        err = pdf.SetLicense("Aspose.PDF.GoViaCPP.lic")
        if err != nil {
            log.Fatal(err)
        }
        // Working with PDF-document
        // ...
        // Close() releases allocated resources for PDF-document
        defer pdf.Close()
    }

Home | Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License

Documentation

Overview

Aspose.PDF for Go via C++

The package asposepdf is a powerful toolkit that allows developers to manipulate PDF files directly and helps do various tasks for PDF.

Features

PDF Processing
 Core operation: New, Open, Save, SaveAs, Close, SetLicense, WordCount, CharacterCount
 Page core operation: Add, Insert, Delete, Count, WordCount, CharacterCount, IsBlank
 Organize: Optimize, OptimizeResource, Grayscale, Rotate, SetBackground, Repair
 Page organize: Rotate, SetSize, Grayscale, AddText
 Others: Get contents as plain text

PDF converting and saving
 Microsoft Office: DOC, DOCX, XLSX, PPTX
 Images: JPEG, PNG, BMP, TIFF
 Others: EPUB, DICOM, SVG, XPS, TEX, TXT

Platforms

Linux x64, macOS x86_64, macOS arm64 and Windows x64, with using cgo.

The platform-specific version of the dynamic library from the 'lib'-folder in the package's root directory is required for distributing the resulting application:
 libAsposePDFforGo_linux_amd64.so for Linux x64 platform
 libAsposePDFforGo_darwin_arm64.dylib for macOS arm64 platform
 libAsposePDFforGo_darwin_amd64.dylib for macOS x86_64 platform
 AsposePDFforGo_windows_amd64.dll for Windows x64 platform

Windows x64 platform requires MinGW-W64 installed.

Installation

This package includes a large file which is stored as a bzip2 archive.

Add the asposepdf package to Your Project:
	  go get github.com/aspose-pdf/aspose-pdf-go-cpp@latest

Generate the large file on macOS and linux

	List the folders of the github.com/aspose-pdf within the Go module cache:
	  ls $(go env GOMODCACHE)/github.com/aspose-pdf/

	Change curent folder to the specific version folder of the package obtained in the previous step.
	Replace `@vx.x.x` with the actual package version:
	  cd $(go env GOMODCACHE)/github.com/aspose-pdf/aspose-pdf-go-cpp@vx.x.x

	Run go generate with superuser privileges:
	  sudo go generate

Generate the large file on Windows:

	List the folders of the github.com/aspose-pdf within the Go module cache:
	  for /f "delims=" %G in ('go env GOMODCACHE') do for /d %a in ("%G\github.com\aspose-pdf\*") do echo %~fa

	Change curent folder to the specific version folder of the package obtained in the previous step:
	  cd <specific version folder of the package>

	Run go generate:
	  go generate

	Add specific version folder of the package to the %PATH% environment variable:
	  setx PATH "%PATH%;<specific version folder of the package>\lib\"

Quick Start

All code snippets are contained in the snippet folder on https://github.com/aspose-pdf/aspose-pdf-go-cpp.

Hello World! example:

package main

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

func main() {
	// Create new PDF-document
	pdf, err := asposepdf.New()
	if err != nil {
		log.Fatal(err)
	}
	// Add new page
	err = pdf.PageAdd()
	if err != nil {
		log.Fatal(err)
	}
	// Set page size A4
	err = pdf.PageSetSize(1, asposepdf.PageSizeA4)
	if err != nil {
		log.Fatal(err)
	}
	// Add text on first page
	err = pdf.PageAddText(1, "Hello World!")
	if err != nil {
		log.Fatal(err)
	}
	// Save PDF-document with "hello.pdf" name
	err = pdf.SaveAs("hello.pdf")
	if err != nil {
		log.Fatal(err)
	}
	// Release allocated resources
	defer pdf.Close()
}

Testing

The test run from the root package folder:
  go test -v

Aspose home

https://www.aspose.com

GitHub.com

https://github.com/aspose-pdf/aspose-pdf-go-cpp

Index

Constants

View Source
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 rotation values.

View Source
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.
)

Enumeration of possible page size values.

View Source
const (
	ERR_OK = ""
)

Meaning no error.

Variables

This section is empty.

Functions

func SplitAtPage added in v1.25.5

func SplitAtPage(document *Document, page int) (*Document, *Document, error)

SplitAtPage splits the PDF-document into two new PDF-documents. The first document includes pages 1 to 'page' (inclusive). The second document includes pages from 'page+1' to the end.

Example:

left, right, err := SplitAtPage(source, 3)
// 'left' contains pages 1–3, 'right' contains pages 4 to end

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document represents a PDF-document.

func MergeDocuments added in v1.25.5

func MergeDocuments(documents []*Document) (*Document, error)

MergeDocuments creates a new PDF-document by merging the provided documents.

Example:

	pdf_merged, err := MergeDocuments([]*Document{pdf1, pdf2})
	if err != nil {
		fmt.Errorf("MergeDocuments(): %v", err)
	} else {
 		// working with new merged PDF-document
	}

func New

func New() (*Document, error)

New creates a new PDF-document.

Example:

	pdf_new, err := New()
	if err != nil {
		fmt.Errorf("New(): %v", err)
	} else {
 		// working with new PDF-document
	}

func Open

func Open(filename string) (*Document, error)

Open opens a PDF-document with filename.

Example:

	pdf, err := Open("example.pdf")
	if err != nil {
		fmt.Errorf("Open(): %v", err)
	} else {
 		// working with open PDF-document
	}

func SplitDocument added in v1.25.5

func SplitDocument(document *Document, pagerange string) ([]*Document, error)

SplitDocument creates a new PDF-document by merging the provided PDF-documents. Each part of the pagerange string (separated by `;`) defines the page range for a new PDF-document.

Example:

pdfs, err := asposepdf.SplitDocument(pdf_source, "1-2;3;4-")
// pdfs[0] will contain pages 1-2, pdfs[1] page 3, pdfs[2] pages 4 to end.

func (*Document) AddPageNum

func (document *Document) AddPageNum() error

AddPageNum adds page number to a PDF-document.

Example:

err := pdf.AddPageNum()

func (*Document) AddTextFooter

func (document *Document) AddTextFooter(footer string) error

AddTextFooter adds text in Footer of a PDF-document.

Example:

err := pdf.AddTextFooter("Footer")

func (*Document) AddTextHeader

func (document *Document) AddTextHeader(header string) error

AddTextHeader adds text in Header of a PDF-document.

Example:

err := pdf.AddTextHeader("Aspose")

func (*Document) Append added in v1.25.4

func (document *Document) Append(anotherdocument *Document) error

Append appends pages from another PDF-document.

Example:

err := pdf.Append(anotherdoc)

func (*Document) AppendPages added in v1.25.5

func (document *Document) AppendPages(anotherdocument *Document, pagerange string) error

AppendPages appends selected pages from another PDF-document.

Example:

err := pdf.AppendPages(anotherdoc, "-2,4,6-8,10-")

func (*Document) Bytes added in v1.25.6

func (document *Document) Bytes() ([]byte, error)

Bytes returns the contents of the PDF-document as a byte slice.

Example:

bytes, err := pdf.Bytes()

func (*Document) CharacterCount

func (document *Document) CharacterCount() (int32, error)

CharacterCount returns character count in PDF-document.

Example:

character_count, err := pdf.CharacterCount()

func (*Document) Close

func (document *Document) Close() error

Close releases allocated resources for PDF-document.

Example:

defer pdf.Close()

func (*Document) ExportFdf

func (document *Document) ExportFdf(filename string) error

ExportFdf exports from previously opened PDF-document with AcroForm to FDF-document with filename.

Example:

err := pdf.ExportFdf("filename.fdf")

func (*Document) ExportXfdf

func (document *Document) ExportXfdf(filename string) error

ExportXfdf exports from previously opened PDF-document with AcroForm to XFDF-document with filename.

Example:

err := pdf.ExportXfdf("filename.xfdf")

func (*Document) ExportXml

func (document *Document) ExportXml(filename string) error

ExportXml exports from previously opened PDF-document with AcroForm to XML-document with filename.

Example:

err := pdf.ExportXml("filename.xml")

func (*Document) ExtractText

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

ExtractText returns PDF-document contents as plain text.

Example:

txt, err := pdf.ExtractText()

func (*Document) Flatten

func (document *Document) Flatten() error

Flatten flattens PDF-document.

Example:

err := pdf.Flatten()

func (*Document) Grayscale

func (document *Document) Grayscale() error

Grayscale converts PDF-document to black and white.

Example:

err := pdf.Grayscale()

func (*Document) Optimize

func (document *Document) Optimize() error

Optimize optimizes PDF-document content.

Example:

err := pdf.Optimize()

func (*Document) OptimizeResource

func (document *Document) OptimizeResource() error

OptimizeResource optimizes resources of PDF-document.

Example:

err := pdf.OptimizeResource()

func (*Document) PageAdd

func (document *Document) PageAdd() error

PageAdd adds new page in PDF-document.

Example:

err := pdf.PageAdd()

func (*Document) PageAddPageNum

func (document *Document) PageAddPageNum(num int32) error

PageAddPageNum adds page number on page.

Example:

err := pdf.PageAddPageNum(1)

func (*Document) PageAddText

func (document *Document) PageAddText(num int32, addText string) error

PageAddText adds text on page.

Example:

err := pdf.PageAddText(1, "text on the first page")

func (*Document) PageAddTextFooter

func (document *Document) PageAddTextFooter(num int32, footer string) error

PageAddTextFooter adds text in page footer

Example:

err := pdf.PageAddTextFooter("Footer")

func (*Document) PageAddTextHeader

func (document *Document) PageAddTextHeader(num int32, header string) error

PageAddTextHeader adds text in page header

Example:

err := pdf.PageAddTextHeader(1, "Aspose")

func (*Document) PageCharacterCount

func (document *Document) PageCharacterCount(num int32) (int32, error)

PageCharacterCount returns character count on specified page in PDF-document.

Example:

character_count, err := pdf.PageCharacterCount(1)

func (*Document) PageCount

func (document *Document) PageCount() (int32, error)

PageCount returns page count in PDF-document.

Example:

page_count, err := pdf.PageCount()

func (*Document) PageDelete

func (document *Document) PageDelete(num int32) error

PageDelete deletes specified page in PDF-document.

Example:

err := pdf.PageDelete(1)

func (*Document) PageGrayscale

func (document *Document) PageGrayscale(num int32) error

PageGrayscale converts page to black and white.

Example:

err := pdf.PageGrayscale(1)

func (*Document) PageInsert

func (document *Document) PageInsert(num int32) error

PageInsert inserts new page at the specified position in PDF-document.

Example:

err := pdf.PageInsert(1)

func (*Document) PageIsBlank

func (document *Document) PageIsBlank(num int32) (bool, error)

PageIsBlank returns page is blank in PDF-document.

Example:

is_blank, err := pdf.PageIsBlank(1)

func (*Document) PageRemoveAnnotations added in v1.25.4

func (document *Document) PageRemoveAnnotations(num int32) error

PageRemoveAnnotations removes annotations in page.

Example:

err := pdf.PageRemoveAnnotations(1)

func (*Document) PageRemoveHiddenText added in v1.25.4

func (document *Document) PageRemoveHiddenText(num int32) error

PageRemoveHiddenText removes hidden text in page.

Example:

err := pdf.PageRemoveHiddenText(1)

func (*Document) PageRemoveImages added in v1.25.4

func (document *Document) PageRemoveImages(num int32) error

PageRemoveImages removes images in page.

Example:

err := pdf.PageRemoveImages(1)

func (*Document) PageReplaceText

func (document *Document) PageReplaceText(num int32, findText, replaceText string) error

PageReplaceText replaces text on page.

Example:

err := pdf.PageReplaceText(1, "old text", "new text")

func (*Document) PageRotate

func (document *Document) PageRotate(num int32, rotation int32) error

PageRotate rotates page.

Example:

err := pdf.PageRotate(1, asposepdf.RotationOn180)

func (*Document) PageSetSize

func (document *Document) PageSetSize(num int32, pageSize int32) error

PageSetSize sets size of page.

Example:

err := pdf.PageSetSize(1, asposepdf.PageSizeA4)

func (*Document) PageToBmp

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

PageToBmp saves the specified page as Bmp-image file.

Example:

err := pdf.PageToBmp(1, 100, "page_num_1_with_100_dpi.bmp")

func (*Document) PageToDICOM

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

PageToDICOM saves the specified page as DICOM-image file.

Example:

err := pdf.PageToDICOM(1, 100, "page_num_1_with_100_dpi.dcm")

func (*Document) PageToJpg

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

PageToJpg saves the specified page as Jpg-image file.

Example:

err := pdf.PageToJpg(1, 300, "page_num_1_with_300_dpi.jpg")

func (*Document) PageToPdf

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

PageToPdf saves the specified page as Pdf-file.

Example:

err := pdf.PageToPdf(1, "page_num_1.pdf")

func (*Document) PageToPng

func (document *Document) PageToPng(num int32, resolution_dpi int32, filename string) error

PageToPng saves the specified page as Png-image file.

Example:

err := pdf.PageToPng(1, 100, "page_num_1_with_100_dpi.png")

func (*Document) PageToSvg

func (document *Document) PageToSvg(num int32, filename string) error

PageToSvg saves the specified page as Svg-image file.

Example:

err := pdf.PageToSvg(1, "page_num_1.svg")

func (*Document) PageToTiff

func (document *Document) PageToTiff(num int32, resolution_dpi int32, filename string) error

PageToTiff saves the specified page as Tiff-image file.

Example:

err := pdf.PageToTiff(1, 100, "page_num_1_with_100_dpi.tiff")

func (*Document) PageWordCount

func (document *Document) PageWordCount(num int32) (int32, error)

PageWordCount returns word count on specified page in PDF-document.

Example:

word_count, err := pdf.PageWordCount(1)

func (*Document) RemoveAnnotations added in v1.25.4

func (document *Document) RemoveAnnotations() error

RemoveAnnotations removes annotations from PDF-document.

Example:

err := pdf.RemoveAnnotations()

func (*Document) RemoveAttachments added in v1.25.4

func (document *Document) RemoveAttachments() error

RemoveAttachments removes attachments from PDF-document.

Example:

err := pdf.RemoveAttachments()

func (*Document) RemoveBlankPages added in v1.25.4

func (document *Document) RemoveBlankPages() error

RemoveBlankPages removes blank pages from PDF-document.

Example:

err := pdf.RemoveBlankPages()

func (*Document) RemoveBookmarks added in v1.25.4

func (document *Document) RemoveBookmarks() error

RemoveBookmarks removes bookmarks from PDF-document.

Example:

err := pdf.RemoveBookmarks()

func (*Document) RemoveHiddenText added in v1.25.4

func (document *Document) RemoveHiddenText() error

RemoveHiddenText removes hidden text from PDF-document.

Example:

err := pdf.RemoveHiddenText()

func (*Document) RemoveImages added in v1.25.4

func (document *Document) RemoveImages() error

RemoveImages removes images from PDF-document.

Example:

err := pdf.RemoveImages()

func (*Document) RemoveJavaScripts added in v1.25.4

func (document *Document) RemoveJavaScripts() error

RemoveJavaScripts removes java scripts from PDF-document.

Example:

err := pdf.RemoveJavaScripts()

func (*Document) Repair

func (document *Document) Repair() error

Repair repaires PDF-document.

Example:

err := pdf.Repair()

func (*Document) ReplaceText

func (document *Document) ReplaceText(findText, replaceText string) error

ReplaceText replaces text in PDF-document.

Example:

err := pdf.ReplaceText("old text", "new text")

func (*Document) Rotate

func (document *Document) Rotate(rotation int32) error

Rotate rotates PDF-document.

Example:

err := pdf.Rotate(asposepdf.RotationOn180)

func (*Document) Save

func (document *Document) Save() error

Save saves previously opened PDF-document.

Example:

err := pdf.Save()

func (*Document) SaveAs

func (document *Document) SaveAs(filename string) error

SaveAs saves previously opened PDF-document with new filename.

Example:

err := pdf.SaveAs("new_filename.pdf")

func (*Document) SaveBooklet

func (document *Document) SaveBooklet(filename string) error

SaveBooklet saves previously opened PDF-document as booklet PDF-document with filename.

Example:

err := pdf.SaveBooklet("filename.pdf")

func (*Document) SaveDoc

func (document *Document) SaveDoc(filename string) error

SaveDoc saves previously opened PDF-document as Doc-document with filename.

Example:

err := pdf.SaveDoc("filename.doc")

func (*Document) SaveDocX

func (document *Document) SaveDocX(filename string) error

SaveDocX saves previously opened PDF-document as DocX-document with filename.

Example:

err := pdf.SaveDocX("filename.docx")

func (*Document) SaveEpub

func (document *Document) SaveEpub(filename string) error

SaveEpub saves previously opened PDF-document as Epub-document with filename.

Example:

err := pdf.SaveEpub("filename.epub")

func (*Document) SaveMarkdown

func (document *Document) SaveMarkdown(filename string) error

SaveMarkdown saves previously opened PDF-document as Markdown-document with filename.

Example:

err := pdf.SaveMarkdown("filename.md")

func (*Document) SaveNUp

func (document *Document) SaveNUp(filename string, columns int32, rows int32) error

SaveNUp saves previously opened PDF-document as N-Up PDF-document with filename.

Example:

err := pdf.SaveNUp("filename.pdf", 2, 2)

func (*Document) SavePptX

func (document *Document) SavePptX(filename string) error

SavePptX saves previously opened PDF-document as PptX-document with filename.

Example:

err := pdf.SavePptX("filename.pptx")

func (*Document) SaveTeX

func (document *Document) SaveTeX(filename string) error

SaveTeX saves previously opened PDF-document as TeX-document with filename.

Example:

err := pdf.SaveTeX("filename.tex")

func (*Document) SaveTxt

func (document *Document) SaveTxt(filename string) error

SaveTxt saves previously opened PDF-document as Txt-document with filename.

Example:

err := pdf.SaveTxt("filename.txt")

func (*Document) SaveXlsX

func (document *Document) SaveXlsX(filename string) error

SaveXlsX saves previously opened PDF-document as XlsX-document with filename.

Example:

err := pdf.SaveXlsX("filename.xlsx")

func (*Document) SaveXps

func (document *Document) SaveXps(filename string) error

SaveXps saves previously opened PDF-document as Xps-document with filename.

Example:

err := pdf.SaveXps("filename.xps")

func (*Document) SetBackground

func (document *Document) SetBackground(r, g, b int32) error

SetBackground sets PDF-document background color.

Example:

err := pdf.SetBackground(200, 100, 101)

func (*Document) SetLicense

func (document *Document) SetLicense(filename string) error

SetLicense licenses with filename.

Example:

err := pdf.SetLicense("Aspose.PDF.Go.lic")

func (*Document) WordCount

func (document *Document) WordCount() (int32, error)

WordCount returns word count in PDF-document.

Example:

word_count, err := pdf.WordCount()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL