semantic

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcroForm

type AcroForm struct {
	NeedAppearances  bool
	XFA              []byte // XML Data Stream
	Fields           []FormField
	CalculationOrder []FormField // CO entry
	DefaultResources *Resources  // DR entry
	OriginalRef      raw.ObjectRef
	Dirty            bool
}

AcroForm represents form-level information.

type Action

type Action interface {
	ActionType() string
}

Action represents a PDF action.

type Annotation

type Annotation interface {
	Type() string
	Rect() Rectangle
	SetRect(Rectangle)
	Reference() raw.ObjectRef
	SetReference(raw.ObjectRef)
	Base() *BaseAnnotation
}

Annotation represents a page annotation.

type ArrayOperand

type ArrayOperand struct{ Values []Operand }

func (ArrayOperand) Type

func (ArrayOperand) Type() string

type ArticleBead

type ArticleBead struct {
	PageIndex   int
	Rect        Rectangle
	OriginalRef raw.ObjectRef
	Dirty       bool
}

ArticleBead describes a single segment of an article.

type ArticleThread

type ArticleThread struct {
	Title       string
	Beads       []ArticleBead
	OriginalRef raw.ObjectRef
	Dirty       bool
}

ArticleThread represents an article with an ordered list of beads.

type AttributeObject

type AttributeObject struct {
	Owner       string // /O (e.g., /Layout, /List, /Table)
	Attributes  map[string]interface{}
	OriginalRef raw.ObjectRef
	Dirty       bool
}

AttributeObject represents Layout or PrintField attributes.

type BaseAnnotation

type BaseAnnotation struct {
	Subtype         string
	RectVal         Rectangle
	Contents        string
	Appearance      []byte
	Flags           int
	Border          []float64
	Color           []float64
	AppearanceState string
	AssociatedFiles []EmbeddedFile // PDF 2.0
	Ref             raw.ObjectRef
	OriginalRef     raw.ObjectRef
	Dirty           bool
}

BaseAnnotation provides common fields for annotations.

func (*BaseAnnotation) Base

func (a *BaseAnnotation) Base() *BaseAnnotation

func (*BaseAnnotation) Rect

func (a *BaseAnnotation) Rect() Rectangle

func (*BaseAnnotation) Reference

func (a *BaseAnnotation) Reference() raw.ObjectRef

func (*BaseAnnotation) SetRect

func (a *BaseAnnotation) SetRect(r Rectangle)

func (*BaseAnnotation) SetReference

func (a *BaseAnnotation) SetReference(r raw.ObjectRef)

func (*BaseAnnotation) Type

func (a *BaseAnnotation) Type() string

type BaseFormField

type BaseFormField struct {
	Name              string
	PageIndex         int
	Rect              Rectangle
	Flags             int
	Appearance        []byte
	AppearanceState   string
	Border            []float64
	Color             []float64
	DefaultAppearance string // DA entry
	Quadding          int    // Q entry: 0=Left, 1=Center, 2=Right
	Ref               raw.ObjectRef
	OriginalRef       raw.ObjectRef
	Dirty             bool
}

BaseFormField provides common fields for form fields.

func (*BaseFormField) FieldFlags

func (f *BaseFormField) FieldFlags() int

func (*BaseFormField) FieldName

func (f *BaseFormField) FieldName() string

func (*BaseFormField) FieldPageIndex

func (f *BaseFormField) FieldPageIndex() int

func (*BaseFormField) FieldRect

func (f *BaseFormField) FieldRect() Rectangle

func (*BaseFormField) GetAppearance

func (f *BaseFormField) GetAppearance() []byte

func (*BaseFormField) GetAppearanceState

func (f *BaseFormField) GetAppearanceState() string

func (*BaseFormField) GetBorder

func (f *BaseFormField) GetBorder() []float64

func (*BaseFormField) GetColor

func (f *BaseFormField) GetColor() []float64

func (*BaseFormField) GetDefaultAppearance

func (f *BaseFormField) GetDefaultAppearance() string

func (*BaseFormField) GetQuadding

func (f *BaseFormField) GetQuadding() int

func (*BaseFormField) IsDirty

func (f *BaseFormField) IsDirty() bool

func (*BaseFormField) Reference

func (f *BaseFormField) Reference() raw.ObjectRef

func (*BaseFormField) SetDirty

func (f *BaseFormField) SetDirty(d bool)

func (*BaseFormField) SetFieldFlags

func (f *BaseFormField) SetFieldFlags(flags int)

func (*BaseFormField) SetFieldPageIndex

func (f *BaseFormField) SetFieldPageIndex(i int)

func (*BaseFormField) SetFieldRect

func (f *BaseFormField) SetFieldRect(r Rectangle)

func (*BaseFormField) SetReference

func (f *BaseFormField) SetReference(r raw.ObjectRef)

type BaseFunction

type BaseFunction struct {
	Type        int
	Domain      []float64
	Range       []float64
	Ref         raw.ObjectRef
	OriginalRef raw.ObjectRef
	Dirty       bool
}

func (*BaseFunction) FunctionDomain

