Documentation ¶
Index ¶
- func ApplyDocumentUnits(svg *Csvg__svg, ladder *Ladder) error
- func ApplyDocumentUnitsScaleLayout(svg *Csvg__svg, layout *Layout) error
- func DiffPosition(from, to geo.Point) geo.Point
- func GetImageBoxesForTextFields(textfields map[string]extract.TextField, heightPx, widthPx int, vanilla bool, ...) ([]optical.Box, error)
- func GetImageBoxesForTextFieldsFromTemplate(svgLayoutPath, spreadName string, widthPx, heightPx int, vanilla bool, ...) ([]optical.Box, error)
- func PrettyPrintLayout(layout *Layout) error
- func PrettyPrintStruct(layout interface{}) error
- func PrintLayout(layout *Layout) error
- func RenderSpread(svgLayoutPath string, spreadName string, previousImagePath string, ...) error
- func RenderSpreadExtra(contents SpreadContents) error
- func ScaleTextFieldGeometry(textfields *(map[string]extract.TextField), heightPx int) error
- func ScaleTextFieldGeometryInSpread(spread *Spread, scaleFactor float64) error
- func SwapTextFieldXCoordsInSpread(spread *Spread) error
- func SwitchTextFieldOriginInSpread(spread *Spread, width, height float64) error
- func TranslatePosition(pos, vec geo.Point) geo.Point
- func UnmarshalComboBox(cb *ComboBox) error
- func UnmarshalTextPrefill(tp *TextPrefill) error
- type Action
- type CRDF__rdf
- type CWork__cc
- type Cdefs__svg
- type Cdesc__svg
- type Cformat__dc
- type Cg__svg
- type Cmetadata__svg
- type Cnamedview__sodipodi
- type ComboBox
- type ComboOptions
- type Cpath__svg
- type Crect__svg
- type Csvg__svg
- type Ctitle__dc
- type Ctitle__svg
- type Ctype__dc
- type DocComboBoxes
- type DocPrefills
- type ImageInsert
- type Ladder
- type Layout
- type MetaData
- type PageComboBoxes
- type PagePrefills
- type Paragraph
- type Spread
- type SpreadContents
- type TextField
- type TextPrefill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDocumentUnits ¶
func GetImageBoxesForTextFields ¶ added in v0.5.0
func GetImageBoxesForTextFields(textfields map[string]extract.TextField, heightPx, widthPx int, vanilla bool, expand int) ([]optical.Box, error)
the textfields we will get are in a map TODO control vanilla at design time, e.g. via custom field in page data TODO figure out a way to have mixed background boxes (... just, you know, in case ...) note heightPx and widthPx are for the "previousImage" which can't be predicted from the PDF because the size depends on the quality settings in the flattening process
func GetImageBoxesForTextFieldsFromTemplate ¶ added in v0.5.0
func PrettyPrintLayout ¶
func PrettyPrintStruct ¶
func PrettyPrintStruct(layout interface{}) error
func PrintLayout ¶
func RenderSpread ¶
func RenderSpreadExtra ¶
func RenderSpreadExtra(contents SpreadContents) error
func ScaleTextFieldGeometry ¶ added in v0.5.0
func ScaleTextFieldGeometryInSpread ¶ added in v0.5.0
func SwapTextFieldXCoordsInSpread ¶ added in v0.5.0
func SwitchTextFieldOriginInSpread ¶ added in v0.5.0
func UnmarshalComboBox ¶
func UnmarshalTextPrefill ¶
func UnmarshalTextPrefill(tp *TextPrefill) error
Types ¶
type CWork__cc ¶
type CWork__cc struct { XMLName xml.Name `xml:"Work,omitempty" json:"Work,omitempty"` AttrRdfSpaceabout string `xml:"http://www.w3.org/1999/02/22-rdf-syntax-ns# about,attr" json:",omitempty"` Cformat__dc *Cformat__dc `xml:"http://purl.org/dc/elements/1.1/ format,omitempty" json:"format,omitempty"` Ctitle__dc *Ctitle__dc `xml:"http://purl.org/dc/elements/1.1/ title,omitempty" json:"title,omitempty"` Ctype__dc *Ctype__dc `xml:"http://purl.org/dc/elements/1.1/ type,omitempty" json:"type,omitempty"` }
type Cdefs__svg ¶
type Cdesc__svg ¶
type Cformat__dc ¶
type Cg__svg ¶
type Cg__svg struct { XMLName xml.Name `xml:"g,omitempty" json:"g,omitempty"` AttrInkscapeSpacegroupmode string `xml:"http://www.inkscape.org/namespaces/inkscape groupmode,attr" json:",omitempty"` Attrid string `xml:"id,attr" json:",omitempty"` AttrInkscapeSpacelabel string `xml:"http://www.inkscape.org/namespaces/inkscape label,attr" json:",omitempty"` Attrstyle string `xml:"style,attr" json:",omitempty"` Cpath__svg []*Cpath__svg `xml:"http://www.w3.org/2000/svg path,omitempty" json:"path,omitempty"` Crect__svg []*Crect__svg `xml:"http://www.w3.org/2000/svg rect,omitempty" json:"rect,omitempty"` Transform string `xml:"transform,attr" json:",omitempty"` }
type Cmetadata__svg ¶
type Cnamedview__sodipodi ¶
type Cnamedview__sodipodi struct { XMLName xml.Name `xml:"namedview,omitempty" json:"namedview,omitempty"` Attrbordercolor string `xml:"bordercolor,attr" json:",omitempty"` Attrborderopacity string `xml:"borderopacity,attr" json:",omitempty"` AttrInkscapeSpacecurrent_dash_layer string `xml:"http://www.inkscape.org/namespaces/inkscape current-layer,attr" json:",omitempty"` AttrInkscapeSpacecx string `xml:"http://www.inkscape.org/namespaces/inkscape cx,attr" json:",omitempty"` AttrInkscapeSpacecy string `xml:"http://www.inkscape.org/namespaces/inkscape cy,attr" json:",omitempty"` AttrInkscapeSpacedocument_dash_units string `xml:"http://www.inkscape.org/namespaces/inkscape document-units,attr" json:",omitempty"` Attrid string `xml:"id,attr" json:",omitempty"` Attrpagecolor string `xml:"pagecolor,attr" json:",omitempty"` AttrInkscapeSpacepageopacity string `xml:"http://www.inkscape.org/namespaces/inkscape pageopacity,attr" json:",omitempty"` AttrInkscapeSpacepageshadow string `xml:"http://www.inkscape.org/namespaces/inkscape pageshadow,attr" json:",omitempty"` Attrshowgrid string `xml:"showgrid,attr" json:",omitempty"` AttrInkscapeSpacesnap_dash_center string `xml:"http://www.inkscape.org/namespaces/inkscape snap-center,attr" json:",omitempty"` AttrInkscapeSpacesnap_dash_global string `xml:"http://www.inkscape.org/namespaces/inkscape snap-global,attr" json:",omitempty"` AttrInkscapeSpacesnap_dash_page string `xml:"http://www.inkscape.org/namespaces/inkscape snap-page,attr" json:",omitempty"` AttrInkscapeSpacewindow_dash_height string `xml:"http://www.inkscape.org/namespaces/inkscape window-height,attr" json:",omitempty"` AttrInkscapeSpacewindow_dash_maximized string `xml:"http://www.inkscape.org/namespaces/inkscape window-maximized,attr" json:",omitempty"` AttrInkscapeSpacewindow_dash_width string `xml:"http://www.inkscape.org/namespaces/inkscape window-width,attr" json:",omitempty"` AttrInkscapeSpacewindow_dash_x string `xml:"http://www.inkscape.org/namespaces/inkscape window-x,attr" json:",omitempty"` AttrInkscapeSpacewindow_dash_y string `xml:"http://www.inkscape.org/namespaces/inkscape window-y,attr" json:",omitempty"` AttrInkscapeSpacezoom string `xml:"http://www.inkscape.org/namespaces/inkscape zoom,attr" json:",omitempty"` }
type ComboBox ¶
type ComboBox struct { Rect geo.Rect ID string Properties string Options ComboOptions }
type ComboOptions ¶
type ComboOptions struct {
Options []string `json:"options"`
}
type Cpath__svg ¶
type Cpath__svg struct { XMLName xml.Name `xml:"path,omitempty" json:"path,omitempty"` Cx string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd cx,attr" json:",omitempty"` Cy string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd cy,attr" json:",omitempty"` Attrd string `xml:"d,attr" json:",omitempty"` AttrSodipodiSpaceend string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd end,attr" json:",omitempty"` ID string `xml:"id,attr" json:",omitempty"` AttrSodipodiSpaceopen string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd open,attr" json:",omitempty"` AttrSodipodiSpacerx string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd rx,attr" json:",omitempty"` AttrSodipodiSpacery string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd ry,attr" json:",omitempty"` AttrSodipodiSpacestart string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd start,attr" json:",omitempty"` Attrstyle string `xml:"style,attr" json:",omitempty"` Transform string `xml:"transform,attr" json:",omitempty"` AttrSodipodiSpacetype string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd type,attr" json:",omitempty"` Desc *Cdesc__svg `xml:"http://www.w3.org/2000/svg desc,omitempty" json:"desc,omitempty"` Title *Ctitle__svg `xml:"http://www.w3.org/2000/svg title,omitempty" json:"title,omitempty"` }
type Crect__svg ¶
type Crect__svg struct { XMLName xml.Name `xml:"rect,omitempty" json:"rect,omitempty"` Height string `xml:"height,attr" json:",omitempty"` Id string `xml:"id,attr" json:",omitempty"` Attrstyle string `xml:"style,attr" json:",omitempty"` Width string `xml:"width,attr" json:",omitempty"` Rx string `xml:"x,attr" json:",omitempty"` Ry string `xml:"y,attr" json:",omitempty"` Desc *Cdesc__svg `xml:"http://www.w3.org/2000/svg desc,omitempty" json:"desc,omitempty"` Title *Ctitle__svg `xml:"http://www.w3.org/2000/svg title,omitempty" json:"title,omitempty"` Transform string `xml:"transform,attr" json:",omitempty"` }
type Csvg__svg ¶
type Csvg__svg struct { XMLName xml.Name `xml:"svg,omitempty" json:"svg,omitempty"` AttrXmlnscc string `xml:"xmlns cc,attr" json:",omitempty"` AttrXmlnsdc string `xml:"xmlns dc,attr" json:",omitempty"` AttrSodipodiSpacedocname string `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd docname,attr" json:",omitempty"` AttrInkscapeSpaceexport_dash_filename string `xml:"http://www.inkscape.org/namespaces/inkscape export-filename,attr" json:",omitempty"` AttrInkscapeSpaceexport_dash_xdpi string `xml:"http://www.inkscape.org/namespaces/inkscape export-xdpi,attr" json:",omitempty"` AttrInkscapeSpaceexport_dash_ydpi string `xml:"http://www.inkscape.org/namespaces/inkscape export-ydpi,attr" json:",omitempty"` Height string `xml:"height,attr" json:",omitempty"` Attrid string `xml:"id,attr" json:",omitempty"` AttrXmlnsinkscape string `xml:"xmlns inkscape,attr" json:",omitempty"` AttrXmlnsrdf string `xml:"xmlns rdf,attr" json:",omitempty"` AttrXmlnssodipodi string `xml:"xmlns sodipodi,attr" json:",omitempty"` AttrXmlnssvg string `xml:"xmlns svg,attr" json:",omitempty"` Attrversion string `xml:"version,attr" json:",omitempty"` AttrviewBox string `xml:"viewBox,attr" json:",omitempty"` Width string `xml:"width,attr" json:",omitempty"` Attrxmlns string `xml:"xmlns,attr" json:",omitempty"` Cdefs__svg *Cdefs__svg `xml:"http://www.w3.org/2000/svg defs,omitempty" json:"defs,omitempty"` Cg__svg []*Cg__svg `xml:"http://www.w3.org/2000/svg g,omitempty" json:"g,omitempty"` Cmetadata__svg *Cmetadata__svg `xml:"http://www.w3.org/2000/svg metadata,omitempty" json:"metadata,omitempty"` Cnamedview__sodipodi *Cnamedview__sodipodi `xml:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd namedview,omitempty" json:"namedview,omitempty"` Ctitle__svg *Ctitle__svg `xml:"http://www.w3.org/2000/svg title,omitempty" json:"title,omitempty"` }
type Ctitle__dc ¶
type Ctitle__svg ¶
type DocComboBoxes ¶
type DocComboBoxes map[int]PageComboBoxes
type DocPrefills ¶
type DocPrefills map[int]PagePrefills
type Ladder ¶
type Ladder struct { Anchor geo.Point Dim geo.Dim ID string TextFields []TextField TextPrefills []TextPrefill ComboBoxes []ComboBox }
func DefineLadderFromSVG ¶
type Layout ¶
type Layout struct { Anchor geo.Point `json:"anchor"` Dim geo.Dim `json:"dim"` ID string `json:"id"` Anchors map[string]geo.Point `json:"anchors"` PageDims map[string]geo.Dim `json:"pageDims"` Filenames map[string]string `json:"filenames"` ImageDims map[string]geo.Dim `json:"ImageDims"` }
func DefineLayoutFromSVG ¶
type PageComboBoxes ¶
type PageComboBoxes map[string]ComboOptions
type PagePrefills ¶
type Paragraph ¶
type Paragraph struct { Text string `json:"text"` TextFont string `json:"textFont"` TextSize float64 `json:"textSize"` LineHeight float64 `json:"lineHeight"` Alignment string `json:"alignment"` EnableWrap bool `json:"enableWrap"` WrapWidth float64 `json:"wrapWidth"` Angle float64 `json:"angle"` AbsolutePositioning bool `json:"absolutePositioning"` Margins []float64 `json:"margins"` XPos float64 `json:"xpos"` YPos float64 `json:"ypos"` ColorHex string `json:"colorHex"` }
we read the properties from a JSON object in the Description field and then apply when writing the text field - these are private fields in the Paragraph struct in unipdf
type Spread ¶
type Spread struct { Name string Dim geo.Dim ExtraWidth float64 Images []ImageInsert Ladders []Ladder TextFields []TextField TextPrefills []TextPrefill ComboBoxes []ComboBox }
TODO move this to types.go; add json tags
func GetTextFieldSpread ¶ added in v0.5.0
zero,zero is upper right for this (swap in X) because the page width is dynamic, coordinate with respect left hand side of page varies from page to page depending on page si this is a cut-down version of render i.e. same logic textfield coordinates look obfuscated in the unipdf extraction tool so we use our layout to find them, rather than read them from the file
type SpreadContents ¶
type SpreadContents struct { SvgLayoutPath string SpreadName string PreviousImagePath string PrefillImagePaths map[string]string Comments comment.Comments PageNumber int PdfOutputPath string Exam string Candidate string PageData pagedata.PageData Prefills DocPrefills ComboBoxes DocComboBoxes TemplatePathsRelative bool PrefillImagePathsRelative bool }