printer

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package printer is the port through which a rendered document becomes a PDF. The engine and the API ask for a Printer and never for a browser; the chromium adapter beside this package is the one implementation today, and None is what runs where no browser is installed.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("no PDF printer is available")

ErrUnavailable is returned by a Printer that cannot print on this machine. Callers treat it as "no PDF", never as a failure of the document itself.

Functions

This section is empty.

Types

type Func

type Func func(ctx context.Context, html []byte) ([]byte, error)

Func adapts a function to the Printer interface.

func (Func) Print

func (f Func) Print(ctx context.Context, html []byte) ([]byte, error)

Print calls f.

type None

type None struct{}

None is the Printer for a deployment without a browser: every call answers ErrUnavailable.

func (None) Print

func (None) Print(context.Context, []byte) ([]byte, error)

Print always returns ErrUnavailable.

type Printer

type Printer interface {
	// Print returns the PDF bytes for html, or ErrUnavailable (possibly
	// wrapped) when nothing on this machine can print.
	Print(ctx context.Context, html []byte) ([]byte, error)
}

Printer prints HTML to PDF.

Directories

Path Synopsis
Package chromium prints HTML to PDF with a headless Chromium.
Package chromium prints HTML to PDF with a headless Chromium.

Jump to

Keyboard shortcuts

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