github.com/MontFerret/ferret@v0.18.0/pkg/drivers/screenshot.go (about) 1 package drivers 2 3 import "github.com/MontFerret/ferret/pkg/runtime/values" 4 5 const ( 6 ScreenshotFormatPNG ScreenshotFormat = "png" 7 ScreenshotFormatJPEG ScreenshotFormat = "jpeg" 8 ) 9 10 type ( 11 ScreenshotFormat string 12 13 ScreenshotParams struct { 14 X values.Float 15 Y values.Float 16 Width values.Float 17 Height values.Float 18 Format ScreenshotFormat 19 Quality values.Int 20 } 21 ) 22 23 func IsScreenshotFormatValid(format string) bool { 24 value := ScreenshotFormat(format) 25 26 return value == ScreenshotFormatPNG || value == ScreenshotFormatJPEG 27 } 28 29 func NewDefaultHTMLPDFParams() PDFParams { 30 return PDFParams{ 31 Landscape: values.False, 32 DisplayHeaderFooter: values.False, 33 PrintBackground: values.False, 34 Scale: values.Float(1), 35 PaperWidth: values.Float(8.5), 36 PaperHeight: values.Float(11), 37 MarginTop: values.Float(0.4), 38 MarginBottom: values.Float(0.4), 39 MarginLeft: values.Float(0.4), 40 MarginRight: values.Float(0.4), 41 PageRanges: values.EmptyString, 42 HeaderTemplate: values.EmptyString, 43 FooterTemplate: values.EmptyString, 44 PreferCSSPageSize: values.False, 45 } 46 }