file

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInspectorRequired = errors.New("PDF inspector capability is required")
	ErrPDFNotFound       = errors.New("PDF file does not exist")
)

Functions

This section is empty.

Types

type Inspection

type Inspection struct {
	Size      int64
	ModTime   time.Time
	Header    []byte
	PageCount int
}

Inspection is the effect-free evidence used by PDFFile validation.

type Inspector

type Inspector interface {
	Inspect(path string) (Inspection, error)
}

Inspector is implemented at an infrastructure boundary that may access files or tools.

type PDFFile

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

PDFFile is a domain entity whose rules operate only on injected inspection evidence.

func NewPDFFile

func NewPDFFile(path string, inspectors ...Inspector) *PDFFile

NewPDFFile creates a PDF entity. Supply an Inspector before invoking effectful queries.

func (*PDFFile) Exists

func (pdf *PDFFile) Exists() bool

func (*PDFFile) GetErrors

func (pdf *PDFFile) GetErrors() []error

func (*PDFFile) GetFileSize

func (pdf *PDFFile) GetFileSize() (int64, error)

func (*PDFFile) GetMetadata

func (pdf *PDFFile) GetMetadata() (*generation.PDFMetadata, error)

func (*PDFFile) GetModificationTime

func (pdf *PDFFile) GetModificationTime() (time.Time, error)

func (*PDFFile) GetPageCount

func (pdf *PDFFile) GetPageCount() (int, error)

func (*PDFFile) HasErrors

func (pdf *PDFFile) HasErrors() bool

func (*PDFFile) IsValid

func (pdf *PDFFile) IsValid() bool

func (*PDFFile) Path

func (pdf *PDFFile) Path() string

func (*PDFFile) String

func (pdf *PDFFile) String() string

func (*PDFFile) Validate

func (pdf *PDFFile) Validate() error

type PDFFileRepository

type PDFFileRepository interface {
	FindByPath(path string) (*PDFFile, error)
	Save(pdf *PDFFile) error
	Delete(pdf *PDFFile) error
}

type PDFFileService

type PDFFileService interface {
	CreatePDFFile(path string) (*PDFFile, error)
	ValidatePDFFile(pdf *PDFFile) error
	GetPDFMetadata(pdf *PDFFile) (*generation.PDFMetadata, error)
	ConvertToImages(pdf *PDFFile, formats []string) ([]string, error)
}

Jump to

Keyboard shortcuts

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