func (f *BaseFunction) FunctionDomain() []float64

func (*BaseFunction) FunctionRange

func (f *BaseFunction) FunctionRange() []float64

func (*BaseFunction) FunctionType

func (f *BaseFunction) FunctionType() int

func (*BaseFunction) Reference

func (f *BaseFunction) Reference() raw.ObjectRef

func (*BaseFunction) SetReference

func (f *BaseFunction) SetReference(r raw.ObjectRef)

type BasePattern

type BasePattern struct {
	Type        int
	Matrix      []float64 // Optional transformation matrix
	Ref         raw.ObjectRef
	OriginalRef raw.ObjectRef
	Dirty       bool
}

func (*BasePattern) PatternType

func (p *BasePattern) PatternType() int

func (*BasePattern) Reference

func (p *BasePattern) Reference() raw.ObjectRef

func (*BasePattern) SetReference

func (p *BasePattern) SetReference(r raw.ObjectRef)

type BasePropertyList

type BasePropertyList struct {
	Ref         raw.ObjectRef
	OriginalRef raw.ObjectRef
	Dirty       bool
}

func (*BasePropertyList) Reference

func (p *BasePropertyList) Reference() raw.ObjectRef

func (*BasePropertyList) SetReference

func (p *BasePropertyList) SetReference(r raw.ObjectRef)

type BaseShading

type BaseShading struct {
	Type        int
	ColorSpace  ColorSpace
	BBox        Rectangle
	AntiAlias   bool
	Ref         raw.ObjectRef
	OriginalRef raw.ObjectRef
	Dirty       bool
}

BaseShading provides common fields for shadings.

func (*BaseShading) Reference

func (s *BaseShading) Reference() raw.ObjectRef

func (*BaseShading) SetReference

func (s *BaseShading) SetReference(r raw.ObjectRef)

func (*BaseShading) ShadingColorSpace

func (s *BaseShading) ShadingColorSpace() ColorSpace

func (*BaseShading) ShadingType

func (s *BaseShading) ShadingType() int

type Builder

type Builder interface {
	Build(ctx context.Context, dec *decoded.DecodedDocument) (*Document, error)
}

Builder produces a Semantic document from Decoded IR.

func NewBuilder

func NewBuilder() Builder

NewBuilder returns a minimal semantic builder that wraps decoded docs.

type ButtonFormField

type ButtonFormField struct {
	BaseFormField
	IsPush  bool
	IsRadio bool
	IsCheck bool
	Checked bool   // For check/radio
	OnState string // The name of the "on" state (e.g., "Yes")
}

ButtonFormField represents a button field (Btn) - Push, Check, Radio.

func (*ButtonFormField) FieldType

func (f *ButtonFormField) FieldType() string

type CIDFont

type CIDFont struct {
	Subtype       string // CIDFontType0 or CIDFontType2
	BaseFont      string
	CIDSystemInfo CIDSystemInfo
	DW            int
	W             map[int]int // CID -> width
	Descriptor    *FontDescriptor
}

CIDFont describes a descendant font for Type0 fonts.

type CIDSystemInfo

type CIDSystemInfo struct {
	Registry   string
	Ordering   string
	Supplement int
}

CIDSystemInfo describes the registry/ordering of a CID font.

type Catalog

type Catalog struct{}

type ChoiceFormField

type ChoiceFormField struct {
	BaseFormField
	Options       []string
	Selected      []string
	IsCombo       bool
	IsMultiSelect bool
}

ChoiceFormField represents a choice field (Ch) - Combo box or List box.

func (*ChoiceFormField) FieldType

func (f *ChoiceFormField) FieldType() string

type CircleAnnotation

type CircleAnnotation struct {
	BaseAnnotation
	IC []float64 // Interior color
	RD []float64 // Rect differences (padding)
}

CircleAnnotation represents a circle annotation.

type ClassMap

type ClassMap map[string]*AttributeObject

ClassMap maps class names to attribute objects.

type ColorSpace

type ColorSpace interface {
	ColorSpaceName() string
}

ColorSpace references a named colorspace.

type ContentStream

type ContentStream struct {
	Operations []Operation
	RawBytes   []byte
}

ContentStream is a sequence of operations on a page.

type DPartRoot

type DPartRoot struct {
	OriginalRef raw.ObjectRef
	Dirty       bool
}

DPartRoot represents the root of the DPart hierarchy (PDF/VT).

type DeviceColorSpace

type DeviceColorSpace struct {
	Name string
}

func (DeviceColorSpace) ColorSpaceName

func (cs DeviceColorSpace) ColorSpaceName() string

type DeviceNAttributes

type DeviceNAttributes struct {
	Subtype string
}

type DeviceNColorSpace

type DeviceNColorSpace struct {
	Names         []string
	Alternate     ColorSpace
	TintTransform Function // Function object
	Attributes    *DeviceNAttributes
	OriginalRef   raw.ObjectRef
	Dirty         bool
}

DeviceNColorSpace represents a DeviceN color space.

func (*DeviceNColorSpace) ColorSpaceName

