export

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package export turns a built deck into images and documents without a browser: go-webengine lays each slide out and paints it, go-pdfkit writes the PDF. Marp CLI drives a headless Chrome for the same outputs.

The slides are rendered in the box frame (deck.FrameBox), which needs neither <foreignObject> nor generated content from the layout engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JPEG

func JPEG(w io.Writer, img image.Image, opts Options) error

JPEG encodes an image as JPEG.

func PDF

func PDF(w io.Writer, b *slides.Build, images []*image.RGBA) error

PDF writes one page per slide. A page is the slide's size, a CSS pixel being 3/4 of a point, as Chrome prints Marp's @page size. The outline lists each slide and, under it, its headings (marp --pdf-outlines).

func PNG

func PNG(w io.Writer, img image.Image) error

PNG encodes an image as PNG.

func PPTX added in v0.2.0

func PPTX(w io.Writer, b *slides.Build, images []*image.RGBA) error

PPTX writes a PowerPoint deck through go-ooxml: each slide is a full-slide picture, at the slide's size, with the slide's speaker notes, as marp-cli's --pptx does. The pictures are PNG; render them at Scale 2 for a sharp deck (marp-cli's default for PPTX).

func Rasterize

func Rasterize(ctx context.Context, b *slides.Build, opts Options) ([]*image.RGBA, error)

Rasterize renders every slide of b, which must have been rendered in deck.FrameBox, to an image of the slide's size times opts.Scale.

Types

type Options

type Options struct {
	// BaseURL resolves the deck's relative URLs (images, backgrounds):
	// typically "file:///path/to/deck/dir/".
	BaseURL string
	// NoFonts leaves out the fonts bundled for the built-in themes.
	NoFonts bool
	// JPEGQuality is the JPEG quality, 1 to 100; 0 means 85, marp-cli's.
	JPEGQuality int
	// Scale is the number of device pixels per CSS pixel: 2 renders a
	// 1280×720 slide as 2560×1440, text and vectors drawn at that density
	// rather than enlarged. 0 means 1 (marp-cli's --image-scale).
	Scale float64
	// FileRoot, when set, lets the slides load file: URLs from under this
	// directory and nowhere else; empty refuses every local file, as
	// marp-cli does without --allow-local-files.
	FileRoot string
}

Options configures the export.

Jump to

Keyboard shortcuts

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