chromium

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: 8 Imported by: 0

Documentation

Overview

Package chromium prints HTML to PDF with a headless Chromium. It is the one printer.Printer adapter today. The browser is found once, lazily, in this order: the path this adapter was built with, the CHROMIUM environment variable, then whatever the PATH calls chromium under any of the names the various builds use. A hard-coded /usr/bin/chromium was true on exactly one machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(hint string) (string, error)

Resolve finds the browser to print with. See the package comment for the order. Exported so a command line can report which browser it would use.

Types

type Printer

type Printer struct {
	// Path is the browser binary to use. Empty means resolve one.
	Path string
	// contains filtered or unexported fields
}

Printer prints with the browser at Path, or with one it resolves.

func New

func New(path string) *Printer

New returns a Printer that uses the given browser, or resolves one when path is empty.

func (*Printer) Print

func (p *Printer) Print(ctx context.Context, html []byte) ([]byte, error)

Print prints html to PDF. The document carries its own print stylesheet (A4 margins, sections kept together), so what comes out is the page a person would print themselves.

Jump to

Keyboard shortcuts

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