mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +02:00
34c8c02258
* Externalized HTML drivers * Fixed unit tests * Updated logging * Added support to set default driver * Updated GetIn and SetIn helpers
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package drivers
|
|
|
|
import "github.com/MontFerret/ferret/pkg/runtime/values"
|
|
|
|
const (
|
|
ScreenshotFormatPNG ScreenshotFormat = "png"
|
|
ScreenshotFormatJPEG ScreenshotFormat = "jpeg"
|
|
)
|
|
|
|
type (
|
|
ScreenshotFormat string
|
|
|
|
ScreenshotParams struct {
|
|
X values.Float
|
|
Y values.Float
|
|
Width values.Float
|
|
Height values.Float
|
|
Format ScreenshotFormat
|
|
Quality values.Int
|
|
}
|
|
)
|
|
|
|
func IsScreenshotFormatValid(format string) bool {
|
|
value := ScreenshotFormat(format)
|
|
|
|
return value == ScreenshotFormatPNG || value == ScreenshotFormatJPEG
|
|
}
|
|
|
|
func NewDefaultHTMLPDFParams() PDFParams {
|
|
return PDFParams{
|
|
Landscape: values.False,
|
|
DisplayHeaderFooter: values.False,
|
|
PrintBackground: values.False,
|
|
Scale: values.Float(1),
|
|
PaperWidth: values.Float(8.5),
|
|
PaperHeight: values.Float(11),
|
|
MarginTop: values.Float(0.4),
|
|
MarginBottom: values.Float(0.4),
|
|
MarginLeft: values.Float(0.4),
|
|
MarginRight: values.Float(0.4),
|
|
PageRanges: values.EmptyString,
|
|
IgnoreInvalidPageRanges: values.False,
|
|
HeaderTemplate: values.EmptyString,
|
|
FooterTemplate: values.EmptyString,
|
|
PreferCSSPageSize: values.False,
|
|
}
|
|
}
|