func (cs *DeviceNColorSpace) ColorSpaceName() string

type DictOperand

type DictOperand struct{ Values map[string]Operand }

func (DictOperand) Type

func (DictOperand) Type() string

type Document

type Document struct {
	Pages         []*Page
	Catalog       *Catalog
	Info          *DocumentInfo
	Metadata      *XMPMetadata
	Lang          string
	Marked        bool
	PageLabels    map[int]string // page index -> prefix
	Outlines      []OutlineItem
	Articles      []ArticleThread
	AcroForm      *AcroForm
	StructTree    *StructureTree
	DPartRoot     *DPartRoot // PDF/VT
	OutputIntents []OutputIntent
	EmbeddedFiles []EmbeddedFile

	OwnerPassword     string
	UserPassword      string
	Permissions       raw.Permissions
	Encrypted         bool
	MetadataEncrypted bool
	OriginalRef       raw.ObjectRef
	Dirty             bool
	Payload           *Document // PDF 2.0 Unencrypted Wrapper Payload
	// contains filtered or unexported fields
}

Document is the semantic representation of a PDF.

func (*Document) Decoded

func (d *Document) Decoded() *decoded.DecodedDocument

Decoded returns the underlying decoded document (if set).

type DocumentInfo

type DocumentInfo struct {
	Title       string
	Author      string
	Subject     string
	Creator     string
	Producer    string
	Trapped     string // "True", "False", or "Unknown"
	Keywords    []string
	OriginalRef raw.ObjectRef
	Dirty       bool
}

DocumentInfo models /Info dictionary values.

type EmbeddedFile

type EmbeddedFile struct {
	Name         string
	Description  string
	Relationship string
	Subtype      string
	Data         []byte
	OriginalRef  raw.ObjectRef
	Dirty        bool
}

EmbeddedFile models an associated file (e.g., PDF/A-3 attachments).

type ExponentialFunction

type ExponentialFunction struct {
	BaseFunction
	C0 []float64
	C1 []float64
	N  float64
}

ExponentialFunction (Type 2)

type ExtGState

type ExtGState struct {
	LineWidth      *float64
	StrokeAlpha    *float64
	FillAlpha      *float64
	BlendMode      string // /BM (Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion)
	AlphaSource    *bool  // /AIS (Alpha Is Shape)
	TextKnockout   *bool  // /TK
	Overprint      *bool  // /OP
	OverprintFill  *bool  // /op
	OverprintMode  *int   // /OPM
	UseBlackPtComp *bool  // /UseBlackPtComp (PDF 2.0)
	SoftMask       *SoftMaskDict
	OriginalRef    raw.ObjectRef
	Dirty          bool
}

ExtGState captures graphics state defaults such as transparency.

type FileAttachmentAnnotation

type FileAttachmentAnnotation struct {
	BaseAnnotation
	File EmbeddedFile
	Name string // Icon name (e.g., "Graph", "PushPin", "Paperclip", "Tag")
}

FileAttachmentAnnotation represents a file attachment annotation.

type Font

type Font struct {
	Subtype        string // Type1 (default), TrueType, Type0, Type3
	BaseFont       string
	Encoding       string
	Widths         map[int]int // character code -> width
	ToUnicode      map[int][]rune
	CIDSystemInfo  *CIDSystemInfo
	DescendantFont *CIDFont
	Descriptor     *FontDescriptor
	// Type 3 specific fields
	CharProcs  map[string][]byte
	FontMatrix []float64
	Resources  *Resources
	FontBBox   Rectangle

	OriginalRef raw.ObjectRef
	Dirty       bool
	// contains filtered or unexported fields
}

Font represents a font resource.

type FontDescriptor

type FontDescriptor struct {
	FontName     string
	Flags        int
	ItalicAngle  float64
	Ascent       float64
	Descent      float64
	CapHeight    float64
	StemV        int
	FontBBox     [4]float64
	FontFile     []byte
	FontFileType string // FontFile2 (TrueType) or FontFile3
	Length1      int    // Length of the ASCII segment (Type 1)
	Length2      int    // Length of the encrypted segment (Type 1)
	Length3      int    // Length of the fixed-content segment (Type 1)
}

FontDescriptor carries metrics and font file embedding details.

type FormField

type FormField interface {
	FieldType() string
	FieldName() string
	FieldFlags() int
	FieldRect() Rectangle
	FieldPageIndex() int
	SetFieldRect(Rectangle)
	SetFieldPageIndex(int)
	SetFieldFlags(int)

	// Common accessors for serialization
	GetAppearance() []byte
	GetAppearanceState() string
	GetBorder() []float64
	GetColor() []float64

	// Reference management
	Reference() raw.ObjectRef
	SetReference(raw.ObjectRef)
	IsDirty() bool
	SetDirty(bool)
}

FormField is the interface for all form fields.

type FreeTextAnnotation

type FreeTextAnnotation struct {
	BaseAnnotation
	DA string // Default appearance string
	Q  int    // Quadding (justification): 0=Left, 1=Center, 2=Right
}

