pdftemplating

package module
v0.0.0-...-9fec372 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

PDFTEMPLATING

Go Report Card codecov GoDoc

Routines and objects to make using PDF files as format templates easy/easier.

Documentation

Index

Constants

View Source
const (
	AlignmentLeft   = 0
	AlignmentCenter = 1
	AlignmentRight  = 2

	OrientationLandscape = 0
	OrientationPortrait  = 1
)

Variables

This section is empty.

Functions

func PdfPageCount

func PdfPageCount(fn string) (int, error)

PdfPageCount returns the number of pages in a PDF document

func PdfPageToImage

func PdfPageToImage(fn string, pageNo int) (image.Image, error)

PdfPageToImage creates an image.Image object from the specified PDF page

func PdfPageToImages

func PdfPageToImages(fn string) ([]image.Image, error)

PdfPageToImages creates an array of image.Image objects from the specified PDF file

Types

type Alignment

type Alignment int

func (Alignment) String

func (a Alignment) String() string

type Orientation

type Orientation int

func (Orientation) String

func (o Orientation) String() string

type Replacement

type Replacement struct {
	Default    string    `yaml:"default" json:"default_value"`
	FontFamily string    `yaml:"font-family" json:"font_family"`
	FontJson   string    `yaml:"font-json" json:"font_json"`
	FontSize   float64   `yaml:"font-size" json:"font_size"`
	PosX       float64   `yaml:"pos-x" json:"x"`
	PosY       float64   `yaml:"pos-y" json:"y"`
	Alignment  Alignment `yaml:"align" json:"align"`
}

type TemplateGenerator

type TemplateGenerator struct {
	Orientation          Orientation
	Template             string
	OverrideReplacements map[string]string
	Replacements         map[string]Replacement
	FontDir              string
	Debug                bool
}

func (*TemplateGenerator) Generate

func (g *TemplateGenerator) Generate(fn string, repl map[string]string) error

Generate generates a single PDF file with the specified replacements

Jump to

Keyboard shortcuts

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