unidoc: github.com/unidoc/unidoc/pdf/annotator Index | Files

package annotator

import "github.com/unidoc/unidoc/pdf/annotator"

The annotator package contains an annotator with a convenient interface for creating annotations with appearance streams. It goes beyond the models package which includes definitions of basic annotation models, in that it can create the appearance streams which specify the exact appearance as needed by many pdf viewers for consistent appearance of the annotations.

Index

Package Files

circle.go doc.go line.go rectangle.go

func CreateCircleAnnotation Uses

func CreateCircleAnnotation(circDef CircleAnnotationDef) (*pdf.PdfAnnotation, error)

Creates a circle/ellipse annotation object with appearance stream that can be added to page PDF annotations.

func CreateLineAnnotation Uses

func CreateLineAnnotation(lineDef LineAnnotationDef) (*pdf.PdfAnnotation, error)

Creates a line annotation object that can be added to page PDF annotations.

func CreateRectangleAnnotation Uses

func CreateRectangleAnnotation(rectDef RectangleAnnotationDef) (*pdf.PdfAnnotation, error)

Creates a rectangle annotation object that can be added to page PDF annotations.

type CircleAnnotationDef Uses

type CircleAnnotationDef struct {
    X             float64
    Y             float64
    Width         float64
    Height        float64
    FillEnabled   bool // Show fill?
    FillColor     *pdf.PdfColorDeviceRGB
    BorderEnabled bool // Show border?
    BorderWidth   float64
    BorderColor   *pdf.PdfColorDeviceRGB
    Opacity       float64 // Alpha value (0-1).
}

type LineAnnotationDef Uses

type LineAnnotationDef struct {
    X1               float64
    Y1               float64
    X2               float64
    Y2               float64
    LineColor        *pdf.PdfColorDeviceRGB
    Opacity          float64 // Alpha value (0-1).
    LineWidth        float64
    LineEndingStyle1 draw.LineEndingStyle // Line ending style of point 1.
    LineEndingStyle2 draw.LineEndingStyle // Line ending style of point 2.
}

Defines a line between point 1 (X1,Y1) and point 2 (X2,Y2). The line ending styles can be none (regular line), or arrows at either end. The line also has a specified width, color and opacity.

type RectangleAnnotationDef Uses

type RectangleAnnotationDef struct {
    X             float64
    Y             float64
    Width         float64
    Height        float64
    FillEnabled   bool // Show fill?
    FillColor     *pdf.PdfColorDeviceRGB
    BorderEnabled bool // Show border?
    BorderWidth   float64
    BorderColor   *pdf.PdfColorDeviceRGB
    Opacity       float64 // Alpha value (0-1).
}

A rectangle defined with a specified Width and Height and a lower left corner at (X,Y). The rectangle can optionally have a border and a filling color. The Width/Height includes the border (if any specified).

Package annotator imports 4 packages (graph). Updated 2017-08-26. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).