FreeTextAnnotation represents a free text annotation.

type Function

type Function interface {
	FunctionType() int
	FunctionDomain() []float64
	FunctionRange() []float64
	Reference() raw.ObjectRef
	SetReference(raw.ObjectRef)
}

Function represents a PDF function.

type FunctionShading

type FunctionShading struct {
	BaseShading
	Coords   []float64
	Domain   []float64
	Function []Function // Function object or array of functions
	Extend   []bool
}

FunctionShading represents function-based shadings (Type 1, 2, 3).

type GenericAnnotation

type GenericAnnotation struct {
	BaseAnnotation
}

GenericAnnotation represents an annotation not covered by specific types.

type GenericFormField

type GenericFormField struct {
	BaseFormField
	Type  string
	Value string
}

GenericFormField for unknown types or simple generic usage

func (*GenericFormField) FieldType

func (f *GenericFormField) FieldType() string

type GoTo3DViewAction

type GoTo3DViewAction struct {
	Target      Annotation // The 3D annotation
	View        string     // The view name
	OriginalRef raw.ObjectRef
	Dirty       bool
}

GoTo3DViewAction represents a go-to 3D view action.

func (GoTo3DViewAction) ActionType

func (a GoTo3DViewAction) ActionType() string

type GoToAction

type GoToAction struct {
	Dest        *OutlineDestination
	PageIndex   int
	OriginalRef raw.ObjectRef
	Dirty       bool
}

GoToAction represents a GoTo action.

func (GoToAction) ActionType

func (a GoToAction) ActionType() string

type GoToEAction

type GoToEAction struct {
	Dest        *OutlineDestination
	DestName    string
	NewWindow   *bool
	Target      *EmbeddedFile // The embedded file
	OriginalRef raw.ObjectRef
	Dirty       bool
}

GoToEAction represents an embedded go-to action.

func (GoToEAction) ActionType

func (a GoToEAction) ActionType() string

type GoToRAction

type GoToRAction struct {
	File        string
	Dest        *OutlineDestination
	DestName    string
	NewWindow   *bool
	OriginalRef raw.ObjectRef
	Dirty       bool
}

GoToRAction represents a remote go-to action.

func (GoToRAction) ActionType

func (a GoToRAction) ActionType() string

type HideAction

type HideAction struct {
	TargetName  string // Name of the field/annotation to hide
	Hide        bool
	OriginalRef raw.ObjectRef
	Dirty       bool
}

HideAction represents a hide action.

func (HideAction) ActionType

func (a HideAction) ActionType() string

type HighlightAnnotation

type HighlightAnnotation struct {
	BaseAnnotation
	QuadPoints []float64 // 8 numbers specifying the coordinates of the four corners of the quadrilateral
}

HighlightAnnotation represents a highlight annotation.

type ICCBasedColorSpace

type ICCBasedColorSpace struct {
	Profile     []byte
	Alternate   ColorSpace
	Range       []float64
	OriginalRef raw.ObjectRef
	Dirty       bool
}

ICCBasedColorSpace represents an ICC-based color space.

func (*ICCBasedColorSpace) ColorSpaceName

func (cs *ICCBasedColorSpace) ColorSpaceName() string

type Image

type Image = XObject

Image is an alias for XObject for image convenience APIs.

type ImportDataAction

type ImportDataAction struct {
	File        string
	OriginalRef raw.ObjectRef
	Dirty       bool
}

ImportDataAction represents an import-data action.

func (ImportDataAction) ActionType

func (a ImportDataAction) ActionType() string

type IndexedColorSpace

type IndexedColorSpace struct {
	Base        ColorSpace
	Hival       int
	Lookup      []byte // Can be stream or string
	OriginalRef raw.ObjectRef
	Dirty       bool
}

IndexedColorSpace represents an Indexed color space.

func (*IndexedColorSpace) ColorSpaceName

func (cs *IndexedColorSpace) ColorSpaceName() string

type InkAnnotation

type InkAnnotation struct {
	BaseAnnotation
	InkList [][]float64 // Array of arrays of points [x1 y1 x2 y2 ...]
}

InkAnnotation represents a freehand "scribble" annotation.

type InlineImageOperand

type InlineImageOperand struct {
	Image DictOperand
	Data  []byte
}

func (InlineImageOperand) Type

func (InlineImageOperand) Type() string

type JavaScriptAction

type JavaScriptAction struct {
	JS          string
	OriginalRef raw.ObjectRef
	Dirty       bool
}

JavaScriptAction represents a JavaScript action.

func (JavaScriptAction) ActionType

func (a JavaScriptAction) ActionType() string

type LaunchAction

type LaunchAction struct {
	File        string
	NewWindow   *bool
	OriginalRef raw.ObjectRef
	Dirty       bool
}

LaunchAction represents a launch action (launching an application or opening a file).

func (LaunchAction) ActionType

func (a LaunchAction) ActionType() string

type LineAnnotation

