Apache FOP2 在图像之间添加不需要的间距
Apache FOP2 is adding unwanted spacing between images
我正在尝试将 A4 设计切片(在 photoshop 中设计)并在 Apache FOP 中重新创建它。
这是设计中的一个部分的片段:
这就是我拍摄图像并将它们放入 XML:
时的样子
referenceegoeshere
和amountgoeshere
下面的大白缝是最后一张图片溢出造成的。
当我删除它时,图像周围仍然有间距:
设计是在 300dpi 下完成的,切片图像仍然是 300dpi。
在 Apache FOP 的配置中,我也将 DPI 设置为 300。
<fop version="1.0">
<strict-configuration>true</strict-configuration>
<strict-validation>true</strict-validation>
<base>./</base>
<font-base>./</font-base>
<source-resolution>300</source-resolution>
<target-resolution>300</target-resolution>
</fop>
这是我的完整 FOP 模板(图像不存在于该位置,我已重命名它们以保护客户的身份)
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
margin="0mm"
padding="0mm"
master-name="simple"
page-height="297mm"
page-width="210mm">
<fo:region-body margin="0" />
<fo:region-before extent="0"/>
<fo:region-after extent="0"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple" color="#365f91">
<!-- Page Body Goes Here -->
<fo:flow flow-name="xsl-region-body">
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_01.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_02.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_03.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_04.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_05.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_06.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_07.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_08.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_09.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_10.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_11.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_12.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_13.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_14.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_15.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_16.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_17.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_18.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_19.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_20.jpg"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
我添加了一些背景颜色来演示图像之间的间距,这几乎就像图像周围有一个透明边框,而实际上根本没有间距。
如何去除图片周围添加的间距?
终于想通了,在每个块上添加 font-size="0"
去除图像周围的间距。
很奇怪,但确实有效。
我正在尝试将 A4 设计切片(在 photoshop 中设计)并在 Apache FOP 中重新创建它。
这是设计中的一个部分的片段:
这就是我拍摄图像并将它们放入 XML:
时的样子referenceegoeshere
和amountgoeshere
下面的大白缝是最后一张图片溢出造成的。
当我删除它时,图像周围仍然有间距:
设计是在 300dpi 下完成的,切片图像仍然是 300dpi。
在 Apache FOP 的配置中,我也将 DPI 设置为 300。
<fop version="1.0">
<strict-configuration>true</strict-configuration>
<strict-validation>true</strict-validation>
<base>./</base>
<font-base>./</font-base>
<source-resolution>300</source-resolution>
<target-resolution>300</target-resolution>
</fop>
这是我的完整 FOP 模板(图像不存在于该位置,我已重命名它们以保护客户的身份)
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
margin="0mm"
padding="0mm"
master-name="simple"
page-height="297mm"
page-width="210mm">
<fo:region-body margin="0" />
<fo:region-before extent="0"/>
<fo:region-after extent="0"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple" color="#365f91">
<!-- Page Body Goes Here -->
<fo:flow flow-name="xsl-region-body">
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_01.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_02.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_03.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_04.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_05.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_06.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_07.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_08.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_09.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_10.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_11.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_12.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_13.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_14.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_15.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_16.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_17.jpg"/>
</fo:block>
<fo:block padding="0mm" margin="0mm">
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_18.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_19.jpg"/>
<fo:external-graphic src="http://www.mycee.com/image/20135-Test-Mockup-V1.0-01_20.jpg"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
我添加了一些背景颜色来演示图像之间的间距,这几乎就像图像周围有一个透明边框,而实际上根本没有间距。
如何去除图片周围添加的间距?
终于想通了,在每个块上添加 font-size="0"
去除图像周围的间距。
很奇怪,但确实有效。