我将身高5cm
的图片放入block-container
高度5cm
。我希望图像完全适合,但实际上fop
会发出警告:
WARNUNG: Content overflows the viewport of an fo:block-container
in block-progression direction by 5784 millipoints. (See position
19:10)
禁用边框,边距和填充。我应该禁用什么?
<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="bodypage" page-height="29.7cm" page-width="21.0cm" margin="0cm">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="bodypage">
<fo:flow flow-name="xsl-region-body">
<fo:block-container
absolute-position = "fixed"
background-color = "yellow"
margin-right = "5cm"
top = "5cm"
left = "5cm"
height = "5cm"
><fo:block border="none" padding="0" margin="0"
><fo:external-graphic border="none" padding="0" margin="0"
src="dummy.pdf" width="5cm" height="5cm"
content-height="scale-to-fit" content-width="scale-to-fit"
/></fo:block
></fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
答案 0 :(得分:2)
fo:external-graphic是内联级元素。当它包含在一个块中时,在每个已知的内联元素(半前导)之前和之后总会有一些空白区域。
这个空间会导致块容器内容物的高度增加,从而导致溢出。你应该能够指定line-height =&#34; 0pt&#34;在封闭图像的块上,以实现正确的行为。
注意:我没有你要测试的图像,但经常会遇到这种情况,这就是我解决这个问题的方法。