type LineAnnotation struct {
	BaseAnnotation
	L  []float64 // Array of 4 numbers [x1 y1 x2 y2]
	LE []string  // Line ending styles [start end] e.g. /Square, /Circle, /Diamond, /OpenArrow, /ClosedArrow, /None
	IC []float64 // Interior color
}

LineAnnotation represents a line annotation.

type LinkAnnotation

type LinkAnnotation struct {
	BaseAnnotation
	URI    string
	Action Action
}

LinkAnnotation represents a link annotation.

type MCR

type MCR struct {
	Pg   *Page
	MCID int
	Stm  raw.ObjectRef // Optional stream containing the marked content
}

MCR (Marked Content Reference)

type MeshShading

type MeshShading struct {
	BaseShading
	BitsPerCoordinate int
	BitsPerComponent  int
	BitsPerFlag       int
	Decode            []float64
	Function          Function // Optional function for Type 4, 5, 6
	Stream            []byte   // The mesh data stream
}

MeshShading represents mesh-based shadings (Type 4, 5, 6, 7).

type MovieAction

type MovieAction struct {
	Title       string // Title of the movie annotation
	Operation   string // Play, Stop, Pause, Resume
	OriginalRef raw.ObjectRef
	Dirty       bool
}

MovieAction represents a movie action.

func (MovieAction) ActionType

func (a MovieAction) ActionType() string

type MovieAnnotation

type MovieAnnotation struct {
	BaseAnnotation
	Title string       // The title of the movie
	Movie EmbeddedFile // The movie file
}

MovieAnnotation represents a movie annotation.

type NameOperand

type NameOperand struct{ Value string }

func (NameOperand) Type

func (NameOperand) Type() string

type NamedAction

type NamedAction struct {
	Name        string
	OriginalRef raw.ObjectRef
	Dirty       bool
}

NamedAction represents a named action (e.g., NextPage, PrevPage).

func (NamedAction) ActionType

func (a NamedAction) ActionType() string

type Namespace

type Namespace struct {
	Type        string // /Namespace
	NS          string // URI
	RoleMapNS   RoleMap
	Schema      *Schema
	OriginalRef raw.ObjectRef
	Dirty       bool
}

Namespace represents a PDF 2.0 Namespace dictionary.

type NumberOperand

type NumberOperand struct{ Value float64 }

func (NumberOperand) Type

func (NumberOperand) Type() string

type OCCreatorInfo

type OCCreatorInfo struct {
	Creator string
	Subtype string
}

type OCExport

type OCExport struct {
	ExportState bool // /ON or /OFF
}

type OCLanguage

type OCLanguage struct {
	Lang      string
	Preferred bool
}

type OCPrint

type OCPrint struct {
	Subtype    string // /Print
	PrintState bool   // /ON or /OFF
}

type OCUsage

type OCUsage struct {
	CreatorInfo *OCCreatorInfo
	Language    *OCLanguage
	Export      *OCExport
	Zoom        *OCZoom
	Print       *OCPrint
	View        *OCView
	User        *OCUser
}

OCUsage describes usage application dictionaries for OCGs.

type OCUser

type OCUser struct {
	Type string // /User
	Name string
	User []string
}

type OCView

type OCView struct {
	ViewState bool // /ON or /OFF
}

type OCZoom

type OCZoom struct {
	Min float64
	Max float64 // 0 means infinity
}

type Operand

type Operand interface {
	Type() string
	// contains filtered or unexported methods
}

Operand is a type-safe operand value.

type Operation

type Operation struct {
	Operator string
	Operands []Operand
}

Operation represents a PDF operator and operands.

type OptionalContentGroup

type OptionalContentGroup struct {
	BasePropertyList
	Name   string
	Intent []string // e.g. /View, /Design
	Usage  *OCUsage
}

OptionalContentGroup (OCG)

func (*OptionalContentGroup) PropertyListType

func (g *OptionalContentGroup) PropertyListType() string

type OptionalContentMembership

type OptionalContentMembership struct {
	BasePropertyList
	OCGs   []*OptionalContentGroup
	Policy string // /AllOn, /AnyOn, /AnyOff, /AllOff
}

OptionalContentMembership (OCMD)

func (*OptionalContentMembership) PropertyListType

func (m *OptionalContentMembership) PropertyListType() string

type OutlineDestination

type OutlineDestination struct {
	X    *float64
	Y    *float64
	Zoom *float64
}

OutlineDestination describes an outline destination using XYZ coordinates. Nil fields indicate "leave unchanged" semantics per PDF spec.

type OutlineItem

type OutlineItem struct {
	Title       string
	PageIndex   int
	Dest        *OutlineDestination
	Children    []OutlineItem
	OriginalRef raw.ObjectRef
	Dirty       bool
}

OutlineItem describes a bookmark entry.

type OutputIntent

type OutputIntent struct {
	S                         string
	OutputConditionIdentifier string
	Info                      string
	DestOutputProfile         []byte
	OriginalRef               raw.ObjectRef
	Dirty                     bool
}

OutputIntent models color output intent metadata.

type Page

