xfa

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseUnit

func ParseUnit(s string) float64

ParseUnit converts an XFA measurement string (e.g., "1in", "72pt", "10mm") to points. 1in = 72pt 1mm = 2.83465pt 1cm = 28.3465pt

Types

type Acrobat

type Acrobat struct {
}

type Agent

type Agent struct {
}

type Area

type Area struct {
	Name string `xml:"name,attr"`
	X    string `xml:"x,attr"`
	Y    string `xml:"y,attr"`
}

type Bind

type Bind struct {
	Match string `xml:"match,attr"` // "dataRef", "none"
	Ref   string `xml:"ref,attr"`
}

type Binder

type Binder struct {
	Form *Form
}

Binder handles the binding of data from Datasets to the Template.

func NewBinder

func NewBinder(form *Form) *Binder

NewBinder creates a new Binder for the given form.

func (*Binder) Bind

func (b *Binder) Bind()

Bind performs the data binding process. It traverses the Template and populates Field values from the Datasets.

type Button

type Button struct {
	Highlight string `xml:"highlight,attr"` // "inverted", "push", "outline"
}

type Caption

type Caption struct {
	Value *Value `xml:"value"`
	Font  *Font  `xml:"font"`
	Para  *Para  `xml:"para"`
}

type CheckButton

type CheckButton struct {
	Shape string `xml:"shape,attr"` // "square", "round"
}

type ChoiceList

type ChoiceList struct {
	Open string `xml:"open,attr"` // "userControl", "always", "multiSelect"
}

type Config

type Config struct {
	Present   *Present   `xml:"present"`
	Acrobat   *Acrobat   `xml:"acrobat"`
	Trace     *Trace     `xml:"trace"`
	Agent     *Agent     `xml:"agent"`
	Log       *Log       `xml:"log"`
	Messaging *Messaging `xml:"messaging"`
}

type ConnectionSet

type ConnectionSet struct {
	WsdlConnection []WsdlConnection `xml:"wsdlConnection"`
	XsdConnection  []XsdConnection  `xml:"xsdConnection"`
}

type Data

type Data struct {
	Nodes []*Node `xml:",any"`
}

type Datasets

type Datasets struct {
	Data *Data `xml:"data"`
}

type DateTimeEdit

type DateTimeEdit struct{}

type Draw

type Draw struct {
	Name  string `xml:"name,attr"`
	W     string `xml:"w,attr"`
	H     string `xml:"h,attr"`
	X     string `xml:"x,attr"`
	Y     string `xml:"y,attr"`
	Value *Value `xml:"value"`
	Font  *Font  `xml:"font"`
	Para  *Para  `xml:"para"`
}

type ExData

type ExData struct {
	ContentType string `xml:"contentType,attr"`
	Content     string `xml:",chardata"`
}

type Field

type Field struct {
	Name    string   `xml:"name,attr"`
	W       string   `xml:"w,attr"`
	H       string   `xml:"h,attr"`
	X       string   `xml:"x,attr"`
	Y       string   `xml:"y,attr"`
	UI      *UI      `xml:"ui"`
	Value   *Value   `xml:"value"`
	Caption *Caption `xml:"caption"`
	Bind    *Bind    `xml:"bind"`
	Font    *Font    `xml:"font"`
	Para    *Para    `xml:"para"`
}

type Font

type Font struct {
	Typeface string `xml:"typeface,attr"`
	Size     string `xml:"size,attr"`
	Weight   string `xml:"weight,attr"`  // "bold"
	Posture  string `xml:"posture,attr"` // "italic"
}

type Form

type Form struct {
	XMLName       xml.Name       `xml:"xdp"`
	Config        *Config        `xml:"config"`
	Template      *Template      `xml:"template"`
	Datasets      *Datasets      `xml:"datasets"`
	LocaleSet     *LocaleSet     `xml:"localeSet"`
	ConnectionSet *ConnectionSet `xml:"connectionSet"`
}

Form represents the root of the XFA DOM. Note: This is a simplified representation. XFA is huge.

type ImageEdit

type ImageEdit struct{}

type ImageVal

type ImageVal struct {
	Href        string `xml:"href,attr"`
	ContentType string `xml:"contentType,attr"`
	Content     string `xml:",chardata"` // Base64
}

