You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Timo Haberkern <th...@emedia-office.de> on 2002/12/06 12:57:42 UTC

Bug?Wrong automatic resize of images in region-start, region-end

hello together,

as I posted in the user-list allready, i've some problems using 
external-graphics in region-start and region-end. The problem is that 
the images are automatically resized by FOP. I tried around a little bit 
and found out that the maximum height of an external-graphic in 
region-start/-end is calculated the as

max = (page height) - margin-top (region-body) - margin-bottom (region-body)

That might be ok for the most use cases. But not for mine. I'm new to 
fop but think i have defined a page layout that has the same layout as 
the pagination.fo example shipped with FOP. I want to use two images in 
the region-start and region-end that are almost as high as the 
page-height. If i set a background-color for the region-start i can see 
that the size of the region is ok, only the image size is calculated wrong.

Is there a patch available for this. The problem is that i need a 
solution very quick (project deadline comes nearer and nearer ;-) ). Any 
ideas?

I have attached my stylesheet at the end of this mail

-- 
regards

Timo Haberkern


<?xml version='1.0' encoding="ISO-8859-1"?>


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
	<!-- 	
	**************************************************
	*** root rule. Defines the general site layout
	**************************************************
	-->
	<xsl:template match="/">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
				<!-- Layout of the first site -->
				<fo:simple-page-master master-name="First" page-height="29.7cm" page-width="21cm">
					<fo:region-body margin-left="3.4cm"  margin-bottom="4.4cm" margin-right="3.4cm" margin-top="7cm" background-color="rgb(211,231,188)"/>
					<fo:region-before precedence="false" extent="7cm" region-name="PucaroHeader"/>
					<fo:region-after precedence="false" region-name="PucaroFooter" extent="4.4cm"/>
					<fo:region-start precedence="false" extent="3.4cm" region-name="PucaroLeftGradientSideBar"/>
					<fo:region-end precedence="false" extent="3.4cm" region-name="PucaroRightProductSideBar"/>
					
				</fo:simple-page-master>
				
				<!-- Layout of all following sites -->
				<fo:simple-page-master master-name="Following" page-height="29.7cm" page-width="21cm">
					<fo:region-before extent="7cm" region-name="PucaroHeader"/>
					<fo:region-start extent="29.7cm" region-name="PucaroLeftGradientSideBar"/>
					<fo:region-body margin-bottom="1.8cm" margin-left="2cm" margin-right="0cm" margin-top="2cm"/>
				</fo:simple-page-master>
				
				<!-- The page sequence master -->
				<fo:page-sequence-master master-name="PucaroSchema">
					<fo:single-page-master-reference master-reference="First"/>
					<fo:repeatable-page-master-reference master-reference="Following"/>
				</fo:page-sequence-master>
			</fo:layout-master-set>
			
			<fo:page-sequence master-reference="PucaroSchema">
				<!-- static sequences: Pucaro left gradient sidebar -->
				<fo:static-content flow-name="PucaroLeftGradientSideBar">
					<fo:block-container height="30cm" width="6cm" top="2cm" left="2cm" position="absolute">
						<fo:block>
							<fo:external-graphic scaling="non-uniform" width="0.6cm" height="25.9cm" src="file:../elk/develop/Layouts/Pucaro/pdf/leftgradient.gif"/>
						</fo:block>
					</fo:block-container>
				</fo:static-content>
				
				<!-- static sequences: Pucaro right product sidebar -->
				<fo:static-content flow-name="PucaroRightProductSideBar" height="27cm" width="3.4cm" content-height="27cm" content-width="3.4cm">
					<fo:block-container height="27cm" width="3.4cm" top="2cm" left="1cm" position="absolute">
						<fo:block>
							<fo:external-graphic scaling="non-uniform" width="2.4cm" height="25.9cm" src="file:../elk/develop/Layouts/Pucaro/pdf/rightproducts.gif"/>
						</fo:block>
					</fo:block-container>
				</fo:static-content>
				
				<!-- static sequences: Pucaro header -->
				<fo:static-content flow-name="PucaroHeader">
					<fo:block-container height="5cm" padding="0" width="14.2cm" top="2cm" left="0cm" position="absolute" background-color="white">
						<xsl:apply-templates select="ELKDocument/eo_51ba8178-02cc-11d7-a9ff-8012d336c952"/> <!-- Block_Kopfbereich_Motoren -->
						<xsl:apply-templates select="ELKDocument/eo_"/> <!-- Block_Kopfbereich_Trafo -->
					</fo:block-container>
				</fo:static-content>
				
				<!-- static sequences: Pucaro_Footer -->
				<fo:static-content flow-name="PucaroFooter">
					<fo:block-container height="2.6cm" padding="0" width="14.2cm" top="1.0cm" left="0cm" position="absolute" background-color="white">
						<xsl:apply-templates select="ELKDocument/eo_51ba8177-02cc-11d7-a9ff-8012d336c952"/> <!-- Block_Fußbereich_Motoren -->
						<xsl:apply-templates select="ELKDocument/eo_"/> <!-- Block_Fußbereich_Trafo -->
					</fo:block-container>
				</fo:static-content>

				<fo:flow flow-name="xsl-region-body">
					<fo:block-container width="14.2cm">
						<fo:block>
						<xsl:apply-templates select="ELKDocument"/>
						</fo:block>
					</fo:block-container>
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>
	
	<!-- 	
	**************************************************
	*** ELK document rule
	**************************************************
	-->
	<xsl:template match="ELKDocument">
		<xsl:apply-templates select="eo_51ba8176-02cc-11d7-a9ff-8012d336c952"/> <!-- Block_Beschreibung_Motoren -->
	</xsl:template>
	
	<!-- Block_Kopfbereich_Motoren -->
	<xsl:template match="eo_51ba8178-02cc-11d7-a9ff-8012d336c952">
		<fo:table width="14.2cm" table-layout="fixed">
			<fo:table-column column-width="9.2cm"/>
			<fo:table-column column-width="5cm"/>
			<fo:table-body>
				<fo:table-row>
					<fo:table-cell>
						<fo:block font-size="24pt" font-weight="bold" color="rgb(77,175,74)">
							<xsl:value-of select="eo_51afd2a2-02cc-11d7-a9ff-8012d336c952"/> <!-- Dokumenten_Benennung -->
						</fo:block>
					</fo:table-cell>
					<fo:table-cell display-align="after">
						<fo:block>
							<fo:external-graphic>
								<xsl:attribute name="width">4cm</xsl:attribute>
								<xsl:attribute name="src">
									<xsl:value-of select="eo_f4678ee4-02e6-11d7-99e8-bc7bf02e2c02"/> <!-- Logo_Pucaro_ohneZusatz -->
								</xsl:attribute>						      	
							</fo:external-graphic>
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-body>
		</fo:table>
		<fo:block space-before.optimum="0.35cm" font-size="24pt" color="black" font-weight="bold">
			<xsl:value-of select="eo_51afd2a4-02cc-11d7-a9ff-8012d336c952"/> <!-- Ueberschrift_Haupt -->
		</fo:block>		
		<fo:block space-before.optimum="0.25cm" font-size="12pt" font-weight="bold" color="black">
			<xsl:value-of select="eo_51afd2a5-02cc-11d7-a9ff-8012d336c952"/> <!-- Ueberschrift_Unter -->
		</fo:block>
		
	</xsl:template>

	<!-- Block_Beschreibung_Motoren -->
	<xsl:template match="eo_51ba8176-02cc-11d7-a9ff-8012d336c952">
		<fo:block content-width="4cm" background-color="white">
			Merkmale
			<fo:external-graphic scaling="non-uniform" width="2.1cm" height="5cm" src="file:../elk/develop/Layouts/Pucaro/pdf/rightproducts.gif"/>
		</fo:block>
		
		<fo:table space-before.optimum="0.5cm" space-after.optimum="0.2cm" border-width="1.15pt" border-color="rgb(154,203,145)" border-style="solid">
			<fo:table-column column-width="4cm"/>
			<fo:table-body>
				<fo:table-row>
					<fo:table-cell>
						<fo:block background-color="white" color="black" font-size="12pt">						
							<xsl:value-of select="eo_51afd2a3-02cc-11d7-a9ff-8012d336c952"/> <!-- Überschrift_Block -->
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-body>
		</fo:table>
	</xsl:template>
	
	<!-- Block_Fußbereich_Motoren -->
	<xsl:template match="eo_51ba8177-02cc-11d7-a9ff-8012d336c952">
		<fo:table width="14.2cm" table-layout="fixed">
			<fo:table-column column-width="5.5cm"/>
			<fo:table-column column-width="5cm"/>
			<fo:table-column column-width="3.7cm"/>
			<fo:table-body>
				<fo:table-row>
					<fo:table-cell  display-align="after">
						<fo:block display-align="after" font-size="6pt" font-weight="bold" color="black">
							<xsl:value-of select="eo_51afd2a6-02cc-11d7-a9ff-8012d336c952"/> <!-- Adresse Pucaro -->
						</fo:block>
					</fo:table-cell>
					<fo:table-cell display-align="after" >
						<fo:block text-align="center">
							<fo:external-graphic>
								<xsl:attribute name="width">2.3cm</xsl:attribute>
								<xsl:attribute name="src">
									<xsl:value-of select="eo_501e5ef9-0527-11d7-9141-e1d8860ec82a "/> <!-- Logo_Pucaro_mitZusatz -->
								</xsl:attribute>						      	
							</fo:external-graphic>
						</fo:block>
					</fo:table-cell>
					<fo:table-cell display-align="after">
						<fo:block>
							<fo:external-graphic>
								<xsl:attribute name="width">3.5cm</xsl:attribute>
								<xsl:attribute name="src">
									<xsl:value-of select="eo_83c1d2ab-0527-11d7-9141-e1d8860ec82a"/> <!-- Logo_Figeholm_mitZusatz -->
								</xsl:attribute>						      	
							</fo:external-graphic>
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-body>
		</fo:table>
	</xsl:template>
