Apache FOP2 在图像之间添加不需要的间距 [英] Apache FOP2 is adding unwanted spacing between images

查看:22
本文介绍了Apache FOP2 在图像之间添加不需要的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试采用切片 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:

referenceegoeshereamountgoeshere 下方的大白空白是由于最后一张图片溢出造成的.当我删除它时,我仍然在图像周围有间距:

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.

很奇怪,但它有效.

这篇关于Apache FOP2 在图像之间添加不需要的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