AVAILABLE NOW: Spring 2025 Release
By Rachmat Hartano | 2021 Nov 23
3 min
Tags
release
sdk
golang
Today, we’re excited to announce support for the Go Language/GoLang. This means Go Developers can now easily add Apryse’s leading, high-quality document creation, editing, printing, conversion, and much more to their applications on Windows, Linux, and Mac.
Given Go’s recent rise in popularity, we knew adding support for a GoLang PDF library would greatly benefit developers when working with PDFs or any other digital documents. The Apryse SDK, a top choice for commercial PDF SDKs, supports functionality for more than 30 file formats.
For detailed guides, sample codes, and other resources, check out our Apryse SDK Go documentation.
The Go PDF library package supports all of the Apryse SDK rich document processing functionalities, including:
Start using the Apryse SDK and GoLang with just a few lines of code.
Once installed, you’re good to go, with dozens of unique document processing capabilities at your fingertips. For example, you can generate PDFs from Office documents. You can also create a PDF from scratch, and perform many other document processing actions to optimize and customize your document to taste. For instance:
This example demonstrates how to create a PDF document containing a blank page and linearize it for fast web view using the Apryse Go SDK.
Create a linearized.go file under go/src/pdftron/Samples/demo
folder:
package main
import (
"fmt"
. "pdftron"
)
func main()
{
// PDFNet must be initialized before accessing any PDFTron API
PDFNetInitialize("demo:1630436733976:78fdd6c00300000000222fa9b8dab35afb9cc6a740157513bd83ca26dd")
doc := NewPDFDoc()
page := doc.PageCreate() // Start a new page
doc.PagePushBack(page) // Add the page to document
doc.Save("output.pdf", uint(SDFDocE_linearized)) // Save the document as a linearized PDF
doc.Close()
}
The next example demonstrates how to convert PDF documents to DOCX. You must download Apryse’s PDF2Word Module to enable PDF to DOCX conversion.
Depending on your platform, extract the module above and put it in:
go/src/pdftron/PDFNetC/Lib/Linux
OR
go/src/pdftron/PDFNetC/Lib/Windows
Next, create a pdf2docx.go
file under go/src/pdftron/Samples/demo
folder:
package main
import (
"fmt"
. "pdftron"
)
func main() {
// PDFNet must be initialized before accessing any PDFTron API
PDFNetInitialize("demo:1630436733976:78fdd6c00300000000222fa9b8dab35afb9cc6a740157513bd83ca26dd")
// Point the PDFNet Resource Path to where PDFNetC/Lib is located at.
PDFNetAddResourceSearchPath("../../PDFNetC/Lib/")
if !PDF2WordModuleIsModuleAvailable() {
fmt.Println("")
fmt.Println("Unable to run the sample: PDFTron SDK Word module not available.")
fmt.Println("---------------------------------------------------------------")
fmt.Println("The Word module is an optional add-on, available for download")
fmt.Println( “at https://www.pdftron.com/documentation/core/info/modules/#pdf2word-module")
fmt.Println("")
return
}
fmt.Println("Converting PDF to Word")
infile := "./input.pdf"
outfile := "./output.docx"
ConvertToWord(infile, outfile)
fmt.Println("Result saved in output.docx")
}
Whether you are converting or editing PDFs using GoLang, we’ve got you covered. Our Go Language package supports all of the Apryse SDK’s rich document processing features, such as converting Office documents to PDF, while retaining the same style and formatting as the original document no matter your platform.
We hope you are as excited as we are about this new GoLang support. Feel free to contact us with any questions or suggestions!
Tags
release
sdk
golang
Rachmat Hartano
Related Products
Share this post
PRODUCTS
Platform Integrations
End User Applications
Popular Content