问题描述
我正在尝试采用切片A4设计(在photoshop中设计)并在Apache FOP中重新创建它。
I'm trying to take a sliced up A4 design (designed in photoshop) and re-creating it in Apache FOP.
这是一个部分的片段在设计中:
Here's a snippet of a section that's in the design:
这就是看起来当我拍摄图像并将它们放在XML中时:
and this is what it looks like when I take the images and place them in the XML:
referenceegoeshere
和 amountgoeshere
下面的大白色间隙是由最后一次图像溢出引起的。
当我删除它时,我仍然可以看到图像间距:
The big white gaps below referenceegoeshere
and amountgoeshere
is caused by the last image overflowing.When I remove it, I still get spacing around images:
设计以300dpi完成,切片图像仍为300dpi。
The design is done in 300dpi and the sliced up images are still 300dpi.
在Apache FOP的配置中,我将DPI设置为300同样。
In Apache FOP's config I've set the DPI to 300 as well.
<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模板(图片在该位置不存在,我已重命名它们是为了保护客户的身份)
This is my full FOP template (the images doesn't exist at that location, I've renamed them to protect the client's identity)
<?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>
我添加了一些背景颜色来说明图像之间的间距,它几乎就像有一个透明的边框在没有间距的情况下图像周围。
I've added some background colour to demostrate the spacing between images, it's almost like there's a transparent border around images when there should be no spacing at all.
如何摆脱图像周围添加的间距?
How do I get rid of the spacing being added around images?
推荐答案
最后想出来,添加 font-size =0
在每个块上剥去图像周围的间距。
Finally figured it out, adding font-size="0"
on each of the blocks strips out the spacing around images.
非常奇怪,但确实有效。
Very strange, but it works.
这篇关于Apache FOP2在图像之间添加了不需要的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!