models

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IdentityMatrix = CTM{1, 0, 0, 1, 0, 0}

Functions

This section is empty.

Types

type ActionEvent

type ActionEvent string

ActionEvent 动作事件类型

const (
	ActionEventDO    ActionEvent = "DO"
	ActionEventPO    ActionEvent = "PO"
	ActionEventClick ActionEvent = "CLICK"
)

type ActionGoto

type ActionGoto struct {
	Dest     *CtDest `xml:"Dest,omitempty"`
	Bookmark *struct {
		Name string `xml:"Name,attr"`
	} `xml:"Bookmark,omitempty"`
}

ActionGoto 跳转动作

type ActionGotoA

type ActionGotoA struct {
	AttachID  string `xml:"AttachID,attr"`
	NewWindow bool   `xml:"NewWindow,attr,omitempty"`
}

ActionGotoA 附件跳转动作

type ActionList

type ActionList struct {
	Actions []CtAction `xml:"Action"`
}

type ActionMovie

type ActionMovie struct {
	ResourceID StRefID       `xml:"ResourceID,attr"`
	Operator   MovieOperator `xml:"Operator,attr,omitempty"`
}

ActionMovie 影片动作

type ActionSound

type ActionSound struct {
	ResourceID  StRefID `xml:"ResourceID,attr"`
	Volume      *int    `xml:"Volume,attr,omitempty"`
	Repeat      *bool   `xml:"Repeat,attr,omitempty"`
	Synchronous *bool   `xml:"Synchronous,attr,omitempty"`
}

ActionSound 声音动作

type ActionURI

type ActionURI struct {
	URI    string  `xml:"URI,attr"`
	Base   *string `xml:"Base,attr,omitempty"`
	Target *string `xml:"Target,attr,omitempty"`
}

ActionURI URI动作

type Actions

type Actions struct {
	Action []CtAction `xml:"Action"`
}

type Annot

type Annot struct {
	ID          string      `xml:"ID,attr"`
	Type        AnnotType   `xml:"Type,attr"`
	Creator     string      `xml:"Creator,attr"`
	LastModDate DateTime    `xml:"LastModDate,attr"`
	Visible     bool        `xml:"Visible,attr,omitempty"`
	Subtype     string      `xml:"Subtype,attr,omitempty"`
	Print       bool        `xml:"Print,attr,omitempty"`
	NoZoom      bool        `xml:"NoZoom,attr,omitempty"`
	NoRotate    bool        `xml:"NoRotate,attr,omitempty"`
	ReadOnly    bool        `xml:"ReadOnly,attr,omitempty"`
	Remark      *string     `xml:"Remark,omitempty"`
	Parameters  *Params     `xml:"Parameters,omitempty"`
	Appearance  *Appearance `xml:"Appearance"`
}

Annot 单个注解定义

type AnnotPage

type AnnotPage struct {
	PageID  StRefID `xml:"PageID,attr"`
	FileLoc StLoc   `xml:"FileLoc"`
}

AnnotPage 单个页面的注解文件引用

type AnnotType

type AnnotType string

AnnotType 注解类型枚举

const (
	AnnotTypeLink      AnnotType = "Link"
	AnnotTypePath      AnnotType = "Path"
	AnnotTypeHighlight AnnotType = "Highlight"
	AnnotTypeStamp     AnnotType = "Stamp"
	AnnotTypeWatermark AnnotType = "Watermark"
)

func (*AnnotType) UnmarshalXMLAttr

func (a *AnnotType) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 自定义AnnotType解析

type Annotations

type Annotations struct {
	XMLName xml.Name    `xml:"Annotations"`
	Xmlns   string      `xml:"xmlns,attr"`
	Pages   []AnnotPage `xml:"Page,omitempty"`
}

Annotations 注解列表容器

type Appearance

type Appearance struct {
	Boundary *StBox `xml:"Boundary,attr,omitempty"`
	CTPageBlock
}

Appearance 注解外观

type ArcData

type ArcData struct {
	RX, RY        float64 // 椭圆半径
	XAxisRotation float64 // x轴旋转角度(度)
	LargeArcFlag  bool    // 大弧标志
	SweepFlag     bool    // 扫过标志
	EndPoint      StPos   // 终点坐标
}

ArcData 定义椭圆弧参数

type Area

type Area struct {
	Start StPos  `xml:"Start,attr"`
	Paths []Path `xml:",any"`
}

Area 区域中的单个区域

type Attachment

type Attachment struct {
	ID           string     `xml:"ID,attr"`
	Name         string     `xml:"Name,attr"`
	Format       *string    `xml:"Format,attr,omitempty"`
	CreationDate *time.Time `xml:"CreationDate,attr,omitempty"`
	ModDate      *time.Time `xml:"ModDate,attr,omitempty"`
	Size         *float64   `xml:"Size,attr,omitempty"`
	Visible      bool       `xml:"Visible,attr,omitempty"`
	Usage        string     `xml:"Usage,attr,omitempty"`
	FileLoc      StLoc      `xml:"FileLoc"`
}

Attachment 单个附件定义

type Attachments

type Attachments struct {
	XMLName     xml.Name     `xml:"Attachments"`
	Xmlns       string       `xml:"xmlns,attr"`
	Attachments []Attachment `xml:"Attachment,omitempty"`
}

Attachments 附件列表容器

type BookmarkList

type BookmarkList struct {
	Bookmarks []CTBookmark `xml:"Bookmark"`
}

type Border

type Border struct {
	BorderColor           *CTColor `xml:"BorderColor"`
	LineWidth             float64  `xml:"LineWidth,attr,omitempty"`
	HorizonalCornerRadius float64  `xml:"HorizonalCornerRadius,attr,omitempty"`
	VerticalCornerRadius  float64  `xml:"VerticalCornerRadius,attr,omitempty"`
	DashOffset            float64  `xml:"DashOffset,attr,omitempty"`
	DashPattern           StArray  `xml:"DashPattern,attr,omitempty"`
}

