parser

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package parser 提供 OFD 文件的打开、解析和文档对象访问能力。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	BaseLoc   models.StLoc
	FileCache *core.Package
}

func (*Common) Init

func (p *Common) Init(fileCache *core.Package, dir models.StLoc)

type Document

type Document struct {
	Common
	models.Document
	Pages          []*Page
	Templates      map[models.StID]*models.PageContent
	DrawParams     map[models.StID]*models.DrawParam
	Res            map[models.StID]*models.MultiMedia
	FontRes        map[models.StID]*models.Font
	CompositeUnits map[models.StID]*models.CompositeGraphicUnit
	PublicRes      []*models.Res
	DocumentRes    []*models.Res
	Signs          map[string]*models.Signature
	Seals          map[models.StID][]*SealInfo
	Annotations    map[models.StID]*models.PageAnnot
	Attachments    *models.Attachments
	CustomTags     *models.CustomTags
	Extensions     *models.Extensions
	Versions       map[string]*models.DocVersion
}

func (*Document) GetDrawParam

func (p *Document) GetDrawParam(id models.StID) *models.DrawParam

func (*Document) ParseSigns

func (p *Document) ParseSigns(file *models.StLoc) error

type OFD

type OFD struct {
	models.OFD

	Documents []*Document
	// contains filtered or unexported fields
}

OFD 表示一个OFD文档解析器

func NewOFD

func NewOFD(input any) (*OFD, error)

func (*OFD) Close

func (p *OFD) Close() error

Close 关闭OFD解析器并释放资源

func (*OFD) Open

func (p *OFD) Open(input any) error

Open 打开OFD文件,支持文件路径、字节数据或通用 io.Reader。 对于 io.Reader,Open 会读取全部内容,但不会关闭传入的 reader。

type Page

type Page struct {
	models.PageContent
	ID models.StID
}

type SealData

type SealData struct {
	FileType string // 文件类型: png, ofd, jpg, jpeg
	Data     []byte // 提取的字节数据
}

SealData 存储提取的签章数据。

func ExtractSealData

func ExtractSealData(source interface{}) (*SealData, error)

ExtractSealData 从签章数据中提取文件类型与内容,支持文件路径(string)、字节数据([]byte) 或 io.Reader 输入。

type SealInfo

type SealInfo struct {
	StampAnnot *models.StampAnnot
	SealData   *SealData
}

type Signature

type Signature struct {
	ID      string       `xml:"ID,attr"`
	BaseLoc models.StLoc `xml:"BaseLoc,attr"`
}

type Signatures

type Signatures struct {
	XMLName    xml.Name    `xml:"Signatures"`
	Xmlns      string      `xml:"xmlns,attr"`
	MaxSignID  *string     `xml:"MaxSignId,omitempty"`
	Signatures []Signature `xml:"Signature,omitempty"`
}

Jump to

Keyboard shortcuts

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