type Page struct {
	Index           int
	MediaBox        Rectangle
	CropBox         Rectangle
	TrimBox         Rectangle
	BleedBox        Rectangle
	ArtBox          Rectangle
	Rotate          int // degrees: 0/90/180/270
	Resources       *Resources
	Contents        []ContentStream
	Annotations     []Annotation
	UserUnit        float64
	OutputIntents   []OutputIntent // PDF 2.0
	AssociatedFiles []EmbeddedFile // PDF 2.0
	Viewports       []geo.Viewport // PDF 2.0 / GeoPDF
	Trans           *Transition    // Page transition

	OriginalRef raw.ObjectRef
	Dirty       bool
	// contains filtered or unexported fields
}

Page models a single PDF page.

type Pattern

type Pattern interface {
	PatternType() int
	Reference() raw.ObjectRef
	SetReference(raw.ObjectRef)
}

Pattern represents a PDF pattern.

type PatternColorSpace

type PatternColorSpace struct {
	Underlying ColorSpace // Optional, for uncolored patterns
}

PatternColorSpace represents the Pattern color space.

func (*PatternColorSpace) ColorSpaceName

func (cs *PatternColorSpace) ColorSpaceName() string

type PopupAnnotation

type PopupAnnotation struct {
	BaseAnnotation
	Parent Annotation // The parent annotation with which this popup is associated
	Open   bool       // Whether the popup window should be open by default
}

PopupAnnotation represents a popup annotation.

type PostScriptFunction

type PostScriptFunction struct {
	BaseFunction
	Code []byte
}

PostScriptFunction (Type 4)

type PrinterMarkAnnotation

type PrinterMarkAnnotation struct {
	BaseAnnotation
}

PrinterMarkAnnotation represents a printer's mark annotation.

type ProjectionAnnotation

type ProjectionAnnotation struct {
	BaseAnnotation
	ProjectionType string // The type of projection
}

ProjectionAnnotation represents a projection annotation.

type PropertyList

type PropertyList interface {
	PropertyListType() string
	Reference() raw.ObjectRef
	SetReference(raw.ObjectRef)
}

PropertyList is a marker interface for objects that can be in the Properties resource dictionary.

type Rectangle

type Rectangle struct {
	LLX, LLY, URX, URY float64
}

Rectangle represents a PDF rectangle.

type RedactAnnotation

type RedactAnnotation struct {
	BaseAnnotation
	OverlayText string    // The text to be displayed on the redacted area
	Repeat      []float64 // The repeat interval for the overlay text
}

RedactAnnotation represents a redaction annotation.

type ResetFormAction

type ResetFormAction struct {
	Fields      []string // List of field names to reset (or exclude)
	Flags       int
	OriginalRef raw.ObjectRef
	Dirty       bool
}

ResetFormAction represents a reset-form action.

func (ResetFormAction) ActionType

func (a ResetFormAction) ActionType() string

type Resources

type Resources struct {
	Fonts       map[string]*Font
	ExtGStates  map[string]ExtGState
	ColorSpaces map[string]ColorSpace
	XObjects    map[string]XObject
	Patterns    map[string]Pattern
	Shadings    map[string]Shading
	Properties  map[string]PropertyList
	OriginalRef raw.ObjectRef
	Dirty       bool
}

Resources holds per-page resources with optional inheritance.

type RichMediaExecuteAction

type RichMediaExecuteAction struct {
	Command     raw.ObjectRef // Command dictionary
	OriginalRef raw.ObjectRef
	Dirty       bool
}

RichMediaExecuteAction represents a rich media execute action.

func (RichMediaExecuteAction) ActionType

func (a RichMediaExecuteAction) ActionType() string

type RoleMap

type RoleMap map[string]string

RoleMap maps structure types to standard types.

type SampledFunction

type SampledFunction struct {
	BaseFunction
	Size          []int
	BitsPerSample int
	Order         int // Default 1
	Encode        []float64
	Decode        []float64
	Samples       []byte
}

SampledFunction (Type 0)

type Schema

type Schema struct {
	// Simplified for now
	OriginalRef raw.ObjectRef
}

Schema represents a PDF 2.0 Structure Element Schema.

type ScreenAnnotation

type ScreenAnnotation struct {
	BaseAnnotation
	Title  string // The title of the screen annotation
	Action Action // The action to be performed
}

ScreenAnnotation represents a screen annotation.

type SeparationColorSpace

type SeparationColorSpace struct {
	Name          string
	Alternate     ColorSpace
	TintTransform Function // Function object
	OriginalRef   raw.ObjectRef
	Dirty         bool
}

SeparationColorSpace represents a Separation color space.

func (*SeparationColorSpace) ColorSpaceName

func (cs *SeparationColorSpace) ColorSpaceName() string

type Shading

type Shading interface {
	ShadingType() int
	ShadingColorSpace() ColorSpace
	Reference() raw.ObjectRef
	SetReference(raw.ObjectRef)
}

Shading is the interface for all shading types.

type ShadingPattern

type ShadingPattern struct {
	BasePattern
	Shading   Shading
	ExtGState *ExtGState
}

ShadingPattern (Type 2)

type SigRef

