Skip to content
LpdfDocsv0.28-r1020.7

Lpdf is pre-release. The XML schema and SDK APIs can change between releases.

Path

Draws an arbitrary shape in a layer using SVG path data. Supports filled shapes, stroked outlines, and complex curves.

Attribute Type Default Description
d string — Required. SVG path data (M, L, H, V, C, Q, Z)
fill color or gradient:name — Fill: a color, or a gradient that spans the path’s bounding box
stroke color — Stroke color
fill-rule string nonzero nonzero or evenodd
stroke-width pt — Stroke width
stroke-dash string — Dash pattern
line-cap string butt butt round square

A path has no box, so it does not support anchor. Use absolute coordinates in the d attribute. To fade a path, put it in a layer with opacity.

<layer opacity="0.8">
<path d="M 200pt 100pt L 350pt 300pt L 50pt 300pt Z" fill="#1a73e8"/>
</layer>
<path d="M 40pt 200pt L 200pt 200pt M 180pt 185pt L 200pt 200pt L 180pt 215pt"
stroke="#333333" stroke-width="2pt" line-cap="round"/>

Complex shape with a hole (evenodd fill rule)

Section titled “Complex shape with a hole (evenodd fill rule)”
<layer opacity="0.6">
<path d="M 100pt 100pt L 300pt 100pt L 300pt 300pt L 100pt 300pt Z
M 150pt 150pt L 250pt 150pt L 250pt 250pt L 150pt 250pt Z"
fill="#1a73e8" fill-rule="evenodd"/>
</layer>
Command Description
M x y Move to
L x y Line to
H x Horizontal line to
V y Vertical line to
C x1 y1 x2 y2 x y Cubic Bézier
Q x1 y1 x y Quadratic Bézier
Z Close path

Lowercase commands use relative coordinates.

Arcs (A) and the smooth curves S and T are not supported. The engine skips a command it does not know, without an error, so a path that uses one is drawn incompletely. Build arcs from C curves.