type CTAxialShd

type CTAxialShd struct {
	Segment    []Segment `xml:"Segment"`
	MapType    string    `xml:"MapType,attr,omitempty"` // Direct, Repeat, Reflect
	MapUnit    float64   `xml:"MapUnit,attr,omitempty"`
	Extend     int       `xml:"Extend,attr,omitempty"` // 0,1,2,3
	StartPoint StPos     `xml:"StartPoint,attr"`
	EndPoint   StPos     `xml:"EndPoint,attr"`
}

type CTBookmark

type CTBookmark struct {
	Name string `xml:"Name,attr"`
	Dest CtDest `xml:"Dest"`
}

type CTCGTransform

type CTCGTransform struct {
	// Glyphs 变换关系中字型索引列表
	Glyphs       StArrayI `xml:"Glyphs"`
	CodePosition int      `xml:"CodePosition,attr"`
	CodeCount    int      `xml:"CodeCount,attr,omitempty"`
	GlyphCount   int      `xml:"GlyphCount,attr,omitempty"`
}

type CTColor

type CTColor struct {
	Pattern      *CtPattern      `xml:"Pattern"`
	AxialShd     *CTAxialShd     `xml:"AxialShd"`
	RadialShd    *CTRadialShd    `xml:"RadialShd"`
	GouraudShd   *CTGouraudShd   `xml:"GouraudShd"`
	LaGourandShd *CTLaGouraudShd `xml:"LaGourandShd"`
	// Value 颜色值,指定了当前颜色空间下各通道的取值。
	//Value的取值应符合"通道 1 通道 2 通道 3 …"格式。
	//此属性不出现时,应参考 Index 属性从颜色空间的调色版中取值。当二者都不出现时,该颜色各通道的值全部为 0
	//
	//可选
	Value *Color `xml:"Value,attr,omitempty"`
	// Index 调色板中颜色的编号,非负整数,将从当前颜色空间的调色板中取出相应索引的预定义颜色用来绘制。
	//索引从0开始 可选
	Index      int     `xml:"Index,attr,omitempty"`
	ColorSpace StRefID `xml:"ColorSpace,attr,omitempty"`
	// Alpha 颜色透明度,在 0~255 之间取值。默认为 255,表示完全不透明
	//
	//可选
	Alpha *uint8 `xml:"Alpha,attr,omitempty"`
}

type CTGouraudShd

type CTGouraudShd struct {
	Point     []GouraudPoint `xml:"Point"`
	BackColor *CTColor       `xml:"BackColor,omitempty"`
	Extend    int            `xml:"Extend,attr,omitempty"`
}

type CTGraphicUnit

type CTGraphicUnit struct {
	Actions   *Actions `xml:"Actions"`
	Clips     *Clips   `xml:"Clips"`
	Boundary  StBox    `xml:"Boundary,attr"`
	Name      string   `xml:"Name,attr,omitempty"`
	Visible   bool     `xml:"Visible,attr,omitempty"`
	CTM       *CTM     `xml:"CTM,attr,omitempty"`
	DrawParam StRefID  `xml:"DrawParam,attr,omitempty"`
	LineWidth float64  `xml:"LineWidth,attr,omitempty"`
	// 线端点样式,枚举值,指定了一条线的端点样式。默认值为 Butt
	Cap  string `xml:"Cap,attr,omitempty"`  // Butt, Round, Square
	Join string `xml:"Join,attr,omitempty"` // Miter, Round, Bevel
	// Join 为 Miter 时小角度 JoinSize 的截断值,默认值为 3.528。当 Join 不等于 Miter 时该参数无效
	MiterLimit  float64   `xml:"MiterLimit,attr,omitempty"`
	DashOffset  float64   `xml:"DashOffset,attr,omitempty"`
	DashPattern *StArrayF `xml:"DashPattern,attr,omitempty"`
	Alpha       *uint8    `xml:"Alpha,attr,omitempty"`
}

type CTLaGouraudShd

type CTLaGouraudShd struct {
	Point          []LaGouraudPoint `xml:"Point"`
	BackColor      *CTColor         `xml:"BackColor,omitempty"`
	VerticesPerRow int              `xml:"VerticesPerRow,attr"`
	Extend         int              `xml:"Extend,attr,omitempty"`
}

type CTM

type CTM [6]float64

CTM 表示OFD图元变换矩阵

func (*CTM) Multiply

func (c *CTM) Multiply(other *CTM) *CTM

Multiply 矩阵乘法:计算 this × other CTM 是3x2矩阵,但实际上是3x3齐次坐标的2D仿射变换矩阵 矩阵形式: [ a c e ] [ b d f ] [ 0 0 1 ]

func (*CTM) RotationAngle

func (c *CTM) RotationAngle() float64

RotationAngle 提取旋转角度(弧度)

func (*CTM) RotationAngleDegrees

func (c *CTM) RotationAngleDegrees() float64

RotationAngleDegrees 提取旋转角度(度)

func (*CTM) String

func (c *CTM) String() string

String 返回字符串表示

func (*CTM) Transform

func (c *CTM) Transform(x, y float64) (float64, float64)

func (*CTM) TransformPoint

func (c *CTM) TransformPoint(p StPos) (float64, float64)

TransformPoint 变换点坐标

func (*CTM) UnmarshalXMLAttr

func (c *CTM) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 实现XML属性解析

func (*CTM) YScale

func (c *CTM) YScale() float64

type CTOutlineElem

type CTOutlineElem struct {
	Title       string          `xml:"Title,attr"`
	Count       *int            `xml:"Count,attr,omitempty"`
	Expanded    *bool           `xml:"Expanded,attr,omitempty"`
	Actions     *ActionList     `xml:"Actions,omitempty"`
	OutlineElem []CTOutlineElem `xml:"OutlineElem,omitempty"`
}