type SigRef struct {
	Type            string              // /Type /SigRef
	TransformMethod string              // /TransformMethod (e.g., DocMDP, UR, FieldMDP)
	TransformParams *SigTransformParams // /TransformParams
	DigestMethod    string              // /DigestMethod (e.g., MD5, SHA1)
	DigestValue     []byte              // /DigestValue
	DigestLocation  []int               // /DigestLocation
}

SigRef represents a signature reference dictionary.

type SigTransformParams

type SigTransformParams struct {
	Type   string   // /Type /TransformParams
	P      int      // /P (Permissions for DocMDP)
	V      string   // /V (Version)
	Fields []string // /Fields (for FieldMDP)
	Action string   // /Action (Include/Exclude/All)
}

SigTransformParams represents parameters for a transform method.

type Signature

type Signature struct {
	Filter      string   // /Filter (e.g., Adobe.PPKLite)
	SubFilter   string   // /SubFilter (e.g., adbe.pkcs7.detached)
	Contents    []byte   // /Contents (hex string in PDF, bytes here)
	Cert        []byte   // /Cert (byte string)
	ByteRange   []int    // /ByteRange
	Reference   []SigRef // /Reference (array of signature reference dicts)
	Name        string   // /Name
	M           string   // /M (Date)
	Location    string   // /Location
	Reason      string   // /Reason
	ContactInfo string   // /ContactInfo
	OriginalRef raw.ObjectRef
	Dirty       bool
}

Signature represents a digital signature dictionary (Type /Sig).

type SignatureFormField

type SignatureFormField struct {
	BaseFormField
	Signature *Signature // To be implemented in Phase 3
}

SignatureFormField represents a signature field (Sig).

func (*SignatureFormField) FieldType

func (f *SignatureFormField) FieldType() string

type SoftMaskDict

type SoftMaskDict struct {
	Subtype       string    // /S (Alpha, Luminosity)
	Group         *XObject  // /G (Transparency Group XObject)
	BackdropColor []float64 // /BC
	Transfer      string    // /TR (Transfer function name)
}

SoftMaskDict represents a soft-mask dictionary used in ExtGState.

type SoundAction

type SoundAction struct {
	Sound       *EmbeddedFile
	Volume      *float64
	Synchronous *bool
	Repeat      *bool
	Mix         *bool
	OriginalRef raw.ObjectRef
	Dirty       bool
}

SoundAction represents a sound action.

func (SoundAction) ActionType

func (a SoundAction) ActionType() string

type SoundAnnotation

type SoundAnnotation struct {
	BaseAnnotation
	Sound EmbeddedFile // The sound to be played
	Name  string       // Icon name (e.g., "Speaker", "Mic")
}

SoundAnnotation represents a sound annotation.

type SpectrallyDefinedColorSpace

type SpectrallyDefinedColorSpace struct {
	Data        []byte // CxF XML
	OriginalRef raw.ObjectRef
	Dirty       bool
}

SpectrallyDefinedColorSpace represents a CxF-based color space (PDF 2.0).

func (*SpectrallyDefinedColorSpace) ColorSpaceName

func (cs *SpectrallyDefinedColorSpace) ColorSpaceName() string

type SquareAnnotation

type SquareAnnotation struct {
	BaseAnnotation
	IC []float64 // Interior color
	RD []float64 // Rect differences (padding)
}

SquareAnnotation represents a square annotation.

type SquigglyAnnotation

type SquigglyAnnotation struct {
	BaseAnnotation
	QuadPoints []float64
}

SquigglyAnnotation represents a squiggly underline annotation.

type StampAnnotation

type StampAnnotation struct {
	BaseAnnotation
	Name string // Icon name (e.g., "Approved", "Confidential")
}

StampAnnotation represents a stamp annotation.

type StitchingFunction

type StitchingFunction struct {
	BaseFunction
	Functions []Function
	Bounds    []float64
	Encode    []float64
}

StitchingFunction (Type 3)

type StrikeOutAnnotation

type StrikeOutAnnotation struct {
	BaseAnnotation
	QuadPoints []float64
}

StrikeOutAnnotation represents a strikeout annotation.

type StringOperand

type StringOperand struct{ Value []byte }

func (StringOperand) Type

func (StringOperand) Type() string

type StructureElement

type StructureElement struct {
	Type            string            // /StructElem
	S               string            // Structure type (e.g., P, H1)
	P               *StructureElement // Parent
	ID              string
	Pg              *Page            // Page containing the content
	K               []StructureItem  // Children
	A               *AttributeObject // Attributes
	C               *ClassMap        // Classes
	R               int              // Revision number
	Title           string
	Lang            string
	Alt             string
	Expanded        string
	ActualText      string
	AssociatedFiles []EmbeddedFile // PDF 2.0
	Namespace       *Namespace     // PDF 2.0
	OriginalRef     raw.ObjectRef
	Dirty           bool
}

StructureElement represents a node in the structure tree.

type StructureItem

type StructureItem struct {
	Element *StructureElement
	MCID    int           // -1 if not an MCID
	MCR     *MCR          // Marked Content Reference
	ObjRef  raw.ObjectRef // For OBJR
}

