goChromedp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 5 Imported by: 0

README

goChromedp

简介

Chromedp简单使用,实现截图和打印pdf

使用

go get github.com/wms3001/goChromedp

实例

  1. 截图
goChr := &GoChromedp{}
goChr.Url = "https://www.oschina.net"
goChr.Quality = 100
ctx, cancel := goChr.Ctx()
resp := goChr.Screenshot(ctx, cancel)
res, _ := json.Marshal(resp)
log.Println(string(res))
  1. pdf
goChr := &GoChromedp{}
goChr.Url = "https://www.oschina.net"
ctx, cancel := goChr.Ctx()
resp := goChr.PrintPdf(ctx, cancel)
res, _ := json.Marshal(resp)
log.Println(string(res))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoChromedp

type GoChromedp struct {
	Url     string `json:"url"`
	Quality int    `json:"quality"`
}

func (*GoChromedp) CloseCtx

func (goChromedp *GoChromedp) CloseCtx(cancel context.CancelFunc)

func (*GoChromedp) Ctx

func (goChromedp *GoChromedp) Ctx() (context.Context, context.CancelFunc)

func (*GoChromedp) PrintPdf

func (goChromedp *GoChromedp) PrintPdf(ctx context.Context, cancel context.CancelFunc) *goCommon.Resp

func (*GoChromedp) Screenshot

func (goChromedp *GoChromedp) Screenshot(ctx context.Context, cancel context.CancelFunc) *goCommon.Resp

Jump to

Keyboard shortcuts

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