Documentation
¶
Overview ¶
Package rendering provides a function to render HTML to images or HTML after JS execution. It uses the Chrome Debug Protocol through the rod package. It will download a headless Chrome version if needed that matches the current platform.
If the environment variable SND_CHROME_DEBUG=1 it will start the chrome instances in non-headless mode.
Index ¶
- Constants
- func ExtractHTML(url string, selector string) (string, error)
- func InitBrowser()
- func RenderHTML(html string, width int) (image.Image, error)
- func RenderURL(url string, width int) (image.Image, error)
- func SetAndroidRenderer(renderer AndroidRenderer)
- func Shutdown() error
- type AndroidRenderer
Constants ¶
View Source
const IdleRequestTimeout = 5
View Source
const ReadyTimeout = 5
Variables ¶
This section is empty.
Functions ¶
func ExtractHTML ¶ added in v0.5.0
ExtractHTML opens the URL, lets the page executes and returns the HTML.
func InitBrowser ¶ added in v0.7.0
func InitBrowser()
func RenderHTML ¶
RenderHTML renders the element #content into an image.
func RenderURL ¶ added in v0.4.1
RenderURL opens the URL and renders the element #content into an image.
func SetAndroidRenderer ¶ added in v1.3.0
func SetAndroidRenderer(renderer AndroidRenderer)
Types ¶
Click to show internal directories.
Click to hide internal directories.