You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by pepone pepone <pe...@gmail.com> on 2005/04/05 16:48:18 UTC

Fop postscript problems

Hello I creating a xsl-fo template to producte postscript files
to print. when i use the Driver.RENDER_PS the size of the page
is not the size that i put in the xsl-fo. if i render the same xsl-fo
whit Driver.RENDER_PDF the result is fine.

is this a know bug on  Driver.RENDER_PS or is an error on my page template?

Thanks in advantage

====Xsl Template==========

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="fo">
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes"/>
  <!-- ========================= -->
  <!-- root element: projectteam -->
  <!-- ========================= -->
  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master 
			master-name="ticket" 
			page-width="72mm"
			page-height="2000mm" 
			margin-top="2mm" 
			margin-bottom="2mm" 
			margin-left="2mm" 
			margin-right="2mm">
       		<fo:region-body
				width="70mm"
				height="97mm"/>
        </fo:simple-page-master>
      </fo:layout-master-set>
	  
      <fo:page-sequence master-reference="ticket">
        <fo:flow flow-name="xsl-region-body">	
		  <fo:block
		  	width="72mm">
			<fo:block>
				<xsl:call-template name="header"/>
			</fo:block>
		  	<fo:block>
				<xsl:call-template name="ticket"/>
			</fo:block>
			<fo:block>
				<xsl:call-template name="total"/>
			</fo:block>
			<fo:block>
				<xsl:call-template name="footer"/>
			</fo:block>
		</fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
  <!-- ========================= -->
  <!-- child element: member     -->
  <!-- ========================= -->
  
  <xsl:template name="ticket">
  	<fo:block font-size="10pt" width="72mm">
		Productos:
		<fo:table table-layout="fixed"
			margin-top="4mm"
			margin-left="2mm"
			margin-right="2mm"
			width="69mm">
			<fo:table-column column-width="32mm"/>  
			<fo:table-column column-width="32mm"/>
			<fo:table-body>
				<xsl:for-each select="/ticket/products/item">
					<xsl:apply-templates select="."/>
				</xsl:for-each>
			</fo:table-body>
		</fo:table>
	</fo:block>
  </xsl:template>
  
  <xsl:template match="item">
    <fo:table-row>
      <fo:table-cell>
        <fo:block font-size="10pt" 
			padding-top="1mm"
			border="1pt"
			border-color="black">
          <xsl:value-of select="./@name"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block font-size="10pt" text-align="right"
			padding-top="2mm">
          <xsl:value-of select="./@precio"/>
		  <xsl:text> x </xsl:text>
		  <xsl:value-of select="./@ud"/>
		  <xsl:text> = </xsl:text>
		  <xsl:value-of select="./@total"/>
        </fo:block>
      </fo:table-cell>
	</fo:table-row>
  </xsl:template>
 
  <xsl:template name="header">
  	<fo:table table-layout="fixed"
		margin-top="1mm"
		margin-right="1mm"
		margin-left="1mm"
		width="70mm">
		<fo:table-column column-width="20mm"/>
		<fo:table-column column-width="50mm"/>
		<fo:table-body>
			<fo:table-row>
				<fo:table-cell number-rows-spanned="5">
					<fo:block>
    					<fo:external-graphic  
							src="url(/home/pepone/forgenovell/trunk/xsl-fo/img/logo.gif)"/>
  					</fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block font-size="10pt" font-weight="bold">
						On-ReZ
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
			<fo:table-row>
				<fo:table-cell>
					<fo:block font-size="10pt">
						Cif: <xsl:value-of select="/ticket/@cif"/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
			<fo:table-row>
				<fo:table-cell>
					<fo:block font-size="10pt">
						Num: <xsl:value-of select="/ticket/@number"/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
			<fo:table-row>
				<fo:table-cell>
					<fo:block font-size="10pt">
						Fecha: <xsl:value-of select="/ticket/@date"/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
			<fo:table-row>
				<fo:table-cell>
					<fo:block font-size="10pt">
						Hora: <xsl:value-of select="/ticket/@time"/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-body>
	</fo:table>
  </xsl:template>

  <xsl:template name="total">
  	<fo:block
		padding-top="1mm"
		padding-right="2mm"
		width="50mm"
		margin-top="5mm"
		margin-left="20mm">
		<fo:block font-size="10pt" text-align="right"
			padding-top="1mm"
			background-color="#cFcFcF">
				Total:	<xsl:value-of select="/ticket/@total"/>
		</fo:block>
		<fo:block font-size="10pt" text-align="right"
			padding-top="1mm">
				Entregado:	<xsl:value-of select="/ticket/@entregado"/>
		</fo:block>
		<fo:block font-size="10pt" text-align="right"
			padding-top="1mm"
			background-color="#cAcAcA">
				Cambio:	<xsl:value-of select="/ticket/@cambio"/>
		</fo:block>
	</fo:block>
  </xsl:template>
  
  <xsl:template name="footer">
		<fo:block 
			font-size="10pt" 
			text-align="center"
			padding-top="1mm">
				Le ha antendido: <xsl:value-of select="/ticket/@camarero"/>
		</fo:block>
		<fo:block 
			width="70mm"
			font-size="10pt" 
			text-align="center"
			padding-top="1mm">
				Gracias por su vista
		</fo:block>
	</xsl:template>
