Documentation ¶
Index ¶
- Variables
- func RenderPage(ctx context.Context, urlStr string) ([]byte, error)
- func RenderPdf(ctx context.Context, urlStr string) ([]byte, error)
- func WithBrowserContext(ctx context.Context, bc *BrowserContext) context.Context
- func WithPdfContext(ctx context.Context, pc *PdfContext) context.Context
- func WithRendererContext(ctx context.Context, rc *RendererContext) context.Context
- type BrowserContext
- type PdfContext
- type RendererContext
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func RenderPage ¶
RenderPage rendered given url in browser and returns result html content
func WithBrowserContext ¶ added in v0.6.0
func WithBrowserContext(ctx context.Context, bc *BrowserContext) context.Context
WithBrowserContext add BrowserContext with browserKey to context and return new context value
func WithPdfContext ¶ added in v0.5.0
func WithPdfContext(ctx context.Context, pc *PdfContext) context.Context
WithPdfContext add PdfContext with pdfKey to context and return new context value
func WithRendererContext ¶ added in v0.4.0
func WithRendererContext(ctx context.Context, rc *RendererContext) context.Context
WithRendererContext add RendererContext with rendererKey to context and return new context value
Types ¶
type BrowserContext ¶ added in v0.6.0
type BrowserContext struct { IdleType string BrowserExecPath string NoSandbox bool DebugMode bool SingleProcess bool }
BrowserContext is use for general browser settings
func GetBrowserContext ¶ added in v0.6.0
func GetBrowserContext(ctx context.Context) (*BrowserContext, error)
GetBrowserContext read and return BrowserContext from input context ErrBrowserContextNotFound is returned if browserKey not exist
type PdfContext ¶ added in v0.5.0
type PdfContext struct { Landscape bool PaperWidthCm float64 PaperHeightCm float64 MarginTopCm float64 MarginBottomCm float64 MarginLeftCm float64 MarginRightCm float64 }
PdfContext is use for print PDF settings
func GetPdfContext ¶ added in v0.5.0
func GetPdfContext(ctx context.Context) (*PdfContext, error)
GetPdfContext read and return PdfContext from input context ErrPdfContextNotFound is returned if pdfKey not exist
type RendererContext ¶ added in v0.4.0
type RendererContext struct { Headless bool WindowWidth int WindowHeight int Timeout int ImageLoad bool SkipFrameCount int }
RendererContext is use for renderer settings
func GetRendererContext ¶ added in v0.4.0
func GetRendererContext(ctx context.Context) (*RendererContext, error)
GetRendererContext read and return RendererContext from input context ErrRendererContextNotFound is returned if rendererKey not exist