type LayoutContext

type LayoutContext struct {
	X, Y   float64
	Page   *semantic.Page
	Pages  *[]*semantic.Page
	Margin float64
}

type LayoutEngine

type LayoutEngine interface {
	Render(ctx context.Context, form *Form) ([]*semantic.Page, error)
}

LayoutEngine renders an XFA Form into PDF pages.

type LayoutEngineImpl

type LayoutEngineImpl struct{}

func NewLayoutEngine

func NewLayoutEngine() *LayoutEngineImpl

func (*LayoutEngineImpl) Render

func (e *LayoutEngineImpl) Render(ctx context.Context, form *Form) ([]*semantic.Page, error)

type Locale

type Locale struct {
	Name string `xml:"name,attr"`
	Desc string `xml:"desc,attr"`
}

type LocaleSet

type LocaleSet struct {
	Locale []Locale `xml:"locale"`
}

type Log

type Log struct {
}

type Messaging

type Messaging struct {
}

type Node

type Node struct {
	XMLName  xml.Name
	Attrs    []xml.Attr
	Content  string
	Children []*Node
}

func (*Node) UnmarshalXML

func (n *Node) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type NumericEdit

type NumericEdit struct{}

type Occur

type Occur struct {
	Min string `xml:"min,attr"`
	Max string `xml:"max,attr"`
}

type Para

type Para struct {
	HAlign string `xml:"hAlign,attr"` // "left", "center", "right", "justify"
	VAlign string `xml:"vAlign,attr"` // "top", "middle", "bottom"
}

type Parser

type Parser interface {
	Parse(r io.Reader) (*Form, error)
}

Parser parses XFA XML streams into an XFA DOM.

type ParserImpl

type ParserImpl struct{}

func NewParser

func NewParser() *ParserImpl

func (*ParserImpl) Parse

func (p *ParserImpl) Parse(r io.Reader) (*Form, error)

type Present

type Present struct {
	Destination string `xml:"destination"` // e.g. "pdf"

}

type Signature

type Signature struct{}

type Subform

type Subform struct {
	Name     string    `xml:"name,attr"`
	Layout   string    `xml:"layout,attr"` // e.g., "tb" (top-to-bottom)
	W        string    `xml:"w,attr"`
	H        string    `xml:"h,attr"`
	X        string    `xml:"x,attr"`
	Y        string    `xml:"y,attr"`
	Fields   []Field   `xml:"field"`
	Subforms []Subform `xml:"subform"`
	Draws    []Draw    `xml:"draw"`
	Content  []Area    `xml:"area"`
	Bind     *Bind     `xml:"bind"`
	Occur    *Occur    `xml:"occur"`
}

type Template

type Template struct {
	Subform *Subform `xml:"subform"`
}

type TextEdit

type TextEdit struct {
	MultiLine string `xml:"multiLine,attr"` // "0" or "1"
}

type Trace

type Trace struct {
}

type UI

type UI struct {
	TextEdit     *TextEdit     `xml:"textEdit"`
	CheckButton  *CheckButton  `xml:"checkButton"`
	ChoiceList   *ChoiceList   `xml:"choiceList"`
	NumericEdit  *NumericEdit  `xml:"numericEdit"`
	DateTimeEdit *DateTimeEdit `xml:"dateTimeEdit"`
	ImageEdit    *ImageEdit    `xml:"imageEdit"`
	Signature    *Signature    `xml:"signature"`
	Button       *Button       `xml:"button"`
}

type Value

type Value struct {
	Text     string    `xml:"text"`
	Integer  string    `xml:"integer"`
	Decimal  string    `xml:"decimal"`
	Float    string    `xml:"float"`
	Boolean  string    `xml:"boolean"`
	Date     string    `xml:"date"`
	Time     string    `xml:"time"`
	DateTime string    `xml:"dateTime"`
	Image    *ImageVal `xml:"image"`
	ExData   *ExData   `xml:"exData"`
}

type WsdlConnection

type WsdlConnection struct {
	Name string `xml:"name,attr"`
}

type XsdConnection

type XsdConnection struct {
	Name    string `xml:"name,attr"`
	DataRef string `xml:"dataDescription,attr"`
}

Jump to

Keyboard shortcuts

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