type CTPageBlock

type CTPageBlock struct {
	TextObject      []TextObject      `xml:"TextObject"`
	PathObject      []PathObject      `xml:"PathObject"`
	ImageObject     []ImageObject     `xml:"ImageObject"`
	CompositeObject []CompositeObject `xml:"CompositeObject"`
	PageBlock       []PageBlock       `xml:"PageBlock"`
}

type CTRadialShd

type CTRadialShd struct {
	Segment      []Segment `xml:"Segment"`
	MapType      string    `xml:"MapType,attr,omitempty"` // Direct, Repeat, Reflect
	MapUnit      float64   `xml:"MapUnit,attr,omitempty"`
	Eccentricity float64   `xml:"Eccentricity,attr,omitempty"`
	Angle        float64   `xml:"Angle,attr,omitempty"`
	StartPoint   StPos     `xml:"StartPoint,attr"`
	StartRadius  float64   `xml:"StartRadius,attr,omitempty"`
	EndPoint     StPos     `xml:"EndPoint,attr"`
	EndRadius    float64   `xml:"EndRadius,attr"`
	Extend       int       `xml:"Extend,attr,omitempty"`
}

type CT_Permission

type CT_Permission struct {
	Edit        *bool          `xml:"Edit,omitempty"`
	Annot       *bool          `xml:"Annot,omitempty"`
	Export      *bool          `xml:"Export,omitempty"`
	Signature   *bool          `xml:"Signature,omitempty"`
	Watermark   *bool          `xml:"Watermark,omitempty"`
	PrintScreen *bool          `xml:"PrintScreen,omitempty"`
	Print       *PrintSettings `xml:"Print,omitempty"`
	ValidPeriod *ValidPeriod   `xml:"ValidPeriod,omitempty"`
}

type CT_VPreferences

type CT_VPreferences struct {
	PageMode     *PageMode    `xml:"PageMode,omitempty"`
	PageLayout   *PageLayout  `xml:"PageLayout,omitempty"`
	TabDisplay   *TabDisplay  `xml:"TabDisplay,omitempty"`
	HideToolbar  *bool        `xml:"HideToolbar,omitempty"`
	HideMenubar  *bool        `xml:"HideMenubar,omitempty"`
	HideWindowUI *bool        `xml:"HideWindowUI,omitempty"`
	Zoom         *ZoomSetting `xml:",omitempty"`
}

type CellContent

type CellContent struct {
	Thumbnail StRefID `xml:"Thumbnail,attr,omitempty"`
	CTPageBlock
}

type ClipArea

type ClipArea struct {
	Path      *CtPath  `xml:"Path"`
	Text      *CtText  `xml:"Text"`
	DrawParam *StRefID `xml:"DrawParam,attr,omitempty"`
	CTM       *CTM     `xml:"CTM,attr,omitempty"`
}

type Clips

type Clips struct {
	Clip []CtClip `xml:"Clip"`
}

type Color

type Color struct {
	color.RGBA
}

func (Color) MarshalXML

func (c Color) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 生成 XML

func (Color) MarshalXMLAttr

func (c Color) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr 生成 XML 属性

func (Color) String

func (c Color) String() string

String 返回 "R G B" 或 "R G B A" 格式

func (*Color) UnmarshalXML

func (c *Color) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 解析 XML 元素

func (*Color) UnmarshalXMLAttr

func (c *Color) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 解析 XML 属性

type ColorSpace

type ColorSpace struct {
	ID               StID     `xml:"ID,attr"`
	Type             string   `xml:"Type,attr"` // GRAY, RGB, CMYK
	BitsPerComponent int      `xml:"BitsPerComponent,attr,omitempty"`
	Profile          StLoc    `xml:"Profile,attr,omitempty"`
	Palette          *Palette `xml:"Palette"`
}

type ColorSpaces

type ColorSpaces struct {
	ColorSpace []ColorSpace `xml:"ColorSpace"`
}

type CommandType

type CommandType string

CommandType 定义路径命令类型 M: 移动到 (Move to) L: 直线到 (Line to) B: 三次贝塞尔曲线 (Cubic Bezier curve) Q: 二次贝塞尔曲线 (Quadratic Bezier curve) A: 椭圆弧 (Elliptical arc) C: 闭合路径 (Close path)

const (
	MoveTo      CommandType = "M" // 移动到命令
	LineTo      CommandType = "L" // 直线命令
	CubicBezier CommandType = "B" // 三次贝塞尔曲线命令
	QuadTo      CommandType = "Q" // 二次贝塞尔曲线命令
	ArcTo       CommandType = "A" // 椭圆弧命令
	Close       CommandType = "C" // 闭合路径命令
)

type CommonData

type CommonData struct {
	MaxUnitID     StID           `xml:"MaxUnitID"`
	PageArea      CtPageArea     `xml:"PageArea"`
	PublicRes     []StLoc        `xml:"PublicRes,omitempty"`
	DocumentRes   []StLoc        `xml:"DocumentRes,omitempty"`
	TemplatePages []TemplatePage `xml:"TemplatePage,omitempty"`
	DefaultCS     *StRefID       `xml:"DefaultCS,omitempty"`
}

type CompositeGraphicUnit

type CompositeGraphicUnit struct {
	ID           StID        `xml:"ID,attr"`
	Width        float64     `xml:"Width,attr"`
	Height       float64     `xml:"Height,attr"`
	Thumbnail    StRefID     `xml:"Thumbnail,omitempty"`
	Substitution StRefID     `xml:"Substitution,omitempty"`
	Content      CTPageBlock `xml:"Content"`
}

type CompositeGraphicUnits

type CompositeGraphicUnits struct {
	CompositeGraphicUnit []CompositeGraphicUnit `xml:"CompositeGraphicUnit"`
}

type CompositeObject

