Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.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
Xsl fo 为什么我的图片不能填充父块_Xsl Fo_Apache Fop - Fatal编程技术网

Xsl fo 为什么我的图片不能填充父块

Xsl fo 为什么我的图片不能填充父块,xsl-fo,apache-fop,Xsl Fo,Apache Fop,这是我的FOP: <fo:block background-color="blue"> <fo:instream-foreign-object background-color="yellow" content-width="0.8cm" content-height="0.3cm" scaling="non-uniform" vertical-align="middle"> <svg xmlns="http://www.w3.org/2000/svg" w

这是我的FOP:

<fo:block background-color="blue">
<fo:instream-foreign-object background-color="yellow" content-width="0.8cm" content-height="0.3cm" scaling="non-uniform" vertical-align="middle">
    <svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" viewBox="0 0 200 100">
        <g>
            <path d="m 0 0 l 200 0 l -50 100 l -150 0 z"/>
            <text x="140" y="80"
                style="font-family: Times New Roman;
                font-size: 80px;
                text-align:end;
                text-anchor:end;
                fill: white;">12</text>
        </g>
    </svg>
</fo:instream-foreign-object>
</fo:block>

12
appache FOP版本2的渲染如下:

为什么SVG不填充父块

content width=“0.8cm”content height=“0.3cm”scaling=“non-uniform”强制图像宽度为0.8cm,高度为0.3cm

如果要填充宽度,请将其更改为
content width=“scale to fit”width=“100%”


12

FOP将自己描述为“由XSL格式化对象(XSL-FO)驱动的打印格式化程序”(请参阅),您的标记还可以与FOP以外的其他格式化程序一起使用。如果您的问题只是SVG上下的蓝色,您可能更感兴趣的是将
font size=“0”
作为删除“半前导”的一种方法(请参阅,例如)这就是蓝色上面和下面的原因。既然你正在使用<代码>字体大小=“0”<代码>,请考虑接受这个答案。
<fo:block background-color="blue" font-size="0">
    <fo:instream-foreign-object background-color="yellow" content-width="scale-to-fit" width="100%">
        <svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" viewBox="0 0 200 100">
            <g>
                <path d="m 0 0 l 200 0 l -50 100 l -150 0 z"/>
                <text x="140" y="80"
                    style="font-family: Times New Roman;
                    font-size: 80px;
                    text-align:end;
                    text-anchor:end;
                    fill: white;">12</text>
            </g>
        </svg>
    </fo:instream-foreign-object>
</fo:block>