Documentation ¶
Index ¶
- Constants
- func ApplyPageRotation(page *model.PdfPage, rect []float64) []float64
- func CheckForTesseract(path string) bool
- func CondenseSpaces(str string) string
- func CropImage(img *image.Image, crop image.Rectangle) (image.Image, error)
- func DeHyphen(str string) string
- func ExpandLigatures(str string) string
- func GetAnnotationColor(annotation *model.PdfAnnotation) string
- func GetAnnotationColorCategory(annotation *model.PdfAnnotation) string
- func GetAnnotationDate(annot *model.PdfAnnotation) *time.Time
- func GetAnnotationID(ids map[string]bool, pageIndex int, x float64, y float64, annotType string) string
- func GetAnnotationRects(page *model.PdfPage, annotation *model.PdfAnnotation) []r2.Rect
- func GetAnnotationSortKey(page int, offset int, top int) string
- func GetAnnotationType(t interface{}) string
- func GetBoundsFromAnnotMarks(annotRect r2.Rect, markRects []r2.Rect) (r2.Rect, int)
- func GetClosestMark(x float64, y float64, markRects []r2.Rect) int
- func GetCoordinates(annotation *model.PdfAnnotation) (float64, float64)
- func GetFallbackText(text string, annotRect r2.Rect, markRects []r2.Rect, ...) string
- func GetMarkRect(mark extractor.TextMark) r2.Rect
- func GetMediaBox(page *model.PdfPage) *model.PdfRectangle
- func GetPageLabelMap(numPages int, labels core.PdfObject) map[int]string
- func GetQuadPoint(annotation *model.PdfAnnotation) *core.PdfObjectArray
- func GetTextByAnnotBounds(fitzDoc *fitz.Document, pageIndex int, page *model.PdfPage, bounds r2.Rect) (string, error)
- func HandleImageOCR(page *model.PdfPage, ocrImg *image.Image, annotRect []float64, tessPath string, ...) string
- func IsWithinOverlapThresh(annot r2.Rect, mark r2.Rect, thresh float64) bool
- func OCRImage(img image.Image, tessPath, lang, dataDir string) (string, error)
- func PDFObjToColorCategory(c core.PdfObject) string
- func PDFObjToHex(c core.PdfObject) string
- func RemoveNul(str string) string
- func ShouldUseFallback(str string, fallback string) bool
- func ValidateLang(tessPath, code string) bool
- func WriteImage(img *image.Image, name string, format string, quality int) error
- type Annotation
- type BySortIndex
- type ImageAnnotArgs
Constants ¶
View Source
const ( Highlight string = "highlight" Strike = "strike" Underline = "underline" Text = "text" Rectangle = "rectangle" Image = "image" Unsupported = "unsupported" )
Variables ¶
This section is empty.
Functions ¶
func CheckForTesseract ¶
func CondenseSpaces ¶
func ExpandLigatures ¶
func GetAnnotationColor ¶
func GetAnnotationColor(annotation *model.PdfAnnotation) string
func GetAnnotationColorCategory ¶
func GetAnnotationColorCategory(annotation *model.PdfAnnotation) string
func GetAnnotationDate ¶
func GetAnnotationDate(annot *model.PdfAnnotation) *time.Time
func GetAnnotationID ¶
func GetAnnotationRects ¶
func GetAnnotationType ¶
func GetAnnotationType(t interface{}) string
func GetBoundsFromAnnotMarks ¶
func GetCoordinates ¶
func GetCoordinates(annotation *model.PdfAnnotation) (float64, float64)
func GetFallbackText ¶
func GetMediaBox ¶
func GetMediaBox(page *model.PdfPage) *model.PdfRectangle
func GetPageLabelMap ¶
func GetQuadPoint ¶
func GetQuadPoint(annotation *model.PdfAnnotation) *core.PdfObjectArray
func GetTextByAnnotBounds ¶
func HandleImageOCR ¶
func IsWithinOverlapThresh ¶
func PDFObjToColorCategory ¶
func PDFObjToHex ¶
func ShouldUseFallback ¶
func ValidateLang ¶
Types ¶
type Annotation ¶
type Annotation struct { AnnotatedText string `json:"annotatedText,omitempty"` Color string `json:"color,omitempty"` ColorCategory string `json:"colorCategory,omitempty"` Comment string `json:"comment,omitempty"` Date string `json:"date,omitempty"` ID string `json:"id"` ImagePath string `json:"imagePath,omitempty"` OCRText string `json:"ocrText,omitempty"` Page int `json:"page"` PageLabel string `json:"pageLabel"` Type string `json:"type"` X float64 `json:"x"` Y float64 `json:"y"` SortIndex string `json:"-"` }
func HandleImageAnnot ¶
func HandleImageAnnot(args ImageAnnotArgs) (*Annotation, error)
type BySortIndex ¶
type BySortIndex []*Annotation
func (BySortIndex) Len ¶
func (a BySortIndex) Len() int
func (BySortIndex) Less ¶
func (a BySortIndex) Less(i, j int) bool
func (BySortIndex) Swap ¶
func (a BySortIndex) Swap(i, j int)
type ImageAnnotArgs ¶
type ImageAnnotArgs struct { Page *model.PdfPage PageImg *image.Image OCRImg *image.Image PageIndex int Annotation *model.PdfAnnotation X float64 Y float64 ID string Write bool AttemptOCR bool ImageOutputPath string ImageBaseName string ImageFormat string ImageQuality int TessPath string TessLang string TessDataDir string }
Click to show internal directories.
Click to hide internal directories.