</xsl:stylesheet>


======XmlData==============

<?xml version="1.0" encoding="UTF-8"?>
<ticket
	date="01-Abril-2005"
	time="20:45:40"
	number="0001-a"
	total="120.55"
	entregado="200.00"
	cambio="79.45"
	camarero="Pepone"
	cif="23333434-c">
  <products>
    <item
		name="Tapa/Tortilla"
		ud="2"
		precio="1.75"
		total="3000.50"/>
		
	<item
		name="Tapa/Tortilla"
		ud="2"
		precio="1.75"
		total="3.50"/>
  </products>
</ticket>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop postscript problems

Posted by pepone pepone <pe...@gmail.com>.
Hello i have a workaround for works while not found RENDER_PS problem

I use RENDER_PDF and the call pdf2ps the generated postscript seems ok for me
> probably also depends on your environment (printers etc.).
I working with FOP 0.20.5 and gentoo linux 2.6.11
dev-java/blackdown-jre 1.4.2.01-r1 and I using printer via CUPS my
printer is StartMicronics TSP600


On Apr 6, 2005 10:07 AM, Jeremias Maerki <de...@greenmail.ch> wrote:
> The page bounding box is set correctly but that's only a DSC comment
> that may be ignored by most PostScript interpreters. FOP 0.20.5 doesn't
> do any setpagedevice calls so this may be the problem. But even after
> inserting a setpagedevice command, GhostView, for example, doesn't seem
> to pick up the page size. So I'm a bit unsure how to solve this. It

> 
> On 05.04.2005 16:48:18 pepone pepone wrote:
> > Hello I creating a xsl-fo template to producte postscript files
> > to print. when i use the Driver.RENDER_PS the size of the page
> > is not the size that i put in the xsl-fo. if i render the same xsl-fo
> > whit Driver.RENDER_PDF the result is fine.
> >
> > is this a know bug on  Driver.RENDER_PS or is an error on my page template?
> 
> Jeremias Maerki
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop postscript problems

Posted by Jeremias Maerki <de...@greenmail.ch>.
The page bounding box is set correctly but that's only a DSC comment
that may be ignored by most PostScript interpreters. FOP 0.20.5 doesn't
do any setpagedevice calls so this may be the problem. But even after
inserting a setpagedevice command, GhostView, for example, doesn't seem
to pick up the page size. So I'm a bit unsure how to solve this. It
probably also depends on your environment (printers etc.).

On 05.04.2005 16:48:18 pepone pepone wrote:
> Hello I creating a xsl-fo template to producte postscript files
> to print. when i use the Driver.RENDER_PS the size of the page
> is not the size that i put in the xsl-fo. if i render the same xsl-fo
> whit Driver.RENDER_PDF the result is fine.
> 
> is this a know bug on  Driver.RENDER_PS or is an error on my page template?


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org