render

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmbeddedTextVersion

func EmbeddedTextVersion() string

func FindMuTool

func FindMuTool() string

func NormalizePageSelection

func NormalizePageSelection(value string) (string, error)

NormalizePageSelection validates a selection and returns its canonical form.

func RelativeArtifactPath

func RelativeArtifactPath(root string, path string) string

RelativeArtifactPath keeps persisted artifact references valid after the complete output directory is moved to another machine.

func WriteManifest

func WriteManifest(path string, command string, result Result, dpi int) error

Types

type Manifest

type Manifest struct {
	Version string       `json:"version"`
	Command string       `json:"command"`
	Input   detect.Input `json:"input"`
	Render  struct {
		DPI             int    `json:"dpi"`
		PageCount       int    `json:"page_count"`
		SourcePageCount int    `json:"source_page_count,omitempty"`
		PageSelection   string `json:"page_selection,omitempty"`
		ImageFormat     string `json:"image_format"`
		OutputDir       string `json:"output_dir"`
	} `json:"render"`
	Pages      []PageImage `json:"pages"`
	StartedAt  time.Time   `json:"started_at"`
	FinishedAt time.Time   `json:"finished_at"`
}

type Options

type Options struct {
	OutputDir            string
	DPI                  int
	Pages                string
	KeepImages           bool
	ChromePath           string
	LibreOfficePath      string
	PresentationRenderer string
	TextGrounding        bool
}

type PageImage

type PageImage struct {
	Page                  int    `json:"page"`
	SourcePath            string `json:"source_path"`
	ImagePath             string `json:"image_path"`
	Width                 int    `json:"width"`
	Height                int    `json:"height"`
	SHA256                string `json:"sha256"`
	EmbeddedTextSHA256    string `json:"embedded_text_sha256,omitempty"`
	EmbeddedTextChars     int    `json:"embedded_text_chars,omitempty"`
	EmbeddedTextTruncated bool   `json:"embedded_text_truncated,omitempty"`
	EmbeddedTextSupported bool   `json:"embedded_text_supported,omitempty"`
	EmbeddedTextChecked   bool   `json:"embedded_text_checked,omitempty"`
	EmbeddedText          string `json:"-"`
}

type PageSelection

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

PageSelection describes the 1-based pages that should be sent to the model. An empty selection means every rendered page.

func ParsePageSelection

func ParsePageSelection(value string) (PageSelection, error)

ParsePageSelection parses expressions such as "1,3-5,9". Page numbers are 1-based and intervals are inclusive.

func (PageSelection) Pages

func (selection PageSelection) Pages(sourcePageCount int) ([]int, error)

Pages expands a non-empty selection against a known source page count.

func (PageSelection) String

func (selection PageSelection) String() string

type Result

type Result struct {
	Input           detect.Input `json:"input"`
	Pages           []PageImage  `json:"pages"`
	SourcePageCount int          `json:"source_page_count"`
	PageSelection   string       `json:"page_selection,omitempty"`
	OutputDir       string       `json:"output_dir"`
	StartedAt       time.Time    `json:"started_at"`
	FinishedAt      time.Time    `json:"finished_at"`
}

func Render

func Render(ctx context.Context, input detect.Input, options Options) (Result, error)

Jump to

Keyboard shortcuts

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