processor

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate added in v0.3.0

type Certificate struct {
	PrivKey *rsa.PrivateKey
	Cert    *x509.Certificate
}

Certificate represents a x509 certificate and its key loaded from a PFX.

type Job

type Job struct {
	CertName string
	InFile   string
	OutFile  string
	Password []byte
}

Job represents a queued doc sign job. This is used in bulk processing utility mode.

type Processor

type Processor struct {
	Wg *sync.WaitGroup
	// contains filtered or unexported fields
}

Processor offers an interface for executing PDF docsign jobs.

func New

func New(def SignProps, l *log.Logger) *Processor

New returns a new instance of Processor.

func (*Processor) GetProps

func (p *Processor) GetProps() SignProps

GetProps returns the default signature props.

func (*Processor) GetStats

func (p *Processor) GetStats() Stats

GetStats returns doc sign success / failure statistics from bulk operations.

func (*Processor) Listen

func (p *Processor) Listen(q chan Job)

Listen starts a listener that consumes PDF file names in fileQ signs them.

func (*Processor) LoadPFX

func (p *Processor) LoadPFX(name, path, password string) error

LoadPFX loads a PFX key and certificate.

func (*Processor) ProcessDoc

func (p *Processor) ProcessDoc(certName string, pr SignProps, password string, b io.ReadSeeker) ([]byte, error)

ProcessDoc takes a document and signs it (with optional password protection).

type SignCoords

type SignCoords struct {
	Pages []int   `json:"pages"`
	X1    float64 `json:"x1"`
	X2    float64 `json:"x2"`
	Y1    float64 `json:"y1"`
	Y2    float64 `json:"y2"`
}

SignCoords holds the signature annotation co-ordinates.

type SignProps

type SignProps struct {
	Name     string `json:"name"`
	Reason   string `json:"reason"`
	Location string `json:"location"`

	Annotations []map[string]string `json:"annotations"`
	Style       SignStyle           `json:"style"`
	Coords      []SignCoords        `json:"coords"`
}

SignProps represents signature properties that are required to do sign a document.

type SignStyle

type SignStyle struct {
	AutoSize    bool    `json:"autoSize"`
	Font        string  `json:"font"`
	FontSize    float64 `json:"fontSize"`
	LineHeight  float64 `json:"lineHeight"`
	FontColor   string  `json:"fontColor"`
	BgColor     string  `json:"bgColor"`
	BorderSize  float64 `json:"borderSize"`
	BorderColor string  `json:"borderColor"`

	FontColorRGBA   model.PdfColorDeviceRGB `json:"-"`
	BgColorRGBA     model.PdfColorDeviceRGB `json:"-"`
	BorderColorRGBA model.PdfColorDeviceRGB `json:"-"`
}

SignStyle holds signature field styles.

type Stats

type Stats struct {
	JobsDone, JobsFailed int
	StartTime            time.Time
}

Stats represents docsign job stats.

Jump to

Keyboard shortcuts

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