type CompositeObject struct {
	ID          StID `xml:"ID,attr"`
	CtComposite      // 嵌入CT_Composite
}

type Content

type Content struct {
	Layer []*Layer `xml:"Layer"`
}

type CtAction

type CtAction struct {
	Event  ActionEvent `xml:"Event,attr"`
	Region *CtRegion   `xml:"Region,omitempty"`

	// 动作选择项
	Goto  *ActionGoto  `xml:"Goto,omitempty"`
	URI   *ActionURI   `xml:"URI,omitempty"`
	GotoA *ActionGotoA `xml:"GotoA,omitempty"`
	Sound *ActionSound `xml:"Sound,omitempty"`
	Movie *ActionMovie `xml:"Movie,omitempty"`
}

CtAction 动作定义

type CtClip

type CtClip struct {
	Area []ClipArea `xml:"Area"`
}

type CtComposite

type CtComposite struct {
	CTGraphicUnit
	ResourceID StRefID `xml:"ResourceID,attr"`
}

type CtDest

type CtDest struct {
	Type   DestType `xml:"Type,attr"`
	PageID StRefID  `xml:"PageID,attr"`
	Left   *float64 `xml:"Left,attr,omitempty"`
	Top    *float64 `xml:"Top,attr,omitempty"`
	Right  *float64 `xml:"Right,attr,omitempty"`
	Bottom *float64 `xml:"Bottom,attr,omitempty"`
	Zoom   *float64 `xml:"Zoom,attr,omitempty"`
}

CtDest 目标定义

type CtImage

type CtImage struct {
	CTGraphicUnit
	Border       *Border `xml:"Border"`
	ResourceID   StRefID `xml:"ResourceID,attr"`
	Substitution StRefID `xml:"Substitution,attr,omitempty"`
	ImageMask    StRefID `xml:"ImageMask,attr,omitempty"`
}

type CtLayer

type CtLayer struct {
	Type      string  `xml:"Type,attr,omitempty"`
	DrawParam StRefID `xml:"DrawParam,attr,omitempty"`
	CTPageBlock
}

type CtPageArea

type CtPageArea struct {
	PhysicalBox    StBox  `xml:"PhysicalBox"`
	ApplicationBox *StBox `xml:"ApplicationBox,omitempty"`
	ContentBox     *StBox `xml:"ContentBox,omitempty"`
	BleedBox       *StBox `xml:"BleedBox,omitempty"`
}

CtPageArea 页面区域定义

type CtPath

type CtPath struct {
	CTGraphicUnit
	StrokeColor     *CTColor `xml:"StrokeColor"`
	FillColor       *CTColor `xml:"FillColor"`
	AbbreviatedData SVGPath  `xml:"AbbreviatedData"`
	// Stroke 是否钩边 默认 true
	Stroke string `xml:"Stroke,attr,omitempty"`
	Fill   bool   `xml:"Fill,attr,omitempty"`
	Rule   string `xml:"Rule,attr,omitempty"` // NonZero, Even-Odd
}

type CtPattern

type CtPattern struct {
	CellContent   CellContent `xml:"CellContent"`
	Width         float64     `xml:"Width,attr"`
	Height        float64     `xml:"Height,attr"`
	XStep         float64     `xml:"XStep,attr,omitempty"`
	YStep         float64     `xml:"YStep,attr,omitempty"`
	ReflectMethod string      `xml:"ReflectMethod,attr,omitempty"` // Normal, Row, Column, RowAndColumn
	RelativeTo    string      `xml:"RelativeTo,attr,omitempty"`    // Page, Object
	CTM           StArray     `xml:"CTM,attr,omitempty"`
}

type CtRegion

type CtRegion struct {
	Areas []Area `xml:"Area"`
}

CtRegion 区域定义

type CtText

type CtText struct {
	CTGraphicUnit
	FillColor   *CTColor        `xml:"FillColor"`
	StrokeColor *CTColor        `xml:"StrokeColor"`
	CGTransform []CTCGTransform `xml:"CGTransform"`
	TextCode    []TextCode      `xml:"TextCode"`
	Font        StRefID         `xml:"Font,attr"`
	// Size 字号,单位为毫米
	Size float64 `xml:"Size,attr"`
	// Stroke 是否描边。默认值为 false 当文字对象被裁剪区引用时此属性被忽略
	Stroke bool `xml:"Stroke,attr,omitempty"`
	// Fill 是否填充 默认值 true 当文字对象被裁剪区引用时此属性被忽略
	Fill string `xml:"Fill,attr,omitempty"`
	// HScale 字型在水平方向的放缩比,取值为[0 1.0],默认值为 1.0
	// 例如:当 HScale 值为 0.5 时表示实际显示的字宽为原来字宽的一半
	HScale float64 `xml:"HScale,attr,omitempty"`
	// ReadDirection 阅读方向,指定了文字排列的方向,默认值为 0
	ReadDirection int `xml:"ReadDirection,attr,omitempty"`
	// CharDirection 字符方向,指定了文字放置的方式,默认值为 0
	CharDirection int `xml:"CharDirection,attr,omitempty"`
	Weight        int `xml:"Weight,attr,omitempty"` // 0,100,...,1000
	// Italic 是否是斜体样式,默认值为 false
	Italic bool `xml:"Italic,attr,omitempty"`
}

type CustomData

type CustomData struct {
	Name  string `xml:"Name,attr"`
	Value string `xml:",chardata"`
}

CustomData 自定义数据

type CustomDatas

type CustomDatas struct {
	CustomData []CustomData `xml:"CustomData"`
}

CustomDatas 自定义数据集合

type CustomTag

type CustomTag struct {
	NameSpace string `xml:"NameSpace,attr"`
	SchemaLoc *StLoc `xml:"SchemaLoc,omitempty"`
	FileLoc   StLoc  `xml:"FileLoc"`
}

CustomTag 单个自定义标签定义

type CustomTags

