gotenberg

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 3 Imported by: 0

README ¶

gotenberg-client

Go Reference Go Report Card License

A high-performance Go client for the Gotenberg HTTP API with a fluent interface. Built using only the Go standard library (via http-client).

Features:

  • Minimal dependencies (only stdlib + http-client)
  • Fluent API for building requests
  • Support for HTML/URL/Markdown to PDF conversion
  • Webhook support
  • Easy file/multipart uploads
  • Paper size, margins, and advanced PDF options

Quick Start: Synchronous HTML to PDF

See examples/cmd/chromium/helloworld for a basic HTML to PDF conversion example.

go run ./examples/cmd/chromium/helloworld

Markdown to PDF Conversion

Convert Markdown files to PDF with custom HTML templates. See examples/cmd/chromium/markdown for a complete example.

go run ./examples/cmd/chromium/markdown

Example: Async PDF Generation with Webhook

See examples/cmd/chromium/webhook for a full async webhook demo (HTML invoice to PDF, with logo, webhook server, and error handling).

# Run webhook example
go run ./examples/cmd/chromium/webhook

This will:

  • Start a local webhook server
  • Generate an invoice PDF using HTML template and logo
  • Receive the PDF via webhook callback from Gotenberg

Installation

go get github.com/nativebpm/gotenberg-client

Testing

Run all tests and benchmarks:

go test -v -bench=. ./...

Project Structure

  • chromium.go — main client implementation
  • examples/ — real-world usage examples
  • examples/cmd/chromium/webhook — async webhook demo
  • examples/cmd/chromium/markdown — basic markdown to PDF conversion
  • examples/cmd/chromium/helloworld — basic HTML to PDF conversion
  • examples/model — invoice data structs
  • examples/pkg/templates/invoice — HTML template for invoice
  • examples/pkg/templates/markdown — HTML template for markdown
  • examples/pkg/image — logo generator

Dependencies

No third-party dependencies are required, ensuring minimal bloat and maximum compatibility.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type Client ¶

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

Client is a Gotenberg HTTP client that wraps the base HTTP client with Gotenberg-specific functionality for document conversion.

func NewClient ¶

func NewClient(httpClient *http.Client, baseURL string) (*Client, error)

NewClient creates a new Gotenberg client with the given HTTP client and base URL. Returns an error if the base URL is invalid.

func (*Client) Chromium ¶ added in v1.7.0

func (c *Client) Chromium() *chromium.Chromium

Directories ¶

Path Synopsis
Package gotenberg provides a client for the Gotenberg service.
Package gotenberg provides a client for the Gotenberg service.
examples

Jump to

Keyboard shortcuts

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