开发者

Embedded jpeg showing in svg, but not in pdf when generated with svglib, reportlab

开发者 https://www.devze.com 2023-03-20 07:39 出处:网络
I\'m using version 0.6.3 of svglib and reportlab 2.5. I created the test svg in Inkscape; placed one jpeg in it, embedded with base64.

I'm using version 0.6.3 of svglib and reportlab 2.5. I created the test svg in Inkscape; placed one jpeg in it, embedded with base64.

When I step in the code, the jpeg gets generated in svglib, but it never shows up in pdf.

Vector shapes work fine and get shown, but jpeg is missing. I was using the basic command in terminal (svg2pdf) for testing.

Did anyone encounter a similar problem?

EDIT: SVG code, as requested:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
开发者_如何学Python<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>


Without a little more detail this is tough to answer, the most common mistake, though, when including images is not including the namespace:

<image href="someurlgoeshere" x="0" y="0" height="10" width="10"></image>

vs

<image xlink:href="someurlgoeshere" x="0" y="0" height="10" width="10"></image>
0

精彩评论

暂无评论...
验证码 换一张
取 消