Documentation
¶
Index ¶
- Constants
- Variables
- func Disassemble(data []byte) (string, error)
- func EncodeCues(c *Cues) []byte
- func EncodePathCollection(paths []*Path) []byte
- func EncodeTextIndex(runs []IndexRun) []byte
- func OpName(op byte) string
- func PlainText(runs []IndexRun) string
- type CellRef
- type Color
- type Continuous
- type Cue
- type CueSystem
- type Cues
- type DCValues
- type Document
- func (d *Document) AddFont(data []byte) Hash
- func (d *Document) AddImage(data []byte) Hash
- func (d *Document) AddObject(o *Object) (Hash, Rect)
- func (d *Document) AddPart(typ string, data []byte) Hash
- func (d *Document) AddPaths(paths []*Path) Hash
- func (d *Document) AddTable(t *Table, data []byte) error
- func (d *Document) AddTableRows(id, title string, rows *parquet.Table, view string, page int) (*Table, error)
- func (d *Document) BuildTextIndex(v *View) (Hash, error)
- func (d *Document) NewView(id, kind, title string) *View
- func (d *Document) Part(h Hash) *Part
- func (d *Document) Parts() []*Part
- func (d *Document) SearchText() (*SearchText, error)
- func (d *Document) Table(id string) *Table
- func (d *Document) WriteSingle(w io.Writer) error
- func (d *Document) WriteSplit(dir string) error
- type DublinCore
- type Encryption
- type Font
- type FontRef
- type FormatError
- type Freeze
- type Glyph
- type Hash
- type ImageRef
- type IndexRun
- type Instr
- type KeySlot
- type Layer
- type Lock
- type Manifest
- type Meta
- type NodeKind
- type ObjRef
- type Object
- func (o *Object) AddExtPath(h Hash, index uint32) PathRef
- func (o *Object) AddFont(f Font) FontRef
- func (o *Object) AddImage(h Hash) ImageRef
- func (o *Object) AddObject(h Hash, bbox Rect) ObjRef
- func (o *Object) AddPaint(p Paint) PaintRef
- func (o *Object) AddPath(p *Path) PathRef
- func (o *Object) Alpha(a float32) *Object
- func (o *Object) Blend(b byte) *Object
- func (o *Object) ClearRect(x, y, w, h float32) *Object
- func (o *Object) ClipPath(p PathRef, rule byte) *Object
- func (o *Object) ClipRect(x, y, w, h float32) *Object
- func (o *Object) Dash(segments []float32, offset float32) *Object
- func (o *Object) Deps() []Hash
- func (o *Object) Encode() []byte
- func (o *Object) Ext(payload []byte) *Object
- func (o *Object) FillColor(c Color) *Object
- func (o *Object) FillPaint(p PaintRef) *Object
- func (o *Object) FillPath(p PathRef, rule byte) *Object
- func (o *Object) FillPathAt(p PathRef, rule byte, x, y float32) *Object
- func (o *Object) FillPathRun(rule byte, glyphs []Glyph) *Object
- func (o *Object) FillRect(x, y, w, h float32) *Object
- func (o *Object) FillText(s string, x, y, advance float32) *Object
- func (o *Object) Filter(css string) *Object
- func (o *Object) Font(f FontRef, size float32) *Object
- func (o *Object) GroupBegin(alpha float32, blend byte, x, y, w, h float32) *Object
- func (o *Object) GroupEnd() *Object
- func (o *Object) Image(img ImageRef, x, y, w, h float32) *Object
- func (o *Object) ImageSub(img ImageRef, sx, sy, sw, sh, dx, dy, dw, dh float32) *Object
- func (o *Object) Line(width float32, cap, join byte, miter float32) *Object
- func (o *Object) Link(x, y, w, h float32, url string) *Object
- func (o *Object) Mark(kind byte, payload string) *Object
- func (o *Object) MaskBegin(kind byte, backdrop Color, transfer []byte) *Object
- func (o *Object) MaskEnd() *Object
- func (o *Object) Restore() *Object
- func (o *Object) Save() *Object
- func (o *Object) Scale(x, y float32) *Object
- func (o *Object) SetBBox(x, y, w, h float32) *Object
- func (o *Object) Shadow(c Color, blur, dx, dy float32) *Object
- func (o *Object) Smoothing(enabled bool, quality byte) *Object
- func (o *Object) StrokeColor(c Color) *Object
- func (o *Object) StrokePaint(p PaintRef) *Object
- func (o *Object) StrokePath(p PathRef) *Object
- func (o *Object) StrokeRect(x, y, w, h float32) *Object
- func (o *Object) StrokeText(s string, x, y, advance float32) *Object
- func (o *Object) TextStyle(align, baseline, dir byte, letterSpacing float32) *Object
- func (o *Object) Transform(a, b, c, d, e, f float32) *Object
- func (o *Object) Translate(x, y float32) *Object
- func (o *Object) UpdateFont(ref FontRef, f Font)
- func (o *Object) UpdateObject(ref ObjRef, h Hash)
- func (o *Object) Use(obj ObjRef) *Object
- func (o *Object) UseAt(obj ObjRef, x, y float32) *Object
- type ObjectPart
- type Page
- type PageText
- type Paint
- type PaintRef
- type Part
- type PartEntry
- type Path
- func (p *Path) ArcTo(x1, y1, x2, y2, r float32) *Path
- func (p *Path) Circle(x, y, r float32) *Path
- func (p *Path) Close() *Path
- func (p *Path) CubicTo(c1x, c1y, c2x, c2y, x, y float32) *Path
- func (p *Path) Ellipse(x, y, rx, ry, rot, a0, a1 float32, ccw bool) *Path
- func (p *Path) LineTo(x, y float32) *Path
- func (p *Path) MoveTo(x, y float32) *Path
- func (p *Path) QuadTo(cx, cy, x, y float32) *Path
- func (p *Path) Rect(x, y, w, h float32) *Path
- func (p *Path) RoundRect(x, y, w, h, r float32) *Path
- type PathEntry
- type PathRef
- type Play
- type PrefixMember
- type PrefixShare
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Encrypted() bool
- func (r *Reader) Entry(h Hash) (PartEntry, bool)
- func (r *Reader) Locked() bool
- func (r *Reader) Object(h Hash) (*ObjectPart, error)
- func (r *Reader) Part(h Hash) ([]byte, error)
- func (r *Reader) StoredManifest() (*Manifest, []byte)
- func (r *Reader) StoredPart(e PartEntry) ([]byte, error)
- func (r *Reader) Table(id string) (*Table, []byte, error)
- func (r *Reader) ToDocument() (*Document, error)
- func (r *Reader) Unlock(password string) error
- func (r *Reader) UnlockECDH(priv *ecdh.PrivateKey) error
- func (r *Reader) WriteSegment(w io.Writer, o SegmentOptions) error
- func (r *Reader) WriteSingle(w io.Writer) error
- func (r *Reader) WriteSplit(dir string) error
- type Rect
- type RectDef
- type Replay
- type Run
- type SealedManifest
- type SearchText
- type Segment
- type SegmentOptions
- type Split
- type Stop
- type Table
- type TableColumn
- type TextContent
- type TextImage
- type TextLink
- type TextNode
- type TextRun
- type View
- type ViewText
Constants ¶
const ( // CipherA256GCM seals parts with AES-256-GCM; the stored bytes are the // 12-byte nonce followed by the ciphertext and the 16-byte tag. CipherA256GCM = "A256GCM" // KeyPassword is a key slot that a password unlocks. KeyPassword = "password" // KDFPBKDF2SHA256 derives key-encryption keys with PBKDF2-HMAC-SHA-256 // from the password normalized to NFKC and encoded as UTF-8: full-width // and half-width spellings, and a letter with its marks written as one // character or as several, are one password. KDFPBKDF2SHA256 = "PBKDF2-SHA256" // DefaultIterations is the PBKDF2 iteration count of new password slots. DefaultIterations = 600_000 // MaxIterations bounds the iteration count readers accept, so a file // cannot keep a reader busy for long: that of a key slot, and the sum of // those of the slots a reader tries. MaxIterations = 10_000_000 // KeyECDH is a key slot that one reader's private key unlocks: the // content key is wrapped with a key agreed with ECDH between the // reader's public key and a key the writer makes for the document and // forgets (docs/spec.md §3.5). KeyECDH = "ecdh" // CurveP256 is the curve of ecdh slots (NIST P-256). CurveP256 = "P-256" // KDFHKDFSHA256 derives the key-encryption key of an ecdh slot from the // shared secret with HKDF-SHA-256. KDFHKDFSHA256 = "HKDF-SHA256" // MaxECDHSlots bounds the ecdh slots a reader tries: each costs a key // agreement. MaxECDHSlots = 16 // FlagEncrypted is the single-file header flag of encrypted documents. FlagEncrypted = 1 )
Encryption values.
const ( FontEmbedded byte = 0 FontSystem byte = 1 )
Font kinds.
const ( StyleNormal byte = 0 StyleItalic byte = 1 StyleOblique byte = 2 )
Font styles.
const ( ViewFixed = "fixed" ViewFlow = "flow" ViewSheet = "sheet" ViewScroll = "scroll" )
View kinds.
const ( DirectionLTR = "ltr" DirectionRTL = "rtl" )
Page progression directions of fixed and flow views.
const ( RoleBackground = "background" RoleMaster = "master" RoleHeader = "header" RoleBody = "body" RoleNotes = "notes" RoleAnnotation = "annotation" )
Layer roles.
const ( PartObject = "obj" PartFont = "font" PartImage = "img" PartPath = "path" PartIndex = "idx" // PartTable is a table the document holds beside its drawing: an // Apache Parquet file (docs/spec.md §4.6). PartTable = "table" // PartSeq is a Standard MIDI File that a view plays (docs/spec.md §4.4). PartSeq = "seq" // PartAudio is an audio file that a view plays, as it is (docs/spec.md // §4.4). PartAudio = "audio" // PartTemplate describes a compiled template of forms as JSON, and // PartSource is the template it was compiled from (package form; // docs/spec.md §4.5). No view refers to them: a reader of documents // passes them over. PartTemplate = "tpl" PartSource = "src" // PartFill is the record of a form completed from a partly filled // form whose values were signed: the values, and the signatures of // those who gave them, as JSON (package form; docs/spec.md §4.5). No // view refers to it. PartFill = "fill" // PartText is the print image of a form filled from a template of // plain text: its grid of columns and lines, and the characters of // each line, as JSON (package form/textpart; docs/spec.md §4). No view // refers to it: a reader of documents passes it over, and the writers // of the text modes of printers (ESC/P, ESC/POS) print from it. PartText = "text" // PartSealed is the type of the parts of an encrypted document's outer // manifest (docs/spec.md §3.5). PartSealed = "sealed" )
Part types.
const ( EncIdentity = "identity" EncDeflateRaw = "deflate-raw" )
Encodings.
const ( // MaxPageSize bounds the sides of pages and of their bodies, in units: // the coordinates of objects are f32, which cannot tell whole units // apart beyond it. MaxPageSize = 1 << 24 // MaxSheetEntries bounds the rows of a sheet, and its columns (Excel // has 1,048,576 rows). MaxSheetEntries = 1 << 24 // MinEntrySize is the smallest size of a row or a column that has one // (0: hidden), in units. MinEntrySize = 1.0 / 64 // DefaultTile is the tile size of a sheet view that states none. DefaultTile = 2048 // MaxTables bounds the tables of a document, and MaxTableColumns the // columns of a table (docs/spec.md §4.6). MaxTables = 1 << 16 MaxTableColumns = 1 << 14 )
Limits of the numbers of a manifest. They decide how long the loops of a reader run and how much it allocates (the tiles of a region, the gridlines of a sheet, the bands of a continuous layout), so a reader checks them once, when it opens the document. What they refuse no writer has a use for.
const ( OpSave byte = 0x01 OpRestore byte = 0x02 OpTransform byte = 0x03 OpTranslate byte = 0x04 OpScale byte = 0x05 OpClipPath byte = 0x06 OpClipRect byte = 0x07 OpFillColor byte = 0x10 OpFillPaint byte = 0x11 OpStrokeColor byte = 0x12 OpStrokePaint byte = 0x13 OpLine byte = 0x14 OpDash byte = 0x15 OpAlpha byte = 0x16 OpBlend byte = 0x17 OpShadow byte = 0x18 OpFilter byte = 0x19 OpFont byte = 0x1A OpTextStyle byte = 0x1B OpFillRect byte = 0x20 OpStrokeRect byte = 0x21 OpFillPath byte = 0x22 OpStrokePath byte = 0x23 OpFillPathAt byte = 0x24 OpFillPathRun byte = 0x25 OpClearRect byte = 0x26 OpFillText byte = 0x30 OpStrokeText byte = 0x31 OpImage byte = 0x40 OpImageSub byte = 0x41 OpSmoothing byte = 0x42 OpUse byte = 0x50 OpUseAt byte = 0x51 OpGroupBegin byte = 0x52 OpGroupEnd byte = 0x53 OpMaskBegin byte = 0x54 OpMaskEnd byte = 0x55 OpLink byte = 0x70 OpMark byte = 0x71 OpExt byte = 0xFF )
Opcodes of opset 1. See docs/spec.md §7.
const ( NonZero byte = 0 EvenOdd byte = 1 )
Fill rules.
const ( CapButt byte = 0 CapRound byte = 1 CapSquare byte = 2 )
Line caps.
const ( JoinMiter byte = 0 JoinRound byte = 1 JoinBevel byte = 2 )
Line joins.
const ( AlignLeft byte = 0 AlignRight byte = 1 AlignCenter byte = 2 AlignStart byte = 3 AlignEnd byte = 4 )
Text alignment.
const ( BaselineAlphabetic byte = 0 BaselineTop byte = 1 BaselineMiddle byte = 2 BaselineBottom byte = 3 BaselineHanging byte = 4 BaselineIdeographic byte = 5 )
Text baseline.
const ( DirInherit byte = 0 DirLTR byte = 1 DirRTL byte = 2 )
Text direction.
const ( BlendSourceOver byte = 0 BlendMultiply byte = 1 BlendScreen byte = 2 BlendOverlay byte = 3 BlendDarken byte = 4 BlendLighten byte = 5 BlendColorDodge byte = 6 BlendColorBurn byte = 7 BlendHardLight byte = 8 BlendSoftLight byte = 9 BlendDifference byte = 10 BlendExclusion byte = 11 BlendHue byte = 12 BlendSaturation byte = 13 BlendColor byte = 14 BlendLuminosity byte = 15 BlendDestinationOver byte = 16 BlendDestinationIn byte = 17 BlendDestinationOut byte = 18 BlendSourceIn byte = 19 BlendSourceOut byte = 20 BlendSourceAtop byte = 21 BlendDestinationAtop byte = 22 BlendXor byte = 23 BlendCopy byte = 24 BlendLighter byte = 25 )
Blend modes (globalCompositeOperation). See docs/spec.md appendix A.
const ( MaskAlpha byte = 0 // the mask's alpha MaskLuminosity byte = 1 // the luminosity of the mask drawn over the backdrop colour )
Soft mask kinds (MASK_BEGIN). See docs/spec.md §7.6.
const ( PaintLinear byte = 0 PaintRadial byte = 1 PaintConic byte = 2 PaintPattern byte = 3 )
Paint kinds.
const ( RepeatBoth byte = 0 RepeatX byte = 1 RepeatY byte = 2 NoRepeat byte = 3 )
Pattern repeat modes.
const ( VerbMove byte = 0 VerbLine byte = 1 VerbQuad byte = 2 VerbCubic byte = 3 VerbClose byte = 4 VerbRect byte = 5 VerbEllipse byte = 6 VerbArcTo byte = 7 VerbRoundRect byte = 8 )
Path verbs.
const ( MarkParagraph byte = 0 MarkLine byte = 1 MarkCell byte = 2 MarkBox byte = 3 MarkAltText byte = 4 MarkWrap byte = 5 MarkHeading byte = 6 // payload: level "1"-"6" MarkList byte = 7 // opens a list, closed by MarkEnd MarkListItem byte = 8 // starts an item of the innermost list MarkTable byte = 9 // opens a table, closed by MarkEnd MarkFigure byte = 10 // payload: alternative text; opens a figure, closed by MarkEnd MarkEnd byte = 11 // closes the innermost list, table or figure MarkLang byte = 12 // payload: BCP 47 language of the runs that follow ("" = document default) MarkBarcode byte = 13 // payload: JSON of the symbol the next drawing draws (image/barcode.Mark) MarkData byte = 14 // payload: the id of the table (docs/spec.md §4.6) the open figure is the data of )
MARK kinds (docs/spec.md §7.8).
const ( SepNone byte = 0 SepSpace byte = 1 SepBreak byte = 2 )
Separators between consecutive text runs (docs/spec.md §7.9).
const ( // MaxUseDepth bounds how deep objects draw objects. MaxUseDepth = 64 // MaxReusedInstructions bounds the instructions read from objects that // were walked before. What is read once is bounded by the size of the // document; this bounds what a document adds by drawing it again. MaxReusedInstructions = 1 << 27 )
Limits of walking the objects an object draws with USE. A document decides how deep objects draw objects and how often, so a small one could otherwise keep a reader busy without end (ten objects that each draw the next one ten times draw the last one 10^10 times).
const FormatVersion = 1
FormatVersion is the container format version written by this package.
const HeaderSize = 32
HeaderSize is the fixed header length of the single-file form.
const MaxManifestSize = 256 << 20
MaxManifestSize bounds both the stored and decoded manifest JSON a reader reads: a manifest states no size of its own, so a file could otherwise ask for any amount of memory.
const OpsetVersion = 1
OpsetVersion is the instruction set version written by this package.
Variables ¶
var BlendNames = []string{
"source-over", "multiply", "screen", "overlay", "darken", "lighten",
"color-dodge", "color-burn", "hard-light", "soft-light", "difference",
"exclusion", "hue", "saturation", "color", "luminosity",
"destination-over", "destination-in", "destination-out", "source-in",
"source-out", "source-atop", "destination-atop", "xor", "copy", "lighter",
}
BlendNames maps blend mode values to globalCompositeOperation strings.
var DCTerms = []string{
"title", "creator", "subject", "description", "publisher", "contributor", "date", "type",
"format", "identifier", "source", "language", "relation", "coverage", "rights", "created", "modified",
}
DCTerms lists the element names DublinCore holds, in field order.
var ErrLocked = errors.New("bdf: the document is encrypted; unlock it with its password")
ErrLocked is returned when the parts of an encrypted document are read before Reader.Unlock.
var ErrWrongKey = errors.New("bdf: the document is not sealed for this key")
ErrWrongKey is returned by Reader.UnlockECDH when no key slot opens with the private key.
var ErrWrongPassword = errors.New("bdf: wrong password")
ErrWrongPassword is returned by Reader.Unlock when no key slot opens with the password.
var Magic = [4]byte{'b', 'd', 'f', 0}
Magic is the single-file magic number: "bdf" and a NUL byte.
Functions ¶
func Disassemble ¶
Disassemble renders an Object part as human-readable text.
func EncodeCues ¶
EncodeCues serializes cues as a cue index part (type "idx").
func EncodePathCollection ¶
EncodePathCollection encodes paths as a Path collection part (type "path").
func EncodeTextIndex ¶
EncodeTextIndex serializes index runs as a text index part (type "idx").
Types ¶
type CellRef ¶ added in v0.2.0
type CellRef struct {
Row, Col int // of the top-left cell, from 0
Rows, Cols int // the cells spanned, 1 or more
Scope string // "col" (a column header), "row" (a row header) or ""
}
CellRef is the payload of a CELL mark: a reference or a range, of a header cell or not ("B2", "A4:B4 col").
func ParseCellRef ¶ added in v0.2.0
ParseCellRef reads the payload of a CELL mark.
type Continuous ¶
type Continuous struct {
Gap float32 `json:"gap"`
}
Continuous configures continuous mode of a flow view.
type Cue ¶
Cue ties a time of a view's music to a place on its pages: at Tick (in the ticks of the Standard MIDI File, or in milliseconds of an audio file) the playing position is at X on System.
type CueSystem ¶
CueSystem is a rectangle of a page that the playing position moves through: a system of a score, or a line of the lyrics of a recording (docs/spec.md §4.4).
type DCValues ¶
type DCValues []string
DCValues holds the values of one element. In JSON a single value is a string and several values are an array of strings.
func SplitKeywords ¶
SplitKeywords splits a keyword list as PDF and Office documents store it into subjects. Keywords are separated by commas or semicolons (ASCII or full-width) or by the ideographic comma.
func (DCValues) MarshalJSON ¶
MarshalJSON writes one value as a string and several as an array.
func (*DCValues) UnmarshalJSON ¶
UnmarshalJSON accepts a string, an array of strings or null.
type Document ¶
type Document struct {
Meta Meta
Views []*View
// Tables are the tables the document holds beside its drawing
// (docs/spec.md §4.6): see AddTable.
Tables []*Table
// CompressionLevel is the flate level of the deflate-raw parts: 1
// (BestSpeed) to 9 (BestCompression). The default, 6, is what
// DefaultCompression names too; 9 writes files a few percent smaller
// in four times the time of the compression.
CompressionLevel int
// MinCompress is the smallest decoded size that gets compressed (default 512).
MinCompress int
// Lock, when set, makes WriteSingle and WriteSplit encrypt the document
// (docs/spec.md §3.5).
Lock *Lock
// contains filtered or unexported fields
}
Document accumulates parts and views and writes them out.
func (*Document) AddPart ¶
AddPart stores data as a part of the given type and returns its hash. Identical content is stored once.
func (*Document) AddTable ¶ added in v0.2.0
AddTable adds a table the document holds beside its drawing (docs/spec.md §4.6): t names it, and data is the Apache Parquet file of its rows, which becomes a PartTable part (t.Part is set). The id must be new to the document; the rows and the columns of t should be those of the file (AddTableRows makes both of a table in memory).
func (*Document) AddTableRows ¶ added in v0.2.0
func (d *Document) AddTableRows(id, title string, rows *parquet.Table, view string, page int) (*Table, error)
AddTableRows adds a table in memory (encoding/parquet.Table) as a table of the document, written as a Parquet file: id and title name it, and view and page say where the figure it is the data of is (page from 1; 0 for a sheet, "" for none).
func (*Document) BuildTextIndex ¶
BuildTextIndex extracts the text of a view from the document's objects, stores it as a text index part and records it in v.TextIndex.
func (*Document) SearchText ¶
func (d *Document) SearchText() (*SearchText, error)
SearchText returns the text of the document for a search index: that of the views' text index parts (docs/spec.md §7.9), or extracted from the objects of a view without one. Pages without text are left out, and so is a scroll view when the document also has a flow view (Word, Markdown and EPUB documents may lay the same text out both ways).
The text is the document's in plain text; a document that was encrypted should not have it stored where the password does not protect it.
func (*Document) WriteSingle ¶
WriteSingle writes the single-file form.
func (*Document) WriteSplit ¶
WriteSplit writes the split form into dir (manifest.json and parts/<hash>).
type DublinCore ¶
type DublinCore struct {
Title DCValues `json:"title,omitempty"`
Creator DCValues `json:"creator,omitempty"`
Subject DCValues `json:"subject,omitempty"`
Description DCValues `json:"description,omitempty"`
Publisher DCValues `json:"publisher,omitempty"`
Contributor DCValues `json:"contributor,omitempty"`
Date DCValues `json:"date,omitempty"`
Type DCValues `json:"type,omitempty"`
Format DCValues `json:"format,omitempty"`
Identifier DCValues `json:"identifier,omitempty"`
Source DCValues `json:"source,omitempty"`
Language DCValues `json:"language,omitempty"`
Relation DCValues `json:"relation,omitempty"`
Coverage DCValues `json:"coverage,omitempty"`
Rights DCValues `json:"rights,omitempty"`
Created DCValues `json:"created,omitempty"`
Modified DCValues `json:"modified,omitempty"`
}
DublinCore describes the document with the fifteen elements of the Dublin Core Metadata Element Set 1.1, plus the DCMI Terms created and modified (docs/spec.md §4.3). Every element is optional and repeatable.
func (*DublinCore) Field ¶
func (dc *DublinCore) Field(name string) *DCValues
Field returns the values of the element with the given name (one of DCTerms), or nil for an unknown name.
func (DublinCore) IsZero ¶
func (dc DublinCore) IsZero() bool
IsZero reports whether no element has a value.
type Encryption ¶
type Encryption struct {
Cipher string `json:"cipher"`
Keys []KeySlot `json:"keys"`
// Manifest is the sealed part that holds the document's manifest.
Manifest SealedManifest `json:"manifest"`
}
Encryption is the "encryption" member of an encrypted document's outer manifest.
type Font ¶
type Font struct {
Kind byte
Hash Hash // embedded: font part
Family string // CSS family list; fallback for embedded, primary for system
Weight uint16
Style byte
}
Font is a font reference used by an object.
func EmbeddedFont ¶
EmbeddedFont references a font part added with Document.AddFont.
type FormatError ¶
FormatError reports malformed data.
func (*FormatError) Error ¶
func (e *FormatError) Error() string
type Hash ¶
type Hash [16]byte
Hash identifies a part by content: the first 16 bytes of SHA-256.
func (Hash) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Hash) String ¶
String returns the 32-character lowercase hex form used in manifests and file names.
func (*Hash) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type IndexRun ¶
type IndexRun struct {
A, B uint32 // page, layer (fixed/flow) or tile x, y (sheet)
Ordinal uint32
Sep byte
Text string
}
IndexRun is one entry of a text index part.
func DecodeTextIndex ¶
DecodeTextIndex parses a text index part.
type Instr ¶
Instr is one decoded instruction. Operands are stored in reading order; f32 operands as float32, u8/u32/varuint as uint64, string refs as string.
type KeySlot ¶
type KeySlot struct {
Type string `json:"type"`
KDF string `json:"kdf"`
Iter int `json:"iter,omitempty"`
Salt []byte `json:"salt,omitempty"`
Crv string `json:"crv,omitempty"`
// EPK is the writer's public key of an ecdh slot, an uncompressed point.
EPK []byte `json:"epk,omitempty"`
// Key is the content key wrapped with AES-KW (RFC 3394).
Key []byte `json:"key"`
}
KeySlot holds the content key wrapped with a key derived from a password (Iter and Salt) or agreed with ECDH (Crv and EPK).
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
A Lock encrypts documents: a random content key and the key slots that unlock it. Set it as Document.Lock before writing.
func NewECDHLock ¶
NewECDHLock makes a lock with a fresh content key that only the private key of reader unlocks (a P-256 key). The key the content key is wrapped with is agreed with ECDH between reader and a key made here, which is forgotten once the lock is made: when the reader forgets its private key too, as a key pair made for one request does, nobody can open what the lock sealed any more.
type Manifest ¶
type Manifest struct {
BDF int `json:"bdf"`
Encryption *Encryption `json:"encryption,omitempty"`
Opset int `json:"opset,omitempty"`
Unit string `json:"unit,omitempty"`
Meta Meta `json:"meta,omitzero"`
// Segment, in a segment document, names the pages it carries
// (docs/spec.md §3.6).
Segment *Segment `json:"segment,omitempty"`
Views []*View `json:"views,omitempty"`
// Tables are the tables the document holds beside its drawing
// (docs/spec.md §4.6).
Tables []*Table `json:"tables,omitempty"`
Parts []PartEntry `json:"parts"`
}
Manifest is the JSON document directory.
An encrypted document stores an outer manifest that holds only BDF, Encryption and the sealed parts; the manifest it is read with is sealed (docs/spec.md §3.5).
type Meta ¶
type Meta struct {
// DC describes the document itself (title, creator, dates, ...).
DC DublinCore `json:"dc,omitzero"`
// Source is the input format the document was converted from ("pdf", "pptx", ...).
Source string `json:"source,omitempty"`
Generator string `json:"generator,omitempty"`
}
Meta holds document metadata.
type NodeKind ¶ added in v0.2.0
type NodeKind byte
NodeKind is the kind of a structure node (docs/spec.md §7.8). Leaves (paragraph, heading, caption, a cell outside a table) hold runs; containers (list, item, table, a cell inside a table, figure) hold nodes.
type Object ¶
type Object struct {
BBox Rect
// contains filtered or unexported fields
}
Object builds and encodes an Object part: a display list plus its resource tables.
Coordinates are local to the object. The builder tracks the bounding box of drawing operations approximately; set BBox explicitly to override.
func NewObject ¶
func NewObject() *Object
NewObject creates an empty object whose bbox is computed from its content.
func (*Object) AddExtPath ¶
AddExtPath registers a reference to path index in a Path collection part.
func (*Object) AddObject ¶
AddObject registers a child object reference. bbox is the child's bounding box, used to grow this object's bbox on USE.
func (*Object) Deps ¶
Deps returns the hashes of parts this object references (fonts, images, paths, objects).
func (*Object) FillText ¶
FillText draws s at (x, y). advance is the expected width in units (0 = no correction).
func (*Object) GroupBegin ¶
func (*Object) MaskBegin ¶
MaskBegin starts drawing a soft mask for the innermost group (kind is MaskAlpha or MaskLuminosity; backdrop is the luminosity backdrop colour; transfer is nil or 256 entries mapping each mask value).
func (*Object) MaskEnd ¶
MaskEnd multiplies the alpha of what the innermost group holds by the mask.
func (*Object) StrokeColor ¶
func (*Object) StrokePaint ¶
func (*Object) StrokePath ¶
func (*Object) StrokeRect ¶
func (*Object) UpdateFont ¶
UpdateFont replaces a registered font (used by converters that finalize font programs after the object has been built).
func (*Object) UpdateObject ¶
UpdateObject replaces the hash of a registered child object.
type ObjectPart ¶
type ObjectPart struct {
Opset uint16
BBox Rect
Strings []string
Paths []PathEntry
Paints []Paint
Fonts []Font
Images []Hash
Objects []Hash
Ops []byte
}
ObjectPart is a decoded Object part.
func DecodeObject ¶
func DecodeObject(data []byte) (*ObjectPart, error)
DecodeObject parses an Object part.
func (*ObjectPart) Deps ¶
func (o *ObjectPart) Deps() []Hash
Deps returns the hashes of the parts the object references: embedded fonts, images, path collections and objects.
func (*ObjectPart) Instructions ¶
func (o *ObjectPart) Instructions() ([]Instr, error)
Instructions decodes the op stream into a slice.
func (*ObjectPart) Walk ¶
func (o *ObjectPart) Walk(fn func(Instr)) error
Walk decodes the op stream, calling fn for each instruction.
type Page ¶
type Page struct {
W float32 `json:"w"`
H float32 `json:"h"`
Body *RectDef `json:"body,omitempty"`
Layers []Layer `json:"layers"`
}
Page is a fixed-size page.
type PageText ¶
PageText is the text of a page (numbered from 1, for links like #page=N), or of a whole sheet (Page 0).
type Paint ¶
type Paint struct {
Kind byte
Coords []float32 // linear: x0 y0 x1 y1; radial: x0 y0 r0 x1 y1 r1; conic: angle x y
Stops []Stop
Image ImageRef // pattern only
Repeat byte // pattern only
Matrix [6]float32 // pattern only
}
Paint is a gradient or pattern fill/stroke style.
func ConicGradient ¶
ConicGradient builds a conic gradient paint.
func LinearGradient ¶
LinearGradient builds a linear gradient paint.
func RadialGradient ¶
RadialGradient builds a radial gradient paint.
type PartEntry ¶
type PartEntry struct {
H Hash `json:"h"`
T string `json:"t"`
Enc string `json:"enc"`
Len int `json:"len"` // stored (possibly compressed) length
Size int `json:"size"` // decoded length
Off int64 `json:"off"` // offset from the start of the parts region (single form)
// Sealed names the part of the outer manifest that holds this part
// sealed (encrypted documents only).
Sealed Hash `json:"sealed,omitzero"`
}
PartEntry describes one part in the manifest.
type Path ¶
Path is a geometric path that maps to a Path2D.
func DecodePathCollection ¶
DecodePathCollection decodes a Path collection part.
type Play ¶
type Play struct {
// Seq is the hash of the PartSeq part.
Seq string `json:"seq,omitempty"`
// Audio is the hash of the PartAudio part, and Type the media type of
// the file it holds ("audio/mpeg").
Audio string `json:"audio,omitempty"`
Type string `json:"type,omitempty"`
// Cues is the hash of the cue index part (PartIndex), if any. Its
// ticks are those of the Standard MIDI File, or milliseconds of the
// audio.
Cues string `json:"cues,omitempty"`
}
Play is what a view plays: the music of a score as a Standard MIDI File (Seq), or a recording as the audio file itself (Audio), and cues that tie its time to places on the pages (docs/spec.md §4.4). A view has one of Seq and Audio.
type PrefixMember ¶
type PrefixMember struct {
Index int
Rest *Object
RestFonts []FontRef
RestObjects []int
// Bytes of the op stream the member no longer carries.
Saved int
}
PrefixMember is a rewritten object: index into the input slice and the rest object, which references the prefix as its child object 0.
type PrefixShare ¶
type PrefixShare struct {
// Fonts and child objects of Prefix, mapped back to the references of
// the object at Members[0] (see Split).
}
PrefixShare is one shared prefix and the objects that were cut to use it.
func SharePrefixes ¶
func SharePrefixes(objs []*Object, minBytes int) ([]PrefixShare, error)
SharePrefixes finds the longest legal instruction prefix that two or more of the objects have in common (at least minBytes of op stream) and returns, per distinct prefix, the shared object and the rewritten members. Objects that share nothing are absent from the result. The objects themselves are not modified.
Equality is by content: instruction bytes plus the paths, paints, fonts, images and child hashes they reference. Callers whose resource tables hold placeholders (fonts or children filled in later) must make the placeholders distinct per resource before calling.
type Reader ¶
type Reader struct {
Manifest *Manifest
// contains filtered or unexported fields
}
Reader reads a document from either form.
An encrypted document opens locked: Manifest is then the outer manifest, whose parts are sealed, until Unlock replaces it with the document's own.
func OpenSingle ¶
OpenSingle parses the single-file form.
func OpenSingleFile ¶
OpenSingleFile opens a single-form file by path. The parts are read from the file as they are asked for, so it stays open until Close.
func (*Reader) Close ¶
Close closes the file of a Reader from OpenSingleFile; the parts cannot be read after it. Readers opened in the other ways hold nothing to close.
func (*Reader) Object ¶
func (r *Reader) Object(h Hash) (*ObjectPart, error)
Object returns a decoded object part.
func (*Reader) Part ¶
Part returns the decoded bytes of a part. The parts of a locked document are its sealed parts, returned as they are stored.
func (*Reader) StoredManifest ¶ added in v0.2.0
StoredManifest returns the manifest as the document stores it (that of an encrypted document is its outer manifest), and its JSON as it was read (decompressed). Signatures (package sign) cover the stored form, which needs no password.
func (*Reader) StoredPart ¶ added in v0.2.0
StoredPart returns the bytes of a part of the stored manifest as they are stored: compressed as its entry says, sealed for an encrypted document.
func (*Reader) Table ¶ added in v0.2.0
Table returns a table of the document (docs/spec.md §4.6) and the bytes of its Parquet file. The tables of a locked document cannot be read.
func (*Reader) ToDocument ¶
ToDocument rebuilds a Document (for split/join round trips). An encrypted document must be unlocked first, and the Document it gives is not encrypted until a Lock is set; WriteSingle and WriteSplit of the Reader copy an encrypted document without its password.
func (*Reader) Unlock ¶
Unlock opens an encrypted document with its password: it decrypts the manifest, which becomes Manifest, and lets Part decrypt parts. It returns ErrWrongPassword when no key slot opens with the password.
func (*Reader) UnlockECDH ¶
func (r *Reader) UnlockECDH(priv *ecdh.PrivateKey) error
UnlockECDH opens an encrypted document with the private key it was sealed for (an ecdh key slot), as Unlock does with a password. It returns ErrWrongKey when no key slot opens with the key.
func (*Reader) WriteSegment ¶
func (r *Reader) WriteSegment(w io.Writer, o SegmentOptions) error
WriteSegment writes a segment of the document in the single-file form (docs/spec.md §3.6). The document must be one of pages: its views fixed, flow or scroll, without music, and an encrypted one unlocked. The views of the segment have no text index (the text of the whole view). It may be called from several goroutines at once.
func (*Reader) WriteSingle ¶
WriteSingle writes the document in the single-file form. The stored parts are copied as they are (after checking their hashes), so an encrypted document needs no password.
func (*Reader) WriteSplit ¶
WriteSplit writes the document in the split form into dir, copying the stored parts as WriteSingle does.
type RectDef ¶
type RectDef struct {
X float32 `json:"x"`
Y float32 `json:"y"`
W float32 `json:"w"`
H float32 `json:"h"`
}
RectDef is a rectangle in JSON.
type Replay ¶ added in v0.1.7
type Replay struct {
// contains filtered or unexported fields
}
Replay copies instructions of an object that was read into an object that is being built: the paths, paints, fonts, images and objects that the instructions refer to are added to the destination when they are first used. It is for a writer that draws a part of an object again (a group by itself, for its shadow); the bounding boxes of the objects that the instructions use are not known, so the destination needs a bounding box of its own (SetBBox).
func NewReplay ¶ added in v0.1.7
func NewReplay(part *ObjectPart, dst *Object) *Replay
NewReplay starts copying instructions of part into dst.
type SealedManifest ¶
type SealedManifest struct {
Part Hash `json:"part"`
// Enc is the encoding of the manifest JSON inside the seal.
Enc string `json:"enc"`
}
SealedManifest locates the sealed manifest.
type SearchText ¶
SearchText is the text of a document for a search index outside it: its metadata and the text of each view, page by page.
type SegmentOptions ¶
type SegmentOptions struct {
Segment
// Have lists the pages the reader holds from earlier segments: the
// parts they need are left out.
Have []Segment
// Lock seals the segment (NewECDHLock); nil writes it in the clear.
Lock *Lock
}
SegmentOptions say which pages a segment carries and how it is sealed.
type Split ¶
type Split struct {
Prefix, Rest *Object
PrefixFonts, RestFonts []FontRef
PrefixObjects, RestObjects []int
}
Split is an object cut in two: Prefix draws the first instructions, Rest begins with USE of it (its object reference 0, to be set by the caller once the prefix has a hash), re-establishes the state and draws the remaining instructions. Both keep the original bounding box.
PrefixFonts / RestFonts and PrefixObjects / RestObjects map each font and child-object reference of the new objects back to the original one, in new-reference order (RestObjects[0] is the prefix placeholder, -1).
type Table ¶ added in v0.2.0
type Table struct {
// ID names the table in the document ("chart-1", "sheet1", "data").
ID string `json:"id"`
Title string `json:"title,omitempty"`
// Part is the hash of the part that holds the Parquet file.
Part string `json:"part"`
// Rows is the count of rows, and Columns the columns, as the Parquet
// file's schema has them: a listing without decoding the file.
Rows int64 `json:"rows"`
Columns []TableColumn `json:"columns"`
// View and Page tell where the figure the table is the data of is:
// the view's id and the page in it, from 1 (0 for a view without
// pages: the table of a sheet); "" when the table is not shown.
View string `json:"view,omitempty"`
Page int `json:"page,omitempty"`
}
Table is a table a document holds beside its drawing (docs/spec.md §4.6): the data of a chart, the cells of a sheet, the rows of a CSV or Parquet file, as an Apache Parquet file in a PartTable part.
type TableColumn ¶ added in v0.2.0
TableColumn is a column of a table: its name, and its type ("string", "number", "integer", "boolean", "date", "datetime" or "other"; encoding/parquet.Type).
type TextContent ¶ added in v0.2.0
TextContent is the text of an object with its structure: the runs, the nodes they belong to, the links and the images, in walk order.
func ExtractContent ¶ added in v0.2.0
func ExtractContent(o *ObjectPart, resolve func(Hash) *ObjectPart) (*TextContent, error)
ExtractContent returns the runs of an object together with its structure (headings, lists, tables, figures: the MARKs of docs/spec.md §7.8), its links and its images, for text layers and for writing the document as text. The runs are the same as ExtractText's, and so are the limits.
type TextImage ¶ added in v0.2.0
type TextImage struct {
Hash Hash
X, Y, W, H float32
After int // index of the last run before the image (-1 before the first)
Node int // the leaf, else the container, open at the image (-1 at the top level)
Before int // index of the first node made after the image (len(Nodes) at the image)
}
TextImage is an IMAGE or IMAGE_SUB: the part it draws, the bounding box it is drawn in, and where it came in the text.
type TextLink ¶ added in v0.2.0
type TextLink struct {
X, Y, W, H float32
URL string
After int // index of the last run before the LINK (-1 before the first)
Node int // the leaf, else the container, open at the LINK (-1 at the top level)
}
TextLink is a LINK: the bounding box of its rectangle in the extraction space, and where it came in the text.
type TextNode ¶ added in v0.2.0
type TextNode struct {
Kind NodeKind
Parent int // index of the enclosing node, -1 at the top level
// Level is the level of a heading, 1 to 6, or 0 when the payload is
// not a level.
Level int
// Cell is the place of a cell: relative to its table inside a TABLE,
// that of the sheet outside one. Nil when the payload is not a
// reference.
Cell *CellRef
// Alt is the alternative text of a figure ("" when it is decorative).
Alt string
// Data is the id of the table a figure is the data of (its DATA mark;
// docs/spec.md §4.6), "" when it has none.
Data string
// Code says a paragraph is a line of code (the word "code" of its
// payload; docs/spec.md §7.8).
Code bool
// Quote is how deep in quotations a paragraph or a list is: the count
// of the word "quote" in its payload.
Quote int
// List is the kind of the markers of a list's items: "bullet",
// "ordered", or "" when the payload does not say.
List string
}
TextNode is a node of the structure of an object: what its MARKs say the text is (docs/spec.md §7.8). Nodes point at their parent by index.
type TextRun ¶
type TextRun struct {
Text string
X, Y float32 // anchor after applying the transform
Advance float32
Size float32
Font *Font
Align byte
Matrix [6]float32
Sep byte // separator from the previous run, from MARKs or position heuristics
Ordinal int // position in the extraction order of the top-level object
AltText bool
Node int // index of the structure node the run belongs to (TextContent.Nodes)
Lang string // BCP 47 language set by a LANG mark; "" for the document's default
}
TextRun is a text drawing instruction (or ALT_TEXT mark) located in the coordinate space of the object being walked.
func ExtractText ¶
func ExtractText(o *ObjectPart, resolve func(Hash) *ObjectPart) ([]TextRun, error)
ExtractText returns the text runs of an object and the objects it USEs, in walk order. resolve must return decoded child objects (nil skips the child).
The objects may not draw each other deeper than MaxUseDepth, nor read more than MaxReusedInstructions from objects that are drawn again.
type View ¶
type View struct {
ID string `json:"id"`
Kind string `json:"kind"`
Title string `json:"title,omitempty"`
// optional text index part (docs/spec.md §7.9)
TextIndex string `json:"textIndex,omitempty"`
// fixed / flow
Pages []*Page `json:"pages,omitempty"`
Continuous *Continuous `json:"continuous,omitempty"`
// Direction is the order pages are put side by side in (spreads, a
// horizontal row): DirectionLTR (the default when "") or DirectionRTL,
// for books bound on the right (docs/spec.md §4.1).
Direction string `json:"direction,omitempty"`
// sheet
Tile float32 `json:"tile,omitempty"`
Cols []Run `json:"cols,omitempty"`
Rows []Run `json:"rows,omitempty"`
Freeze *Freeze `json:"freeze,omitempty"`
Gridlines bool `json:"gridlines,omitempty"`
Tiles map[string]string `json:"tiles,omitempty"`
TilesRef string `json:"tilesRef,omitempty"`
// Play is the music a view plays (docs/spec.md §4.4).
Play *Play `json:"play,omitempty"`
}
View is a viewing unit: a slide deck, a document, or a sheet.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
bdf
command
Command bdf generates, inspects and converts BDF files.
|
Command bdf generates, inspects and converts BDF files. |
|
bdfwasm
command
Command bdfwasm is the converters built for the browser: a page hands it the bytes of a file and gets a BDF document back, so that the file never leaves the browser.
|
Command bdfwasm is the converters built for the browser: a page hands it the bytes of a file and gets a BDF document back, so that the file never leaves the browser. |
|
docflow
command
Command docflow is BDF Docflow, a document workflow engine on Popcorn Web: documents and data enter at uploaders and virtual printers, flow through a topology of nodes, and end on printers, on the tablets of a location (a warehouse), in archives and in downloaders.
|
Command docflow is BDF Docflow, a document workflow engine on Popcorn Web: documents and data enter at uploaders and virtual printers, flow through a topology of nodes, and end on printers, on the tablets of a location (a warehouse), in archives and in downloaders. |
|
Package conformance writes a machine-readable conformance suite: inputs and what a reader of BDF v1 must do with them, as this implementation does it.
|
Package conformance writes a machine-readable conformance suite: inputs and what a reader of BDF v1 must do with them, as this implementation does it. |
|
contrib
|
|
|
otf
Package otf opens OpenType font files, TrueType-flavored (.ttf, .ttc) and CFF-flavored (.otf, .otc) alike, for reading with little memory.
|
Package otf opens OpenType font files, TrueType-flavored (.ttf, .ttc) and CFF-flavored (.otf, .otc) alike, for reading with little memory. |
|
Package converter is the registry of the input formats that convert into BDF documents, with what their converters have in common: options, format detection and page selection.
|
Package converter is the registry of the input formats that convert into BDF documents, with what their converters have in common: options, format detection and page selection. |
|
ai
Package ai converts Adobe Illustrator artwork (.ai) into BDF documents, one page per artboard.
|
Package ai converts Adobe Illustrator artwork (.ai) into BDF documents, one page per artboard. |
|
all
Package all registers every input format of this module with the converter registry.
|
Package all registers every input format of this module with the converter registry. |
|
audio
Package audio converts audio files — MP3, AAC (in an MP4 container, as .m4a, or raw as ADTS), FLAC, Ogg Vorbis and Opus, WAV and AIFF — into BDF documents of one page: a card that shows the cover art the file carries (or a placeholder when it has none) across the top, and under it what the tags say: the title, the artists, the album, the other fields in a table, the lyrics and the chapters.
|
Package audio converts audio files — MP3, AAC (in an MP4 container, as .m4a, or raw as ADTS), FLAC, Ogg Vorbis and Opus, WAV and AIFF — into BDF documents of one page: a card that shows the cover art the file carries (or a placeholder when it has none) across the top, and under it what the tags say: the title, the artists, the album, the other fields in a table, the lyrics and the chapters. |
|
cgm
Package cgm converts Computer Graphics Metafiles (CGM, ISO/IEC 8632) into BDF documents: the binary encoding (Part 3), which CAD programs, technical illustration tools and WebCGM write, and the clear text encoding (Part 4), of versions 1 to 4.
|
Package cgm converts Computer Graphics Metafiles (CGM, ISO/IEC 8632) into BDF documents: the binary encoding (Part 3), which CAD programs, technical illustration tools and WebCGM write, and the clear text encoding (Part 4), of versions 1 to 4. |
|
csv
Package csv converts CSV and TSV files into BDF documents: one sheet view that shows the values the way Excel shows a CSV file it opens (the sheet is laid out and drawn by converter/xlsx; see xlsx.Grid).
|
Package csv converts CSV and TSV files into BDF documents: one sheet view that shows the values the way Excel shows a CSV file it opens (the sheet is laid out and drawn by converter/xlsx; see xlsx.Grid). |
|
docx
Package docx converts Word documents (.docx) into BDF documents.
|
Package docx converts Word documents (.docx) into BDF documents. |
|
drawio
Package drawio converts draw.io (diagrams.net) diagrams into BDF documents.
|
Package drawio converts draw.io (diagrams.net) diagrams into BDF documents. |
|
dxf
Package dxf converts DXF drawings (AutoCAD's Drawing Exchange Format, text and binary, R12 to 2018) into BDF documents.
|
Package dxf converts DXF drawings (AutoCAD's Drawing Exchange Format, text and binary, R12 to 2018) into BDF documents. |
|
emf
Package emf converts Windows metafiles (.emf and .wmf) into BDF documents: one page the size of the picture, drawn by replaying the metafile's records (the same replay draws the metafiles pictures of Office documents; see docs/design.md §3.4).
|
Package emf converts Windows metafiles (.emf and .wmf) into BDF documents: one page the size of the picture, drawn by replaying the metafile's records (the same replay draws the metafiles pictures of Office documents; see docs/design.md §3.4). |
|
epub
Package epub converts EPUB publications (EPUB 3 and EPUB 2) into BDF documents.
|
Package epub converts EPUB publications (EPUB 3 and EPUB 2) into BDF documents. |
|
font
Package font shows font files: TrueType and OpenType fonts (.ttf, .otf), collections of them (.ttc, .otc) and web fonts (.woff, .woff2).
|
Package font shows font files: TrueType and OpenType fonts (.ttf, .otf), collections of them (.ttc, .otc) and web fonts (.woff, .woff2). |
|
gerber
Package gerber converts the fabrication data of printed circuit boards into BDF documents: Gerber files (RS-274X, as the Ucamco Gerber Layer Format Specification defines it, with the X2 attributes and the deprecated commands of older files), Excellon drill files, and a zip archive of the files of a board (with its Gerber job file, when it has one).
|
Package gerber converts the fabrication data of printed circuit boards into BDF documents: Gerber files (RS-274X, as the Ucamco Gerber Layer Format Specification defines it, with the X2 attributes and the deprecated commands of older files), Excellon drill files, and a zip archive of the files of a board (with its Gerber job file, when it has one). |
|
hpgl
Package hpgl converts HP-GL/2 plot files (.plt) into BDF documents: the vector language of HP plotters and printers, with the HP-GL of older pen plotters and cutters, the PJL job and PCL or HP RTL escape sequences that files printed to a large-format plotter or a PCL printer carry around it, and the raster images of HP RTL.
|
Package hpgl converts HP-GL/2 plot files (.plt) into BDF documents: the vector language of HP plotters and printers, with the HP-GL of older pen plotters and cutters, the PJL job and PCL or HP RTL escape sequences that files printed to a large-format plotter or a PCL printer carry around it, and the raster images of HP RTL. |
|
html
Package html converts HTML documents (.html, .xhtml, and web pages saved as MHTML) into BDF documents in reader mode.
|
Package html converts HTML documents (.html, .xhtml, and web pages saved as MHTML) into BDF documents in reader mode. |
|
idml
Package idml converts InDesign documents saved as IDML (InDesign Markup Language, the XML interchange format InDesign exports and opens) into BDF documents.
|
Package idml converts InDesign documents saved as IDML (InDesign Markup Language, the XML interchange format InDesign exports and opens) into BDF documents. |
|
image
Package image converts the images browsers display by themselves (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO and SVG) into BDF documents: one page the size of the image, which draws it.
|
Package image converts the images browsers display by themselves (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO and SVG) into BDF documents: one page the size of the image, which draws it. |
|
internal/cad
Package cad draws the 2D drawings of CAD formats (DXF, JWW, SXF, CGM) and the plots of HP-GL/2.
|
Package cad draws the 2D drawings of CAD formats (DXF, JWW, SXF, CGM) and the plots of HP-GL/2. |
|
internal/canvas
Package canvas builds the objects of a document whose text the converter lays out itself.
|
Package canvas builds the objects of a document whose text the converter lays out itself. |
|
internal/cfb
Package cfb reads Compound File Binary files ([MS-CFB]): the container of legacy Office documents, and of encrypted Office Open XML documents, which keep their encrypted package in a stream of one.
|
Package cfb reads Compound File Binary files ([MS-CFB]): the container of legacy Office documents, and of encrypted Office Open XML documents, which keep their encrypted package in a stream of one. |
|
internal/cjkcmap
Package cjkcmap holds Adobe's predefined CJK CMaps (the encodings of the Adobe-Japan1, -Japan2, -GB1, -CNS1 and -Korea1 character collections, such as 90ms-RKSJ-H or UniJIS-UCS2-H) and derives CID → Unicode for those collections from their UTF-32 CMaps.
|
Package cjkcmap holds Adobe's predefined CJK CMaps (the encodings of the Adobe-Japan1, -Japan2, -GB1, -CNS1 and -Korea1 character collections, such as 90ms-RKSJ-H or UniJIS-UCS2-H) and derives CID → Unicode for those collections from their UTF-32 CMaps. |
|
internal/convtest
Package convtest holds what the tests of the converters share: reading the documents they make back, their text, the files of testdata, and the pictures and symbols the tests of forms look for.
|
Package convtest holds what the tests of the converters share: reading the documents they make back, their text, the files of testdata, and the pictures and symbols the tests of forms look for. |
|
internal/equation
Package equation is the formula engine (internal/mathlayout) for the converters: it lays formulas out with the fonts of a document (fontset.Set), which keeps the characters they draw for the embedded subsets, and draws them into BDF objects as text.
|
Package equation is the formula engine (internal/mathlayout) for the converters: it lays formulas out with the fonts of a document (fontset.Set), which keeps the characters they draw for the embedded subsets, and draws them into BDF objects as text. |
|
internal/fontset
Package fontset picks the fonts that lay out the text of a document being converted, measures the characters with them, and embeds the faces in use as subsets of those characters.
|
Package fontset picks the fonts that lay out the text of a document being converted, measures the characters with them, and embeds the faces in use as subsets of those characters. |
|
internal/formbox
Package formbox draws the values of the fields of a form in their places on pages: what the fillers of forms whose fields have places share (the form of a PDF, a template of pdfme).
|
Package formbox draws the values of the fields of a form in their places on pages: what the fillers of forms whose fields have places share (the form of a PDF, a template of pdfme). |
|
internal/hpglsniff
Package hpglsniff recognizes HP-GL and HP-GL/2 plot files, which have no signature: a bare plot file is a sequence of two-letter instructions ("IN;SP1;PA0,0;PD1000,0;"), and a plot sent to a printer or a large-format plotter is wrapped in a PJL job with PCL or HP RTL escape sequences around the HP-GL/2 and the raster data.
|
Package hpglsniff recognizes HP-GL and HP-GL/2 plot files, which have no signature: a bare plot file is a sequence of two-letter instructions ("IN;SP1;PA0,0;PD1000,0;"), and a plot sent to a printer or a large-format plotter is wrapped in a PJL job with PCL or HP RTL escape sequences around the HP-GL/2 and the raster data. |
|
internal/isobmff
Package isobmff reads the boxes of the ISO base media file format (ISO/IEC 14496-12): the container of AVIF and HEIF images, of MP4 and M4A audio, and of MP4 and QuickTime video.
|
Package isobmff reads the boxes of the ISO base media file format (ISO/IEC 14496-12): the container of AVIF and HEIF images, of MP4 and M4A audio, and of MP4 and QuickTime video. |
|
internal/jbig2
Package jbig2 decodes JBIG2 bi-level images (ITU-T T.88) in the form PDF embeds them with the JBIG2Decode filter: the sequential organisation without the file header, optionally preceded by a stream of global segments.
|
Package jbig2 decodes JBIG2 bi-level images (ITU-T T.88) in the form PDF embeds them with the JBIG2Decode filter: the sequential organisation without the file header, optionally preceded by a stream of global segments. |
|
internal/jpx
Package jpx decodes JPEG 2000 images (ITU-T T.800 | ISO/IEC 15444-1): bare codestreams and JP2/JPX files, the data of the JPXDecode filter of PDF.
|
Package jpx decodes JPEG 2000 images (ITU-T T.800 | ISO/IEC 15444-1): bare codestreams and JP2/JPX files, the data of the JPXDecode filter of PDF. |
|
internal/linebreak
Package linebreak holds the line breaking rules of the converters that lay text out themselves (Office documents): the simple rules Office applies.
|
Package linebreak holds the line breaking rules of the converters that lay text out themselves (Office documents): the simple rules Office applies. |
|
internal/localfile
Package localfile opens document resources within a directory.
|
Package localfile opens document resources within a directory. |
|
internal/metafile
Package metafile replays Windows metafiles (EMF and WMF), the vector pictures Office documents embed, into BDF objects.
|
Package metafile replays Windows metafiles (EMF and WMF), the vector pictures Office documents embed, into BDF objects. |
|
internal/music
Package music engraves scores: it lays out music as staff notation on pages of a BDF document and stores what the viewer plays (a Standard MIDI File and the cues that tie its time to places on the pages, docs/spec.md §4.4).
|
Package music engraves scores: it lays out music as staff notation on pages of a BDF document and stores what the viewer plays (a Standard MIDI File and the cues that tie its time to places on the pages, docs/spec.md §4.4). |
|
internal/music/smufl
Package smufl holds the music symbols the score engraver draws: glyphs of Bravura, the reference font of the Standard Music Font Layout (SMuFL), with their metrics and anchors, and the font's engraving defaults.
|
Package smufl holds the music symbols the score engraver draws: glyphs of Bravura, the reference font of the Standard Music Font Layout (SMuFL), with their metrics and anchors, and the font's engraving defaults. |
|
internal/offcrypto
Package offcrypto decrypts password-protected Office Open XML documents ([MS-OFFCRYPTO]).
|
Package offcrypto decrypts password-protected Office Open XML documents ([MS-OFFCRYPTO]). |
|
internal/ooxml
Package ooxml reads Office Open XML documents (.pptx, .docx, .xlsx): the parts of their Open Packaging Conventions container (ECMA-376 Part 2), the relationships between the parts, and part XML as generic element trees.
|
Package ooxml reads Office Open XML documents (.pptx, .docx, .xlsx): the parts of their Open Packaging Conventions container (ECMA-376 Part 2), the relationships between the parts, and part XML as generic element trees. |
|
internal/ooxml/drawingml
Package drawingml draws DrawingML (ECMA-376 Part 1 §20, §21): the shapes, pictures, text bodies, tables and charts that Office documents share, with their themes and color maps.
|
Package drawingml draws DrawingML (ECMA-376 Part 1 §20, §21): the shapes, pictures, text bodies, tables and charts that Office documents share, with their themes and color maps. |
|
internal/tiff
Package tiff reads TIFF files: the image file directories (IFDs) of a multi-page file, their tags and their pixels (docs/design.md §3.15).
|
Package tiff reads TIFF files: the image file directories (IFDs) of a multi-page file, their tags and their pixels (docs/design.md §3.15). |
|
internal/webdoc
Package webdoc reads web documents for the converters that lay them out in reader mode (converter/html, converter/markdown, converter/epub): HTML and XHTML into the node tree of golang.org/x/net/html, svg elements into SVG documents of their own, and data: URLs.
|
Package webdoc reads web documents for the converters that lay them out in reader mode (converter/html, converter/markdown, converter/epub): HTML and XHTML into the node tree of golang.org/x/net/html, svg elements into SVG documents of their own, and data: URLs. |
|
internal/wordproc
Package wordproc lays out word-processing documents for the converters of Word documents (converter/docx) and of HTML and Markdown (converter/html, converter/markdown).
|
Package wordproc lays out word-processing documents for the converters of Word documents (converter/docx) and of HTML and Markdown (converter/html, converter/markdown). |
|
internal/xmp
Package xmp reads the Dublin Core of XMP metadata packets (ISO 16684-1), as image and design files embed them, and of other RDF/XML, such as the metadata of SVG documents (docs/spec.md §4.3).
|
Package xmp reads the Dublin Core of XMP metadata packets (ISO 16684-1), as image and design files embed them, and of other RDF/XML, such as the metadata of SVG documents (docs/spec.md §4.3). |
|
internal/ziputil
Package ziputil opens zip archives (Office packages, EPUB publications, archives of KiCad, Gerber and SXF files) with the inflate of klauspost/compress, which reads a third faster than the standard library's and gives the same bytes.
|
Package ziputil opens zip archives (Office packages, EPUB publications, archives of KiCad, Gerber and SXF files) with the inflate of klauspost/compress, which reads a third faster than the standard library's and gives the same bytes. |
|
jww
Package jww converts the drawings of Jw_cad (.jww) into BDF documents.
|
Package jww converts the drawings of Jw_cad (.jww) into BDF documents. |
|
kicad
Package kicad converts KiCad schematics (.kicad_sch) and boards (.kicad_pcb) of KiCad 6 and later, and zip archives of their projects, into BDF documents.
|
Package kicad converts KiCad schematics (.kicad_sch) and boards (.kicad_pcb) of KiCad 6 and later, and zip archives of their projects, into BDF documents. |
|
markdown
Package markdown converts Markdown documents into BDF documents.
|
Package markdown converts Markdown documents into BDF documents. |
|
midi
Package midi reads Standard MIDI Files: the .mid (.midi, .smf) files of sequencers and notation programs, karaoke files (.kar) and RIFF MIDI files (.rmi).
|
Package midi reads Standard MIDI Files: the .mid (.midi, .smf) files of sequencers and notation programs, karaoke files (.kar) and RIFF MIDI files (.rmi). |
|
mml
Package mml reads MML (Music Macro Language), the text that chip music and game music are written in, into a music.Performance that converter/internal/music writes as staff notation and plays.
|
Package mml reads MML (Music Macro Language), the text that chip music and game music are written in, into a music.Performance that converter/internal/music writes as staff notation and plays. |
|
musicxml
Package musicxml reads MusicXML scores (.musicxml, .xml, and compressed .mxl) into the music engine's Score, which converter/internal/music engraves as staff notation on pages with the music played by the viewer.
|
Package musicxml reads MusicXML scores (.musicxml, .xml, and compressed .mxl) into the music engine's Score, which converter/internal/music engraves as staff notation on pages with the music played by the viewer. |
|
parquet
Package parquet converts Apache Parquet files into BDF documents: one sheet view of the table, the column names bold and frozen at the top with a gray row of their types under them, and the values the way data tools show them (the sheet is laid out and drawn by converter/xlsx; see xlsx.Grid).
|
Package parquet converts Apache Parquet files into BDF documents: one sheet view of the table, the column names bold and frozen at the top with a gray row of their types under them, and the values the way data tools show them (the sheet is laid out and drawn by converter/xlsx; see xlsx.Grid). |
|
pdf
Package pdf converts PDF files into BDF documents.
|
Package pdf converts PDF files into BDF documents. |
|
pdfform
Package pdfform fills the interactive form of a PDF (its AcroForm) with data, as a template of a form: the file is the template, its fields are what the data has values for, and the filled form is a BDF document of its pages with the values drawn in the places of the fields.
|
Package pdfform fills the interactive form of a PDF (its AcroForm) with data, as a template of a form: the file is the template, its fields are what the data has values for, and the filled form is a BDF document of its pages with the values drawn in the places of the fields. |
|
pdfme
Package pdfme fills templates of pdfme (https://pdfme.com) with data: a template made with the designer of pdfme (a JSON file: a base PDF or a blank page, and the fields on its pages with their places) is filled as the generator of pdfme fills it, into a BDF document.
|
Package pdfme fills templates of pdfme (https://pdfme.com) with data: a template made with the designer of pdfme (a JSON file: a base PDF or a blank page, and the fields on its pages with their places) is filled as the generator of pdfme fills it, into a BDF document. |
|
pptx
Package pptx converts PowerPoint presentations (.pptx) into BDF documents.
|
Package pptx converts PowerPoint presentations (.pptx) into BDF documents. |
|
psd
Package psd converts Photoshop documents (.psd, and .psb, the large document format) into BDF documents: the image as Photoshop composited it, one page per artboard.
|
Package psd converts Photoshop documents (.psd, and .psb, the large document format) into BDF documents: the image as Photoshop composited it, one page per artboard. |
|
sxf
Package sxf converts SXF drawings, the CAD data exchange format of the electronic deliveries of Japanese public works (電子納品), into BDF documents: the STEP files (.p21, and .p2z, a P21 file in a zip) and the feature comment files (.sfc) of SXF Ver.2 to Ver.3.1.
|
Package sxf converts SXF drawings, the CAD data exchange format of the electronic deliveries of Japanese public works (電子納品), into BDF documents: the STEP files (.p21, and .p2z, a P21 file in a zip) and the feature comment files (.sfc) of SXF Ver.2 to Ver.3.1. |
|
textform
Package textform fills templates of plain text with data: forms whose characters are on a grid of columns and lines, as dot matrix printers print continuous forms and slips in their text mode, and as receipt printers print receipts.
|
Package textform fills templates of plain text with data: forms whose characters are on a grid of columns and lines, as dot matrix printers print continuous forms and slips in their text mode, and as receipt printers print receipts. |
|
tiff
Package tiff converts TIFF images into BDF documents: each page of the file (each image of the IFD chain that is not a reduced-resolution copy or a mask) becomes a page of a fixed view, drawn by one image the size of the page (see docs/design.md §3.15).
|
Package tiff converts TIFF images into BDF documents: each page of the file (each image of the IFD chain that is not a reduced-resolution copy or a mask) becomes a page of a fixed view, drawn by one image the size of the page (see docs/design.md §3.15). |
|
visio
Package visio converts Visio drawings into BDF documents: the packages of Visio 2013 and later (.vsdx, .vsdm, .vstx, .vstm).
|
Package visio converts Visio drawings into BDF documents: the packages of Visio 2013 and later (.vsdx, .vsdm, .vstx, .vstm). |
|
xlsx
Package xlsx converts Excel workbooks (.xlsx) into BDF documents.
|
Package xlsx converts Excel workbooks (.xlsx) into BDF documents. |
|
Package docflow is the core of BDF Docflow, a document workflow engine: a topology of nodes a job flows through, as an administrator composes it.
|
Package docflow is the core of BDF Docflow, a document workflow engine: a topology of nodes a job flows through, as an administrator composes it. |
|
flowtest
Package flowtest is what the tests of the adapters of docflow share: a manager over a store of a temporary directory, served over HTTP, with a clock of its own, and the far sides an exit sends to, in the process (an SMTP server, a web hook).
|
Package flowtest is what the tests of the adapters of docflow share: a manager over a store of a temporary directory, served over HTTP, with a clock of its own, and the far sides an exit sends to, in the process (an SMTP server, a web hook). |
|
io/all
Package all imports every input and output of docflow, and its render node, so that a program that serves them all imports this package alone: the IPP printers and CUPS servers (docflow/io/ipp), mail (docflow/io/smtp), S3 and its trigger (docflow/io/s3), HTTP (docflow/io/http), FTP and SFTP, each an exit and a polling entry (docflow/io/ftp, docflow/io/sftp), the notify node (docflow/io/notify) and the render node (docflow/render).
|
Package all imports every input and output of docflow, and its render node, so that a program that serves them all imports this package alone: the IPP printers and CUPS servers (docflow/io/ipp), mail (docflow/io/smtp), S3 and its trigger (docflow/io/s3), HTTP (docflow/io/http), FTP and SFTP, each an exit and a polling entry (docflow/io/ftp, docflow/io/sftp), the notify node (docflow/io/notify) and the render node (docflow/render). |
|
io/ftp
Package ftp is the FTP input and output of docflow: the kind ftp writes what reaches the node to a directory of an FTP server (an exit), and the kind ftp-poll takes the files that appear in one (an entry, which polls at every tick).
|
Package ftp is the FTP input and output of docflow: the kind ftp writes what reaches the node to a directory of an FTP server (an exit), and the kind ftp-poll takes the files that appear in one (an entry, which polls at every tick). |
|
io/http
Package http is the HTTP output of docflow: the kind http, shown as HTTP (push), sends what reaches the node to a web service in a request (a downloader is where applications fetch documents instead).
|
Package http is the HTTP output of docflow: the kind http, shown as HTTP (push), sends what reaches the node to a web service in a request (a downloader is where applications fetch documents instead). |
|
io/ipp
Package ipp is the IPP input and output of docflow: the printers a job is printed on (the kind printer, over IPP, port 9100 or LPD), the CUPS servers jobs are printed to (the kind cups, an entry: a source), and the queues of CUPS servers jobs are printed on (the kind cups-out, an exit: a sink), as docflow's kinds of node are registered.
|
Package ipp is the IPP input and output of docflow: the printers a job is printed on (the kind printer, over IPP, port 9100 or LPD), the CUPS servers jobs are printed to (the kind cups, an entry: a source), and the queues of CUPS servers jobs are printed on (the kind cups-out, an exit: a sink), as docflow's kinds of node are registered. |
|
io/notify
Package notify is the notify node of docflow: it tells that a job passed it, to Slack (an incoming webhook), by mail, or to a webhook of one's own (http), and sends the job on along its To, if any, with what reached it.
|
Package notify is the notify node of docflow: it tells that a job passed it, to Slack (an incoming webhook), by mail, or to a webhook of one's own (http), and sends the job on along its To, if any, with what reached it. |
|
io/s3
Package s3 is the S3 input and output of docflow: the kind s3 writes what reaches the node to a bucket (an exit), and the kind s3-trigger takes the objects an S3 event names (an entry).
|
Package s3 is the S3 input and output of docflow: the kind s3 writes what reaches the node to a bucket (an exit), and the kind s3-trigger takes the objects an S3 event names (an entry). |
|
io/sftp
Package sftp is the SFTP input and output of docflow: the kind sftp writes what reaches the node to a directory of an SFTP server (an exit), and the kind sftp-poll takes the files that appear in one (an entry, which polls at every tick).
|
Package sftp is the SFTP input and output of docflow: the kind sftp writes what reaches the node to a directory of an SFTP server (an exit), and the kind sftp-poll takes the files that appear in one (an entry, which polls at every tick). |
|
io/smtp
Package smtp is the mail output of docflow: the kind smtp sends what reaches the node as the attachment of a mail, over SMTP (net/smtp).
|
Package smtp is the mail output of docflow: the kind smtp sends what reaches the node as the attachment of a mail, over SMTP (net/smtp). |
|
io/transfer
Package transfer is what the file-transfer kinds of docflow share (docflow/io/ftp, docflow/io/sftp): a far side's files behind one interface (FS), a node's far side as its URL says it (Site), the settings and the fields of an exit that uploads under a temporary name and renames into place (Send), and of an entry that polls a directory at every tick, claims a file by renaming it, takes it in as a job and deletes or moves it (Poll).
|
Package transfer is what the file-transfer kinds of docflow share (docflow/io/ftp, docflow/io/sftp): a far side's files behind one interface (FS), a node's far side as its URL says it (Site), the settings and the fields of an exit that uploads under a temporary name and renames into place (Send), and of an entry that polls a directory at every tick, claims a file by renaming it, takes it in as a job and deletes or moves it (Poll). |
|
render
Package render is the render node of docflow: it draws the .bdf document that reaches it as a PDF file (vector/pdfbdf), or a page of it as a PNG image (raster/imagebdf), for an exit whose far side has no viewer of BDF (a mail's reader, a web service).
|
Package render is the render node of docflow: it draws the .bdf document that reaches it as a PDF file (vector/pdfbdf), or a page of it as a PNG image (raster/imagebdf), for an exit whose far side has no viewer of BDF (a mail's reader, a web service). |
|
web/help
Package help is Docflow's manual: chapters written in Markdown beside this file, in English (en) and Japanese (ja), embedded in the binary and served by the web application at /help for everyone signed in.
|
Package help is Docflow's manual: chapters written in Markdown beside this file, in English (en) and Japanese (ja), embedded in the binary and served by the web application at /help for everyone signed in. |
|
webmessages
Package webmessages is the catalog of the texts of Docflow's pages, in English and Japanese: pages.yaml, compiled by pw generate into messages_pw_gen.go, which the templates of docflow/web call with the locale of the request (popcornweb.toml's [i18n]).
|
Package webmessages is the catalog of the texts of Docflow's pages, in English and Japanese: pages.yaml, compiled by pw generate into messages_pw_gen.go, which the templates of docflow/web call with the locale of the request (popcornweb.toml's [i18n]). |
|
encoding
|
|
|
htmlro
Package htmlro is a read-only pull tokenizer for HTML and, on top of it, a parser that builds the tree golang.org/x/net/html builds.
|
Package htmlro is a read-only pull tokenizer for HTML and, on top of it, a parser that builds the tree golang.org/x/net/html builds. |
|
parquet
Package parquet writes and reads the tables a document holds beside its drawing (docs/spec.md §4.6): Apache Parquet files of flat columns.
|
Package parquet writes and reads the tables a document holds beside its drawing (docs/spec.md §4.6): Apache Parquet files of flat columns. |
|
examples
|
|
|
light-server
command
Command light-server is a sample architecture (docs/examples/light-server): the server never converts a document to bdf.
|
Command light-server is a sample architecture (docs/examples/light-server): the server never converts a document to bdf. |
|
preview-server
command
Command preview-server is a sample architecture (docs/examples/preview-server): the server converts every document to bdf itself, once, and caches both the bdf and its thumbnail on disk (makePreviews).
|
Command preview-server is a sample architecture (docs/examples/preview-server): the server converts every document to bdf itself, once, and caches both the bdf and its thumbnail on disk (makePreviews). |
|
print-server
command
Command print-server is a sample (docs/examples/print-server): a business application that prints invoices through a print server it embeds (package print/server, the server of bdf printd).
|
Command print-server is a sample (docs/examples/print-server): a business application that prints invoices through a print server it embeds (package print/server, the server of bdf printd). |
|
search
command
Command search is a sample architecture (docs/examples/search): on top of what preview-server does (convert and cache every document as bdf, and a thumbnail), it also extracts each document's text with bdf.Document.SearchText and indexes it in Meilisearch, one document per page (a sheet is one entry, without a page number — see bdf.Document.SearchText's doc comment).
|
Command search is a sample architecture (docs/examples/search): on top of what preview-server does (convert and cache every document as bdf, and a thumbnail), it also extracts each document's text with bdf.Document.SearchText and indexes it in Meilisearch, one document per page (a sheet is one entry, without a page number — see bdf.Document.SearchText's doc comment). |
|
secure-reader
command
Command secure-reader is a sample architecture (docs/examples/secure-reader): a site where readers log in and read the PDF books they own, which are never sent as files.
|
Command secure-reader is a sample architecture (docs/examples/secure-reader): a site where readers log in and read the PDF books they own, which are never sent as files. |
|
Package fixture builds the sample document used by tests and demos.
|
Package fixture builds the sample document used by tests and demos. |
|
font
|
|
|
woff2
Package woff2 packs TrueType and CFF-flavored OpenType fonts into WOFF2 (W3C WOFF File Format 2.0), the web font format browsers load with FontFace.
|
Package woff2 packs TrueType and CFF-flavored OpenType fonts into WOFF2 (W3C WOFF File Format 2.0), the web font format browsers load with FontFace. |
|
Package form fills templates with data and makes the forms that business systems print (invoices, slips, certificates) as BDF documents.
|
Package form fills templates with data and makes the forms that business systems print (invoices, slips, certificates) as BDF documents. |
|
tag
Package tag reads the tags of form templates: the marks in the text of a Word, Excel or PowerPoint file that data replaces when the template is filled (package form).
|
Package tag reads the tags of form templates: the marks in the text of a Word, Excel or PowerPoint file that data replaces when the template is filled (package form). |
|
textpart
Package textpart reads and writes the print image of a form filled from a template of plain text: the part of the type bdf.PartText ("text") of a document, as JSON (docs/spec.md §4).
|
Package textpart reads and writes the print image of a form filled from a template of plain text: the part of the type bdf.PartText ("text") of a document, as JSON (docs/spec.md §4). |
|
image
|
|
|
barcode
Package barcode makes QR codes and barcodes as drawings: the symbols that forms carry for the machines that read them (slips, labels, invoices).
|
Package barcode makes QR codes and barcodes as drawings: the symbols that forms carry for the machines that read them (slips, labels, invoices). |
|
formula
Package formula lays out mathematical formulas written in LaTeX or MathML and returns them as vector graphics: a BDF object of filled and stroked paths, which any renderer of BDF objects draws — into an image (raster/imagebdf), on an Ebitengine screen (raster/ebitenginebdf), or on a browser's canvas as the page of a document (@bdfkit/render).
|
Package formula lays out mathematical formulas written in LaTeX or MathML and returns them as vector graphics: a BDF object of filled and stroked paths, which any renderer of BDF objects draws — into an image (raster/imagebdf), on an Ebitengine screen (raster/ebitenginebdf), or on a browser's canvas as the page of a document (@bdfkit/render). |
|
imgconv
Package imgconv decides how raster images are stored in a BDF document.
|
Package imgconv decides how raster images are stored in a BDF document. |
|
rowenc
Package rowenc writes PNG and TIFF files from the rows of an image as they come, for an image drawn in bands (imagebdf.PageRows) that is not all in memory at once: a page at 600 dpi is written with the memory of a band of it and of the compression.
|
Package rowenc writes PNG and TIFF files from the rows of an image as they come, for an image drawn in bands (imagebdf.PageRows) that is not all in memory at once: a page at 600 dpi is written with the memory of a band of it and of the compression. |
|
svg
Package svg reads SVG documents: the tree of their elements with the style sheets of the document applied, and the values their attributes hold — colours, numbers, lengths and transforms.
|
Package svg reads SVG documents: the tree of their elements with the style sheets of the document applied, and the values their attributes hold — colours, numbers, lengths and transforms. |
|
internal
|
|
|
affine
Package affine has the affine transform of Canvas 2D, as the rasterizer and the vector exporters keep it.
|
Package affine has the affine transform of Canvas 2D, as the rasterizer and the vector exporters keep it. |
|
cff
Package cff reads and subsets CFF font programs: the Type 2 outlines of OpenType fonts with a "CFF " table, and those PDF files embed.
|
Package cff reads and subsets CFF font programs: the Type 2 outlines of OpenType fonts with a "CFF " table, and those PDF files embed. |
|
cms
Package cms writes and reads the signatures of the Cryptographic Message Syntax (RFC 5652): SignedData with one signer or more, as the signatures of BDF documents (package sign) and of PDF files (PAdES, vector/pdfbdf) are, and the time-stamp tokens of RFC 3161, which are SignedData too.
|
Package cms writes and reads the signatures of the Cryptographic Message Syntax (RFC 5652): SignedData with one signer or more, as the signatures of BDF documents (package sign) and of PDF files (PAdES, vector/pdfbdf) are, and the time-stamp tokens of RFC 3161, which are SignedData too. |
|
cms/cmstest
Package cmstest makes what tests of signatures need: a certificate authority of its own, certificates of keys that it issues, and a time-stamp authority (RFC 3161) over HTTP.
|
Package cmstest makes what tests of signatures need: a certificate authority of its own, certificates of keys that it issues, and a time-stamp authority (RFC 3161) over HTTP. |
|
fontchain
Package fontchain finds the fonts text is drawn with, as a browser does: the font parts of a document, the families of the system that fonts refer to, and fallbacks for the characters those lack.
|
Package fontchain finds the fonts text is drawn with, as a browser does: the font parts of a document, the families of the system that fonts refer to, and fallbacks for the characters those lack. |
|
fontdb
Package fontdb finds font files, resolves the family names documents ask for to faces that are available (directly, through metric-compatible substitutes, or through generic fallbacks), measures glyphs for text layout, and builds the subset font programs that get embedded.
|
Package fontdb finds font files, resolves the family names documents ask for to faces that are available (directly, through metric-compatible substitutes, or through generic fallbacks), measures glyphs for text layout, and builds the subset font programs that get embedded. |
|
gauss
Package gauss blurs the planes of shadows: the renderers of BDF (raster/imagebdf, vector/pdfbdf) draw the same shadow with it.
|
Package gauss blurs the planes of shadows: the renderers of BDF (raster/imagebdf, vector/pdfbdf) draw the same shadow with it. |
|
mathlayout
Package equation lays out mathematical formulas and draws them into BDF objects, for every converter whose documents hold formulas: Office Math (OMML) in Word documents, MathML in HTML pages, and LaTeX in Markdown.
|
Package equation lays out mathematical formulas and draws them into BDF objects, for every converter whose documents hold formulas: Office Math (OMML) in Word documents, MathML in HTML pages, and LaTeX in Markdown. |
|
otlayout
Package otlayout reads the OpenType layout tables GSUB, GPOS and GDEF: the scripts and language systems a font declares, its features and the lookups they apply, and what each lookup substitutes or positions.
|
Package otlayout reads the OpenType layout tables GSUB, GPOS and GDEF: the scripts and language systems a font declares, its features and the lookups they apply, and what each lookup substitutes or positions. |
|
sfnt
Package sfnt is a minimal TrueType/OpenType table reader and writer: enough to look glyphs up and measure them, drop unused glyphs, and rebuild a font program with a synthesized cmap so browsers can load it.
|
Package sfnt is a minimal TrueType/OpenType table reader and writer: enough to look glyphs up and measure them, drop unused glyphs, and rebuild a font program with a synthesized cmap so browsers can load it. |
|
textrun
Package textrun holds what the renderers of BDF text share: how a string of a FILL_TEXT is put in visual order, where its baseline lies, which families a font reference names, and the bold and italic that are synthesized for a face that has none.
|
Package textrun holds what the renderers of BDF text share: how a string of a FILL_TEXT is put in visual order, where its baseline lies, which families a font reference names, and the bold and italic that are synthesized for a face that has none. |
|
xmltree
Package xmltree reads XML with xmlro, the pull reader that allocates nothing for the tokens it passes over.
|
Package xmltree reads XML with xmlro, the pull reader that allocates nothing for the tokens it passes over. |
|
Package print prints BDF documents on printers: it picks what to send (the pages as a PDF file or a PostScript file, or as PWG Raster, Apple Raster or PCLm drawn by raster/imagebdf), turns a Ticket of what the job asks into the attributes of IPP, and sends the job to a printer or a queue with package print/ipp, waiting for it to be done.
|
Package print prints BDF documents on printers: it picks what to send (the pages as a PDF file or a PostScript file, or as PWG Raster, Apple Raster or PCLm drawn by raster/imagebdf), turns a Ticket of what the job asks into the attributes of IPP, and sends the job to a printer or a queue with package print/ipp, waiting for it to be done. |
|
fakeidp
Package fakeidp is an OpenID Provider for tests: discovery, a JWKS, the authorization code flow with PKCE (S256) and RS256 ID tokens, with the people of a test and their groups in a claim of any path ("groups", "roles", Keycloak's "realm_access.roles").
|
Package fakeidp is an OpenID Provider for tests: discovery, a JWKS, the authorization code flow with PKCE (S256) and RS256 ID tokens, with the people of a test and their groups in a claim of any path ("groups", "roles", Keycloak's "realm_access.roles"). |
|
fakeprinter
Package fakeprinter is printers that are not there, for tests and for trying bdf print and bdf printd without paper.
|
Package fakeprinter is printers that are not there, for tests and for trying bdf print and bdf printd without paper. |
|
fakeprinter/readback
Package readback turns what a fake printer received back into pages: the images of PWG Raster and Apple Raster as they are, PDF and PCLm drawn (converter/pdf, then raster/imagebdf), PostScript drawn by Ghostscript where it is, JPEG and PNG decoded, and the label, receipt and dot-matrix languages read as their printers print them (print/pdl): their dots, and the commands of the printer's own barcodes.
|
Package readback turns what a fake printer received back into pages: the images of PWG Raster and Apple Raster as they are, PDF and PCLm drawn (converter/pdf, then raster/imagebdf), PostScript drawn by Ghostscript where it is, JPEG and PNG decoded, and the label, receipt and dot-matrix languages read as their printers print them (print/pdl): their dots, and the commands of the printer's own barcodes. |
|
ipp
Package ipp reads and writes the messages of the Internet Printing Protocol (RFC 8010) and speaks it to printers (RFC 8011, PWG 5100.12: IPP/2.x).
|
Package ipp reads and writes the messages of the Internet Printing Protocol (RFC 8010) and speaks it to printers (RFC 8011, PWG 5100.12: IPP/2.x). |
|
pdl
Package pdl writes BDF pages in the languages of printers of labels, receipts and continuous forms, which take neither PDF nor PostScript: ZPL (Zebra), SBPL (SATO) and TPCL (Toshiba TEC) for labels, ESC/POS (Epson TM and the printers like it) for receipts, and ESC/P (Epson VP and the dot-matrix printers like it) for continuous forms.
|
Package pdl writes BDF pages in the languages of printers of labels, receipts and continuous forms, which take neither PDF nor PostScript: ZPL (Zebra), SBPL (SATO) and TPCL (Toshiba TEC) for labels, ESC/POS (Epson TM and the printers like it) for receipts, and ESC/P (Epson VP and the dot-matrix printers like it) for continuous forms. |
|
printconv
Package printconv converts the documents a print server receives into .bdf documents of pages, with the converters registered in package converter (import converter/all, or the converters a program needs) and print/raster for the rasters of driverless clients.
|
Package printconv converts the documents a print server receives into .bdf documents of pages, with the converters registered in package converter (import converter/all, or the converters a program needs) and print/raster for the rasters of driverless clients. |
|
raster
Package raster writes the raster formats of driverless printing: PWG Raster (PWG 5102.4, image/pwg-raster), which IPP Everywhere printers take, Apple Raster (image/urf), which AirPrint printers take, and PCLm (application/PCLm), which Mopria printers take.
|
Package raster writes the raster formats of driverless printing: PWG Raster (PWG 5102.4, image/pwg-raster), which IPP Everywhere printers take, Apple Raster (image/urf), which AirPrint printers take, and PCLm (application/PCLm), which Mopria printers take. |
|
raw
Package raw sends documents to printers that do not speak IPP: over the raw socket of port 9100 (AppSocket, JetDirect), the line printer daemon protocol (LPD, RFC 1179), a serial port (and a Bluetooth printer of the serial port profile, which the OS shows as one), the device file of a USB printer (Linux and the BSDs), and a queue of Windows whose driver passes RAW data on (winspool).
|
Package raw sends documents to printers that do not speak IPP: over the raw socket of port 9100 (AppSocket, JetDirect), the line printer daemon protocol (LPD, RFC 1179), a serial port (and a Bluetooth printer of the serial port profile, which the OS shows as one), the device file of a USB printer (Linux and the BSDs), and a queue of Windows whose driver passes RAW data on (winspool). |
|
server
Package server is the print server: a spool (print/spool) of the queues and printers of a configuration file, its HTTP API (/api/v1), the changes as Server-Sent Events, /metrics, and a page of its state.
|
Package server is the print server: a spool (print/spool) of the queues and printers of a configuration file, its HTTP API (/api/v1), the changes as Server-Sent Events, /metrics, and a page of its state. |
|
server/client
Package client talks to a print server (bdf printd) over its HTTP API: it submits documents, follows and changes jobs, and reads the queues, the printers and the accounting.
|
Package client talks to a print server (bdf printd) over its HTTP API: it submits documents, follows and changes jobs, and reads the queues, the printers and the accounting. |
|
spool
Package spool keeps print jobs and sends them to printers: it takes a job and its document, keeps both across restarts, queues the job, sends it to a printer of its queue as print.Print does, follows it until the printer is done, retries what failed for want of the printer, and never prints a job twice after a crash.
|
Package spool keeps print jobs and sends them to printers: it takes a job and its document, keeps both across restarts, queues the job, sends it to a printer of its queue as print.Print does, follows it until the printer is done, retries what failed for want of the printer, and never prints a job twice after a crash. |
|
raster
|
|
|
imagebdf
Package imagebdf draws BDF documents into images without a browser: the pages of fixed and flow views, stretches of scroll views and regions of sheets, for thumbnails and other server-side previews, and objects that are in no document (Object).
|
Package imagebdf draws BDF documents into images without a browser: the pages of fixed and flow views, stretches of scroll views and regions of sheets, for thumbnails and other server-side previews, and objects that are in no document (Object). |
|
internal/shapes
Package shapes reads an object that draws paths only as a list of filled and stroked shapes in the units of the object: the transforms applied, every path made of moves, lines, quadratic and cubic curves and closes (rectangles, ellipses, arcs and rounded rectangles drawn as those), and every shape with its color.
|
Package shapes reads an object that draws paths only as a list of filled and stroked shapes in the units of the object: the transforms applied, every path made of moves, lines, quadratic and cubic curves and closes (rectangles, ellipses, arcs and rounded rectangles drawn as those), and every shape with its color. |
|
Package segment serves documents to readers a few pages at a time, each segment sealed for a key pair the reader makes for that one request (docs/spec.md §3.6, docs/design.md §3.30).
|
Package segment serves documents to readers a few pages at a time, each segment sealed for a key pair the reader makes for that one request (docs/spec.md §3.6, docs/design.md §3.30). |
|
Package sign signs BDF documents and verifies their signatures, so that a change made to a document after it was signed is found (spec §3.7).
|
Package sign signs BDF documents and verifies their signatures, so that a change made to a document after it was signed is found (spec §3.7). |
|
text
|
|
|
markdownbdf
Package markdownbdf writes a document as Markdown: the structure its MARKs carry (headings, paragraphs, lists, tables, figures with their alternative texts; docs/spec.md §7.8) as the blocks of GitHub Flavored Markdown, the fonts of its runs as emphasis and code, its LINKs as links and its images as files beside the text.
|
Package markdownbdf writes a document as Markdown: the structure its MARKs carry (headings, paragraphs, lists, tables, figures with their alternative texts; docs/spec.md §7.8) as the blocks of GitHub Flavored Markdown, the fonts of its runs as emphasis and code, its LINKs as links and its images as files beside the text. |
|
Package thumbnail draws a thumbnail image of a BDF document: the top of the first page of a text document, the whole first slide or drawing, or the top-left corner of a spreadsheet.
|
Package thumbnail draws a thumbnail image of a BDF document: the top of the first page of a text document, the whole first slide or drawing, or the top-left corner of a spreadsheet. |
|
tools
|
|
|
fakeprinter
command
Command fakeprinter runs a farm of fake printers (print/fakeprinter) from a YAML file: printers of IPP, ipps, the raw port 9100, LPD and serial lines (pseudo-terminals), and CUPS servers with classes, each of a preset kind, failing as their faults say.
|
Command fakeprinter runs a farm of fake printers (print/fakeprinter) from a YAML file: printers of IPP, ipps, the raw port 9100, LPD and serial lines (pseudo-terminals), and CUPS servers with classes, each of a preset kind, failing as their faults say. |
|
gen-drawio-awsmap
command
Command gen-drawio-awsmap writes the table the drawio converter draws the shapes of older AWS icon generations with (converter/drawio/ aws_legacy_table.go): for every shape name of mxgraph.aws (stencils/aws), mxgraph.aws2 (stencils/aws2), mxgraph.aws3 (stencils/aws3.xml) and mxgraph.aws3d (stencils/aws3d.xml and mxAWS3D.js), the style that draw.io's current AWS palette (Sidebar-AWS4.js) draws the same service or resource with, or none.
|
Command gen-drawio-awsmap writes the table the drawio converter draws the shapes of older AWS icon generations with (converter/drawio/ aws_legacy_table.go): for every shape name of mxgraph.aws (stencils/aws), mxgraph.aws2 (stencils/aws2), mxgraph.aws3 (stencils/aws3.xml) and mxgraph.aws3d (stencils/aws3d.xml and mxAWS3D.js), the style that draw.io's current AWS palette (Sidebar-AWS4.js) draws the same service or resource with, or none. |
|
gen-drawio-stencils
command
Command gen-drawio-stencils writes the draw.io stencil libraries that the drawio converter embeds (converter/drawio/stencils): it reads the stencil XML files of a draw.io release, drops what drawing does not use (the <connections> elements, comments and the whitespace between elements), rounds coordinates to a precision the stencil's size cannot show, writes the steps of each <path> as a compact d attribute ("M44 11L44 9C…", which the converter expands back into elements when it parses the file), and stores each file gzip-compressed, together with the license.
|
Command gen-drawio-stencils writes the draw.io stencil libraries that the drawio converter embeds (converter/drawio/stencils): it reads the stencil XML files of a draw.io release, drops what drawing does not use (the <connections> elements, comments and the whitespace between elements), rounds coordinates to a precision the stencil's size cannot show, writes the steps of each <path> as a compact d attribute ("M44 11L44 9C…", which the converter expands back into elements when it parses the file), and stores each file gzip-compressed, together with the license. |
|
gen-newstroke
command
Command gen-newstroke writes the stroke font the KiCad converter draws text with (converter/kicad/newstroke.txt.gz): NewStroke by Vladimir Uryvaev, the plotter font KiCad was designed with, as its author released it under CC0.
|
Command gen-newstroke writes the stroke font the KiCad converter draws text with (converter/kicad/newstroke.txt.gz): NewStroke by Vladimir Uryvaev, the plotter font KiCad was designed with, as its author released it under CC0. |
|
gen-smufl
command
Command gen-smufl writes the music symbols that the score engraver embeds (converter/internal/music/smufl): it reads a release of Bravura, the SMuFL reference font, and its metadata, and writes the outlines of the glyphs the engraver draws, their advance widths, bounding boxes and anchors (where stems and flags attach), and the font's engraving defaults (line thicknesses) as a Go table, together with the license.
|
Command gen-smufl writes the music symbols that the score engraver embeds (converter/internal/music/smufl): it reads a release of Bravura, the SMuFL reference font, and its metadata, and writes the outlines of the glyphs the engraver draws, their advance widths, bounding boxes and anchors (where stems and flags attach), and the font's engraving defaults (line thicknesses) as a Go table, together with the license. |
|
vector
|
|
|
internal/export
Package export holds what the writers of PDF and PostScript files share: the pen that writes the segments of Canvas paths as the operators of both, and the readings of a document's paints and instructions.
|
Package export holds what the writers of PDF and PostScript files share: the pen that writes the segments of Canvas paths as the operators of both, and the readings of a document's paints and instructions. |
|
internal/flatten
Package flatten draws as pictures what a vector format without transparency cannot draw (PostScript, vector/psbdf): the rectangles of a page where something is drawn with alpha, a blend mode, a group or a soft mask, a shadow or a filter are collected, merged until none overlap, and drawn by the image renderer with all that the page draws there.
|
Package flatten draws as pictures what a vector format without transparency cannot draw (PostScript, vector/psbdf): the rectangles of a page where something is drawn with alpha, a blend mode, a group or a soft mask, a shadow or a filter are collected, merged until none overlap, and drawn by the image renderer with all that the page draws there. |
|
internal/vectortest
Package vectortest holds what the tests of the vector exporters share: the fonts and documents they write, and how their pages are compared.
|
Package vectortest holds what the tests of the vector exporters share: the fonts and documents they write, and how their pages are compared. |
|
pdfbdf
Package pdfbdf writes BDF documents as PDF files, for what a PDF is there for: printing, filing, sending to those who have no viewer of BDF.
|
Package pdfbdf writes BDF documents as PDF files, for what a PDF is there for: printing, filing, sending to those who have no viewer of BDF. |
|
psbdf
Package psbdf writes BDF documents as PostScript (Level 3), for the printers that take PostScript and not PDF: office printers of the years before PDF was common, the PostScript of other makers (KPDL, BR-Script), and large-format PostScript printers.
|
Package psbdf writes BDF documents as PostScript (Level 3), for the printers that take PostScript and not PDF: office printers of the years before PDF was common, the PostScript of other makers (KPDL, BR-Script), and large-format PostScript printers. |