HomeUniDoc
...

Package redactor

Overview ▾

type RectangleProps

RectangleProps defines properties of the redaction rectangle to be drawn.

type RectangleProps struct {
    FillColor   creator.Color // fill color of the rectangle.
    BorderWidth float64       // a floating number that determines the border width.
    FillOpacity float64       // a floating number that determines the opacity of the rectangle as a fraction of 1.
}

func RedactRectanglePropsNew

func RedactRectanglePropsNew() *RectangleProps

RedactRectanglePropsNew return a new pointer to a default RectangleProps object.

type RedactionOptions

RedactionOptions is a collection of RedactionTerm objects.

type RedactionOptions struct {
    Terms []RedactionTerm
}

type RedactionTerm

RedactionTerm holds the regexp pattern and the replacement string for the redaction process.

type RedactionTerm struct {
    Pattern *regexp.Regexp
}

type Redactor

Redactor represents a Redactor object.

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

func New

func New(reader *model.PdfReader, opts *RedactionOptions, rectProps *RectangleProps) *Redactor

New instantiates a Redactor object with given PdfReader and `regex` pattern.

func (*Redactor) Redact

func (re *Redactor) Redact() error

Redact executes the redact operation on a pdf file and updates the content streams of all pages of the file.

func (*Redactor) Write

func (re *Redactor) Write(writer io.Writer) error

Write writes the content of `re.creator` to writer of type io.Writer interface.

func (*Redactor) WriteToFile

func (re *Redactor) WriteToFile(outputPath string) error

WriteToFile writes the redacted document to file specified by `outputPath`.