pdfexport

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SansFontFamily = sansFontFamily

	PrimaryTextGray   = primaryTextGray
	SecondaryTextGray = secondaryTextGray
	RuleTextGray      = ruleTextGray
	DimTextGray       = dimTextGray

	ThinGridLineMM    = thinGridLineMM
	MajorGridLineMM   = majorGridLineMM
	OuterBorderLineMM = outerBorderLineMM

	InstructionLineHMM = instructionLineHMM

	PuzzleBottomInsetMM = puzzleBottomInsetMM
	WordSearchGridGapMM = wordSearchGridListGap

	PuzzleWordBankFontSize = puzzleWordBankFontSize
	PuzzleWordBankHeadSize = puzzleWordBankHeadSize
)
View Source
const ExportSchemaV1 = "puzzletea.export.v1"

Variables

This section is empty.

Functions

func CenteredOrigin

func CenteredOrigin(area Rect, cols, rows int, cellSize float64) (float64, float64)

func ClampStandardCellFontSize

func ClampStandardCellFontSize(fontSize float64) float64

func FitCompactCellSize

func FitCompactCellSize(cols, rows int, area Rect) float64

func FitHashiCellSize

func FitHashiCellSize(cols, rows int, area Rect) float64

func FitNonogramCellSize

func FitNonogramCellSize(cols, rows int, area Rect) float64

func FitSudokuCellSize

func FitSudokuCellSize(cols, rows int, area Rect) float64

func FitTableCellSize

func FitTableCellSize(cols, rows int, area Rect) float64

func FitWordSearchCellSize

func FitWordSearchCellSize(cols, rows int, area Rect) float64

func InstructionY

func InstructionY(boardBottom, pageH float64, lineCount int) float64

func SetInstructionStyle

func SetInstructionStyle(pdf *fpdf.Fpdf)

func StandardCellFontSize

func StandardCellFontSize(cellSize, scale float64) float64

func WritePDF

func WritePDF(outputPath string, docs []PackDocument, puzzles []Puzzle, cfg RenderConfig) error

Types

type DifficultyConfidence

type DifficultyConfidence string
const (
	DifficultyConfidenceHigh   DifficultyConfidence = "high"
	DifficultyConfidenceMedium DifficultyConfidence = "medium"
)

type FillominoData

type FillominoData struct {
	Width  int
	Height int
	Givens [][]int
}

func ParseFillominoPrintData

func ParseFillominoPrintData(saveData []byte) (*FillominoData, error)

type GridTable

type GridTable struct {
	Rows         [][]string
	HasHeaderRow bool
	HasHeaderCol bool
}

type HashiData

type HashiData struct {
	Width   int
	Height  int
	Islands []HashiIsland
}

func ParseHashiPrintData

func ParseHashiPrintData(saveData []byte) (*HashiData, error)

type HashiIsland

type HashiIsland struct {
	X        int
	Y        int
	Required int
}

type HitoriData

type HitoriData struct {
	Size    int
	Numbers [][]string
}

func ParseHitoriPrintData

func ParseHitoriPrintData(saveData []byte) (*HitoriData, error)

type JSONLPackMeta

type JSONLPackMeta struct {
	Generated     string `json:"generated"`
	Version       string `json:"version"`
	Category      string `json:"category"`
	ModeSelection string `json:"mode_selection"`
	Count         int    `json:"count"`
	Seed          string `json:"seed"`
}

type JSONLPuzzle

type JSONLPuzzle struct {
	Index int             `json:"index"`
	Name  string          `json:"name"`
	Game  string          `json:"game"`
	Mode  string          `json:"mode"`
	Save  json.RawMessage `json:"save"`
}

type JSONLRecord

type JSONLRecord struct {
	Schema string        `json:"schema"`
	Pack   JSONLPackMeta `json:"pack"`
	Puzzle JSONLPuzzle   `json:"puzzle"`
}

type NonogramData

