Actually, at least in version 7.1.7 you can directly use Embedded with SVG. There is even an example in Book , although it deals with ThemeResource :
// A resource reference to some object Resource res = new ThemeResource("img/reindeer.svg"); // Display the object Embedded object = new Embedded("My SVG", res); object.setMimeType("image/svg+xml"); // Unnecessary layout.addComponent(object);
However, StreamResource also works great, at least with the following snippet:
Embedded image = new Embedded(); image.setMimeType("image/svg+xml"); //also unnecessary here :p layout.addComponent(image); StreamSource source = //define your source image.setSource(new StreamResource(source, "image.svg"));
(note that if you need to restore your image, you must provide a new unique filename for StreamResource )
source share