Skip to content
LpdfDocsv0.24-r1004.10

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

Image (canvas)

Absolutely positioned image. Both w and h are required — canvas images do not auto-size.

The image must be declared in assets before use, with a src file path or bytes you load on the engine (see Installation).

Attribute Type Default Description
name string — Required. Asset name declared in assets
x signed pt — X position (or offset from anchor)
y signed pt — Y position (or offset from anchor)
w pt — Required. Width
h pt — Required. Height
anchor string — Reference point

Either anchor or both x and y must be provided.

<lpdf version="1">
<assets>
<image name="logo" src="logo.png"/>
</assets>
<document size="letter" margin="48pt">
<section>
<layout>
<text>Main content</text>
</layout>
<canvas>
<layer page="each">
<img name="logo" anchor="top-right" x="-18pt" y="18pt" w="80pt" h="24pt"/>
</layer>
</canvas>
</section>
</document>
</lpdf>
<canvas>
<layer page="each" opacity="0.08">
<img name="watermark" anchor="center" w="300pt" h="300pt"/>
</layer>
</canvas>