Go Client Library for DynamicPDF API
The DynamicPDF API provides a full‑featured client library for GO that simplifies integration with the REST endpoints.
The Go client library is the official SDK for integrating the DynamicPDF API into Go applications. It provides idiomatic Go types and methods that make it easy to generate new PDF documents, convert HTML and images to PDF, merge multiple PDFs, extract text and metadata, and perform detailed PDF inspection without having to construct raw HTTP requests.This library gives developers access to the complete set of DynamicPDF API capabilities, including creating PDFs from code, merging or splitting existing documents, filling and flattening interactive forms, stamping text or images onto pages, retrieving XMP and document information, rasterizing PDF pages into images, and applying encryption or other security options. The DynamicPDF API offers an extensive collection of PDF focused endpoints that support generation, conversion, manipulation, analysis, and secure delivery of PDF content directly from Go applications.
The DynamicPDF API offers clean, intuitive wrappers around the following REST endpoints:
dlex-layoutfor creating dynamic PDF reports from DLEX templates and JSON data,image-infofor extracting detailed metadata from images,pdffor creating and manipulating PDFs, merging documents, and converting HTML, Word, and Excel files to PDF,pdf-infofor retrieving document information and metadata from existing PDFs,pdf-security-infofor obtaining PDF encryption details and security settings,pdf-textfor extracting text content from PDF pages, andpdf-xmpfor reading embedded XMP metadata from PDF files.
Installation
The DynamicPDF API library is available using the Go Package Manager (https://pkg.go.dev/github.com/dynamicpdf-api/go-client).
go get github.com/dynamicpdf-api/go-client@latest
Source & Repo
- GitHub Repo: https://github.com/dynamicpdf-api/go-client
- Sample Applications: https://github.com/dynamicpdf-api/go-client-examples
Usage Example
func main() {
pr := endpoint.NewPdf()
pr.Endpoint.ApiKey = apiKey
pdfResource := resource.NewPdfResourceWithResourcePath("DocA.pdf", "DocA.pdf")
prInput := input.NewPdfWithResource(pdfResource)
pr.Inputs = append(pr.Inputs, prInput)
pdfResource2 := resource.NewPdfResourceWithResourcePath("DocB.pdf", "DocB.pdf")
prInput2 := input.NewPdfWithResource(pdfResource2)
pr.Inputs = append(pr.Inputs, prInput2)
resp := pr.Process()
res := <-resp
os.WriteFile("output.pdf", res.Content().Bytes(), os.ModeType)
}