pages

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pages provides page range parsing and validation for pdf-cli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPageRanges

func ExpandPageRanges(ranges []PageRange) []int

ExpandPageRanges expands a slice of PageRange to individual page numbers.

func FormatPageRanges

func FormatPageRanges(pages []int) string

FormatPageRanges converts a slice of page numbers back to a compact range string.

func ParseAndExpandPages

func ParseAndExpandPages(input string) ([]int, error)

ParseAndExpandPages parses a page range string and returns individual page numbers.

func ParseReorderSequence

func ParseReorderSequence(spec string, totalPages int) ([]int, error)

ParseReorderSequence parses a reorder sequence string and returns the page numbers in order. Supports individual pages (1,3,5), ranges (1-10), special values (end), reverse ranges (10-1), and page duplication (1,2,3,1 repeats page 1 at the end).

func ValidatePageNumbers

func ValidatePageNumbers(pages []int, totalPages int) error

ValidatePageNumbers checks if all page numbers are within the valid range.

Types

type PageRange

type PageRange struct {
	Start int
	End   int
}

PageRange represents a range of pages.

func ParsePageRanges

func ParsePageRanges(input string) ([]PageRange, error)

ParsePageRanges parses a page range string like "1-5,7,10-12". Returns a slice of PageRange structs.

Jump to

Keyboard shortcuts

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