Documentation
¶
Index ¶
- func BuildPDFFromXFAStreams(streams *XFAStreams, verbose bool) ([]byte, error)
- func CompressStream(data []byte) ([]byte, error)
- func ConfigToXFA(config *types.XFAConfig, verbose bool) (string, error)
- func ConnectionSetToXFA(connectionSet *types.XFAConnectionSet, verbose bool) (string, error)
- func DatasetsToXFA(datasets *types.XFADatasets, verbose bool) (string, error)
- func DecompressStream(streamBytes []byte) ([]byte, bool, error)
- func FindXFADatasetsStream(pdfBytes []byte, encryptInfo *types.PDFEncryption, verbose bool) ([]byte, int, error)
- func FormToXFA(formSchema *types.FormSchema, verbose bool) (string, error)
- func LocaleSetToXFA(localeSet *types.XFALocaleSet, verbose bool) (string, error)
- func ParseXFAConfig(xfaConfigXML string, verbose bool) (*types.XFAConfig, error)
- func ParseXFAConnectionSet(xfaConnectionSetXML string, verbose bool) (*types.XFAConnectionSet, error)
- func ParseXFADatasets(xfaDatasetsXML string, verbose bool) (*types.XFADatasets, error)
- func ParseXFAForm(xfaXML string, verbose bool) (*types.FormSchema, error)
- func ParseXFALocaleSet(xfaLocaleSetXML string, verbose bool) (*types.XFALocaleSet, error)
- func ParseXFAStylesheet(xfaStylesheetXML string, verbose bool) (*types.XFAStylesheet, error)
- func ReadObjectFromXRef(pdfBytes []byte, objNum, genNum int, xrefOffset int64, ...) ([]byte, error)
- func RebuildPDFFromXFAStreams(originalPDFBytes []byte, streams *XFAStreams, encryptInfo *types.PDFEncryption, ...) ([]byte, error)
- func ReplaceStreamInPDF(pdfBytes []byte, streamObjNum int, newStream []byte, verbose bool) ([]byte, error)
- func StylesheetToXFA(stylesheet *types.XFAStylesheet, verbose bool) (string, error)
- func UpdateXFAFieldValues(xfaXML string, formData types.FormData, verbose bool) (string, error)
- func UpdateXFAInPDF(pdfBytes []byte, formData types.FormData, encryptInfo *types.PDFEncryption, ...) ([]byte, error)
- func UpdateXFAValues(xfaXML string, formData types.FormData, verbose bool) (string, error)
- type PDFStream
- type ParsedDictEntry
- type XFAEvent
- type XFAFieldData
- type XFAOption
- type XFAStreamInfo
- type XFAStreams
- type XFAStructure
- type XFASubformData
- type XFAValidation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPDFFromXFAStreams ¶
func BuildPDFFromXFAStreams(streams *XFAStreams, verbose bool) ([]byte, error)
BuildPDFFromXFAStreams creates a new PDF entirely from XFA stream data This is useful when you need a clean PDF with only the XFA content
func CompressStream ¶
CompressStream compresses data using FlateDecode
func ConfigToXFA ¶
ConfigToXFA converts XFAConfig to XFA XML
func ConnectionSetToXFA ¶
func ConnectionSetToXFA(connectionSet *types.XFAConnectionSet, verbose bool) (string, error)
ConnectionSetToXFA converts XFAConnectionSet to XFA XML
func DatasetsToXFA ¶
func DatasetsToXFA(datasets *types.XFADatasets, verbose bool) (string, error)
DatasetsToXFA converts XFADatasets to XFA XML
func DecompressStream ¶
DecompressStream attempts to decompress a stream (handles FlateDecode) FlateDecode can be either raw deflate or zlib-wrapped
func FindXFADatasetsStream ¶
func FindXFADatasetsStream(pdfBytes []byte, encryptInfo *types.PDFEncryption, verbose bool) ([]byte, int, error)
FindXFADatasetsStream finds and extracts the XFA datasets stream This is a convenience function that uses ExtractAllXFAStreams and returns only the datasets stream
func FormToXFA ¶
func FormToXFA(formSchema *types.FormSchema, verbose bool) (string, error)
FormToXFA converts a FormSchema to XFA XML
func LocaleSetToXFA ¶
func LocaleSetToXFA(localeSet *types.XFALocaleSet, verbose bool) (string, error)
LocaleSetToXFA converts XFALocaleSet to XFA XML
func ParseXFAConfig ¶
ParseXFAConfig parses XFA config XML and converts it to XFAConfig type
func ParseXFAConnectionSet ¶
func ParseXFAConnectionSet(xfaConnectionSetXML string, verbose bool) (*types.XFAConnectionSet, error)
ParseXFAConnectionSet parses XFA connectionSet XML and converts it to XFAConnectionSet type
func ParseXFADatasets ¶
func ParseXFADatasets(xfaDatasetsXML string, verbose bool) (*types.XFADatasets, error)
ParseXFADatasets parses XFA datasets XML and converts it to XFADatasets type
func ParseXFAForm ¶
func ParseXFAForm(xfaXML string, verbose bool) (*types.FormSchema, error)
ParseXFAForm parses raw XFA XML and converts it to a strongly-typed FormSchema
func ParseXFALocaleSet ¶
func ParseXFALocaleSet(xfaLocaleSetXML string, verbose bool) (*types.XFALocaleSet, error)
ParseXFALocaleSet parses XFA localeSet XML and converts it to XFALocaleSet type
func ParseXFAStylesheet ¶
func ParseXFAStylesheet(xfaStylesheetXML string, verbose bool) (*types.XFAStylesheet, error)
ParseXFAStylesheet parses XFA stylesheet XML and converts it to XFAStylesheet type
func ReadObjectFromXRef ¶
func ReadObjectFromXRef(pdfBytes []byte, objNum, genNum int, xrefOffset int64, encryptInfo *types.PDFEncryption, verbose bool) ([]byte, error)
ReadObjectFromXRef reads an object using xref offset (PyPDF approach) Matches PyPDF's get_object method (lines 413-490)
func RebuildPDFFromXFAStreams ¶
func RebuildPDFFromXFAStreams(originalPDFBytes []byte, streams *XFAStreams, encryptInfo *types.PDFEncryption, verbose bool) ([]byte, error)
RebuildPDFFromXFAStreams rebuilds a PDF from extracted XFA streams using proper PDF writer
func ReplaceStreamInPDF ¶
func ReplaceStreamInPDF(pdfBytes []byte, streamObjNum int, newStream []byte, verbose bool) ([]byte, error)
ReplaceStreamInPDF replaces a stream in the PDF and updates the length
func StylesheetToXFA ¶
func StylesheetToXFA(stylesheet *types.XFAStylesheet, verbose bool) (string, error)
StylesheetToXFA converts XFAStylesheet to XFA XML
func UpdateXFAFieldValues ¶
UpdateXFAFieldValues updates individual field values in XFA XML
func UpdateXFAInPDF ¶
func UpdateXFAInPDF(pdfBytes []byte, formData types.FormData, encryptInfo *types.PDFEncryption, verbose bool) ([]byte, error)
UpdateXFAInPDF updates XFA field values in PDF bytes
Types ¶
type PDFStream ¶
type PDFStream struct {
// contains filtered or unexported fields
}
PDFStream represents a stream-like interface for reading PDF bytes
func NewPDFStream ¶
type ParsedDictEntry ¶
type ParsedDictEntry struct {
Key []byte // Key (e.g., "/XFA")
Value []byte // Value (raw bytes, may be encrypted)
}
ParsedDictEntry represents a key-value pair in a parsed dictionary
type XFAEvent ¶
type XFAEvent struct {
Type string // "initialize", "change", "enter", "exit", etc.
Script string
Target string
Action string
}
XFAEvent represents an event in XFA (for rules extraction)
type XFAFieldData ¶
type XFAFieldData struct {
Name string
FullName string
Type string
Value string
Default string
Label string
Description string
Required bool
ReadOnly bool
Hidden bool
PageNumber int
Options []XFAOption
Validation *XFAValidation
Properties map[string]interface{}
Events []XFAEvent
}
XFAFieldData represents a field extracted from XFA XML
type XFAStreamInfo ¶
type XFAStreamInfo struct {
Data []byte `json:"data"`
ObjectNumber int `json:"objectNumber"`
Compressed bool `json:"compressed"`
}
XFAStreamInfo contains stream data and metadata
type XFAStreams ¶
type XFAStreams struct {
Template *XFAStreamInfo `json:"template,omitempty"`
Datasets *XFAStreamInfo `json:"datasets,omitempty"`
Config *XFAStreamInfo `json:"config,omitempty"`
LocaleSet *XFAStreamInfo `json:"localeSet,omitempty"`
ConnectionSet *XFAStreamInfo `json:"connectionSet,omitempty"`
Stylesheet *XFAStreamInfo `json:"stylesheet,omitempty"`
XMP *XFAStreamInfo `json:"xmp,omitempty"`
Signature *XFAStreamInfo `json:"signature,omitempty"`
SourceSet *XFAStreamInfo `json:"sourceSet,omitempty"`
}
XFAStreams represents all XFA streams extracted from a PDF
func ExtractAllXFAStreams ¶
func ExtractAllXFAStreams(pdfBytes []byte, encryptInfo *types.PDFEncryption, verbose bool) (*XFAStreams, error)
ExtractAllXFAStreams extracts all XFA streams from a PDF without using UniPDF
type XFAStructure ¶
type XFAStructure struct {
Title string
Description string
Version string
Fields []XFAFieldData
Subforms []XFASubformData
}
XFAStructure represents the parsed XFA XML structure
type XFASubformData ¶
type XFASubformData struct {
Name string
Fields []XFAFieldData
}
XFASubformData represents a subform in XFA