xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arthur Derewjankin <Arthur.Derewjan...@solvians.com>
Subject Padding when displaying two blocks side by side
Date Tue, 25 Jun 2019 09:48:30 GMT
Hi,

I have the problem that I get a small padding when I want to display two blocks side by side.

I have created a small example to show you what I exactly mean.

<?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 master-name="page" page-height="297mm" page-width="210mm" margin="0">
				<fo:region-body region-name="xsl-region-body" margin="20mm 19mm"/>
				<fo:region-before region-name="xsl-region-before" extent="20mm"/>
			</fo:simple-page-master>
		</fo:layout-master-set>
		<fo:page-sequence master-reference="page">
			<fo:static-content flow-name="xsl-region-before">
				<fo:block background-color="red" font-size="10pt">
					<fo:inline-container inline-progression-dimension="105mm">
						<fo:block>
							Text left
						</fo:block>
					</fo:inline-container>
					<fo:inline-container inline-progression-dimension="105mm">
						<fo:block text-align="right" background-color="yellow">
							Text right
						</fo:block>
					</fo:inline-container>
				</fo:block>
			</fo:static-content>
			<fo:flow flow-name="xsl-region-body">
				<fo:block/>
			</fo:flow>
		</fo:page-sequence>
	</fo:root>
	
This example leads to testOutput1.pdf.

After some research I found this post (http://apache-fop.1065347.n5.nabble.com/Eliminating-block-s-padding-around-an-external-graphic-td39020.html)

and I was able to "fix" it. The implementation now looks like this:

<?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 master-name="page" page-height="297mm" page-width="210mm" margin="0">
				<fo:region-body region-name="xsl-region-body" margin="20mm 19mm"/>
				<fo:region-before region-name="xsl-region-before" extent="20mm"/>
			</fo:simple-page-master>
		</fo:layout-master-set>
		<fo:page-sequence master-reference="page">
			<fo:static-content flow-name="xsl-region-before">
				<fo:block background-color="red" font-size="0"> <!-- here I have set the font-size
-->
					<fo:inline-container inline-progression-dimension="105mm">
						<fo:block font-size="10pt"> <!-- here I have set the font-size -->
							Text left
						</fo:block>
					</fo:inline-container>
					<fo:inline-container inline-progression-dimension="105mm">
						<fo:block text-align="right" background-color="yellow" font-size="10pt"> <!--
here I have set the font-size -->
							Text right
						</fo:block>
					</fo:inline-container>
				</fo:block>
			</fo:static-content>
			<fo:flow flow-name="xsl-region-body">
				<fo:block/>
			</fo:flow>
		</fo:page-sequence>
	</fo:root>

This example leads to testOutput2.pdf.

As you can see it does what I want. But to set the font-size for every block is more a "hack"
than a proper solution. 
I have also tried to set a padding of -1 which works but this feels like a hack aswell. In
my opinion this can't be the final solution. 
Any ideas?


Thanks,

Arthur



Mime
View raw message