Documentation ¶
Overview ¶
Package wkhtmltoimage provides a simple wrapper around wkhtmltoimage (http://wkhtmltopdf.org/) binary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateImage ¶
func GenerateImage(options *ImageOptions) ([]byte, error)
GenerateImage creates an image from an input. It returns the image ([]byte) and any error encountered.
Types ¶
type ImageOptions ¶
type ImageOptions struct { // BinaryPath the path to your wkhtmltoimage binary. REQUIRED // // Must be absolute path e.g /usr/local/bin/wkhtmltoimage BinaryPath string // Input is the content to turn into an image. REQUIRED // // Can be a url (http://example.com), a local file (/tmp/example.html), or html as a string (send "-" and set the Html value) Input string // Format is the type of image to generate // // jpg, png, svg, bmp supported. Defaults to local wkhtmltoimage default Format string // Height is the height of the screen used to render in pixels. // // Default is calculated from page content. Default 0 (renders entire page top to bottom) Height int // Width is the width of the screen used to render in pixels. // // Note that this is used only as a guide line. Default 1024 Width int // Quality determines the final image quality. // // Values supported between 1 and 100. Default is 94 Quality int // Html is a string of html to render into and image. // // Only needed to be set if Input is set to "-" Html string // Output controls how to save or return the image. // // Leave nil to return a []byte of the image. Set to a path (/tmp/example.png) to save as a file. Output string }
ImageOptions represent the options to generate the image.
Click to show internal directories.
Click to hide internal directories.