嵌入的jpeg在svg中显示,但在使用svglib和reportlab生成的pdf中不显示
我正在使用svglib的0.6.3版本和reportlab的2.5版本。
我在Inkscape里创建了一个测试用的svg文件;在里面放了一张jpeg图片,并用base64格式嵌入。
当我调试代码时,jpeg图片在svglib中生成了,但在pdf里却从来没有显示出来。
矢量图形显示得很好,但jpeg图片就是缺失。我在终端里使用了基本命令(svg2pdf)来测试。
有没有人遇到过类似的问题?
编辑:根据要求,这里是SVG代码:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="744"
height="1052"
id="svg2"
version="1.1">
<defs
id="defs4" />
<rect width="1000" height="1000"
style="fill:rgb(0,0,255);stroke-width:1;
stroke:rgb(0,0,0)"/>
<image
y="378"
x="282"
id="image2993"
xlink:href="data:image/jpeg;base64,/9j/4AAQSk... snip snip .../9k="
height="307"
width="186" />
</svg>
1 个回答
0
如果没有更多的细节,这个问题很难回答。不过,最常见的错误之一是在插入图片时没有包含命名空间:
<image href="someurlgoeshere" x="0" y="0" height="10" width="10"></image>
和
<image xlink:href="someurlgoeshere" x="0" y="0" height="10" width="10"></image>