</xsl:stylesheet>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Bug?Wrong automatic resize of images in region-start, region-end

Posted by Timo Haberkern <th...@emedia-office.de>.
I have done some quick-and-dirty changes in the FOP code. At the moment 
i have not the time to deep-hack into the system, but my changes working 
good for me. No guarantee that it works in all other cases after the 
changes. May i have the time after the 16th Dec. (Project-Deadline). I 
will take then a closer look to the code.

My only change in file ExternalGraphic.java (Line 156, current CVS version)

Replaced

int pageHeight = area.getPage().getBody().getMaxHeight() - spaceBefore;

with

int pageHeight = area.getPage().getHeight()- spaceBefore;


May that helps others too.

Timo

Timo Haberkern wrote:

> hello together,
>
> as I posted in the user-list allready, i've some problems using 
> external-graphics in region-start and region-end. The problem is that 
> the images are automatically resized by FOP. I tried around a little 
> bit and found out that the maximum height of an external-graphic in 
> region-start/-end is calculated the as
>
> max = (page height) - margin-top (region-body) - margin-bottom 
> (region-body)
>
> That might be ok for the most use cases. But not for mine. I'm new to 
> fop but think i have defined a page layout that has the same layout as 
> the pagination.fo example shipped with FOP. I want to use two images 
> in the region-start and region-end that are almost as high as the 
> page-height. If i set a background-color for the region-start i can 
> see that the size of the region is ok, only the image size is 
> calculated wrong.
>
> Is there a patch available for this. The problem is that i need a 
> solution very quick (project deadline comes nearer and nearer ;-) ). 
> Any ideas?
>
> I have attached my stylesheet at the end of this mail
>

-- 
Grüsse

Timo Haberkern

EMEDIA OFFICE GmbH
Wingertstr. 4
74850 Schefflenz-Kl.

http://www.emedia-office.com
thaberkern@emedia-office.de

Tel.: 06293/921121
Fax:  06293/921129



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org