StructureItem represents a child of a structure element. It can be another StructureElement, a Marked Content ID (MCID), or an Object Reference (MCR).

type StructureTree

type StructureTree struct {
	Type              string // /StructTreeRoot
	K                 []*StructureElement
	IDTree            map[string]*StructureElement
	ParentTree        map[int][]interface{} // PageIndex -> []StructureItem
	ParentTreeNextKey int
	RoleMap           RoleMap
	ClassMap          ClassMap
	Namespaces        []*Namespace // PDF 2.0
	OriginalRef       raw.ObjectRef
	Dirty             bool
}

StructureTree is the root of the logical structure.

type SubmitFormAction

type SubmitFormAction struct {
	URL         string
	Flags       int
	OriginalRef raw.ObjectRef
	Dirty       bool
}

SubmitFormAction represents a submit-form action.

func (SubmitFormAction) ActionType

func (a SubmitFormAction) ActionType() string

type TextAnnotation

type TextAnnotation struct {
	BaseAnnotation
	Open bool
	Icon string // e.g., "Comment", "Key", "Note", "Help", "NewParagraph", "Paragraph", "Insert"
}

TextAnnotation represents a sticky note annotation.

type TextFormField

type TextFormField struct {
	BaseFormField
	Value  string
	MaxLen int
}

TextFormField represents a text field (Tx).

func (*TextFormField) FieldType

func (f *TextFormField) FieldType() string

type ThreadAction

type ThreadAction struct {
	File        string        // Optional file specification
	Thread      raw.ObjectRef // Dictionary or integer or string
	Bead        raw.ObjectRef // Optional bead
	OriginalRef raw.ObjectRef
	Dirty       bool
}

ThreadAction represents a thread action.

func (ThreadAction) ActionType

func (a ThreadAction) ActionType() string

type ThreeDAnnotation

type ThreeDAnnotation struct {
	BaseAnnotation
	ThreeD EmbeddedFile // The 3D artwork
	View   string       // The initial view of the 3D artwork
}

ThreeDAnnotation represents a 3D annotation.

type TilingPattern

type TilingPattern struct {
	BasePattern
	PaintType  int // 1 = Colored, 2 = Uncolored
	TilingType int // 1 = Constant, 2 = No Distortion, 3 = Constant Spacing
	BBox       Rectangle
	XStep      float64
	YStep      float64
	Resources  *Resources
	Content    []byte
}

TilingPattern (Type 1)

type Transition

type Transition struct {
	Style       string   // /S (Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade)
	Duration    *float64 // /D
	Dimension   string   // /Dm (H, V)
	Motion      string   // /M (I, O)
	Direction   int      // /Di (0, 90, 180, 270, 315)
	Scale       *float64 // /SS
	Base        *bool    // /B
	OriginalRef raw.ObjectRef
	Dirty       bool
}

Transition describes the visual transition when moving to the page.

type TransparencyGroup

type TransparencyGroup struct {
	CS       ColorSpace // /CS
	Isolated bool       // /I
	Knockout bool       // /K
}

TransparencyGroup describes the attributes of a transparency group XObject.

type TrapNetAnnotation

type TrapNetAnnotation struct {
	BaseAnnotation
	LastModified string // The date and time of the last modification
	Version      []int  // The version of the trapping network
}

TrapNetAnnotation represents a trapping network annotation.

type URIAction

type URIAction struct {
	URI         string
	OriginalRef raw.ObjectRef
	Dirty       bool
}

URIAction represents a URI action.

func (URIAction) ActionType

func (a URIAction) ActionType() string

type UnderlineAnnotation

type UnderlineAnnotation struct {
	BaseAnnotation
	QuadPoints []float64
}

UnderlineAnnotation represents an underline annotation.

type WatermarkAnnotation

type WatermarkAnnotation struct {
	BaseAnnotation
	FixedPrint bool // Whether the watermark should be printed at a fixed size and position
}

WatermarkAnnotation represents a watermark annotation.

type WidgetAnnotation

type WidgetAnnotation struct {
	BaseAnnotation
	Field FormField
}

WidgetAnnotation represents a form widget annotation.

type XMPMetadata

type XMPMetadata struct {
	Raw         []byte
	OriginalRef raw.ObjectRef
	Dirty       bool
}

type XObject

type XObject struct {
	Subtype string // e.g., Image, Form
	Width   int
	Height  int
	ColorSpace
	BitsPerComponent int
	Data             []byte
	BBox             Rectangle  // used for Form XObjects
	Matrix           []float64  // /Matrix (optional)
	Resources        *Resources // /Resources (for Form XObjects)
	Interpolate      bool
	SMask            *XObject
	Group            *TransparencyGroup // /Group (for Form XObjects)
	AssociatedFiles  []EmbeddedFile     // PDF 2.0
	OriginalRef      raw.ObjectRef
	Dirty            bool
}

XObject describes a referenced object (limited to simple images).

Jump to

Keyboard shortcuts

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