Documentation
¶
Index ¶
Constants ¶
View Source
const ( PAGE_SIZE_TOLERANCE_MM = 6 PS_TO_MM_CONVERSION_FACTOR = 0.352778 )
Variables ¶
This section is empty.
Functions ¶
func AddPaperStandard ¶
func RemovePaperStandard ¶
func RemovePaperStandard(name string)
Types ¶
type QuoteConfig ¶
type QuoteConfig struct {
PricesPerPage map[string]SizePrices // Key is "A4", "Legal", etc. Make sure to add a "Fallback" key for unknown sizes; otherwise, unknown sizes will be unsupported and will return an error
FullColorThreshold float64 // Percentage of color pixels to consider the page "Full color" (e.g., 0.25 for 25%)
}
QuoteConfig holds the price per page type
type QuoteResult ¶
type QuoteResult struct {
Pages map[string]SizeQuantity // Key is "A4", "Legal", etc.
TotalPrice float64
}
QuoteResult holds the result of the quote
type Quoter ¶
type Quoter struct {
Config QuoteConfig
}
Quoter holds the configuration and provides methods to calculate the quote
func NewQuoter ¶
func NewQuoter(config QuoteConfig) *Quoter
func (*Quoter) Estimate ¶
func (q *Quoter) Estimate(r io.ReadSeeker) (QuoteResult, error)
Estimate receives any Go file-like object or bytes and returns the quote
func (*Quoter) IdentifyPageSize ¶
func (q *Quoter) IdentifyPageSize(wPts float64, hPts float64) StandardSize
IdentifyPageSize receives the width and height in points and returns the closest standard size. If no standard size is found, returns a fallback size.
type SizePrices ¶
type SizeQuantity ¶
type StandardSize ¶
func GetPaperStandard ¶
func GetPaperStandard(name string) StandardSize
func GetPaperStandards ¶
func GetPaperStandards() []StandardSize
Click to show internal directories.
Click to hide internal directories.