type CustomTags struct {
	XMLName    xml.Name    `xml:"CustomTags"`
	Xmlns      string      `xml:"xmlns,attr"`
	CustomTags []CustomTag `xml:"CustomTag,omitempty"`
}

CustomTags 自定义标签容器

type DateTime

type DateTime struct {
	time.Time
}

DateTime 自定义时间类型,用于解析OFD中的时间格式

func (*DateTime) MarshalXML

func (t *DateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 自定义XML序列化方法

func (*DateTime) MarshalXMLAttr

func (t *DateTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr 自定义XML属性序列化方法

func (*DateTime) UnmarshalXML

func (t *DateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 自定义XML元素解析方法

func (*DateTime) UnmarshalXMLAttr

func (t *DateTime) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 自定义XML属性解析方法

type DestType

type DestType string

DestType 目标类型枚举

const (
	DestTypeXYZ  DestType = "XYZ"
	DestTypeFit  DestType = "Fit"
	DestTypeFitH DestType = "FitH"
	DestTypeFitV DestType = "FitV"
	DestTypeFitR DestType = "FitR"
)

type DocBody

type DocBody struct {
	DocInfo    DocInfo   `xml:"DocInfo"`
	DocRoot    StLoc     `xml:"DocRoot"`
	Versions   *Versions `xml:"Versions,omitempty"`
	Signatures *StLoc    `xml:"Signatures,omitempty"`
}

DocBody 文档体

type DocInfo

type DocInfo struct {
	DocID          string       `xml:"DocID"`
	Title          *string      `xml:"Title,omitempty"`
	Author         *string      `xml:"Author,omitempty"`
	Subject        *string      `xml:"Subject,omitempty"`
	Abstract       *string      `xml:"Abstract,omitempty"`
	CreationDate   *DateTime    `xml:"CreationDate,omitempty"`
	ModDate        *DateTime    `xml:"ModDate,omitempty"`
	DocUsage       *string      `xml:"DocUsage,omitempty"`
	Cover          *StLoc       `xml:"Cover,omitempty"`
	Keywords       *Keywords    `xml:"Keywords,omitempty"`
	Creator        *string      `xml:"Creator,omitempty"`
	CreatorVersion *string      `xml:"CreatorVersion,omitempty"`
	CustomDatas    *CustomDatas `xml:"CustomDatas,omitempty"`
}

DocInfo 文档信息

type DocVersion

type DocVersion struct {
	XMLName      xml.Name   `xml:"DocVersion"`
	Xmlns        string     `xml:"xmlns,attr"`
	ID           string     `xml:"ID,attr"`
	Version      *string    `xml:"Version,attr,omitempty"`
	Name         *string    `xml:"Name,attr,omitempty"`
	CreationDate *time.Time `xml:"CreationDate,attr,omitempty"`
	FileList     FileList   `xml:"FileList"`
	DocRoot      StLoc      `xml:"DocRoot"`
}

DocVersion 文档版本信息

type Document

type Document struct {
	XMLName      xml.Name         `xml:"Document"`
	XMLNS        string           `xml:"xmlns:ofd,attr"`
	CommonData   CommonData       `xml:"CommonData"`
	Pages        PageList         `xml:"Pages"`
	Outlines     *OutlineList     `xml:"Outlines,omitempty"`
	Permissions  *CT_Permission   `xml:"Permissions,omitempty"`
	Actions      *ActionList      `xml:"Actions,omitempty"`
	VPreferences *CT_VPreferences `xml:"VPreferences,omitempty"`
	Bookmarks    *BookmarkList    `xml:"Bookmarks,omitempty"`
	Annotations  *StLoc           `xml:"Annotations,omitempty"`
	CustomTags   *StLoc           `xml:"CustomTags,omitempty"`
	Attachments  *StLoc           `xml:"Attachments,omitempty"`
	Extensions   *StLoc           `xml:"Extensions,omitempty"`
}

func (*Document) String

func (p *Document) String() string

type DrawParam

type DrawParam struct {
	ID          StID      `xml:"ID,attr"`
	Relative    StRefID   `xml:"Relative,attr,omitempty"`
	LineWidth   float64   `xml:"LineWidth,attr,omitempty"`
	Join        string    `xml:"Join,attr,omitempty"` // Miter, Round, Bevel
	Cap         string    `xml:"Cap,attr,omitempty"`  // Butt, Round, Square
	DashOffset  float64   `xml:"DashOffset,attr,omitempty"`
	DashPattern *StArrayF `xml:"DashPattern,attr,omitempty"`
	MiterLimit  float64   `xml:"MiterLimit,attr,omitempty"`
	FillColor   *CTColor  `xml:"FillColor"`
	StrokeColor *CTColor  `xml:"StrokeColor"`
}

type DrawParams

type DrawParams struct {
	DrawParam []*DrawParam `xml:"DrawParam"`
}

type Extension

type Extension struct {
	AppName    string          `xml:"AppName,attr"`
	Company    *string         `xml:"Company,attr,omitempty"`
	AppVersion *string         `xml:"AppVersion,attr,omitempty"`
	Date       *time.Time      `xml:"Date,attr,omitempty"`
	RefID      StRefID         `xml:"RefId,attr"`
	Properties []ExtensionProp `xml:"Property,omitempty"`
	Data       *interface{}    `xml:"Data,omitempty"`
	ExtendData *StLoc          `xml:"ExtendData,omitempty"`
}

Extension 单个扩展定义

func (*Extension) MarshalXML

func (e *Extension) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

MarshalXML 自定义Extension序列化(修正版)

func (*Extension) UnmarshalXML

func (e *Extension) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 自定义Extension解析

type ExtensionProp

type ExtensionProp struct {
	Name  string  `xml:"Name,attr"`
	Type  *string `xml:"Type,attr,omitempty"`
	Value string  `xml:",chardata"`
}

ExtensionProp 扩展属性

type Extensions

type Extensions struct {
	XMLName    xml.Name    `xml:"Extensions"`
	Xmlns      string      `xml:"xmlns,attr"`
	Extensions []Extension `xml:"Extension"`
}

Extensions 扩展列表容器

type FileList

type FileList struct {
	Files []VersionFile `xml:"File"`
}

FileList 文件列表

type Font

type Font struct {
	ID         StID   `xml:"ID,attr"`
	FontName   string `xml:"FontName,attr"`
	FamilyName string `xml:"FamilyName,attr,omitempty"`
	Charset    string `xml:"Charset,attr,omitempty"` // symbol, prc, big5, shift-jis, wansung, johab, unicode
	Italic     bool   `xml:"Italic,attr,omitempty"`
	Bold       bool   `xml:"Bold,attr,omitempty"`
	Serif      bool   `xml:"Serif,attr,omitempty"`
	FixedWidth bool   `xml:"FixedWidth,attr,omitempty"`
	FontFile   StLoc  `xml:"FontFile,omitempty"`
}

type Fonts

type Fonts struct {
	Font []Font `xml:"Font"`
}

type GouraudPoint

type GouraudPoint struct {
	Color    CTColor `xml:"Color"`
	X        float64 `xml:"X,attr"`
	Y        float64 `xml:"Y,attr"`
	EdgeFlag int     `xml:"EdgeFlag,attr"` // 0,1,2
}

type ImageObject

type ImageObject struct {
	ID      StID `xml:"ID,attr"`
	CtImage      // 嵌入CT_Image
}

type Keywords

type Keywords struct {
	Keyword []string `xml:"Keyword"`
}

Keywords 关键词集合

type LaGouraudPoint

type LaGouraudPoint struct {
	Color CTColor `xml:"Color"`
	X     float64 `xml:"X,attr,omitempty"`
	Y     float64 `xml:"Y,attr,omitempty"`
}

type Layer

type Layer struct {
	ID        StID    `xml:"ID,attr"`
	Type      string  `xml:"Type,attr,omitempty"` // Body, Background, Foreground, Custom
	DrawParam StRefID `xml:"DrawParam,attr,omitempty"`
	// CTPageBlock 内容
	TextObject      []TextObject      `xml:"TextObject"`
	PathObject      []PathObject      `xml:"PathObject"`
	ImageObject     []ImageObject     `xml:"ImageObject"`
	CompositeObject []CompositeObject `xml:"CompositeObject"`
	PageBlock       []PageBlock       `xml:"PageBlock"`
}

type MovieOperator

type MovieOperator string

MovieOperator 影片操作类型

const (
	MovieOperatorPlay   MovieOperator = "Play"
	MovieOperatorStop   MovieOperator = "Stop"
	MovieOperatorPause  MovieOperator = "Pause"
	MovieOperatorResume MovieOperator = "Resume"
)

type MultiMedia

type MultiMedia struct {
	ID        StID   `xml:"ID,attr"`
	Type      string `xml:"Type,attr"` // Image, Audio, Video
	Format    string `xml:"Format,attr,omitempty"`
	MediaFile StLoc  `xml:"MediaFile"`
}

type MultiMedias

type MultiMedias struct {
	MultiMedia []*MultiMedia `xml:"MultiMedia"`
}

type OFD

type OFD struct {
	XMLName   xml.Name  `xml:"OFD"`
	XMLNS     string    `xml:"xmlns:ofd,attr"`
	Version   string    `xml:"Version,attr"`
	DocType   string    `xml:"DocType,attr"`
	DocBodies []DocBody `xml:"DocBody"`
}

OFD 文档根元素

func (*OFD) String

func (p *OFD) String() string

type OutlineList

type OutlineList struct {
	OutlineElems []CTOutlineElem `xml:"OutlineElem"`
}

type Page

type Page struct {
	ID      StID  `xml:"ID,attr"`
	BaseLoc StLoc `xml:"BaseLoc,attr"`
}

type PageAnnot

type PageAnnot struct {
	XMLName xml.Name `xml:"PageAnnot"`
	Xmlns   string   `xml:"xmlns,attr"`
	Annots  []*Annot `xml:"Annot"`
}

PageAnnot 页面注解容器

type PageBlock

type PageBlock struct {
	ID          StID `xml:"ID,attr"`
	CTPageBlock      // 嵌入CT_PageBlock
}

type PageContent

type PageContent struct {
	Template []Template  `xml:"Template"`
	PageRes  []StLoc     `xml:"PageRes"`
	Area     *CtPageArea `xml:"Area"`
	Content  *Content    `xml:"Content"`
	Actions  *Actions    `xml:"Actions"`
}

type PageLayout

type PageLayout string
const (
	PageLayoutOneColumn PageLayout = "OneColumn"
	PageLayoutTwoPageL  PageLayout = "TwoPageL"
)

type PageList

type PageList struct {
	Pages []Page `xml:"Page"`
}

type PageMode

type PageMode string
const (
	PageModeNone        PageMode = "None"
	PageModeFullScreen  PageMode = "FullScreen"
	PageModeUseOutlines PageMode = "UseOutlines"
)

type Palette

type Palette struct {
	CV []StArray `xml:"CV"`
}

type Parameter

type Parameter struct {
	Name  string `xml:"Name,attr"`
	Value string `xml:",chardata"`
}

Parameter 单个参数

type Params

type Params struct {
	Parameters []Parameter `xml:"Parameter"`
}

Params 参数集合

type Path

type Path struct {
	XMLName xml.Name
	// 公共属性
	Point1 *StPos `xml:"Point1,attr,omitempty"`
	Point2 *StPos `xml:"Point2,attr,omitempty"`
	Point3 *StPos `xml:"Point3,attr,omitempty"`

	// Arc特有属性
	SweepDirection *bool    `xml:"SweepDirection,attr,omitempty"`
	LargeArc       *bool    `xml:"LargeArc,attr,omitempty"`
	RotationAngle  *float64 `xml:"RotationAngle,attr,omitempty"`
	EllipseSize    *StArray `xml:"EllipseSize,attr,omitempty"`
	EndPoint       *StPos   `xml:"EndPoint,attr,omitempty"`
}

Path 路径元素

type PathCommand

type PathCommand struct {
	Type   CommandType
	Points []StPos
	Arc    *ArcData // 仅当Type为ArcTo时有意义
}

PathCommand 定义路径命令

type PathObject

type PathObject struct {
	ID     StID `xml:"ID,attr"`
	CtPath      // 嵌入CT_Path
}

type PrintSettings

type PrintSettings struct {
	Printable bool `xml:"Printable,attr"`
	Copies    int  `xml:"Copies,attr"`
}

type Provider

type Provider struct {
	ProviderName string `xml:"ProviderName,attr"`
	Version      string `xml:"Version,attr,omitempty"`
	Company      string `xml:"Company,attr,omitempty"`
}

type Reference

type Reference struct {
	FileRef    StLoc  `xml:"FileRef,attr"`
	CheckValue []byte `xml:"CheckValue"`
}

type References

type References struct {
	CheckMethod string      `xml:"CheckMethod,attr,omitempty"` // MD5, SHA1
	Reference   []Reference `xml:"Reference"`
}

type Res

type Res struct {
	BaseLoc               StLoc                  `xml:"BaseLoc,attr"`
	ColorSpaces           *ColorSpaces           `xml:"ColorSpaces"`
	DrawParams            *DrawParams            `xml:"DrawParams"`
	Fonts                 *Fonts                 `xml:"Fonts"`
	MultiMedias           *MultiMedias           `xml:"MultiMedias"`
	CompositeGraphicUnits *CompositeGraphicUnits `xml:"CompositeGraphicUnits"`
}

type SVGPath

type SVGPath []PathCommand

SVGPath 定义SVG路径,是PathCommand的切片类型 可以用于直接解析和编码XML

func ParsePathData

func ParsePathData(data string) (SVGPath, error)

ParsePathData 解析路径字符串为SVGPath (公开的工厂函数)

func (*SVGPath) AddCommand

func (p *SVGPath) AddCommand(cmd PathCommand)

AddCommand 添加路径命令

func (SVGPath) CalculateBoundingBox

func (p SVGPath) CalculateBoundingBox() (minX, minY, maxX, maxY float64)

CalculateBoundingBox 计算边界框

func (*SVGPath) Clear

func (p *SVGPath) Clear()

Clear 清空路径

func (SVGPath) CountCommands

func (p SVGPath) CountCommands() map[CommandType]int

CountCommands 统计命令数量

func (SVGPath) Format

func (p SVGPath) Format() string

Format 格式化输出命令

func (SVGPath) GetCommand

func (p SVGPath) GetCommand(index int) (PathCommand, error)

GetCommand 获取指定索引的命令

func (SVGPath) GetStartPoint

func (p SVGPath) GetStartPoint(cmdIndex int) (StPos, error)

GetStartPoint 获取指定命令的起始点(用于弧计算)

func (SVGPath) Length

func (p SVGPath) Length() int

Length 获取路径中的命令数量

func (SVGPath) MarshalXML

func (p SVGPath) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 实现xml.Marshaler接口

func (SVGPath) String

func (p SVGPath) String() string

String 返回路径的字符串表示

func (*SVGPath) UnmarshalXML

func (p *SVGPath) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 实现xml.Unmarshaler接口 支持解析如: <path>M 10 20 L 30 40</path>

type Seal

type Seal struct {
	BaseLoc StLoc `xml:"BaseLoc"`
}

type Segment

type Segment struct {
	Color    CTColor `xml:"Color"`
	Position float64 `xml:"Position,attr,omitempty"`
}

type SigType

type SigType string

SigType 签名类型枚举

const (
	SigTypeSeal SigType = "Seal"
	SigTypeSign SigType = "Sign"
)

type Signature

type Signature struct {
	SignedInfo  SignedInfo `xml:"SignedInfo"`
	SignedValue StLoc      `xml:"SignedValue"`
}

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"`
}

Signatures 签名列表容器

type SignedInfo

type SignedInfo struct {
	Provider          Provider      `xml:"Provider"`
	SignatureMethod   string        `xml:"SignatureMethod,omitempty"`
	SignatureDateTime string        `xml:"SignatureDateTime,omitempty"`
	References        References    `xml:"References"`
	StampAnnot        []*StampAnnot `xml:"StampAnnot,omitempty"`
	Seal              *Seal         `xml:"Seal,omitempty"`
}

type StArray

type StArray []string

StArray 数组字符串类型

func (*StArray) MarshalXML

func (p *StArray) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 将StArray序列化为XML字符串

func (*StArray) UnmarshalXML

func (p *StArray) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 从XML字符串解析StArray

type StArrayF

type StArrayF []float64

func (StArrayF) MarshalXML

func (s StArrayF) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 实现 xml.Marshaler 接口

func (StArrayF) MarshalXMLAttr

func (s StArrayF) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr 实现 xml.MarshalerAttr 接口

func (StArrayF) String

func (s StArrayF) String() string

转换为普通字符串

func (*StArrayF) UnmarshalXML

func (s *StArrayF) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 实现 xml.Unmarshaler 接口

func (*StArrayF) UnmarshalXMLAttr

func (s *StArrayF) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 实现 xml.UnmarshalerAttr 接口

type StArrayI

type StArrayI []int

func (StArrayI) MarshalXML

func (s StArrayI) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 实现 xml.Marshaler 接口

func (StArrayI) MarshalXMLAttr

func (s StArrayI) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr 实现 xml.MarshalerAttr 接口

func (StArrayI) String

func (s StArrayI) String() string

转换为普通字符串

func (*StArrayI) UnmarshalXML

func (s *StArrayI) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 实现 xml.Unmarshaler 接口

func (*StArrayI) UnmarshalXMLAttr

func (s *StArrayI) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 实现 xml.UnmarshalerAttr 接口

type StBox

type StBox struct {
	X      float64 `xml:"X,attr"`
	Y      float64 `xml:"Y,attr"`
	Width  float64 `xml:"Width,attr"`
	Height float64 `xml:"Height,attr"`
}

StBox 盒子区域定义 (X Y Width Height)

func (*StBox) Area

func (p *StBox) Area() float64

Area 计算页面面积

func (*StBox) CopyAndShift added in v0.0.2

func (p *StBox) CopyAndShift(box *StBox) StBox

func (*StBox) IsPortrait

func (p *StBox) IsPortrait() bool

IsPortrait 判断是否是纵向页面

func (*StBox) MarshalXML

func (p *StBox) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 自定义XML序列化方法

func (*StBox) String

func (p *StBox) String() string

String 返回字符串表示

func (*StBox) UnmarshalXML

func (b *StBox) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 自定义XML元素解析方法

func (*StBox) UnmarshalXMLAttr

func (b *StBox) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr 自定义XML属性解析

type StID

type StID uint64

StID 标识符类型

func (*StID) MarshalXML

func (p *StID) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*StID) UnmarshalXML

func (p *StID) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type StLoc

type StLoc string

StLoc 位置字符串类型

func NewStLoc

func NewStLoc(path string) StLoc

NewStLoc 创建 StLoc

func (StLoc) Base

func (p StLoc) Base() string

Base 返回文件名部分

func (StLoc) Clean

func (p StLoc) Clean() StLoc

Clean 清理路径

func (StLoc) Dir

func (p StLoc) Dir() StLoc

Dir 返回目录部分

func (StLoc) Ext

func (p StLoc) Ext() string

Ext 返回扩展名

func (StLoc) HasPrefix

func (p StLoc) HasPrefix(prefix StLoc) bool

HasPrefix 判断是否有指定前缀

func (StLoc) In

func (p StLoc) In(dir StLoc) bool

In 判断路径是否在指定目录下

func (StLoc) IsAbsolute

func (p StLoc) IsAbsolute() bool

IsAbsolute 判断是否是绝对路径

func (StLoc) IsEmpty

func (p StLoc) IsEmpty() bool

IsEmpty 判断是否为空

func (StLoc) Join

func (p StLoc) Join(elem ...string) StLoc

Join 拼接路径

func (StLoc) Resolve

func (p StLoc) Resolve(base StLoc) StLoc

Resolve 解析路径 base: 基础路径

func (StLoc) String

func (p StLoc) String() string

String 转换为字符串

func (StLoc) TrimPrefix

func (p StLoc) TrimPrefix(prefix StLoc) StLoc

TrimPrefix 去除前缀

type StPos

type StPos struct {
	X float64
	Y float64
}

StPos 位置坐标类型

func (*StPos) MarshalXML

func (p *StPos) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML 将 StPos 序列化为 XML 字符串

func (*StPos) UnmarshalXML

func (p *StPos) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML 从 XML 字符串解析 StPos

func (*StPos) UnmarshalXMLAttr

func (p *StPos) UnmarshalXMLAttr(attr xml.Attr) error

type StRefID

type StRefID StID

StRefID 引用ID类型

type StampAnnot

type StampAnnot struct {
	ID       string  `xml:"ID,attr"` // xs:ID 类型
	PageRef  StRefID `xml:"PageRef,attr"`
	Boundary StBox   `xml:"Boundary,attr"`
	Clip     StBox   `xml:"Clip,attr,omitempty"`
}

type TabDisplay

type TabDisplay string
const (
	TabDisplayDocTitle TabDisplay = "DocTitle"
	TabDisplayFileName TabDisplay = "FileName"
)

type Template

type Template struct {
	TemplateID StRefID `xml:"TemplateID,attr"`
	ZOrder     string  `xml:"ZOrder,attr,omitempty"` // Background or Foreground
}

type TemplatePage

type TemplatePage struct {
	ID      StID    `xml:"ID,attr"`
	Name    *string `xml:"Name,attr,omitempty"`
	ZOrder  *string `xml:"ZOrder,attr,omitempty"`
	BaseLoc StLoc   `xml:"BaseLoc,attr"`
}

type TextCode

type TextCode struct {
	Value  string   `xml:",chardata"`
	X      float64  `xml:"X,attr,omitempty"`
	Y      float64  `xml:"Y,attr,omitempty"`
	DeltaX StArrayF `xml:"DeltaX,attr,omitempty"`
	DeltaY StArrayF `xml:"DeltaY,attr,omitempty"`
}

type TextObject

type TextObject struct {
	ID     StID `xml:"ID,attr"`
	CtText      // 嵌入CT_Text
}

type ValidPeriod

type ValidPeriod struct {
	StartDate DateTime `xml:"StartDate,attr,omitempty"`
	EndDate   DateTime `xml:"EndDate,attr,omitempty"`
}

type Version

type Version struct {
	ID      string `xml:"ID,attr"`
	Index   int    `xml:"Index,attr"`
	Current bool   `xml:"Current,attr"`
	BaseLoc StLoc  `xml:"BaseLoc,attr"`
}

Version 文档版本

type VersionFile

type VersionFile struct {
	ID   string `xml:"ID,attr"`
	Path StLoc  `xml:",chardata"`
}

VersionFile 版本文件

type Versions

type Versions struct {
	VersionList []Version `xml:"Version"`
}

Versions 版本集合

type ZoomSetting

type ZoomSetting struct {
	Mode  *string  `xml:"ZoomMode,omitempty"`
	Value *float64 `xml:"Zoom,omitempty"`
}

Jump to

Keyboard shortcuts

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