Documentation
¶
Overview ¶
Package models 定义 OFD XML 文档的内部数据模型。
Index ¶
- Variables
- type ActionEvent
- type ActionGoto
- type ActionGotoA
- type ActionList
- type ActionMovie
- type ActionSound
- type ActionURI
- type Actions
- type Annot
- type AnnotPage
- type AnnotType
- type Annotations
- type Appearance
- type ArcData
- type Area
- type Attachment
- type Attachments
- type BookmarkList
- type Border
- type CTAxialShd
- type CTBookmark
- type CTCGTransform
- type CTColor
- type CTGouraudShd
- type CTGraphicUnit
- type CTLaGouraudShd
- type CTM
- func (c *CTM) IsFinite() bool
- func (c *CTM) Multiply(other *CTM) *CTM
- func (c *CTM) RotationAngle() float64
- func (c *CTM) RotationAngleDegrees() float64
- func (c *CTM) String() string
- func (c *CTM) Transform(x, y float64) (float64, float64)
- func (c *CTM) TransformPoint(p StPos) (float64, float64)
- func (c *CTM) UnmarshalXMLAttr(attr xml.Attr) error
- func (c *CTM) YScale() float64
- type CTOutlineElem
- type CTPageBlock
- type CTRadialShd
- type CT_Permission
- type CT_VPreferences
- type CellContent
- type ClipArea
- type Clips
- type Color
- type ColorSpace
- type ColorSpaces
- type CommandType
- type CommonData
- type CompositeGraphicUnit
- type CompositeGraphicUnits
- type CompositeObject
- type Content
- type CtAction
- type CtClip
- type CtComposite
- type CtDest
- type CtImage
- type CtLayer
- type CtPageArea
- type CtPath
- type CtPattern
- type CtRegion
- type CtText
- type CustomData
- type CustomDatas
- type CustomTag
- type CustomTags
- type DateTime
- type DestType
- type DocBody
- type DocInfo
- type DocVersion
- type Document
- type DrawParam
- type DrawParams
- type Extension
- type ExtensionProp
- type Extensions
- type FileList
- type Font
- type Fonts
- type GouraudPoint
- type ImageObject
- type Keywords
- type LaGouraudPoint
- type Layer
- type MovieOperator
- type MultiMedia
- type MultiMedias
- type OFD
- type OptionalBool
- func (o *OptionalBool) Bool() *bool
- func (o OptionalBool) IsSet() bool
- func (o OptionalBool) MarshalXMLAttr(name xml.Name) (xml.Attr, error)
- func (o *OptionalBool) Reset()
- func (o *OptionalBool) Set(b bool)
- func (o *OptionalBool) UnmarshalXMLAttr(attr xml.Attr) error
- func (o OptionalBool) Value(defaultIfNotSet bool) bool
- type OutlineList
- type Page
- type PageAnnot
- type PageBlock
- type PageContent
- type PageItem
- type PageItemKind
- type PageLayout
- type PageList
- type PageMode
- type Palette
- type Parameter
- type Params
- type Path
- type PathCommand
- type PathObject
- type PrintSettings
- type Provider
- type Reference
- type References
- type Res
- type SVGPath
- func (p *SVGPath) AddCommand(cmd PathCommand)
- func (p SVGPath) CalculateBoundingBox() (minX, minY, maxX, maxY float64)
- func (p *SVGPath) Clear()
- func (p SVGPath) CountCommands() map[CommandType]int
- func (p SVGPath) Format() string
- func (p SVGPath) GetCommand(index int) (PathCommand, error)
- func (p SVGPath) GetStartPoint(cmdIndex int) (StPos, error)
- func (p SVGPath) Length() int
- func (p SVGPath) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (p SVGPath) String() string
- func (p *SVGPath) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Seal
- type Segment
- type SigType
- type Signature
- type Signatures
- type SignedInfo
- type StArray
- type StArrayF
- func (s StArrayF) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (s StArrayF) MarshalXMLAttr(name xml.Name) (xml.Attr, error)
- func (s StArrayF) String() string
- func (s *StArrayF) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (s *StArrayF) UnmarshalXMLAttr(attr xml.Attr) error
- type StArrayI
- func (s StArrayI) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (s StArrayI) MarshalXMLAttr(name xml.Name) (xml.Attr, error)
- func (s StArrayI) String() string
- func (s *StArrayI) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (s *StArrayI) UnmarshalXMLAttr(attr xml.Attr) error
- type StBox
- func (p *StBox) Area() float64
- func (p *StBox) CopyAndShift(box *StBox) StBox
- func (b StBox) IsFinite() bool
- func (p *StBox) IsPortrait() bool
- func (p *StBox) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (p *StBox) String() string
- func (b *StBox) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (b *StBox) UnmarshalXMLAttr(attr xml.Attr) error
- type StID
- type StLoc
- func (p StLoc) Base() string
- func (p StLoc) Clean() StLoc
- func (p StLoc) Dir() StLoc
- func (p StLoc) Ext() string
- func (p StLoc) HasPrefix(prefix StLoc) bool
- func (p StLoc) In(dir StLoc) bool
- func (p StLoc) IsAbsolute() bool
- func (p StLoc) IsEmpty() bool
- func (p StLoc) Join(elem ...string) StLoc
- func (p StLoc) Resolve(base StLoc) StLoc
- func (p StLoc) String() string
- func (p StLoc) TrimPrefix(prefix StLoc) StLoc
- type StPos
- type StRefID
- type StampAnnot
- type TabDisplay
- type Template
- type TemplatePage
- type TextCode
- type TextObject
- type ValidPeriod
- type Version
- type VersionFile
- type Versions
- type ZoomSetting
Constants ¶
This section is empty.
Variables ¶
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 动作列表。
Actions []CtAction `xml:"Action"`
}
ActionList 动作列表。
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 动作列表。
Action []CtAction `xml:"Action"`
}
Actions 动作集合。
type Annot ¶
type Annot struct {
// ID 注解标识,在页面注解文件内唯一。
ID string `xml:"ID,attr"`
// Type 注解类型。
Type AnnotType `xml:"Type,attr"`
// Creator 创建该注解的软件或用户名称。
Creator string `xml:"Creator,attr"`
// LastModDate 注解最后修改时间。
LastModDate DateTime `xml:"LastModDate,attr"`
// Visible 表示该注释对象是否显示,未指定时默认为 true。
Visible OptionalBool `xml:"Visible,attr,omitempty"`
// Subtype 注解子类型。
Subtype string `xml:"Subtype,attr,omitempty"`
// Print 是否在打印文档时显示该注解。
Print OptionalBool `xml:"Print,attr,omitempty"`
// NoZoom 是否在缩放页面时保持注解大小不变。
NoZoom bool `xml:"NoZoom,attr,omitempty"`
// NoRotate 是否在旋转页面时保持注解方向不变。
NoRotate bool `xml:"NoRotate,attr,omitempty"`
// ReadOnly 是否禁止修改该注解。
ReadOnly bool `xml:"ReadOnly,attr,omitempty"`
// Remark 注解备注。
Remark *string `xml:"Remark,omitempty"`
// Parameters 注解参数集合。
Parameters *Params `xml:"Parameters,omitempty"`
// Appearance 注解外观内容。
Appearance *Appearance `xml:"Appearance"`
}
Annot 单个页面注解定义。
type AnnotType ¶
type AnnotType string
AnnotType 注解类型枚举。
const ( // AnnotTypeLink 表示链接注解。 AnnotTypeLink AnnotType = "Link" // AnnotTypePath 表示路径注解。 AnnotTypePath AnnotType = "Path" // AnnotTypeHighlight 表示高亮注解。 AnnotTypeHighlight AnnotType = "Highlight" // AnnotTypeStamp 表示图章注解。 AnnotTypeStamp AnnotType = "Stamp" // AnnotTypeWatermark 表示水印注解。 AnnotTypeWatermark AnnotType = "Watermark" )
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 注解外观的边界框。
Boundary *StBox `xml:"Boundary,attr,omitempty"`
// CTPageBlock 注解外观中的页面对象。
CTPageBlock
}
Appearance 注解外观定义。
func (*Appearance) UnmarshalXML ¶ added in v0.0.6
func (a *Appearance) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML 先解析外观边界,再将其内容交由共享的页面块解析器处理。
type ArcData ¶
type ArcData struct {
// RX 椭圆在 X 轴方向的半径。
RX float64
// RY 椭圆在 Y 轴方向的半径。
RY float64
// XAxisRotation 椭圆相对于 X 轴的旋转角度,单位为度。
XAxisRotation float64
// LargeArcFlag 是否选择大于或等于 180 度的弧段。
LargeArcFlag bool
// SweepFlag 是否沿正向角度方向绘制弧段。
SweepFlag bool
// EndPoint 椭圆弧的终点坐标。
EndPoint StPos
}
ArcData 定义椭圆弧参数。
type Attachment ¶
type Attachment struct {
ID string `xml:"ID,attr"`
Name string `xml:"Name,attr"`
Format *string `xml:"Format,attr,omitempty"`
CreationDate DateTime `xml:"CreationDate,attr,omitempty"`
ModDate DateTime `xml:"ModDate,attr,omitempty"`
Size *float64 `xml:"Size,attr,omitempty"`
Visible OptionalBool `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 书签列表。
Bookmarks []CTBookmark `xml:"Bookmark"`
}
BookmarkList 文档书签列表。
type Border ¶
type Border struct {
// BorderColor 边框颜色。
BorderColor *CTColor `xml:"BorderColor"`
// LineWidth 边框线宽,单位为毫米。
LineWidth float64 `xml:"LineWidth,attr,omitempty"`
// HorizonalCornerRadius 水平方向圆角半径,单位为毫米。
HorizonalCornerRadius float64 `xml:"HorizonalCornerRadius,attr,omitempty"`
// VerticalCornerRadius 垂直方向圆角半径,单位为毫米。
VerticalCornerRadius float64 `xml:"VerticalCornerRadius,attr,omitempty"`
// DashOffset 虚线模式的起始偏移量。
DashOffset float64 `xml:"DashOffset,attr,omitempty"`
// DashPattern 虚线模式中实线段和空白段的长度数组。
DashPattern StArray `xml:"DashPattern,attr,omitempty"`
}
Border 图像边框定义。
type CTAxialShd ¶
type CTAxialShd struct {
// Segment 渐变颜色分段列表。
Segment []Segment `xml:"Segment"`
// MapType 渐变映射方式,可为 Direct、Repeat 或 Reflect。
MapType string `xml:"MapType,attr,omitempty"` // Direct, Repeat, Reflect
// MapUnit 渐变映射单元长度。
MapUnit float64 `xml:"MapUnit,attr,omitempty"`
// Extend 渐变起止范围外的延伸方式,可为 0、1、2 或 3。
Extend int `xml:"Extend,attr,omitempty"` // 0,1,2,3
// StartPoint 渐变起点。
StartPoint StPos `xml:"StartPoint,attr"`
// EndPoint 渐变终点。
EndPoint StPos `xml:"EndPoint,attr"`
}
CTAxialShd 轴向渐变填充定义。
type CTBookmark ¶
type CTBookmark struct {
// Name 书签名称。
Name string `xml:"Name,attr"`
// Dest 书签指向的目标位置。
Dest CtDest `xml:"Dest"`
}
CTBookmark 文档书签定义。
type CTCGTransform ¶
type CTCGTransform struct {
// Glyphs 变换关系中字型索引列表
Glyphs StArrayI `xml:"Glyphs"`
// CodePosition 变换起始字符在 TextCode 中的位置。
CodePosition int `xml:"CodePosition,attr"`
// CodeCount 参与变换的字符数量。
CodeCount int `xml:"CodeCount,attr,omitempty"`
// GlyphCount 参与变换的字形数量。
GlyphCount int `xml:"GlyphCount,attr,omitempty"`
}
CTCGTransform 字符图形变换定义。
type CTColor ¶
type CTColor struct {
// Pattern 图案填充定义。
Pattern *CtPattern `xml:"Pattern"`
// AxialShd 轴向渐变填充定义。
AxialShd *CTAxialShd `xml:"AxialShd"`
// RadialShd 径向渐变填充定义。
RadialShd *CTRadialShd `xml:"RadialShd"`
// GouraudShd Gouraud 三角网格渐变填充定义。
GouraudShd *CTGouraudShd `xml:"GouraudShd"`
// LaGourandShd 规范 XML Schema 中的字段拼写,对应 LaGouraudShd。
LaGourandShd *CTLaGouraudShd `xml:"LaGourandShd"`
// LaGouraudShd 是标准正文中的拼写,LaGourandShd 是规范 XML Schema 中的拼写。
LaGouraudShd *CTLaGouraudShd `xml:"LaGouraudShd"`
// Value 颜色值,指定了当前颜色空间下各通道的取值。
//Value的取值应符合"通道 1 通道 2 通道 3 …"格式。
//此属性不出现时,应参考 Index 属性从颜色空间的调色版中取值。当二者都不出现时,该颜色各通道的值全部为 0
//
//可选
Value *Color `xml:"Value,attr,omitempty"`
// Index 调色板中颜色的编号,非负整数,将从当前颜色空间的调色板中取出相应索引的预定义颜色用来绘制。
//索引从0开始 可选
Index int `xml:"Index,attr,omitempty"`
// ColorSpace 颜色空间资源引用。
ColorSpace StRefID `xml:"ColorSpace,attr,omitempty"`
// Alpha 颜色透明度,在 0~255 之间取值。默认为 255,表示完全不透明
//
//可选
Alpha *uint8 `xml:"Alpha,attr,omitempty"`
}
CTColor 颜色及颜色填充定义。
type CTGouraudShd ¶
type CTGouraudShd struct {
// Point Gouraud 网格控制点列表。
Point []GouraudPoint `xml:"Point"`
// BackColor 网格背景颜色。
BackColor *CTColor `xml:"BackColor,omitempty"`
// Extend 渐变起止范围外的延伸方式。
Extend int `xml:"Extend,attr,omitempty"`
}
CTGouraudShd Gouraud 三角网格渐变填充定义。
type CTGraphicUnit ¶
type CTGraphicUnit struct {
// Actions 图元触发的动作集合。
Actions *Actions `xml:"Actions"`
// Clips 图元使用的裁剪区域集合。
Clips *Clips `xml:"Clips"`
// Boundary 图元的边界框,单位为毫米。
Boundary StBox `xml:"Boundary,attr"`
// Name 图元名称。
Name string `xml:"Name,attr,omitempty"`
// Visible 像素是否可见,未指定时默认为 true。
Visible OptionalBool `xml:"Visible,attr,omitempty"`
// CTM 图元使用的坐标变换矩阵。
CTM *CTM `xml:"CTM,attr,omitempty"`
// DrawParam 图元使用的绘制参数引用。
DrawParam StRefID `xml:"DrawParam,attr,omitempty"`
// LineWidth 线宽,单位为毫米。
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 虚线模式的起始偏移量。
DashOffset float64 `xml:"DashOffset,attr,omitempty"`
// DashPattern 虚线模式中实线段和空白段的长度数组。
DashPattern *StArrayF `xml:"DashPattern,attr,omitempty"`
// Alpha 图元整体透明度,取值范围为 0 到 255。
Alpha *uint8 `xml:"Alpha,attr,omitempty"`
// 兼容将这些属性编码为子元素的文档。
DrawParamElement *StID `xml:"DrawParam,omitempty"`
LineWidthElement *float64 `xml:"LineWidth,omitempty"`
CapElement *string `xml:"Cap,omitempty"`
JoinElement *string `xml:"Join,omitempty"`
MiterLimitElement *float64 `xml:"MiterLimit,omitempty"`
DashOffsetElement *float64 `xml:"DashOffset,omitempty"`
DashPatternElement *StArrayF `xml:"DashPattern,omitempty"`
}
CTGraphicUnit 图元通用属性定义。
func (CTGraphicUnit) VisibleValue ¶ added in v0.0.5
func (g CTGraphicUnit) VisibleValue() bool
VisibleValue 返回图元是否可见。OFD 未指定 Visible 时默认为可见。
type CTLaGouraudShd ¶
type CTLaGouraudShd struct {
// Point Gouraud 网格控制点列表。
Point []LaGouraudPoint `xml:"Point"`
// BackColor 网格背景颜色。
BackColor *CTColor `xml:"BackColor,omitempty"`
// VerticesPerRow 每行的顶点数量。
VerticesPerRow int `xml:"VerticesPerRow,attr"`
// Extend 渐变起止范围外的延伸方式。
Extend int `xml:"Extend,attr,omitempty"`
}
CTLaGouraudShd Gouraud 网格渐变填充定义。
type CTM ¶
type CTM [6]float64
CTM 表示OFD图元变换矩阵
func (*CTM) IsFinite ¶ added in v0.0.9
IsFinite 判断矩阵的每个分量是否都是有限数值。 CTM 也可能由代码直接构造而不是通过 XML 解析,因此传入渲染器前仍需单独校验。
func (*CTM) Multiply ¶
Multiply 矩阵乘法:计算 this × other CTM 是3x2矩阵,但实际上是3x3齐次坐标的2D仿射变换矩阵 矩阵形式: [ a c e ] [ b d f ] [ 0 0 1 ]
func (*CTM) RotationAngleDegrees ¶
RotationAngleDegrees 提取旋转角度(度)
func (*CTM) TransformPoint ¶
TransformPoint 变换点坐标
func (*CTM) UnmarshalXMLAttr ¶
UnmarshalXMLAttr 实现XML属性解析
type CTOutlineElem ¶
type CTOutlineElem struct {
// Title 大纲项标题。
Title string `xml:"Title,attr"`
// Count 大纲项后代节点数量。
Count *int `xml:"Count,attr,omitempty"`
// Expanded 是否展开该大纲项的子项。
Expanded *bool `xml:"Expanded,attr,omitempty"`
// Actions 选择该大纲项时执行的动作集合。
Actions *ActionList `xml:"Actions,omitempty"`
// OutlineElem 子大纲项列表。
OutlineElem []CTOutlineElem `xml:"OutlineElem,omitempty"`
}
CTOutlineElem 文档大纲中的单个大纲项。
type CTPageBlock ¶
type CTPageBlock struct {
// TextObject 页面块中的文字对象,按类型分组保存。
TextObject []TextObject `xml:"TextObject"`
// PathObject 页面块中的路径对象,按类型分组保存。
PathObject []PathObject `xml:"PathObject"`
// ImageObject 页面块中的图像对象,按类型分组保存。
ImageObject []ImageObject `xml:"ImageObject"`
// CompositeObject 页面块中的复合对象,按类型分组保存。
CompositeObject []CompositeObject `xml:"CompositeObject"`
// PageBlock 页面块中的嵌套页面对象块,按类型分组保存。
PageBlock []PageBlock `xml:"PageBlock"`
// Items 页面对象的文档顺序列表,用于保持原始绘制顺序。
Items []PageItem
}
CTPageBlock 页面内容块,除了按类型分组保存外,还按文档顺序记录到 Items 中。
func (*CTPageBlock) UnmarshalXML ¶ added in v0.0.5
func (p *CTPageBlock) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML 按文档顺序解析页面块中的图形对象,保证绘制时各对象保持原始先后顺序。
type CTRadialShd ¶
type CTRadialShd struct {
// Segment 渐变颜色分段列表。
Segment []Segment `xml:"Segment"`
// MapType 渐变映射方式,可为 Direct、Repeat 或 Reflect。
MapType string `xml:"MapType,attr,omitempty"` // Direct, Repeat, Reflect
// MapUnit 渐变映射单元长度。
MapUnit float64 `xml:"MapUnit,attr,omitempty"`
// Eccentricity 径向渐变的离心率。
Eccentricity float64 `xml:"Eccentricity,attr,omitempty"`
// Angle 径向渐变的旋转角度。
Angle float64 `xml:"Angle,attr,omitempty"`
// StartPoint 起始圆心位置。
StartPoint StPos `xml:"StartPoint,attr"`
// StartRadius 起始半径,单位为毫米。
StartRadius float64 `xml:"StartRadius,attr,omitempty"`
// EndPoint 结束圆心位置。
EndPoint StPos `xml:"EndPoint,attr"`
// EndRadius 结束半径,单位为毫米。
EndRadius float64 `xml:"EndRadius,attr"`
// Extend 渐变起止范围外的延伸方式。
Extend int `xml:"Extend,attr,omitempty"`
}
CTRadialShd 径向渐变填充定义。
type CT_Permission ¶
type CT_Permission struct {
// Edit 是否允许编辑文档内容。
Edit *bool `xml:"Edit,omitempty"`
// Annot 是否允许添加或修改注解。
Annot *bool `xml:"Annot,omitempty"`
// Export 是否允许导出文档内容。
Export *bool `xml:"Export,omitempty"`
// Signature 是否允许签名。
Signature *bool `xml:"Signature,omitempty"`
// Watermark 是否允许添加或修改水印。
Watermark *bool `xml:"Watermark,omitempty"`
// PrintScreen 是否允许截屏。
PrintScreen *bool `xml:"PrintScreen,omitempty"`
// Print 文档打印权限设置。
Print *PrintSettings `xml:"Print,omitempty"`
// ValidPeriod 权限有效期。
ValidPeriod *ValidPeriod `xml:"ValidPeriod,omitempty"`
}
CT_Permission 文档权限定义。
type CT_VPreferences ¶
type CT_VPreferences struct {
// PageMode 文档打开时的页面显示模式。
PageMode *PageMode `xml:"PageMode,omitempty"`
// PageLayout 文档打开时的页面布局方式。
PageLayout *PageLayout `xml:"PageLayout,omitempty"`
// TabDisplay 文档标签中显示的标题类型。
TabDisplay *TabDisplay `xml:"TabDisplay,omitempty"`
// HideToolbar 是否隐藏工具栏。
HideToolbar *bool `xml:"HideToolbar,omitempty"`
// HideMenubar 是否隐藏菜单栏。
HideMenubar *bool `xml:"HideMenubar,omitempty"`
// HideWindowUI 是否隐藏窗口用户界面。
HideWindowUI *bool `xml:"HideWindowUI,omitempty"`
// Zoom 文档打开时的缩放设置。
Zoom *ZoomSetting `xml:",omitempty"`
}
CT_VPreferences 文档视图首选项定义。
func (*CT_VPreferences) UnmarshalXML ¶ added in v0.1.1
func (p *CT_VPreferences) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML 兼容 OFD 中直接使用 ZoomMode 或 Zoom 子元素的写法。
type CellContent ¶
type CellContent struct {
// Thumbnail 图案单元缩略图资源引用。
Thumbnail StRefID `xml:"Thumbnail,attr,omitempty"`
// CTPageBlock 图案单元中的页面对象。
CTPageBlock
}
CellContent 图案填充单元的内容。
type ClipArea ¶
type ClipArea struct {
// Path 用于定义裁剪区域的路径对象。
Path *CtPath `xml:"Path"`
// Text 用于定义裁剪区域的文字对象。
Text *CtText `xml:"Text"`
// DrawParam 裁剪对象使用的绘制参数引用。
DrawParam *StRefID `xml:"DrawParam,attr,omitempty"`
// CTM 裁剪对象使用的坐标变换矩阵。
CTM *CTM `xml:"CTM,attr,omitempty"`
}
ClipArea 单个裁剪区域,可以由路径或文字对象定义。
type Clips ¶
type Clips struct {
// TransFlag 是否对裁剪区域应用透明处理。
TransFlag *bool `xml:"TransFlag,attr,omitempty"`
// Clip 裁剪定义列表。
Clip []CtClip `xml:"Clip"`
}
Clips 图元裁剪集合。
type Color ¶
func (Color) MarshalXML ¶
MarshalXML 生成 XML
func (Color) MarshalXMLAttr ¶
MarshalXMLAttr 生成 XML 属性
func (*Color) UnmarshalXML ¶
UnmarshalXML 解析 XML 元素
type ColorSpace ¶
type ColorSpace struct {
// ID 颜色空间标识,在资源文件内唯一。
ID StID `xml:"ID,attr"`
// Type 颜色空间类型,可为 GRAY、RGB 或 CMYK。
Type string `xml:"Type,attr"`
// BitsPerComponent 每个颜色分量的位数。
BitsPerComponent int `xml:"BitsPerComponent,attr,omitempty"`
// Profile 颜色空间配置文件的位置。
Profile StLoc `xml:"Profile,attr,omitempty"`
// Palette 颜色空间使用的调色板。
Palette *Palette `xml:"Palette"`
}
ColorSpace 颜色空间资源定义。
type ColorSpaces ¶
type ColorSpaces struct {
// ColorSpace 颜色空间资源列表。
ColorSpace []ColorSpace `xml:"ColorSpace"`
}
ColorSpaces 颜色空间资源集合。
type CommandType ¶
type CommandType string
CommandType 定义路径命令类型。 S: SubPath起点 (Start point of SubPath) - 定义子路径的起始点坐标(x,y) M: 移动到 (Move to) - 移动画笔到指定点,不绘制线条 L: 直线到 (Line to) - 从当前点到指定点绘制直线 B: 三次贝塞尔曲线 (Cubic Bezier curve) - 需要两个控制点和一个终点的曲线 Q: 二次贝塞尔曲线 (Quadratic Bezier curve) - 需要一个控制点和一个终点的曲线 A: 椭圆弧 (Elliptical arc) - 绘制椭圆弧线 C: 闭合路径 (Close path) - 从当前点绘制直线回到子路径起点
const ( // Start 表示子路径的起点。 Start CommandType = "S" // MoveTo 表示移动到指定点但不绘制线条。 MoveTo CommandType = "M" // LineTo 表示从当前点绘制直线到指定点。 LineTo CommandType = "L" // CubicBezier 表示三次贝塞尔曲线,需要两个控制点和一个终点。 CubicBezier CommandType = "B" // QuadTo 表示二次贝塞尔曲线,需要一个控制点和一个终点。 QuadTo CommandType = "Q" // ArcTo 表示椭圆弧线。 ArcTo CommandType = "A" // Close 表示闭合路径,从当前点绘制直线回到子路径起点。 Close CommandType = "C" )
type CommonData ¶
type CommonData struct {
// MaxUnitID 文档中已使用的最大对象标识。
MaxUnitID StID `xml:"MaxUnitID"`
// PageArea 文档页面区域定义。
PageArea CtPageArea `xml:"PageArea"`
// PublicRes 公共资源文件的位置列表。
PublicRes []StLoc `xml:"PublicRes,omitempty"`
// DocumentRes 文档资源文件的位置列表。
DocumentRes []StLoc `xml:"DocumentRes,omitempty"`
// TemplatePages 文档模板页列表。
TemplatePages []TemplatePage `xml:"TemplatePage,omitempty"`
// DefaultCS 文档默认颜色空间资源引用。
DefaultCS *StRefID `xml:"DefaultCS,omitempty"`
}
CommonData 文档公共数据定义。
type CompositeGraphicUnit ¶
type CompositeGraphicUnit struct {
// ID 复合图形资源标识,在资源文件内唯一。
ID StID `xml:"ID,attr"`
// Width 复合图形的宽度,单位为毫米。
Width float64 `xml:"Width,attr"`
// Height 复合图形的高度,单位为毫米。
Height float64 `xml:"Height,attr"`
// Thumbnail 复合图形缩略图资源引用。
Thumbnail StRefID `xml:"Thumbnail,omitempty"`
// Substitution 复合图形替代资源引用。
Substitution StRefID `xml:"Substitution,omitempty"`
// Content 复合图形包含的页面对象内容。
Content CTPageBlock `xml:"Content"`
}
CompositeGraphicUnit 复合图形资源定义。
type CompositeGraphicUnits ¶
type CompositeGraphicUnits struct {
// CompositeGraphicUnit 复合图形资源列表。
CompositeGraphicUnit []CompositeGraphicUnit `xml:"CompositeGraphicUnit"`
}
CompositeGraphicUnits 复合图形资源集合。
type CompositeObject ¶
type CompositeObject struct {
// ID 复合对象标识,在页面内唯一。
ID StID `xml:"ID,attr"`
// CtComposite 复合图元的通用属性和资源引用。
CtComposite
}
CompositeObject 页面中的复合对象。
type Content ¶
type Content struct {
// Layer 页面图层列表,顺序即图层的绘制顺序。
Layer []*Layer `xml:"Layer"`
}
Content 页面内容容器。
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 CtComposite ¶
type CtComposite struct {
// CTGraphicUnit 复合图元的通用属性。
CTGraphicUnit
// ResourceID 复合图形资源标识。
ResourceID StRefID `xml:"ResourceID,attr"`
}
CtComposite 复合图元定义。
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 图像图元的通用属性。
CTGraphicUnit
// Border 图像边框定义。
Border *Border `xml:"Border"`
// ResourceID 图像资源标识。
ResourceID StRefID `xml:"ResourceID,attr"`
// Substitution 替代图像资源标识。
Substitution StRefID `xml:"Substitution,attr,omitempty"`
// ImageMask 图像蒙版资源标识。
ImageMask StRefID `xml:"ImageMask,attr,omitempty"`
}
CtImage 图像图元定义。
type CtLayer ¶
type CtLayer struct {
// Type 图层类型,可为 Body、Background、Foreground 或 Custom。
Type string `xml:"Type,attr,omitempty"`
// DrawParam 图层使用的绘制参数引用。
DrawParam StRefID `xml:"DrawParam,attr,omitempty"`
// CTPageBlock 图层中的页面对象。
CTPageBlock
}
CtLayer 图层内容定义。
type CtPageArea ¶
type CtPageArea struct {
// PhysicalBox 页面物理区域,定义页面的实际大小。
PhysicalBox StBox `xml:"PhysicalBox"`
// ApplicationBox 应用区域,定义应用程序可使用的页面区域。
ApplicationBox *StBox `xml:"ApplicationBox,omitempty"`
// ContentBox 内容区域,定义页面主要内容所在的区域。
ContentBox *StBox `xml:"ContentBox,omitempty"`
// BleedBox 出血区域,定义超出页面成品边界的扩展区域。
BleedBox *StBox `xml:"BleedBox,omitempty"`
}
CtPageArea 页面区域定义
func (*CtPageArea) EnsurePhysicalBox ¶ added in v0.0.6
func (p *CtPageArea) EnsurePhysicalBox()
EnsurePhysicalBox 确保页面物理区域有效,无效时使用 A4 尺寸。
type CtPath ¶
type CtPath struct {
// CTGraphicUnit 路径图元的通用属性。
CTGraphicUnit
// StrokeColor 路径描边颜色。
StrokeColor *CTColor `xml:"StrokeColor"`
// FillColor 路径填充颜色。
FillColor *CTColor `xml:"FillColor"`
// AbbreviatedData 路径的 SVG 简写数据。
AbbreviatedData SVGPath `xml:"AbbreviatedData"`
// Stroke 是否描边,默认值为 true。
Stroke string `xml:"Stroke,attr,omitempty"`
// Fill 是否填充路径。
Fill bool `xml:"Fill,attr,omitempty"`
// Rule 填充规则,可为 NonZero 或 Even-Odd。
Rule string `xml:"Rule,attr,omitempty"` // NonZero, Even-Odd
}
CtPath 路径图元定义。
type CtPattern ¶
type CtPattern struct {
// CellContent 图案单元中的内容。
CellContent CellContent `xml:"CellContent"`
// Width 图案单元宽度,单位为毫米。
Width float64 `xml:"Width,attr"`
// Height 图案单元高度,单位为毫米。
Height float64 `xml:"Height,attr"`
// XStep 图案在水平方向上的重复步长,单位为毫米。
XStep float64 `xml:"XStep,attr,omitempty"`
// YStep 图案在垂直方向上的重复步长,单位为毫米。
YStep float64 `xml:"YStep,attr,omitempty"`
// ReflectMethod 图案重复时的镜像方式,可为 Normal、Row、Column 或 RowAndColumn。
ReflectMethod string `xml:"ReflectMethod,attr,omitempty"` // Normal, Row, Column, RowAndColumn
// RelativeTo 图案坐标的参考对象,可为 Page 或 Object。
RelativeTo string `xml:"RelativeTo,attr,omitempty"` // Page, Object
// CTM 图案单元使用的坐标变换矩阵。
CTM StArray `xml:"CTM,attr,omitempty"`
}
CtPattern 图案填充定义。
type CtText ¶
type CtText struct {
// CTGraphicUnit 文字图元的通用属性。
CTGraphicUnit
// FillColor 文字填充颜色。
FillColor *CTColor `xml:"FillColor"`
// StrokeColor 文字描边颜色。
StrokeColor *CTColor `xml:"StrokeColor"`
// CGTransform 字符图形变换列表。
CGTransform []CTCGTransform `xml:"CGTransform"`
// TextCode 文字编码及定位信息列表。
TextCode []TextCode `xml:"TextCode"`
// Font 文字使用的字体引用。
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 字重,通常取 0、100 至 1000 之间的值。
Weight int `xml:"Weight,attr,omitempty"` // 0,100,...,1000
// Italic 是否为斜体样式,默认值为 false。
Italic bool `xml:"Italic,attr,omitempty"`
}
CtText 文字图元定义。
type CustomData ¶
CustomData 自定义数据
type CustomDatas ¶
type CustomDatas struct {
CustomData []CustomData `xml:"CustomData"`
}
CustomDatas 自定义数据集合
type CustomTag ¶
type CustomTag struct {
// NameSpace 自定义标签使用的命名空间。
NameSpace string `xml:"NameSpace,attr"`
// TypeID 兼容历史生产者使用的类型标识属性。
TypeID string `xml:"TypeID,attr,omitempty"`
// SchemaLoc 自定义标签模式文件的位置。
SchemaLoc *StLoc `xml:"SchemaLoc,omitempty"`
// FileLoc 自定义标签数据文件的位置。
FileLoc StLoc `xml:"FileLoc"`
}
CustomTag 单个自定义标签定义。
type CustomTags ¶
type CustomTags struct {
// XMLName 自定义标签根元素名称。
XMLName xml.Name `xml:"CustomTags"`
// Xmlns 自定义标签命名空间地址。
Xmlns string `xml:"xmlns,attr"`
// CustomTags 自定义标签列表。
CustomTags []CustomTag `xml:"CustomTag,omitempty"`
}
CustomTags 自定义标签容器。
type DateTime ¶
DateTime 自定义时间类型,用于解析OFD中的时间格式
func (*DateTime) MarshalXML ¶
MarshalXML 自定义XML序列化方法
func (*DateTime) MarshalXMLAttr ¶
MarshalXMLAttr 自定义XML属性序列化方法
func (*DateTime) UnmarshalXML ¶
UnmarshalXML 自定义XML元素解析方法
type DocBody ¶
type DocBody struct {
// DocInfo 文档元数据信息。
DocInfo DocInfo `xml:"DocInfo"`
// DocRoot 文档根目录的位置。
DocRoot StLoc `xml:"DocRoot"`
// Versions 文档版本集合。
Versions *Versions `xml:"Versions,omitempty"`
// Signatures 签名文件的位置。
Signatures *StLoc `xml:"Signatures,omitempty"`
}
DocBody OFD 文档体。
type DocInfo ¶
type DocInfo struct {
// DocID 文档标识。
DocID string `xml:"DocID"`
// Title 文档标题。
Title *string `xml:"Title,omitempty"`
// Author 文档作者。
Author *string `xml:"Author,omitempty"`
// Subject 文档主题。
Subject *string `xml:"Subject,omitempty"`
// Abstract 文档摘要。
Abstract *string `xml:"Abstract,omitempty"`
// CreationDate 文档创建时间。
CreationDate *DateTime `xml:"CreationDate,omitempty"`
// ModDate 文档最后修改时间。
ModDate *DateTime `xml:"ModDate,omitempty"`
// DocUsage 文档用途。
DocUsage *string `xml:"DocUsage,omitempty"`
// Cover 文档封面文件的位置。
Cover *StLoc `xml:"Cover,omitempty"`
// Keywords 文档关键词集合。
Keywords *Keywords `xml:"Keywords,omitempty"`
// Creator 创建文档的软件名称。
Creator *string `xml:"Creator,omitempty"`
// CreatorVersion 创建文档的软件版本。
CreatorVersion *string `xml:"CreatorVersion,omitempty"`
// CustomDatas 文档自定义数据集合。
CustomDatas *CustomDatas `xml:"CustomDatas,omitempty"`
}
DocInfo 文档元数据信息。
type DocVersion ¶
type DocVersion struct {
// XMLName 文档版本根元素名称。
XMLName xml.Name `xml:"DocVersion"`
// Xmlns 文档版本命名空间地址。
Xmlns string `xml:"xmlns,attr"`
// ID 文档版本标识。
ID string `xml:"ID,attr"`
// Version 文档版本号。
Version *string `xml:"Version,attr,omitempty"`
// Name 文档版本名称。
Name *string `xml:"Name,attr,omitempty"`
// CreationDate 文档版本创建时间。
CreationDate *DateTime `xml:"CreationDate,attr,omitempty"`
// FileList 文档版本包含的文件列表。
FileList FileList `xml:"FileList"`
// DocRoot 文档根目录的位置。
DocRoot StLoc `xml:"DocRoot"`
}
DocVersion 文档版本信息。
type Document ¶
type Document struct {
// XMLName 文档主体根元素名称。
XMLName xml.Name `xml:"Document"`
// XMLNS OFD 命名空间地址。
XMLNS string `xml:"xmlns:ofd,attr"`
// CommonData 文档公共数据。
CommonData CommonData `xml:"CommonData"`
// Pages 文档页面列表。
Pages PageList `xml:"Pages"`
// Outlines 文档大纲。
Outlines *OutlineList `xml:"Outlines,omitempty"`
// Permissions 文档权限设置。
Permissions *CT_Permission `xml:"Permissions,omitempty"`
// Actions 文档级动作集合。
Actions *ActionList `xml:"Actions,omitempty"`
// VPreferences 文档视图首选项。
VPreferences *CT_VPreferences `xml:"VPreferences,omitempty"`
// Bookmarks 文档书签列表。
Bookmarks *BookmarkList `xml:"Bookmarks,omitempty"`
// Annotations 注解文件的位置。
Annotations *StLoc `xml:"Annotations,omitempty"`
// CustomTags 自定义标签文件的位置。
CustomTags *StLoc `xml:"CustomTags,omitempty"`
// Attachments 附件文件的位置。
Attachments *StLoc `xml:"Attachments,omitempty"`
// Extensions 扩展文件的位置。
Extensions *StLoc `xml:"Extensions,omitempty"`
}
Document OFD 文档主体定义。
type DrawParam ¶
type DrawParam struct {
// ID 绘制参数标识,在资源文件内唯一。
ID StID `xml:"ID,attr"`
// Relative 继承的绘制参数资源引用。
Relative StRefID `xml:"Relative,attr,omitempty"`
// LineWidth 线宽,单位为毫米。
LineWidth float64 `xml:"LineWidth,attr,omitempty"`
// Join 线连接样式,可为 Miter、Round 或 Bevel。
Join string `xml:"Join,attr,omitempty"`
// Cap 线端点样式,可为 Butt、Round 或 Square。
Cap string `xml:"Cap,attr,omitempty"`
// DashOffset 虚线模式的起始偏移量。
DashOffset float64 `xml:"DashOffset,attr,omitempty"`
// DashPattern 虚线模式中实线段和空白段的长度数组。
DashPattern *StArrayF `xml:"DashPattern,attr,omitempty"`
// MiterLimit 斜接连接的长度限制。
MiterLimit float64 `xml:"MiterLimit,attr,omitempty"`
// FillColor 填充颜色。
FillColor *CTColor `xml:"FillColor"`
// StrokeColor 描边颜色。
StrokeColor *CTColor `xml:"StrokeColor"`
// contains filtered or unexported fields
}
DrawParam 绘制参数资源定义。
func (DrawParam) HasDashOffset ¶ added in v0.0.6
func (DrawParam) HasLineWidth ¶ added in v0.0.6
func (DrawParam) HasMiterLimit ¶ added in v0.0.6
func (*DrawParam) UnmarshalXML ¶ added in v0.0.6
UnmarshalXML 解析绘制参数,并记录显式出现的数值属性。 这些标记用于区分未指定与合法的零值,以便正确处理 Relative 继承。
type DrawParams ¶
type DrawParams struct {
// DrawParam 绘制参数资源列表。
DrawParam []*DrawParam `xml:"DrawParam"`
}
DrawParams 绘制参数资源集合。
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 ¶
MarshalXML 自定义Extension序列化(修正版)
func (*Extension) UnmarshalXML ¶
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 文档版本文件列表。
Files []VersionFile `xml:"File"`
}
FileList 文档版本文件列表。
type Font ¶
type Font struct {
// ID 字体标识,在资源文件内唯一。
ID StID `xml:"ID,attr"`
// FontName 字体名称。
FontName string `xml:"FontName,attr"`
// FamilyName 字体族名称。
FamilyName string `xml:"FamilyName,attr,omitempty"`
// Charset 字符集,可为 symbol、prc、big5、shift-jis、wansung、johab 或 unicode。
Charset string `xml:"Charset,attr,omitempty"`
// Italic 是否为斜体字体。
Italic bool `xml:"Italic,attr,omitempty"`
// Bold 是否为粗体字体。
Bold bool `xml:"Bold,attr,omitempty"`
// Serif 是否为衬线字体。
Serif bool `xml:"Serif,attr,omitempty"`
// FixedWidth 是否为等宽字体。
FixedWidth bool `xml:"FixedWidth,attr,omitempty"`
// FontFile 字体文件的位置。
FontFile StLoc `xml:"FontFile,omitempty"`
}
Font 字体资源定义。
type GouraudPoint ¶
type GouraudPoint struct {
// Color 控制点颜色。
Color CTColor `xml:"Color"`
// X 控制点横坐标。
X float64 `xml:"X,attr"`
// Y 控制点纵坐标。
Y float64 `xml:"Y,attr"`
// EdgeFlag 网格边缘标志,可为 0、1 或 2。
EdgeFlag int `xml:"EdgeFlag,attr"` // 0,1,2
}
GouraudPoint Gouraud 渐变控制点。
type ImageObject ¶
type ImageObject struct {
// ID 图像对象标识,在页面内唯一。
ID StID `xml:"ID,attr"`
// CtImage 图像图元的通用属性和资源引用。
CtImage
}
ImageObject 页面中的图像对象。
type Keywords ¶
type Keywords struct {
// Keyword 关键词列表。
Keyword []string `xml:"Keyword"`
}
Keywords 文档关键词集合。
type LaGouraudPoint ¶
type LaGouraudPoint struct {
// Color 控制点颜色。
Color CTColor `xml:"Color"`
// X 控制点横坐标。
X float64 `xml:"X,attr,omitempty"`
// Y 控制点纵坐标。
Y float64 `xml:"Y,attr,omitempty"`
}
LaGouraudPoint Gouraud 网格渐变控制点。
type Layer ¶
type Layer struct {
// ID 图层标识,在页面内唯一。
ID StID `xml:"ID,attr"`
// Type 图层类型,可为 Body、Background、Foreground 或 Custom。
Type string `xml:"Type,attr,omitempty"`
// DrawParam 图层使用的绘制参数引用。
DrawParam StRefID `xml:"DrawParam,attr,omitempty"`
// CTPageBlock 图层中的页面对象。
CTPageBlock
}
Layer 页面图层,包含按文档顺序排列的页面对象。
func (*Layer) UnmarshalXML ¶ added in v0.0.5
UnmarshalXML 解析 Layer,除了图层属性外,还需按文档顺序记录其中的图形对象。
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 多媒体资源标识,在资源文件内唯一。
ID StID `xml:"ID,attr"`
// Type 多媒体类型,可为 Image、Audio 或 Video。
Type string `xml:"Type,attr"`
// Format 多媒体文件格式。
Format string `xml:"Format,attr,omitempty"`
// MediaFile 多媒体文件的位置。
MediaFile StLoc `xml:"MediaFile"`
}
MultiMedia 多媒体资源定义。
type MultiMedias ¶
type MultiMedias struct {
// MultiMedia 多媒体资源列表。
MultiMedia []*MultiMedia `xml:"MultiMedia"`
}
MultiMedias 多媒体资源集合。
type OFD ¶
type OFD struct {
// XMLName 文档根元素名称。
XMLName xml.Name `xml:"OFD"`
// XMLNS OFD 命名空间地址。
XMLNS string `xml:"xmlns:ofd,attr"`
// Version OFD 文档规范版本。
Version string `xml:"Version,attr"`
// DocType 文档类型。
DocType string `xml:"DocType,attr"`
// DocBodies 文档体列表。
DocBodies []DocBody `xml:"DocBody"`
}
OFD OFD 文档根元素。
type OptionalBool ¶ added in v0.0.5
type OptionalBool struct {
// contains filtered or unexported fields
}
OptionalBool 表示一个可选的布尔值,用于处理 XML 属性中 缺省时需要默认值为 true 的场景(如 OFD 的 Visible 属性)。
使用方式:
- 属性未指定:Value() 返回默认值(由调用方指定)
- 属性值为 true:Value() 返回 true
- 属性值为 false:Value() 返回 false
示例:
// 判断是否可见(默认 true)
if unit.Visible.Value(true) { ... }
func NewOptionalBool ¶ added in v0.0.5
func NewOptionalBool(b bool) OptionalBool
NewOptionalBool 创建一个 OptionalBool
func (OptionalBool) MarshalXMLAttr ¶ added in v0.0.5
MarshalXMLAttr 实现 XML 属性序列化
func (*OptionalBool) UnmarshalXMLAttr ¶ added in v0.0.5
func (o *OptionalBool) UnmarshalXMLAttr(attr xml.Attr) error
UnmarshalXMLAttr 实现 XML 属性反序列化
func (OptionalBool) Value ¶ added in v0.0.5
func (o OptionalBool) Value(defaultIfNotSet bool) bool
Value 返回布尔值。defaultIfNotSet 为属性未设置时的默认值。
type OutlineList ¶
type OutlineList struct {
// OutlineElems 大纲项列表。
OutlineElems []CTOutlineElem `xml:"OutlineElem"`
}
OutlineList 文档大纲列表。
type Page ¶
type Page struct {
// ID 页面标识,在文档内唯一。
ID StID `xml:"ID,attr"`
// BaseLoc 页面内容文件的位置。
BaseLoc StLoc `xml:"BaseLoc,attr"`
}
Page OFD 页面定义。
type PageAnnot ¶
type PageAnnot struct {
// XMLName 页面注解根元素名称。
XMLName xml.Name `xml:"PageAnnot"`
// Xmlns 页面注解命名空间地址。
Xmlns string `xml:"xmlns,attr"`
// Annots 页面中的注解列表。
Annots []*Annot `xml:"Annot"`
}
PageAnnot 页面注解文件的根容器。
type PageBlock ¶
type PageBlock struct {
// ID 页面对象块标识,在页面内唯一。
ID StID `xml:"ID,attr"`
// CTPageBlock 页面对象块中的子对象。
CTPageBlock
}
PageBlock 页面对象块,可以包含嵌套的页面对象。
func (*PageBlock) UnmarshalXML ¶ added in v0.0.5
UnmarshalXML 解析 PageBlock,读取 ID 属性后按文档顺序解析其内容。
type PageContent ¶
type PageContent struct {
// Template 页面使用的模板页引用。
Template []Template `xml:"Template"`
// PageRes 页面级资源文件的位置。
PageRes []StLoc `xml:"PageRes"`
// Area 页面的区域定义。
Area *CtPageArea `xml:"Area"`
// Content 页面图层和页面对象内容。
Content *Content `xml:"Content"`
// Actions 页面级动作集合。
Actions *Actions `xml:"Actions"`
}
PageContent OFD 页面内容,包含页面区域、资源、模板和内容对象。
func (*PageContent) EnsurePhysicalBox ¶ added in v0.0.6
func (p *PageContent) EnsurePhysicalBox()
EnsurePhysicalBox 确保页面区域存在且物理区域有效。
type PageItem ¶ added in v0.0.5
type PageItem struct {
// Kind 页面对象的类型。
Kind PageItemKind
// Text 当 Kind 为 PageItemText 时保存的文字对象。
Text TextObject
// Path 当 Kind 为 PageItemPath 时保存的路径对象。
Path PathObject
// Image 当 Kind 为 PageItemImage 时保存的图像对象。
Image ImageObject
// Composite 当 Kind 为 PageItemComposite 时保存的复合对象。
Composite CompositeObject
// Block 当 Kind 为 PageItemBlock 时保存的嵌套页面对象块。
Block PageBlock
}
PageItem 按文档顺序保存页面块中的一个图形对象。
type PageItemKind ¶ added in v0.0.5
type PageItemKind int
PageItemKind 页面块中对象的种类。
const ( // PageItemText 表示文字对象。 PageItemText PageItemKind // PageItemPath 表示路径对象。 PageItemPath // PageItemImage 表示图像对象。 PageItemImage // PageItemComposite 表示复合对象。 PageItemComposite // PageItemBlock 表示嵌套页面对象块。 PageItemBlock )
type PageLayout ¶
type PageLayout string
PageLayout 文档打开时的页面布局方式。
const ( // PageLayoutOneColumn 以单列方式显示页面。 PageLayoutOneColumn PageLayout = "OneColumn" // PageLayoutTwoPageL 以双页方式显示页面,页面从左向右排列。 PageLayoutTwoPageL PageLayout = "TwoPageL" )
type Palette ¶
type Palette struct {
// CV 调色板中的颜色值列表。
CV []StArray `xml:"CV"`
}
Palette 颜色空间的调色板定义。
type Parameter ¶
type Parameter struct {
// Name 参数名称。
Name string `xml:"Name,attr"`
// Value 参数值。
Value string `xml:",chardata"`
}
Parameter 单个注解参数。
type Params ¶
type Params struct {
// Parameters 注解参数列表。
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 路径命令类型。
Type CommandType
// Points 命令使用的坐标点;弧命令使用 Arc 保存参数。
Points []StPos
// Arc 椭圆弧参数,仅当 Type 为 ArcTo 时有效。
Arc *ArcData
}
PathCommand 定义一条路径命令及其参数。
type PathObject ¶
type PathObject struct {
// ID 路径对象标识,在页面内唯一。
ID StID `xml:"ID,attr"`
// CtPath 路径图元的通用属性和路径数据。
CtPath
}
PathObject 页面中的路径对象。
type PrintSettings ¶
type PrintSettings struct {
// Printable 是否允许打印。
Printable bool `xml:"Printable,attr"`
// Copies 允许打印的份数。
Copies int `xml:"Copies,attr"`
}
PrintSettings 文档打印权限设置。
type References ¶
type Res ¶
type Res struct {
// BaseLoc 资源文件的基础路径。
BaseLoc StLoc `xml:"BaseLoc,attr"`
// ColorSpaces 颜色空间资源集合。
ColorSpaces *ColorSpaces `xml:"ColorSpaces"`
// DrawParams 绘制参数资源集合。
DrawParams *DrawParams `xml:"DrawParams"`
// Fonts 字体资源集合。
Fonts *Fonts `xml:"Fonts"`
// MultiMedias 多媒体资源集合。
MultiMedias *MultiMedias `xml:"MultiMedias"`
// CompositeGraphicUnits 复合图形资源集合。
CompositeGraphicUnits *CompositeGraphicUnits `xml:"CompositeGraphicUnits"`
}
Res OFD 资源文件定义。
type SVGPath ¶
type SVGPath []PathCommand
SVGPath 定义 SVG 路径,是 PathCommand 的切片类型。 SVGPath 实现了 XML 编解码接口,可直接解析和编码 OFD 的路径数据。
func ParsePathData ¶
ParsePathData 解析路径字符串并返回 SVGPath。 输入为空或仅包含空白字符时返回空路径。
func (*SVGPath) AddCommand ¶
func (p *SVGPath) AddCommand(cmd PathCommand)
AddCommand 将一条路径命令追加到路径末尾。
func (SVGPath) CalculateBoundingBox ¶
CalculateBoundingBox 计算路径中坐标点的轴对齐边界框。 返回值依次为最小 X、最小 Y、最大 X 和最大 Y;空路径返回四个零值。
func (SVGPath) CountCommands ¶
func (p SVGPath) CountCommands() map[CommandType]int
CountCommands 统计路径中各类命令的数量。
func (SVGPath) GetCommand ¶
func (p SVGPath) GetCommand(index int) (PathCommand, error)
GetCommand 获取指定索引处的路径命令。 当索引越界时返回错误。
func (SVGPath) GetStartPoint ¶
GetStartPoint 获取指定命令之前最近的有效终点,作为该命令的起始点。 对于首条命令或找不到有效点的情况返回错误。
func (SVGPath) MarshalXML ¶
MarshalXML 将路径命令编码为 XML 元素文本。
func (*SVGPath) UnmarshalXML ¶
UnmarshalXML 从 XML 元素的文本内容中解析路径命令。 路径数据由命令字母和空格分隔的数值参数组成,例如 M 10 20 L 30 40。
type Segment ¶
type Segment struct {
// Color 当前分段的颜色。
Color CTColor `xml:"Color"`
// Position 当前颜色在渐变中的位置。
Position float64 `xml:"Position,attr,omitempty"`
}
Segment 渐变中的颜色分段。
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 ¶
MarshalXML 将StArray序列化为XML字符串
func (StArray) MarshalXMLAttr ¶ added in v0.0.5
MarshalXMLAttr 将字符串数组编码为 XML 属性。
func (*StArray) UnmarshalXML ¶
UnmarshalXML 从XML字符串解析StArray
type StArrayF ¶
type StArrayF []float64
func (StArrayF) MarshalXML ¶
MarshalXML 实现 xml.Marshaler 接口
func (StArrayF) MarshalXMLAttr ¶
MarshalXMLAttr 实现 xml.MarshalerAttr 接口
func (*StArrayF) UnmarshalXML ¶
UnmarshalXML 实现 xml.Unmarshaler 接口
type StArrayI ¶
type StArrayI []int
func (StArrayI) MarshalXML ¶
MarshalXML 实现 xml.Marshaler 接口
func (StArrayI) MarshalXMLAttr ¶
MarshalXMLAttr 实现 xml.MarshalerAttr 接口
func (*StArrayI) UnmarshalXML ¶
UnmarshalXML 实现 xml.Unmarshaler 接口
type StBox ¶
type StBox struct {
// X 盒子左上角的横坐标。
X float64 `xml:"X,attr"`
// Y 盒子左上角的纵坐标。
Y float64 `xml:"Y,attr"`
// Width 盒子宽度。
Width float64 `xml:"Width,attr"`
// Height 盒子高度。
Height float64 `xml:"Height,attr"`
}
StBox 盒子区域定义,字段顺序为 X、Y、Width、Height。
func (*StBox) CopyAndShift ¶ added in v0.0.2
CopyAndShift 复制盒子区域,并根据给定盒子的坐标偏移复制结果。
func (*StBox) MarshalXML ¶
MarshalXML 将盒子区域编码为 XML 元素文本。
func (*StBox) UnmarshalXML ¶
UnmarshalXML 从 XML 元素文本中解析盒子区域。
type StID ¶
type StID uint64
StID 标识,无符号整数,应在文档内唯一。0 表示无效
func (*StID) MarshalXML ¶
func (*StID) UnmarshalText ¶ added in v0.0.3
func (*StID) UnmarshalXML ¶
type StPos ¶
StPos 位置坐标类型
func (*StPos) MarshalXML ¶
MarshalXML 将 StPos 序列化为 XML 字符串
func (*StPos) UnmarshalXML ¶
UnmarshalXML 从 XML 字符串解析 StPos
type StampAnnot ¶
type TabDisplay ¶
type TabDisplay string
TabDisplay 文档标签中显示的标题类型。
const ( // TabDisplayDocTitle 在标签中显示文档标题。 TabDisplayDocTitle TabDisplay = "DocTitle" // TabDisplayFileName 在标签中显示文件名。 TabDisplayFileName TabDisplay = "FileName" )
type Template ¶
type Template struct {
// TemplateID 被引用模板页的标识。
TemplateID StRefID `xml:"TemplateID,attr"`
// ZOrder 模板页的叠放顺序,可为 Background 或 Foreground。
ZOrder string `xml:"ZOrder,attr,omitempty"`
}
Template 页面使用的模板引用。
type TemplatePage ¶
type TemplatePage struct {
// ID 模板页标识,在文档内唯一。
ID StID `xml:"ID,attr"`
// Name 模板页名称。
Name *string `xml:"Name,attr,omitempty"`
// ZOrder 模板页的叠放顺序。
ZOrder *string `xml:"ZOrder,attr,omitempty"`
// BaseLoc 模板页内容文件的位置。
BaseLoc StLoc `xml:"BaseLoc,attr"`
}
TemplatePage 文档模板页定义。
type TextCode ¶
type TextCode struct {
// Value 文字内容。
Value string `xml:",chardata"`
// X 文字起始位置的横坐标,单位为毫米。
X float64 `xml:"X,attr,omitempty"`
// Y 文字起始位置的纵坐标,单位为毫米。
Y float64 `xml:"Y,attr,omitempty"`
// DeltaX 字符在水平方向上的位置增量。
DeltaX StArrayF `xml:"DeltaX,attr,omitempty"`
// DeltaY 字符在垂直方向上的位置增量。
DeltaY StArrayF `xml:"DeltaY,attr,omitempty"`
}
TextCode 文字编码及其定位信息。
type TextObject ¶
type TextObject struct {
// ID 文字对象标识,在页面内唯一。
ID StID `xml:"ID,attr"`
// CtText 文字图元的通用属性和文字内容。
CtText
}
TextObject 页面中的文字对象。
type ValidPeriod ¶
type ValidPeriod struct {
// StartDate 权限生效时间。
StartDate DateTime `xml:"StartDate,attr,omitempty"`
// EndDate 权限失效时间。
EndDate DateTime `xml:"EndDate,attr,omitempty"`
}
ValidPeriod 权限有效期定义。
type Version ¶
type Version struct {
// ID 文档版本标识。
ID string `xml:"ID,attr"`
// Index 文档版本序号。
Index int `xml:"Index,attr"`
// Current 是否为当前使用的版本。
Current bool `xml:"Current,attr"`
// BaseLoc 版本文件的基础路径。
BaseLoc StLoc `xml:"BaseLoc,attr"`
}
Version 文档版本定义。
type VersionFile ¶
type VersionFile struct {
// ID 文件标识。
ID string `xml:"ID,attr"`
// Path 文件路径。
Path StLoc `xml:",chardata"`
}
VersionFile 文档版本中的单个文件。
type Versions ¶
type Versions struct {
// Version 文档版本列表。
VersionList []Version `xml:"Version"`
}
Versions 文档版本集合。
type ZoomSetting ¶
type ZoomSetting struct {
// Mode 缩放模式。
Mode *string `xml:"ZoomMode,omitempty"`
// Value 缩放比例。
Value *float64 `xml:"Zoom,omitempty"`
}
ZoomSetting 文档打开时的页面缩放设置。