Documentation
¶
Overview ¶
Package models 提供复用pkg/spec标准声明的内部包装及快速解析入口。 标准声明与标准库 XML 解码复用pkg/spec;别名和少量内部包装衔接现有消费者。 快速解析、页面尺寸兜底及文字位置兼容策略仍留在内部。
Index ¶
- Constants
- Variables
- func EnsurePhysicalBox(p *CtPageArea)
- 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 BookmarkRef
- type Border
- type CTAxialShd
- type CTBookmark
- type CTCGTransform
- type CTColor
- type CTGouraudShd
- type CTGraphicUnit
- type CTLaGouraudShd
- type CTM
- type CTOutlineElem
- type CTPageBlock
- type CTRadialShd
- 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 CustomTag
- type CustomTags
- type DestType
- type Document
- type DrawParam
- type DrawParams
- type Extension
- type ExtensionProp
- type Extensions
- type Font
- type Fonts
- type GouraudPoint
- type ImageObject
- type LaGouraudPoint
- type Layer
- type MovieOperator
- type MultiMedia
- type MultiMedias
- type OptionalBool
- 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 Provider
- type Reference
- type References
- type Res
- type SVGPath
- type Seal
- type Segment
- type Signature
- type SignatureParameter
- type SignatureParameters
- type Signatures
- type SignedInfo
- type StArray
- type StBox
- type StID
- type StPos
- type StRefID
- type StampAnnot
- type TabDisplay
- type Template
- type TemplatePage
- type TextCode
- type TextObject
- type ZOrder
- type ZoomSetting
Constants ¶
const ( AnnotTypeLink AnnotType = spec.AnnotTypeLink AnnotTypePath AnnotType = spec.AnnotTypePath AnnotTypeHighlight AnnotType = spec.AnnotTypeHighlight AnnotTypeStamp AnnotType = spec.AnnotTypeStamp AnnotTypeWatermark AnnotType = spec.AnnotTypeWatermark PageItemText = spec.PageItemText PageItemPath = spec.PageItemPath PageItemImage = spec.PageItemImage PageItemComposite = spec.PageItemComposite PageItemBlock = spec.PageItemBlock Start = spec.Start MoveTo = spec.MoveTo LineTo = spec.LineTo CubicBezier = spec.CubicBezier QuadTo = spec.QuadTo ArcTo = spec.ArcTo Close = spec.Close DestTypeXYZ DestType = spec.DestTypeXYZ DestTypeFit DestType = spec.DestTypeFit DestTypeFitH DestType = spec.DestTypeFitH DestTypeFitV DestType = spec.DestTypeFitV DestTypeFitR DestType = spec.DestTypeFitR ActionEventDO ActionEvent = spec.ActionEventDO ActionEventPO ActionEvent = spec.ActionEventPO ActionEventClick ActionEvent = spec.ActionEventClick MovieOperatorPlay MovieOperator = spec.MovieOperatorPlay MovieOperatorStop MovieOperator = spec.MovieOperatorStop MovieOperatorPause MovieOperator = spec.MovieOperatorPause MovieOperatorResume MovieOperator = spec.MovieOperatorResume )
Variables ¶
var IdentityMatrix = CTM{1, 0, 0, 1, 0, 0}
IdentityMatrix 供尚未迁移的内部消费者使用;公开调用方应使用 spec.IdentityCTM。
Functions ¶
func EnsurePhysicalBox ¶ added in v0.1.9
func EnsurePhysicalBox(p *CtPageArea)
EnsurePhysicalBox 保留页面物理区域的兼容兜底,无效尺寸使用 A4。 这是读取/显示策略,不属于 pkg/spec 的标准声明解码。
Types ¶
type BookmarkRef ¶ added in v0.1.9
type BookmarkRef = spec.BookmarkRef
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type CTCGTransform ¶
type CTCGTransform = spec.CTCGTransform
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
func ExpandCGTransformPositions ¶ added in v0.1.5
func ExpandCGTransformPositions(codes []TextCode, transforms []CTCGTransform) []CTCGTransform
ExpandCGTransformPositions 将按 TextCode 局部计数的 CGTransform.CodePosition 展开为整个文字对象内的字符位置。规范形式的全局递增位置保持原样;遇到位置重置 时,将后续位置解释为下一段 TextCode 内的偏移,兼容常见的逐字 TextCode 文档。
type CT_VPreferences ¶
type CT_VPreferences = spec.VPreferences //nolint:revive // 分批迁移期间保留内部名称,公开类型不使用下划线。
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type CompositeGraphicUnit ¶
type CompositeGraphicUnit = spec.CompositeGraphicUnit
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type CompositeGraphicUnits ¶
type CompositeGraphicUnits = spec.CompositeGraphicUnits
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type CompositeObject ¶
type CompositeObject = spec.CompositeObject
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type Document ¶
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
func ParseDocumentXML ¶ added in v0.1.4
ParseDocumentXML 解析 OFD 文档主体 XML。页面列表(Pages/Page)是打开文档时 解析量最大的部分——大文档动辄上千个仅含 ID/BaseLoc 的 Page 元素,用 encoding/xml 反射逐元素 unmarshal 会产生大量分配;这里直接用 tdewolff 的 零分配 XML lexer 重建。其余低频且复杂的子树(CommonData、Outlines、颜色、 权限等)用 fastxml.SpanElement 捕获字节区间后回退 encoding/xml,语义与 xml.Unmarshal 一致。
type OptionalBool ¶ added in v0.0.5
type OptionalBool = spec.OptionalBool
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
func NewOptionalBool ¶ added in v0.0.5
func NewOptionalBool(value bool) OptionalBool
NewOptionalBool 为尚未迁移的内部图元构造可选布尔属性。
type PageContent ¶
type PageContent spec.PageContent
PageContent 复用标准声明,并保留内部页面尺寸兼容策略。
func ParsePageContentXML ¶ added in v0.1.3
func ParsePageContentXML(data []byte) (*PageContent, error)
ParsePageContentXML 解析 OFD 页面内容 XML,入口语义与 xml.Unmarshal 一致: 第一个元素作为根元素跳过,子元素按名称匹配。
func (*PageContent) EnsurePhysicalBox ¶ added in v0.0.6
func (p *PageContent) EnsurePhysicalBox()
EnsurePhysicalBox 确保页面区域存在且物理区域有效;这不是标准声明解码行为。
type PageItemKind ¶ added in v0.0.5
type PageItemKind = spec.PageItemKind
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type Res ¶
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
func ParseResXML ¶ added in v0.1.9
ParseResXML 使用 fastxml.Lexer 解析资源文件。低频且结构复杂的资源子树仍由 fastxml.DecodeSpan 按模型解码,颜色空间和调色板则直接从词法 token 重建。
type SVGPath ¶
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
func ParsePathData ¶
ParsePathData 在分批迁移期间复用公开模型的 OFD 紧缩路径解码。
type Signature ¶
type Signature struct {
spec.Signature
Type string `xml:"-"`
Relative string `xml:"-"`
FilePath string `xml:"-"`
}
Signature 将标准签名描述与内部加载上下文分开;上下文不参与 XML 解码。
type SignatureParameter ¶ added in v0.1.6
type SignatureParameter = spec.SignatureParameter
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。
type SignatureParameters ¶ added in v0.1.6
type SignatureParameters = spec.SignatureParameters
内部模型在分批迁移期间复用公开类型,避免维护两份声明和编解码行为。