type NonogramData struct {
	Width    int
	Height   int
	RowHints [][]int
	ColHints [][]int
	Grid     [][]string
}

func ParseNonogramPrintData

func ParseNonogramPrintData(saveData []byte) (*NonogramData, error)

type NurikabeData

type NurikabeData struct {
	Width  int
	Height int
	Clues  [][]int
}

func ParseNurikabePrintData

func ParseNurikabePrintData(saveData []byte) (*NurikabeData, error)

type PackDocument

type PackDocument struct {
	SourcePath string
	Metadata   PackMetadata
	Puzzles    []Puzzle
}

func ParseFile

func ParseFile(path string) (PackDocument, error)

func ParseFiles

func ParseFiles(paths []string) ([]PackDocument, error)

func ParseJSONLFile

func ParseJSONLFile(path string) (PackDocument, error)

func ParseJSONLFiles

func ParseJSONLFiles(paths []string) ([]PackDocument, error)

func ParseMarkdown

func ParseMarkdown(path, content string) (PackDocument, error)

type PackMetadata

type PackMetadata struct {
	GeneratedRaw   string
	GeneratedAt    time.Time
	Version        string
	Category       string
	ModeSelection  string
	Count          int
	Seed           string
	Format         string
	SourceFileName string
}

type Puzzle

type Puzzle struct {
	SourcePath           string
	SourceFileName       string
	Category             string
	ModeSelection        string
	Name                 string
	Index                int
	Body                 string
	SaveData             []byte
	PrintPayload         any
	DifficultyScore      float64
	DifficultyConfidence DifficultyConfidence
	DifficultySource     string
}

func OrderPuzzlesForPrint

func OrderPuzzlesForPrint(puzzles []Puzzle, seed string) []Puzzle

type RGB

type RGB struct{ R, G, B uint8 }

type Rect

type Rect struct {
	X float64
	Y float64
	W float64
	H float64
}

func PuzzleBoardRect

func PuzzleBoardRect(pageW, pageH float64, pageNo, ruleLines int) Rect

func PuzzleBodyRect

func PuzzleBodyRect(pageW, pageH float64, pageNo int) Rect

type RenderConfig

type RenderConfig struct {
	Title         string
	CoverSubtitle string
	HeaderText    string
	VolumeNumber  int
	AdvertText    string
	GeneratedAt   time.Time
	ShuffleSeed   string
	CoverColor    *RGB // nil = omit front/back covers
}

type RippleEffectCage

type RippleEffectCage struct {
	Size  int                `json:"size"`
	Cells []RippleEffectCell `json:"cells"`
}

type RippleEffectCell

type RippleEffectCell struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type RippleEffectData

type RippleEffectData struct {
	Width  int
	Height int
	Givens [][]int
	Cages  []RippleEffectCage
}

func ParseRippleEffectPrintData

func ParseRippleEffectPrintData(saveData []byte) (*RippleEffectData, error)

type ShikakuData

type ShikakuData struct {
	Width  int
	Height int
	Clues  [][]int
}

func ParseShikakuPrintData

func ParseShikakuPrintData(saveData []byte) (*ShikakuData, error)

type SudokuData

type SudokuData struct {
	Givens [9][9]int `json:"givens"`
}

func ParseSudokuPrintData

func ParseSudokuPrintData(saveData []byte) (*SudokuData, error)

type TakuzuData

type TakuzuData struct {
	Size          int
	Givens        [][]string
	GroupEveryTwo bool
}

func ParseTakuzuPrintData

func ParseTakuzuPrintData(saveData []byte) (*TakuzuData, error)

type WordSearchData

type WordSearchData struct {
	Width  int        `json:"width"`
	Height int        `json:"height"`
	Grid   [][]string `json:"grid"`
	Words  []string   `json:"words"`
}

func ParseWordSearchPrintData

func ParseWordSearchPrintData(saveData []byte) (*WordSearchData, error)

Jump to

Keyboard shortcuts

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