Documentation
¶
Overview ¶
Package pdf writes PDF documents in pure Go: pages of RGB raster images, Flate-compressed and streamed to an io.Writer as they are added. Output is deterministic (no timestamps or document IDs), so the same pages always produce the same bytes.
w := pdf.NewWriter(out, "Report")
a4 := pdf.Size{W: pdf.Millimetres(210), H: pdf.Millimetres(297)}
if err := w.AddPage(a4, page); err != nil { ... }
if err := w.Close(); err != nil { ... }
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoPages = errors.New("pdf: a document needs at least one page")
ErrNoPages reports a Close before any AddPage; a PDF has at least one page.
Functions ¶
This section is empty.
Types ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer streams a PDF document. Pages are written as they are added; Close writes the page tree and cross-reference table. A write error sticks: every later call returns it.