pub struct Svg {
    pub width: Px,
    pub height: Px,
    /* private fields */
}
Expand description

SVG - wrapper around an XObject to allow for more control within the library

Fields

width: Px

Width of the rendered SVG content

height: Px

Height of the rendered SVG content

Implementations

Internally parses the SVG string, converts it to a PDF document using the svg2pdf crate, parses the resulting PDF again (using lopdf), then extracts the SVG XObject.

I wish there was a more direct way, but handling SVG is very tricky.

Adds the SVG to the pages /Resources, returns the name of the reference to the SVG, so that one SVG can be used more than once on a page

Adds the image to a specific layer and consumes it.

This is due to a PDF weirdness - images are basically just “names” and you have to make sure that they are added to resources of the same page as they are used on.

You can use the “transform.dpi” parameter to specify a scaling - the default is 300dpi

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Does nothing but move self, equivalent to drop.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.