Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将SVG合并在一起_Svg - Fatal编程技术网

将SVG合并在一起

将SVG合并在一起,svg,Svg,我有一个SVG,它可以呈现以下内容(SVG-1) 我有一组单独的Svg文档,其中包含以下内容(Svg-2) 我试图实现的是得到一个类似于下面的组合svg ---------------- | (Image) Text| | | | Some Content | | here | | | | | | Text | ---------------- 我相信href标签可以在这里使用,但不

我有一个SVG,它可以呈现以下内容(SVG-1)

我有一组单独的Svg文档,其中包含以下内容(Svg-2)

我试图实现的是得到一个类似于下面的组合svg

----------------
| (Image)  Text|
|              |
| Some Content |
| here         |
|              |
|              |
|         Text |
----------------
我相信href标签可以在这里使用,但不确定这是否是最好的方法,也不确定如何实现它

以下是svg-01(也称为svg01.svg)的代码

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg width="200mm" height="300mm"
    xmlns="http://www.w3.org/2000/svg" dominant-baseline="hanging">
    <image x="1.74mm" y="1.59mm" height="19.97mm" width="23.41mm" href=".."/>
    <text x="139.85mm" y="1.85mm" font-size="12pt">Text</text>
    <text x="142.05mm" y="289.72mm" font-size="12pt">Text</text>
</svg>

正文
正文
下面是我尝试的组合svg的代码

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg width="300mm" height="200mm"
    xmlns:xlink="http://www.w3.org/1999/xlink>
    xmlns="http://www.w3.org/2000/svg" dominant-baseline="hanging">
    <image xlink:href="svg01.svg" />
    <text x="43.12mm" y="50.54mm" width="73.98mm" height="8.41mm" font-size="12pt">Some Content here</text>
</svg>


如果你的SVG大小相同,你可以把每个SVG的内容合并起来。如果SVG的大小不同或视图框不同,则可能需要进行调整

第一个SVG

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg width="200mm" height="300mm"
    xmlns="http://www.w3.org/2000/svg" dominant-baseline="hanging">
    <image x="1.74mm" y="1.59mm" height="19.97mm" width="23.41mm" href=".."/>
    <text x="139.85mm" y="1.85mm" font-size="12pt">Text</text>
    <text x="142.05mm" y="289.72mm" font-size="12pt">Text</text>
</svg>

正文
正文
第二个SVG

<svg width="200mm" height="300mm"
    xmlns:xlink="http://www.w3.org/1999/xlink>
    <text x="43.12mm" y="50.54mm" width="73.98mm" height="8.41mm" font-size="12pt">Some Content here</text>
</svg>

是的,但在这里,您基本上创建了一个新的svg,内容在第一个和第二个。我的要求是在这样一个世界里,我不能有一个单独的文件名组合svg,但我想在第一个和第二个svg@burgany中将内容合并在一起。你的问题不清楚,你想合并内容,但当有人在回答中真的这样做时,你说那不是你想要的。我想通过链接将两个独立的SVG合并在一起。不通过将两者结合起来创建一个全新的SVG
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg width="200mm" height="300mm"
    xmlns="http://www.w3.org/2000/svg" dominant-baseline="hanging">
    <image x="1.74mm" y="1.59mm" height="19.97mm" width="23.41mm" href=".."/>
    <text x="139.85mm" y="1.85mm" font-size="12pt">Text</text>
    <text x="142.05mm" y="289.72mm" font-size="12pt">Text</text>
</svg>
<svg width="200mm" height="300mm"
    xmlns:xlink="http://www.w3.org/1999/xlink>
    <text x="43.12mm" y="50.54mm" width="73.98mm" height="8.41mm" font-size="12pt">Some Content here</text>
</svg>
<svg width="200mm" height="300mm"
    xmlns="http://www.w3.org/2000/svg" dominant-baseline="hanging">

    <!-- Content from first SVG -->
    <image x="1.74mm" y="1.59mm" height="19.97mm" width="23.41mm" href=".."/>
    <text x="139.85mm" y="1.85mm" font-size="12pt">Text</text>
    <text x="142.05mm" y="289.72mm" font-size="12pt">Text</text>

    <!-- Content from second SVG -->
    <text x="43.12mm" y="50.54mm" width="73.98mm" height="8.41mm" font-size="12pt">Some Content here</text>
</svg>