Bug 40112 - keep-with-previous.within-page not working
Summary: keep-with-previous.within-page not working
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: 0.92
Hardware: PC Linux
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-26 09:39 UTC by Bastian Hoesch
Modified: 2012-04-18 07:03 UTC (History)
1 user (show)



Attachments
Sample PDF output (28.11 KB, application/pdf)
2006-07-26 09:42 UTC, Bastian Hoesch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bastian Hoesch 2006-07-26 09:39:45 UTC
I've got a block container which contains:

 a) an image (rendered correctly)
 b) some absolute positionend containers which shall be glued to that image with
    the keep-with-previous.within-page="always" property

The idea is to have a background image (which is guaranteed to fit on the page)
and to overlay text elements with absolute positions over it. This positions are
naturally in-boundery of that image, so the would no need for a page break.
Sometimes, the layout engine creates a pagebreak here and the overlayed images
appear on the next page, which is unusefull. Trying to protect the whole
container with keep-together results in Exceptions (I found a posting on the
developer mailing list describing that keep-together is implemented only partly).
Comment 1 Bastian Hoesch 2006-07-26 09:42:01 UTC
Created attachment 18642 [details]
Sample PDF output

Code for this output:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
	xmlns:html="http://www.w3.org/1999/xhtml" writing-mode="lr-tb"
	hyphenate="false" text-align="start" role="html:html">
	<fo:layout-master-set>
		<fo:simple-page-master page-width="auto" page-height="auto"
			master-name="all-pages">
			<fo:region-body column-gap="12pt" column-count="1"
margin-left="1in"
				margin-bottom="1in" margin-right="1in"
margin-top="1in"/>
			<fo:region-before display-align="before" extent="1in"
				region-name="page-header"/>
			<fo:region-after display-align="after" extent="1in"
				region-name="page-footer"/>
			<fo:region-start extent="1in"/>
			<fo:region-end extent="1in"/>
		</fo:simple-page-master>
	</fo:layout-master-set>
	
	<fo:page-sequence master-reference="all-pages">
		<fo:title>Scale</fo:title>
		<fo:static-content flow-name="page-header">
			<fo:block font-size="small" text-align="center"
space-before="0.5in"
			       
space-before.conditionality="retain">Scale</fo:block>
		</fo:static-content>
		<fo:static-content flow-name="page-footer">
			<fo:block font-size="small" text-align="center"
space-after="0.5in"
				space-after.conditionality="retain">-
				<fo:page-number/> -</fo:block>
		</fo:static-content>
		<fo:flow flow-name="xsl-region-body">
			<fo:block font-family="FranklinGothicMedium"
role="html:body">
				<fo:block font-size="1.17em" font-weight="bold"
space-before="1em"
					space-after="1em"
keep-with-next.within-column="always"
					keep-together.within-column="always"
role="html:h3">
					Scale</fo:block>
				<fo:block border="1px inset"
space-before="0.67em"
					space-after="0.67em" role="html:hr"/>
				<fo:block font-size="1em" font-weight="bold"
space-before="1.17em"
					space-after="1.17em"
keep-with-next.within-column="always"
					keep-together.within-column="always"
role="html:h4">
					Inhaltsverzeichnis:</fo:block>
				<fo:list-block space-before="1em"
space-after="1em" role="html:ul">
					<fo:list-item relative-align="baseline"
role="html:li">
						<fo:list-item-label
wrap-option="no-wrap" text-align="end"
						       
end-indent="label-end()">
							<fo:block>
								<fo:inline
font="1em serif">•</fo:inline>
							</fo:block>
						</fo:list-item-label>
						<fo:list-item-body
start-indent="body-start()">
							<fo:block>
								<fo:basic-link
text-decoration="underline"
								       
color="blue" role="html:a"
								       
internal-destination="2990">neuer Knoten
								       
<fo:inline font-family="starstruck">
								       
</fo:inline> </fo:basic-link>
							</fo:block>
						</fo:list-item-body>
					</fo:list-item>
				</fo:list-block>
				<fo:block padding-bottom="0.3em"
role="html:br"/>Das Symbol
				<fo:inline
font-family="starstruck">e</fo:inline> gibt den
				Schwierigkeitsgrad einer Übungsaufabe an.
				<fo:block padding-bottom="0.3em"
role="html:br"/>
				<fo:block padding-bottom="0.3em"
role="html:br"/>
				<fo:block border="1px inset"
space-before="0.67em"
					space-after="0.67em" role="html:hr"/>
				<fo:block font-size="1.17em" font-weight="bold"
space-before="1em"
					space-after="1em"
keep-with-next.within-column="always"
					keep-together.within-column="always"
role="html:h3">
					<fo:inline color="#263264">
						<fo:inline role="html:a"
id="2990">neuer Knoten
							<fo:inline
font-family="starstruck">
							</fo:inline>
</fo:inline>
					</fo:inline>
				</fo:block>
				<fo:block padding-bottom="0.3em"
role="html:br"/>
				<fo:block-container role="html:div">
					<fo:block end-indent="0pt"
start-indent="0pt">
						<fo:external-graphic
src="url('inmemimage:gpec;9fa2fb')"
							content-width="0.938in"
content-height="5in"
							role="html:img"/>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="1.103in" left="0.753in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="0.156in" left="0.569in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>XXX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="0.759in" left="0.362in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxxx
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>XXXXX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="1.194in" left="0.162in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxxxx
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxxx
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxx
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>XXXX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="1.022in" left="0.744in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">ccc</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="0.138in" left="0.225in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">X</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="3.216in" left="0.312in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxxxx
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxxx
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>xxxxxx</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="2.634in" left="0.453in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="1.919in" left="0.416in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXXXX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="3.869in" left="0.238in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">XXXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>XXXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>XXXXX
								       
<fo:block padding-bottom="0.3em"
									       
role="html:br"/>XXXXX</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="3.091in" left="0.744in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">.</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="3.916in" left="0.509in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">.</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="2.338in" left="0.194in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">o</fo:inline>
							</fo:block>
						</fo:block-container>
						<fo:block-container
						       
keep-with-previous.within-page="always" margin="0px"
							padding="0px"
top="4.425in" left="0.478in"
							position="absolute">
							<fo:block
role="html:div">
								<fo:inline
font-size="7.5pt">o</fo:inline>
							</fo:block>
						</fo:block-container>
					</fo:block>
				</fo:block-container> </fo:block>
		</fo:flow>
	</fo:page-sequence>
</fo:root>
Comment 2 Bastian Hoesch 2006-07-26 11:26:42 UTC
Workaround: 

manipulate the space needed by the image with block-progression-dimension.
It seems to work!
Comment 3 Glenn Adams 2012-04-07 01:43:08 UTC
resetting P2 open bugs to P3 pending further review