Open Source Go Library for Converting Microsoft® Word Processing Files
Convert Microsoft Word Processing Documents (Doc, Docx) to PDF via Open Source Free GO API
What is Gotenberg Go client?
Gotenberg Go client is an open-source go library that gives software developers the capability to convert Microsoft Word Processing documents to PDF inside their own applications. Gotenberg is a Docker-powered stateless API for converting Office documents to PDF. Using the API, you can easily convert DOCX, DOC, RTF, and TXT file format to PDF.
By using the API, you can convert one or more word processing documents at the same time and save the resultant document in PDF format. The API provides structured logging allowing you to have relevant information about what’s going on.
Getting Started with Gotenberg Go client
The recommended way to install the Gotenberg Go client into your project is by using GitHub. Please use the following command for a smooth installation.
Install Gotenberg Go client via GitHub
$ go get -u github.com/thecodingmachine/gotenberg-go-client/v7
Convert DOCX to PDF via Free Go API
The Open source library Gotenberg Go client allows computer programmers to convert DOCX to PDF inside their own Go applications. In order to convert your DOCX to PDF, you just need to load your document and convert it using gotenberg.NewOfficeRequest() method. By using the following lines of code, you can easily convert DOCX to PDF./p>
Convert Word Processing to PDF in GO
- Load two DOCX files using NewDocumentFromPath() method and pass filename and file path as parameters
- Convert both files to PDF using gotenberg.NewOfficeRequest() method and pass doc objects
- Save PDF document
Convert DOCX to PDF via Free GO API
c := &gotenberg.Client{Hostname: "http://localhost:3000"}
doc, _ := gotenberg.NewDocumentFromPath("document.docx", "/path/to/file")
doc2, _ := gotenberg.NewDocumentFromPath("document2.docx", "/path/to/file")
req := gotenberg.NewOfficeRequest(doc, doc2)
dest := "result.pdf"
c.Store(req, dest)