wkhtmltoimage.go
func GenerateImage(options *ImageOptions) ([]byte, error) {
	arr, err := buildParams(options)
	if err != nil {
		return []byte{}, err
	}

	if options.BinaryPath == "" {
		return []byte{}, errors.New("BinaryPath not set")
	}

	cmd := exec.Command(options.BinaryPath, arr...)

	if options.Html != "" {
		cmd.Stdin = strings.NewReader(options.Html)
	}

	output, err := cmd.CombinedOutput()

	trimmed := cleanupOutput(output, options.Format)

	return trimmed, err
}
func GenerateImage(options *ImageOptions) ([]byte, error) {
	arr, err := buildParams(options)
	if err != nil {
		return []byte{}, err
	}

	if options.BinaryPath == "" {
		return []byte{}, errors.New("BinaryPath not set")
	}

	cmd := exec.Command(options.BinaryPath, arr...)

	if options.Html != "" {
		cmd.Stdin = strings.NewReader(options.Html)
	}

	output, err := cmd.CombinedOutput()

	trimmed := cleanupOutput(output, options.Format)

	return trimmed, err
}
func GenerateImage ( options * ImageOptions ) ( [ ] byte , error ) { arr , err := buildParams ( options ) if err != nil { return [ ] byte { } , err } if options . BinaryPath == " " { return [ ] byte { } , errors . New ( " " ) } cmd := exec . Command ( options . BinaryPath , arr ... ) if options . Html != " " { cmd . Stdin = strings . NewReader ( options . Html ) } output , err := cmd . CombinedOutput ( ) trimmed := cleanupOutput ( output , options . Format ) return trimmed , err }
// GenerateImage creates an image from an input.
// It returns the image ([]byte) and any error encountered.
GenerateImage creates an image from an input . It returns the image ( [] byte ) and any error encountered .