html2image

package module
v0.0.0-...-06d6ed7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2022 License: MIT Imports: 7 Imported by: 0

README

go-html2image

HTML to image tool based on golang

Documentation

Index

Constants

View Source
const DefaultFromSurface = true

DefaultFromSurface Capture the screenshot from the surface, rather than the view. Defaults to true.

View Source
const DefaultQuality = 0

DefaultQuality Compression quality from range [0..100] (jpeg only).

View Source
const DefaultViewportHeight = 996

DefaultViewportHeight Rectangle height in device independent pixels (dip).

View Source
const DefaultViewportScale = 1

DefaultViewportScale Page scale factor.

View Source
const DefaultViewportWidth = 996

DefaultViewportWidth Rectangle width in device independent pixels (dip).

View Source
const DefaultViewportX = 0

DefaultViewportX Capture the screenshot of a given region only. X offset in device independent pixels (dip).

View Source
const DefaultViewportY = 0

DefaultViewportY Y offset in device independent pixels (dip).

View Source
const DefaultWaitingTime = 0

DefaultWaitingTime Waiting time after the page loaded. Default 0 means not wait. unit:Millisecond

FormatPng Image compression format (defaults to png).

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonRequestDTO

type CommonRequestDTO struct {
	Url       string `schema:"url,omitempty" validate:"required,url"`
	UploadKey string `schema:"uploadKey,omitempty" validate:"omitempty"`
	Username  string `schema:"u,omitempty" validate:"required"`
	Password  string `schema:"p,omitempty" validate:"required"`
}

type Conver

type Conver struct {
	// contains filtered or unexported fields
}

type ConvertConfig

type ConvertConfig struct {
	Url    string `validate:"required,url"`
	Params Params
}

type Converter

type Converter interface {
	Convert() ([]byte, error)
	GetConvertElapsed() time.Duration
}

type DoctronConfig

type DoctronConfig struct {
	TraceId     uuid.UUID
	Ctx         context.Context
	DoctronType int
	ConvertConfig
}

type Html2ImageParams

type Html2ImageParams struct {
	page.CaptureScreenshotParams
	CustomClip  bool
	WaitingTime int // Waiting time after the page loaded. Default 0 means not wait. unit:Millisecond
}

func NewDefaultHtml2ImageParams

func NewDefaultHtml2ImageParams() Html2ImageParams

NewDefaultHtml2ImageParams default html convert to image params

type Html2ImageRequestDTO

type Html2ImageRequestDTO struct {
	CommonRequestDTO
	Format      page.CaptureScreenshotFormat `schema:"format,omitempty" validate:"omitempty"`      // Image compression format (defaults to png).
	Quality     int64                        `schema:"quality,omitempty" validate:"omitempty"`     // Compression quality from range [0..100] (jpeg only).
	CustomClip  bool                         `schema:"customClip,omitempty" validate:"omitempty"`  //if set this value, the below clip will work,otherwise not work!
	ClipX       float64                      `schema:"clipX,omitempty" validate:"omitempty"`       // Capture the screenshot of a given region only.X offset in device independent pixels (dip).
	ClipY       float64                      `schema:"clipY,omitempty" validate:"omitempty"`       // Capture the screenshot of a given region only.Y offset in device independent pixels (dip).
	ClipWidth   float64                      `schema:"clipWidth,omitempty" validate:"omitempty"`   // Capture the screenshot of a given region only.Rectangle width in device independent pixels (dip).
	ClipHeight  float64                      `schema:"clipHeight,omitempty" validate:"omitempty"`  // Capture the screenshot of a given region only.Rectangle height in device independent pixels (dip).
	ClipScale   float64                      `schema:"clipScale,omitempty" validate:"omitempty"`   // Capture the screenshot of a given region only.Page scale factor.
	FromSurface bool                         `schema:"fromSurface,omitempty" validate:"omitempty"` // Capture the screenshot from the surface, rather than the view. Defaults to true.
	WaitingTime int                          `schema:"waitingTime,omitempty" validate:"omitempty"` // Waiting time after the page loaded. Default 0 means not wait. unit:Millisecond
}

type Params

type Params interface {
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL