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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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