Documentation
¶
Index ¶
- Constants
- func Close() error
- func Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
- func ConvertPDFToPNG(pdfData []byte, outputPath string, dpi int) error
- func ConvertSVGToPDF(svgBytes []byte) ([]byte, error)
- func ConvertSVGToPNG(svgBytes []byte) ([]byte, error)
- func ConvertWithFallback(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
- func ExtractSVGDimensions(svgBytes []byte) (float64, float64, error)
- func GetAvailableConverters() []string
- func GetPreferred() string
- func GetSupportedFormats() []string
- func NewConverterError(converter, operation string, err error) error
- func SaveAnalysisDebugImage(imagePath, outputPath string, result *LayoutAnalysisResult) error
- func SetPreferred(name string) error
- type Bounds
- type Box
- type BoxBuilder
- func (b *BoxBuilder) AddLabel(label Label) *BoxBuilder
- func (b *BoxBuilder) AddLine(line Line) *BoxBuilder
- func (b *BoxBuilder) Build() Box
- func (b *BoxBuilder) WithBorder(line api.Line) *BoxBuilder
- func (b *BoxBuilder) WithBorderColor(color api.Color) *BoxBuilder
- func (b *BoxBuilder) WithBorders(borders *api.Borders) *BoxBuilder
- func (b *BoxBuilder) WithLabel(label string, positionOrStyle ...string) *BoxBuilder
- func (b *BoxBuilder) WithLabels(labels []Label) *BoxBuilder
- func (b *BoxBuilder) WithLines(lines []Line) *BoxBuilder
- func (b *BoxBuilder) WithRectangle(rect api.Rectangle) *BoxBuilder
- func (b *BoxBuilder) WithSize(width, height int) *BoxBuilder
- type ChildBox
- type ChromiumConverter
- func (c *ChromiumConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
- func (c *ChromiumConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
- func (c *ChromiumConverter) GetChromePath() string
- func (c *ChromiumConverter) IsAvailable() bool
- func (c *ChromiumConverter) Name() string
- func (c *ChromiumConverter) SupportedFormats() []string
- type Circle
- type CircleShape
- type ConvertOptions
- type ConverterError
- type ConverterType
- type Cut
- type EdgeCut
- type FontSize
- type HorizontalPosition
- type InkscapeConverter
- func (c *InkscapeConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
- func (c *InkscapeConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
- func (c *InkscapeConverter) IsAvailable() bool
- func (c *InkscapeConverter) Name() string
- func (c *InkscapeConverter) SupportedFormats() []string
- type InsidePosition
- type Label
- type LabelBounds
- type LabelPosition
- type LayoutAnalysisResult
- type Line
- type MM
- type MeasureLine
- type PaddingBox
- type PlaywrightConverter
- func (c *PlaywrightConverter) Close() error
- func (c *PlaywrightConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
- func (c *PlaywrightConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
- func (c *PlaywrightConverter) IsAvailable() bool
- func (c *PlaywrightConverter) Name() string
- func (c *PlaywrightConverter) SupportedFormats() []string
- type Point
- type Positionable
- type PositionedLabel
- type RSVGConverter
- func (c *RSVGConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
- func (c *RSVGConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
- func (c *RSVGConverter) IsAvailable() bool
- func (c *RSVGConverter) Name() string
- func (c *RSVGConverter) SupportedFormats() []string
- type Rem
- type SVGBox
- type SVGBoxBuilder
- func (b *SVGBoxBuilder) AddChildBox(child ChildBox) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddChildBoxAt(x, y float64, childBox SVGBox) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddCircle(x, y, diameter float64, label ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddCircleShape(circle CircleShape) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddCut(orientation string, position, width, depth float64, label ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddEdgeCut(edge string, width, depth float64, label ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddLabel(label Label) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddLine(x1, y1, x2, y2 float64, styles ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddMeasureLine(x1, y1, x2, y2 float64, label string, options ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) AddSVGLine(line SVGLine) *SVGBoxBuilder
- func (b *SVGBoxBuilder) Build() SVGBox
- func (b *SVGBoxBuilder) WithActualSize(width, height float64) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithCollisionAvoidance(enable bool) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithFill(color api.Color) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithLabel(text, position string, styles ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithPadding(padding api.Padding) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithSVGPadding(padding float64) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithShowDimensions(show bool, unit ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithSize(width, height int) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithStyle(styles ...string) *SVGBoxBuilder
- func (b *SVGBoxBuilder) WithYAxisUp(up bool) *SVGBoxBuilder
- type SVGConverter
- type SVGConverterManager
- type SVGLine
- type SVGWidget
- type VerticalPosition
Constants ¶
const ( VerticalTop VerticalPosition = "top" VerticalBottom VerticalPosition = "bottom" VerticalCenter VerticalPosition = "" // center is the default HorizontalLeft HorizontalPosition = "left" HorizontalRight HorizontalPosition = "right" HorizontalCenter HorizontalPosition = "" // center is the default InsideTop InsidePosition = "" // inside is the default InsideBottom InsidePosition = "outside" )
const ( // 1 point = 25.4/72 mm (exact: 1/72 inch = 25.4mm/72) PointsToMM = 25.4 / 72.0 // 1 mm = 72/25.4 points (exact reciprocal) MMToPoints = 72.0 / 25.4 // 1 rem = 12 points (common web default) RemToPoints = 12.0 // 1 rem = 4.233333... mm (12pt converted to mm) RemToMM = RemToPoints * PointsToMM )
Unit conversion constants
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
Convert converts an SVG file using the best available converter
func ConvertPDFToPNG ¶
ConvertPDFToPNG converts a PDF to PNG using Ghostscript or ImageMagick
func ConvertSVGToPDF ¶
ConvertSVGToPDF converts SVG bytes to PDF bytes
func ConvertSVGToPNG ¶
ConvertSVGToPNG converts SVG bytes to PNG bytes with aspect ratio preservation
func ConvertWithFallback ¶
func ConvertWithFallback(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
ConvertWithFallback attempts conversion with fallback to other converters
func ExtractSVGDimensions ¶
ExtractSVGDimensions parses SVG content to extract width and height
func GetAvailableConverters ¶
func GetAvailableConverters() []string
GetAvailableConverters returns a list of available converter names
func GetSupportedFormats ¶
func GetSupportedFormats() []string
GetSupportedFormats returns all formats supported by at least one converter
func NewConverterError ¶
NewConverterError creates a new converter error
func SaveAnalysisDebugImage ¶
func SaveAnalysisDebugImage(imagePath, outputPath string, result *LayoutAnalysisResult) error
SaveAnalysisDebugImage saves a debug version of the image with column boundaries marked
func SetPreferred ¶
SetPreferred sets the preferred converter by name
Types ¶
type Bounds ¶
type Bounds struct {
X int `json:"x"`
Y int `json:"y"`
Width int `json:"width"`
Height int `json:"height"`
}
Bounds represents a rectangular area
type Box ¶
func NewBorderedBox ¶
NewBorderedBox creates a box with borders and optional label
func NewCardBox ¶
NewCardBox creates a card-style box with border and title
func NewSimpleBox ¶
NewSimpleBox creates a simple box with dimensions and optional label
func NewTitledBox ¶
NewTitledBox creates a box with a title label at the top
type BoxBuilder ¶
type BoxBuilder struct {
// contains filtered or unexported fields
}
BoxBuilder provides a fluent API for creating Box instances
func (*BoxBuilder) AddLabel ¶
func (b *BoxBuilder) AddLabel(label Label) *BoxBuilder
AddLabel adds a pre-built Label to the box
func (*BoxBuilder) AddLine ¶
func (b *BoxBuilder) AddLine(line Line) *BoxBuilder
AddLine adds a line to the box
func (*BoxBuilder) Build ¶
func (b *BoxBuilder) Build() Box
Build creates and returns the Box instance
func (*BoxBuilder) WithBorder ¶
func (b *BoxBuilder) WithBorder(line api.Line) *BoxBuilder
WithBorder sets all borders to the same line style
func (*BoxBuilder) WithBorderColor ¶
func (b *BoxBuilder) WithBorderColor(color api.Color) *BoxBuilder
WithBorderColor sets all borders to the same color with default width
func (*BoxBuilder) WithBorders ¶
func (b *BoxBuilder) WithBorders(borders *api.Borders) *BoxBuilder
WithBorders sets the borders of the box
func (*BoxBuilder) WithLabel ¶
func (b *BoxBuilder) WithLabel(label string, positionOrStyle ...string) *BoxBuilder
WithLabel adds a label to the box using variadic parameters First parameter is the label text Additional parameters can be position ("top-left") or styles ("font-bold")
func (*BoxBuilder) WithLabels ¶
func (b *BoxBuilder) WithLabels(labels []Label) *BoxBuilder
WithLabels sets multiple labels at once
func (*BoxBuilder) WithLines ¶
func (b *BoxBuilder) WithLines(lines []Line) *BoxBuilder
WithLines sets multiple lines at once
func (*BoxBuilder) WithRectangle ¶
func (b *BoxBuilder) WithRectangle(rect api.Rectangle) *BoxBuilder
WithRectangle sets the rectangle dimensions using an api.Rectangle
func (*BoxBuilder) WithSize ¶
func (b *BoxBuilder) WithSize(width, height int) *BoxBuilder
WithSize sets the width and height of the box
type ChildBox ¶
type ChildBox struct {
Box SVGBox // The child box
X float64 // X position on parent
Y float64 // Y position on parent
}
ChildBox represents a box positioned within another box
type ChromiumConverter ¶
type ChromiumConverter struct {
// contains filtered or unexported fields
}
ChromiumConverter implements SVGConverter using Chrome/Chromium headless mode
func NewChromiumConverter ¶
func NewChromiumConverter() *ChromiumConverter
NewChromiumConverter creates a new Chromium converter
func (*ChromiumConverter) Convert ¶
func (c *ChromiumConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
Convert converts an SVG file using Chrome/Chromium headless mode
func (*ChromiumConverter) ConvertToFormat ¶
func (c *ChromiumConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
ConvertToFormat is a convenience method that determines output path based on format
func (*ChromiumConverter) GetChromePath ¶
func (c *ChromiumConverter) GetChromePath() string
GetChromePath returns the detected Chrome path (for testing/debugging)
func (*ChromiumConverter) IsAvailable ¶
func (c *ChromiumConverter) IsAvailable() bool
IsAvailable checks if Chrome/Chromium is available on the system
func (*ChromiumConverter) Name ¶
func (c *ChromiumConverter) Name() string
Name returns the name of this converter
func (*ChromiumConverter) SupportedFormats ¶
func (c *ChromiumConverter) SupportedFormats() []string
SupportedFormats returns formats supported by Chrome/Chromium
type CircleShape ¶
CircleShape represents a circular shape in the box
type ConvertOptions ¶
type ConvertOptions struct {
// Output format (png, jpg, jpeg, pdf, eps, ps)
Format string
// Output width in pixels (0 = auto)
Width int
// Output height in pixels (0 = auto)
Height int
// DPI for raster formats (0 = default)
DPI int
// Background color (transparent if empty)
BackgroundColor string
// Quality for JPEG (0-100, 0 = default)
Quality int
}
ConvertOptions holds options for SVG conversion
func DefaultConvertOptions ¶
func DefaultConvertOptions() *ConvertOptions
DefaultConvertOptions returns default conversion options
type ConverterError ¶
ConverterError represents an error from a converter
func (*ConverterError) Error ¶
func (e *ConverterError) Error() string
func (*ConverterError) Unwrap ¶
func (e *ConverterError) Unwrap() error
type ConverterType ¶
type ConverterType string
ConverterType represents the type of SVG converter
const ( ConverterTypeInkscape ConverterType = "inkscape" ConverterTypeRSVG ConverterType = "rsvg" ConverterTypeChromium ConverterType = "chromium" ConverterTypePlaywright ConverterType = "playwright" )
type Cut ¶
type Cut struct {
Orientation string // "horizontal" or "vertical"
Position float64
Width float64
Depth float64
Label string
}
Cut represents a rectangular cut in the box
type EdgeCut ¶
type EdgeCut struct {
Edge string // "left", "right", "top", "bottom"
Width float64
Depth float64
Label string
}
EdgeCut represents a cut along an edge of the box
type FontSize ¶
type FontSize Point
FontSize represents a font size in points (standard unit for typography)
func NewFontSize ¶
NewFontSize creates a new FontSize value
func (FontSize) LineHeight ¶
LineHeight calculates line height with a given multiplier
type HorizontalPosition ¶
type HorizontalPosition string
type InkscapeConverter ¶
type InkscapeConverter struct{}
InkscapeConverter implements SVGConverter using Inkscape
func NewInkscapeConverter ¶
func NewInkscapeConverter() *InkscapeConverter
NewInkscapeConverter creates a new Inkscape converter
func (*InkscapeConverter) Convert ¶
func (c *InkscapeConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
Convert converts an SVG file using Inkscape
func (*InkscapeConverter) ConvertToFormat ¶
func (c *InkscapeConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
ConvertToFormat is a convenience method that determines output path based on format
func (*InkscapeConverter) IsAvailable ¶
func (c *InkscapeConverter) IsAvailable() bool
IsAvailable checks if Inkscape is available in PATH
func (*InkscapeConverter) Name ¶
func (c *InkscapeConverter) Name() string
Name returns the name of this converter
func (*InkscapeConverter) SupportedFormats ¶
func (c *InkscapeConverter) SupportedFormats() []string
SupportedFormats returns formats supported by Inkscape
type InsidePosition ¶
type InsidePosition string
type Label ¶
type Label struct {
Positionable
api.Text
}
type LabelBounds ¶
LabelBounds represents the rectangular bounds of a label
type LabelPosition ¶
type LabelPosition struct {
Vertical VerticalPosition
Horizontal HorizontalPosition
Inside InsidePosition
}
func ParsePosition ¶
func ParsePosition(s string) LabelPosition
ParsePosition parses position strings like "center", "top-left", "bottom-right-outside"
type LayoutAnalysisResult ¶
type LayoutAnalysisResult struct {
PageWidth int `json:"page_width"`
PageHeight int `json:"page_height"`
LeftColumnBounds *Bounds `json:"left_column_bounds"`
RightColumnBounds *Bounds `json:"right_column_bounds"`
LeftColumnWidth int `json:"left_column_width"`
RightColumnWidth int `json:"right_column_width"`
LeftColumnRatio float64 `json:"left_column_ratio"`
RightColumnRatio float64 `json:"right_column_ratio"`
HasSideBySideLayout bool `json:"has_side_by_side_layout"`
LayoutValid bool `json:"layout_valid"`
ValidationErrors []string `json:"validation_errors"`
}
LayoutAnalysisResult contains the results of analyzing a PDF layout
func AnalyzeImageLayout ¶
func AnalyzeImageLayout(imagePath string, targetLeftRatio, targetRightRatio float64) (*LayoutAnalysisResult, error)
AnalyzeImageLayout analyzes a PNG image to determine layout structure
func AnalyzePDFLayout ¶
func AnalyzePDFLayout(pdfData []byte, targetLeftRatio, targetRightRatio float64) (*LayoutAnalysisResult, error)
AnalyzePDFLayout converts a PDF to PNG and analyzes its layout structure
type MeasureLine ¶
type MeasureLine struct {
X1 float64
Y1 float64
X2 float64
Y2 float64
Label string
Offset float64 // Distance from the measured object
ShowArrows bool
Style string // "solid" or "dashed"
}
MeasureLine represents a dimension line with arrows and label
type PaddingBox ¶
PaddingBox represents padding for all four sides
type PlaywrightConverter ¶
type PlaywrightConverter struct {
// contains filtered or unexported fields
}
PlaywrightConverter implements SVGConverter using Playwright
func NewPlaywrightConverter ¶
func NewPlaywrightConverter() *PlaywrightConverter
NewPlaywrightConverter creates a new Playwright converter
func (*PlaywrightConverter) Close ¶
func (c *PlaywrightConverter) Close() error
Close closes the browser and Playwright instance
func (*PlaywrightConverter) Convert ¶
func (c *PlaywrightConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
Convert converts an SVG file using Playwright
func (*PlaywrightConverter) ConvertToFormat ¶
func (c *PlaywrightConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
ConvertToFormat is a convenience method that determines output path based on format
func (*PlaywrightConverter) IsAvailable ¶
func (c *PlaywrightConverter) IsAvailable() bool
IsAvailable checks if Playwright is available (lazy initialization)
func (*PlaywrightConverter) Name ¶
func (c *PlaywrightConverter) Name() string
Name returns the name of this converter
func (*PlaywrightConverter) SupportedFormats ¶
func (c *PlaywrightConverter) SupportedFormats() []string
SupportedFormats returns formats supported by Playwright
type Point ¶
type Point float64
Point represents a measurement in typographic points
type Positionable ¶
type Positionable struct {
Position *LabelPosition
// If both position and absolute is provided, absolute is relative to position
Absolute *api.Position
}
type PositionedLabel ¶
type PositionedLabel struct {
Label Label
X int
Y int
Anchor string
Bounds LabelBounds
}
PositionedLabel represents a label with calculated position
type RSVGConverter ¶
type RSVGConverter struct{}
RSVGConverter implements SVGConverter using rsvg-convert
func NewRSVGConverter ¶
func NewRSVGConverter() *RSVGConverter
NewRSVGConverter creates a new RSVG converter
func (*RSVGConverter) Convert ¶
func (c *RSVGConverter) Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
Convert converts an SVG file using rsvg-convert
func (*RSVGConverter) ConvertToFormat ¶
func (c *RSVGConverter) ConvertToFormat(ctx context.Context, svgPath, format string, options *ConvertOptions) (string, error)
ConvertToFormat is a convenience method that determines output path based on format
func (*RSVGConverter) IsAvailable ¶
func (c *RSVGConverter) IsAvailable() bool
IsAvailable checks if rsvg-convert is available in PATH
func (*RSVGConverter) Name ¶
func (c *RSVGConverter) Name() string
Name returns the name of this converter
func (*RSVGConverter) SupportedFormats ¶
func (c *RSVGConverter) SupportedFormats() []string
SupportedFormats returns formats supported by rsvg-convert
type Rem ¶
type Rem float64
Rem represents a measurement in CSS rem units
func (Rem) ToFontSize ¶
ToFontSize converts rem to FontSize (assuming rem is used for font sizing)
type SVGBox ¶
type SVGBox struct {
api.Box // Inherits Rectangle, Fill, Border, Padding
Labels []Label
Lines []SVGLine
Circles []CircleShape
Cuts []Cut
EdgeCuts []EdgeCut
MeasureLines []MeasureLine
ChildBoxes []ChildBox // Nested boxes positioned on this box
ShowDimensions bool
DimensionUnit string
ActualWidth float64
ActualHeight float64
SVGPadding float64 // Padding for the SVG canvas
EnableCollisionAvoidance bool // Enable automatic collision avoidance
YAxisUp bool // True for bottom-up (CNC/CAD), false for top-down (SVG default)
}
SVGBox generates an SVG representation of a box with labels and borders
func NewLayoutBox ¶
NewLayoutBox creates an SVG box for layout diagrams with child boxes
func NewSimpleSVGBox ¶
NewSimpleSVGBox creates a simple SVG box with dimensions and optional label
func NewTechnicalDrawing ¶
NewTechnicalDrawing creates an SVG box for technical drawings
func NewWoodworkingBox ¶
NewWoodworkingBox creates an SVG box suitable for woodworking diagrams
func (SVGBox) GenerateSVG ¶
GenerateSVG creates an SVG representation of the box
type SVGBoxBuilder ¶
type SVGBoxBuilder struct {
// contains filtered or unexported fields
}
SVGBoxBuilder provides a fluent API for creating SVGBox instances
func NewSVGBoxBuilder ¶
func NewSVGBoxBuilder() *SVGBoxBuilder
NewSVGBoxBuilder creates a new SVGBoxBuilder with sensible defaults
func (*SVGBoxBuilder) AddChildBox ¶
func (b *SVGBoxBuilder) AddChildBox(child ChildBox) *SVGBoxBuilder
AddChildBox adds a child box at the specified position
func (*SVGBoxBuilder) AddChildBoxAt ¶
func (b *SVGBoxBuilder) AddChildBoxAt(x, y float64, childBox SVGBox) *SVGBoxBuilder
AddChildBoxAt adds a child SVGBox at the specified coordinates
func (*SVGBoxBuilder) AddCircle ¶
func (b *SVGBoxBuilder) AddCircle(x, y, diameter float64, label ...string) *SVGBoxBuilder
AddCircle adds a circle to the SVG box with optional label
func (*SVGBoxBuilder) AddCircleShape ¶
func (b *SVGBoxBuilder) AddCircleShape(circle CircleShape) *SVGBoxBuilder
AddCircleShape adds a pre-built CircleShape to the SVG box
func (*SVGBoxBuilder) AddCut ¶
func (b *SVGBoxBuilder) AddCut(orientation string, position, width, depth float64, label ...string) *SVGBoxBuilder
AddCut adds a cut to the SVG box with optional label
func (*SVGBoxBuilder) AddEdgeCut ¶
func (b *SVGBoxBuilder) AddEdgeCut(edge string, width, depth float64, label ...string) *SVGBoxBuilder
AddEdgeCut adds an edge cut to the SVG box with optional label
func (*SVGBoxBuilder) AddLabel ¶
func (b *SVGBoxBuilder) AddLabel(label Label) *SVGBoxBuilder
AddLabel adds a pre-built Label to the SVG box
func (*SVGBoxBuilder) AddLine ¶
func (b *SVGBoxBuilder) AddLine(x1, y1, x2, y2 float64, styles ...string) *SVGBoxBuilder
AddLine adds a line to the SVG box with coordinates and optional styles
func (*SVGBoxBuilder) AddMeasureLine ¶
func (b *SVGBoxBuilder) AddMeasureLine(x1, y1, x2, y2 float64, label string, options ...string) *SVGBoxBuilder
AddMeasureLine adds a measure line to the SVG box
func (*SVGBoxBuilder) AddSVGLine ¶
func (b *SVGBoxBuilder) AddSVGLine(line SVGLine) *SVGBoxBuilder
AddSVGLine adds a pre-built SVGLine to the SVG box
func (*SVGBoxBuilder) Build ¶
func (b *SVGBoxBuilder) Build() SVGBox
Build creates and returns the SVGBox instance
func (*SVGBoxBuilder) WithActualSize ¶
func (b *SVGBoxBuilder) WithActualSize(width, height float64) *SVGBoxBuilder
WithActualSize sets the actual physical dimensions (for dimension display)
func (*SVGBoxBuilder) WithCollisionAvoidance ¶
func (b *SVGBoxBuilder) WithCollisionAvoidance(enable bool) *SVGBoxBuilder
WithCollisionAvoidance enables/disables automatic label collision avoidance
func (*SVGBoxBuilder) WithFill ¶
func (b *SVGBoxBuilder) WithFill(color api.Color) *SVGBoxBuilder
WithFill sets the fill color of the SVG box
func (*SVGBoxBuilder) WithLabel ¶
func (b *SVGBoxBuilder) WithLabel(text, position string, styles ...string) *SVGBoxBuilder
func (*SVGBoxBuilder) WithPadding ¶
func (b *SVGBoxBuilder) WithPadding(padding api.Padding) *SVGBoxBuilder
WithPadding sets the padding of the SVG box
func (*SVGBoxBuilder) WithSVGPadding ¶
func (b *SVGBoxBuilder) WithSVGPadding(padding float64) *SVGBoxBuilder
WithSVGPadding sets the SVG canvas padding
func (*SVGBoxBuilder) WithShowDimensions ¶
func (b *SVGBoxBuilder) WithShowDimensions(show bool, unit ...string) *SVGBoxBuilder
WithShowDimensions enables/disables dimension display with optional unit
func (*SVGBoxBuilder) WithSize ¶
func (b *SVGBoxBuilder) WithSize(width, height int) *SVGBoxBuilder
WithSize sets the width and height of the SVG box
func (*SVGBoxBuilder) WithStyle ¶
func (b *SVGBoxBuilder) WithStyle(styles ...string) *SVGBoxBuilder
WithStyle applies Tailwind-style classes to the SVG box, including border parsing
func (*SVGBoxBuilder) WithYAxisUp ¶
func (b *SVGBoxBuilder) WithYAxisUp(up bool) *SVGBoxBuilder
WithYAxisUp sets the Y-axis direction (true for bottom-up like CAD, false for top-down like SVG)
type SVGConverter ¶
type SVGConverter interface {
// Name returns the name of the converter
Name() string
// IsAvailable checks if the converter is available on the system
IsAvailable() bool
// SupportedFormats returns the list of output formats this converter supports
SupportedFormats() []string
// Convert converts an SVG file to the specified format
Convert(ctx context.Context, svgPath, outputPath string, options *ConvertOptions) error
}
SVGConverter defines the interface for converting SVG files to other formats
func GetConverter ¶
func GetConverter(name string) (SVGConverter, error)
GetConverter returns a converter by name
type SVGConverterManager ¶
type SVGConverterManager struct {
// contains filtered or unexported fields
}
SVGConverterManager manages multiple SVG converters with fallback support
func NewSVGConverterManager ¶
func NewSVGConverterManager() *SVGConverterManager
NewSVGConverterManager creates a new converter manager
func (*SVGConverterManager) GetBestConverter ¶
func (m *SVGConverterManager) GetBestConverter(format string) (SVGConverter, error)
GetBestConverter returns the best available converter for the given format
type SVGLine ¶
type SVGLine struct {
X1 float64 // Start X coordinate
Y1 float64 // Start Y coordinate
X2 float64 // End X coordinate
Y2 float64 // End Y coordinate
Line api.Line // Styling information
}
SVGLine represents a geometric line with coordinates and styling
type SVGWidget ¶
SVGWidget renders an SVGBox as a widget in the PDF
func NewSVGWidget ¶
NewSVGWidget creates a new SVG widget from an SVGBox
func (*SVGWidget) WithHeight ¶
WithHeight sets the height of the SVG widget in mm
type VerticalPosition ¶
type VerticalPosition string