Forum How do I...?

SVG link not active on background images

kheitmann
If I embed the following SVG as a background image of a page
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="100px" height="100px" viewBox="0 0 100 100" enable-background="new " xml:space="preserve">
<rect x="-12" y="-16" opacity="0.05" fill="#E2001A" width="100" height="100"/>
<a xlink:href="http://abc.de" >
	<rect x="12" y="12" fill="#DDDDDD" width="40" height="40"/>
</a>
</svg>

...the SVG image is shown as a bg image but the link is not active on the Prince rendered PDF. Any ideas why? BTW in a browser the link works...

--Kai Heitmann

Edited by kheitmann

mikeday
I suspect it may not have occurred to us that background images could contain links. :)

Edited by mikeday

kheitmann
Thanks... (well, tech pubs may have that ;-)
Does that mean that there is no hope to have that implemented in Prince?

--Kai Heitmann

mikeday
I will add it to the roadmap and we will investigate. :)
mikeday
Just to clarify, are you applying the SVG background to an element in the document, or to an @page rule?

Also, repeating/tiled backgrounds make it very difficult to process links properly, so the background will need to be only drawn once.
kheitmann
One of our main and urgent use cases is:
@page:nth(1) { background: url(vr81-0001.svg) no-repeat fixed; }

where the svg image contains a link to a web form. It is a non-repating background.
Thanks!

--Kai Heitmann

Edited by kheitmann

mikeday
I think you can do this more easily by making an absolutely positioned block with z-index -1, like this:
body::before {
    content: url(vr81-0001.svg);
    position: absolute;
    z-index: -1;
    left: ... top: ... width: ... height: ...
}