git-svn-id: https://svn.coded.pt/svn/SIPRP@1003 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
João Neto 17 years ago
parent 689b16771b
commit 672cf13bd4

@ -13,8 +13,6 @@
<classpathentry kind="lib" path="SIPRPSoft/lib/jai_imageio.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/nlog4j-1.2.25.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/avalon-framework-4.2.0.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/batik.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/fop.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/postgresql-8.0-317.jdbc3.jar"/>
<classpathentry kind="lib" path="web/lib/commons-email-1.0-dev.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/iText-2.0.7.jar"/>
@ -36,5 +34,13 @@
<classpathentry kind="lib" path="common/lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="common/lib/jcalendar-1.3.2.jar"/>
<classpathentry kind="lib" path="common/lib/ashwood-1.1.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/xmlgraphics-commons-1.3.1.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/batik-all-1.7.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/serializer-2.7.0.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/xalan-2.7.0.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/xercesImpl-2.7.1.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/fop.jar"/>
<classpathentry kind="output" path="SIPRPSoft/build/classes"/>
</classpath>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -10,6 +10,9 @@ import static siprp.ProcessoConstants.PROCESSO_FECHADO_DESCRIPTION;
import java.awt.Color;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.Date;
@ -68,6 +71,7 @@ public class Main implements com.evolute.utils.ui.window.Connector
private static LoginWindow loginWindow;
private static AvisosPanel avisos = null;
public static File fopConfigFile;
static
{
@ -117,6 +121,7 @@ public class Main implements com.evolute.utils.ui.window.Connector
// new IBookDataLoader().load();
dbase = (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME );
dbase = "siprp_local3";
/* Calendar cal = Calendar.getInstance();
cal.set( 2004, 06, 14 );
if( cal.before( Calendar.getInstance() ) )
@ -168,10 +173,35 @@ public class Main implements com.evolute.utils.ui.window.Connector
loginWindow.expandAll();
}
} );
fopConfigFile = loadFopConfigFile();
new UpdateWindow().update();
}
private static File loadFopConfigFile() {
try {
InputStream is = ClassLoader.getSystemClassLoader()
.getResourceAsStream("siprp/util/fop/fop.xconf");
if (is != null) {
File tempFile = File.createTempFile("fop", ".xconf");
FileOutputStream fos = new FileOutputStream(tempFile);
byte[] buf = new byte[256];
int read = 0;
while ((read = is.read(buf)) > 0) {
fos.write(buf, 0, read);
}
return tempFile;
}
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public boolean connect( String user, String passwd )
{
try
@ -184,6 +214,7 @@ public class Main implements com.evolute.utils.ui.window.Connector
{
//server = "192.168.1.191";
server = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL );
server = "storage";
// server = "ws_fpalma";
}
String prefix = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL_PREFIX );

File diff suppressed because it is too large Load Diff

@ -9,15 +9,21 @@
package siprp.clientes;
import java.io.*;
import java.text.*;
import java.util.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Vector;
import com.evolute.utils.fop.*;
import com.evolute.utils.ui.*;
import com.evolute.utils.xml.*;
import siprp.data.EtiquetaData;
import siprp.util.fop.FOPCreator;
import siprp.util.fop.FOPPrinter;
import siprp.data.*;
import com.evolute.utils.ui.DialogException;
import com.evolute.utils.xml.SimpleXMLElement;
/**
*

@ -1,91 +1,78 @@
<?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"/>
<xsl:template match="GUIA">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4"
page-height="29.7cm"
page-width="21cm"
margin-top="2cm"
margin-bottom="2cm"
margin-left="2cm"
margin-right="2cm">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%" space-before.optimum="0pt" space-after.optimum="0pt">
<fo:table-column column-width="10cm"/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-header>
<fo:table-row>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">
Cuidado Prestado
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">
C&#xf3;digo
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">
Valor
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">
Benef.
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">
Entidade
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:for-each select="CORPO/LINHA_CORPO">
<fo:table-row>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="PRODUTO/DESCRICAO" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRODUTO/CODIGO_TABELA" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRECO/PRECO_TOTAL" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRECO/PRECO_BENEFICIARIO" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRECO/PRECO_ENTIDADE" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
<xsl:template match="GUIA">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%" space-before.optimum="0pt" space-after.optimum="0pt">
<fo:table-column column-width="10cm" />
<fo:table-column />
<fo:table-column />
<fo:table-column />
<fo:table-column />
<fo:table-header>
<fo:table-row>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">Cuidado Prestado</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">Código</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">Valor</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">Benef.</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="center" font-weight="bold">Entidade</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:for-each select="CORPO/LINHA_CORPO">
<fo:table-row>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="PRODUTO/DESCRICAO" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRODUTO/CODIGO_TABELA" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRECO/PRECO_TOTAL" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRECO/PRECO_BENEFICIARIO" />
</fo:block>
</fo:table-cell>
<fo:table-cell border="0.7pt solid #000000">
<fo:block font-size="10pt" text-align="right">
<xsl:value-of select="PRECO/PRECO_ENTIDADE" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
<table-row xmlns="http://www.w3.org/1999/XSL/Format">
<table-cell />
</table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>

@ -143,12 +143,12 @@ public class ExamePDF implements FichaAptidaoConstants
public void print( byte []pdf, String nome )
throws Exception
{
new PDFFilePrinter( pdf, false );
// new PDFFilePrinter( pdf, false );
if( true )
{
// if( true )
// {
// return;
}
// }
long time = System.currentTimeMillis();
// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" );

File diff suppressed because it is too large Load Diff

@ -1,67 +1,55 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Create the page layout
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0">
<xsl:template match="office:document-content">
<importacao>
<xsl:apply-templates select="office:body" />
</importacao>
</xsl:template>
<xsl:template match="office:body">
<xsl:apply-templates select="office:spreadsheet" />
</xsl:template>
<xsl:template match="office:spreadsheet">
<xsl:apply-templates select="table:table" />
</xsl:template>
<xsl:template match="table:table">
<xsl:for-each select="table:table-row">
<xsl:if test="position() &gt; 1">
<entrada>
<xsl:for-each select="table:table-cell">
<xsl:choose>
<xsl:when test="position() = 1">
<tema>
<xsl:apply-templates />
</tema>
</xsl:when>
<xsl:when test="position() = 2">
<risco>
<xsl:apply-templates />
</risco>
</xsl:when>
<xsl:when test="position() = 3">
<requisito>
<xsl:apply-templates />
</requisito>
</xsl:when>
<xsl:when test="position() = 4">
<medida>
<xsl:apply-templates />
</medida>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</entrada>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="text:p">
<linha>
<xsl:value-of select="." />
</linha>
</xsl:template>
</xsl:stylesheet>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" version="1.0">
<xsl:template match="office:document-content">
<importacao>
<xsl:apply-templates select="office:body" />
</importacao>
</xsl:template>
<xsl:template match="office:body">
<xsl:apply-templates select="office:spreadsheet" />
</xsl:template>
<xsl:template match="office:spreadsheet">
<xsl:apply-templates select="table:table" />
</xsl:template>
<xsl:template match="table:table">
<xsl:for-each select="table:table-row">
<xsl:if test="position() &gt; 1">
<entrada>
<xsl:for-each select="table:table-cell">
<xsl:choose>
<xsl:when test="position() = 1">
<tema>
<xsl:apply-templates />
</tema>
</xsl:when>
<xsl:when test="position() = 2">
<risco>
<xsl:apply-templates />
</risco>
</xsl:when>
<xsl:when test="position() = 3">
<requisito>
<xsl:apply-templates />
</requisito>
</xsl:when>
<xsl:when test="position() = 4">
<medida>
<xsl:apply-templates />
</medida>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</entrada>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="text:p">
<linha>
<xsl:value-of select="." />
</linha>
</xsl:template>
</xsl:stylesheet>

@ -8,9 +8,12 @@ import org.jdom.Document;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import com.evolute.utils.fop.PDFCreator;
import siprp.Main;
import siprp.util.fop.PDFCreator;
import com.evolute.utils.xml.XSLTransformer;
public class RelatorioPDFCreator
{
@ -20,21 +23,25 @@ public class RelatorioPDFCreator
Document foDoc = new Document( relatorio.toJdomElement() );
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
ByteArrayOutputStream foBaos = new ByteArrayOutputStream();
// FileOutputStream fofos = new FileOutputStream("/home/jneto/Desktop/a.xml");
outputter.output( foDoc, foBaos );
// outputter.output( foDoc, fofos );
// System.out.println( new String( foBaos.toByteArray() ) );
System.out.println( new String( foBaos.toByteArray() ) );
byte fo[] =
applyTemplate(
getClass().getClassLoader().getResourceAsStream(
"siprp/higiene/relatorio/print/relatorio.xsl" ),
new ByteArrayInputStream( foBaos.toByteArray() ) );
// System.out.println( new String( fo ) );
//FIXME: FOP COPIADO
//FIXME: VERSAO PDFCREATOR HACKADA. FAZER UPGRADE PARA 0.20
PDFCreator.setUserConfig(Main.fopConfigFile);
PDFCreator pdfCreator = PDFCreator.getPDFCreator();
byte pdf[] = pdfCreator.createPdfFromFo( fo );
return pdf;
}

@ -1,215 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes" />
<xsl:template match="evolute">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="pm1_0"
page-height="11in" page-width="8.5in" margin-top="0.7874in"
margin-right="0.7874in" margin-left="0.7874in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_0">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="pm1_0" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:simple-page-master master-name="pm1_1"
page-height="11.6925in" page-width="8.2673in" margin-top="0.3937in"
margin-right="0.5909in" margin-left="1.0319in">
<fo:region-body />
<fo:region-before margin-bottom="0.0953in" />
<fo:region-after margin-top="0.4929in" />
</fo:simple-page-master>
<fo:simple-page-master master-name="pm2_1"
page-height="11.6925in" page-width="8.2673in" margin-top="0.3937in"
margin-right="0.5909in" margin-left="1.0319in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:simple-page-master master-name="pm3_1"
page-height="11.6925in" page-width="8.2673in" margin-top="0.7874in"
margin-right="0.7874in" margin-left="0.7874in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_1">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="pm1_1" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master
master-name="First_20_Page_1">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="pm2_1" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="Index_1">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="pm3_1" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:simple-page-master master-name="pm1_2"
page-height="8.2673in" page-width="11.6925in" margin-top="0.4925in"
margin-right="0.9846in" margin-left="0.9846in">
<fo:region-body />
<fo:region-before margin-bottom="0.552in" />
<fo:region-after margin-top="0.2563in" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_2">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="pm1_2" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:simple-page-master master-name="pm1_3"
page-height="11.6925in" page-width="8.2673in" margin-top="0.4917in"
margin-right="1.1811in" margin-left="1.1811in">
<fo:region-body />
<fo:region-before margin-bottom="0.4535in" />
<fo:region-after margin-top="0.4535in" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_3">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="pm1_3" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Standard_0"
initial-page-number="auto" force-page-count="no-force">
<fo:static-content flow-name="xsl-region-before">
<fo:block-container position="absolute"
top="-1.521cm" left="-3.373cm" height="9.899cm" width="9.899cm">
<fo:external-graphic
src="url('http://www.evolute.pt/~siprp/planoactuacao/roda.jpg')"
height="9.899cm" width="9.899cm" />
</fo:block-container>
<fo:block-container position="absolute" top="0cm"
left="18cm" height="11.007cm" width="2.941cm">
<fo:external-graphic
src="url('http://www.evolute.pt/~siprp/planoactuacao/siprp_land.jpg')"
height="11.007cm" width="2.941cm" />
</fo:block-container>
<fo:block font-size="12pt" color="#606060"
font-weight="bold" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" margin-bottom="0in"
space-before="1.32cm">
ATRIUM SALDANHA  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" space-before="0.0866in"
margin-bottom="0in">
Praça Duque de Saldanha, 1 9º G  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" space-before="0.0866in"
margin-bottom="0in">
1050 094 Lisboa  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" space-before="0.0866in"
margin-bottom="0in">
Telefone (+351) 213 504 540  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" space-before="0.0866in"
margin-bottom="0in">
Fax (+351) 213 504 549  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" space-before="0.0866in"
margin-bottom="0in">
geral@siprp.pt  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="start" margin-left="1.058cm" space-before="0.0866in"
margin-bottom="0in">
www.siprp.com  
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="12pt" color="#606060"
font-weight="bold" margin-right="0in" text-indent="0in"
text-align="center" margin-left="0.6in" space-before="0.1043in"
margin-bottom="0in">
Lisboa  
</fo:block>
<fo:block font-size="10pt" color="#505050"
font-weight="normal" margin-right="0in" text-indent="0in"
text-align="center" margin-left="0.6in" space-before="0.0866in"
margin-bottom="0in">
<fo:inline color="#000000">
<xsl:value-of
select="data-relatorio/mes-extenso" />
de
<xsl:value-of select="data-relatorio/ano" />
</fo:inline>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="center">
<fo:external-graphic
src="url('http://www.evolute.pt/~siprp/relatoriohigieneeseguranca/capa.jpg')"
height="8.4cm" width="12.55cm" />
</fo:block>
<fo:block font-size="16pt" color="#606060"
font-weight="bold" margin-right="0in" text-indent="0in"
text-align="center" margin-left="0in" margin-top="0in"
margin-bottom="0in">
AVALIAÇÃO DE RISCOS LABORAIS  
</fo:block>
<fo:block font-size="16pt" color="#606060"
font-weight="bold" margin-right="0in" text-indent="0in"
text-align="center" margin-left="0in" margin-top="0in"
margin-bottom="0in">
Relatório
</fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt" text-align="center">
<xsl:variable name="logotipo"
select="empresa/logotipo" />
<fo:external-graphic src="url('{$logotipo}')"
height="2cm" />
</fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="18pt" color="#000000"
font-weight="bold" margin-right="0in" text-indent="0in"
text-align="center" margin-left="0in" margin-top="0.1563in"
margin-bottom="0in">
<xsl:value-of
select="empresa/designacao-social" />
-
<xsl:value-of select="empresa/estabelecimento" />
 
</fo:block>
<fo:block font-size="12pt"> </fo:block>
</fo:flow>
</fo:page-sequence>
<!-- <fo:page-sequence master-reference="Standard_1"
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
<xsl:template match="evolute">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="pm1_0" page-height="11in" page-width="8.5in" margin-top="0.7874in" margin-right="0.7874in" margin-left="0.7874in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_0">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pm1_0" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:simple-page-master master-name="pm1_1" page-height="11.6925in" page-width="8.2673in" margin-top="0.3937in" margin-right="0.5909in" margin-left="1.0319in">
<fo:region-body />
<fo:region-before margin-bottom="0.0953in" />
<fo:region-after margin-top="0.4929in" />
</fo:simple-page-master>
<fo:simple-page-master master-name="pm2_1" page-height="11.6925in" page-width="8.2673in" margin-top="0.3937in" margin-right="0.5909in" margin-left="1.0319in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:simple-page-master master-name="pm3_1" page-height="11.6925in" page-width="8.2673in" margin-top="0.7874in" margin-right="0.7874in" margin-left="0.7874in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_1">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pm1_1" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="First_20_Page_1">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pm2_1" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="Index_1">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pm3_1" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:simple-page-master master-name="pm1_2" page-height="8.2673in" page-width="11.6925in" margin-top="0.4925in" margin-right="0.9846in" margin-left="0.9846in">
<fo:region-body />
<fo:region-before margin-bottom="0.552in" />
<fo:region-after margin-top="0.2563in" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_2">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pm1_2" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:simple-page-master master-name="pm1_3" page-height="11.6925in" page-width="8.2673in" margin-top="0.4917in" margin-right="1.1811in" margin-left="1.1811in">
<fo:region-body />
<fo:region-before margin-bottom="0.4535in" />
<fo:region-after margin-top="0.4535in" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Standard_3">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pm1_3" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Standard_0" initial-page-number="auto" force-page-count="no-force">
<fo:static-content flow-name="xsl-region-before">
<fo:block-container position="absolute" top="-1.521cm" left="-3.373cm" height="9.899cm" width="9.899cm">
<fo:block>
<fo:external-graphic src="url('http://www.evolute.pt/~siprp/planoactuacao/roda.jpg')" content-width="9.899cm" content-height="9.899cm" />
</fo:block>
</fo:block-container>
<fo:block-container position="absolute" top="0cm" left="18cm" height="11.007cm" width="2.941cm">
<fo:block>
<fo:external-graphic src="url('http://www.evolute.pt/~siprp/planoactuacao/siprp_land.jpg')" content-width="2.941cm" content-height="11.007cm" />
</fo:block>
</fo:block-container>
<fo:block font-size="12pt" color="#606060" font-weight="bold" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" margin-bottom="0in" space-before="1.32cm">ATRIUM SALDANHA  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" space-before="0.0866in" margin-bottom="0in">Praça Duque de Saldanha, 1 9º G  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" space-before="0.0866in" margin-bottom="0in">1050 094 Lisboa  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" space-before="0.0866in" margin-bottom="0in">Telefone (+351) 213 504 540  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" space-before="0.0866in" margin-bottom="0in">Fax (+351) 213 504 549  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" space-before="0.0866in" margin-bottom="0in">geral@siprp.pt  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="start" margin-left="1.058cm" space-before="0.0866in" margin-bottom="0in">www.siprp.com  </fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="12pt" color="#606060" font-weight="bold" margin-right="0in" text-indent="0in" text-align="center" margin-left="0.6in" space-before="0.1043in" margin-bottom="0in">Lisboa  </fo:block>
<fo:block font-size="10pt" color="#505050" font-weight="normal" margin-right="0in" text-indent="0in" text-align="center" margin-left="0.6in" space-before="0.0866in" margin-bottom="0in">
<fo:inline color="#000000">
<xsl:value-of select="data-relatorio/mes-extenso" />
de
<xsl:value-of select="data-relatorio/ano" />
</fo:inline>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="center">
<fo:external-graphic src="url('http://www.evolute.pt/~siprp/relatoriohigieneeseguranca/capa.jpg')" content-width="12.55cm" content-height="8.4cm" />
</fo:block>
<fo:block font-size="16pt" color="#606060" font-weight="bold" margin-right="0in" text-indent="0in" text-align="center" margin-left="0in" margin-top="0in" margin-bottom="0in">AVALIAÇÃO DE RISCOS LABORAIS  </fo:block>
<fo:block font-size="16pt" color="#606060" font-weight="bold" margin-right="0in" text-indent="0in" text-align="center" margin-left="0in" margin-top="0in" margin-bottom="0in">Relatório</fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt" text-align="center">
<xsl:variable name="logotipo" select="empresa/logotipo" />
<fo:external-graphic src="url('{$logotipo}')" content-height="2cm" />
</fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="18pt" color="#000000" font-weight="bold" margin-right="0in" text-indent="0in" text-align="center" margin-left="0in" margin-top="0.1563in" margin-bottom="0in">
<xsl:value-of select="empresa/designacao-social" />
-
<xsl:value-of select="empresa/estabelecimento" />
 
</fo:block>
<fo:block font-size="12pt"> </fo:block>
</fo:flow>
</fo:page-sequence>
<!-- <fo:page-sequence master-reference="Standard_1"
initial-page-number="auto">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="12pt"> </fo:block>
@ -3667,185 +3581,91 @@
aceitáveis.  
</fo:block>
</fo:flow>
</fo:page-sequence>-->
<fo:page-sequence master-reference="Standard_3"
initial-page-number="auto">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="12pt">
<fo:inline padding-left="1cm"
white-space-collapse="false">
 
</fo:inline>
<fo:inline padding-left="1cm"
white-space-collapse="false">
 
</fo:inline>
 
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="12pt" border-bottom="none"
border-top="0.0071in solid #000000" border-right="none"
border-left="none">
<fo:inline>
Avaliação Periódica de Riscos Laborais
<fo:inline padding-left="1cm"
white-space-collapse="false">
 
</fo:inline>
<fo:inline padding-left="1cm"
white-space-collapse="false">
 
</fo:inline>
</fo:inline>
<fo:inline>
<fo:inline>113</fo:inline>
</fo:inline>
 
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block id="N65910" font-size="13pt"
font-weight="bold" padding-left="0.0555in" padding-top="0.0138in"
text-shadow="#000000 0.0626in 0.0626in" padding-bottom="0.0138in"
text-align="justify" border="0.0071in solid #000000"
background-color="#f2f2f2" padding-right="0.0555in">
9. PLANO DE ACTUAÇÃO  
</fo:block>
<fo:block font-size="12pt" text-align="justify">
 
</fo:block>
<fo:block font-size="12pt" text-align="justify"
line-height="130%">
A partir dos resultados da avaliação de riscos,
é elaborado um outro documento (Plano de
Actuação), que inclui a listagem das acções que
deverão ser realizadas de modo a eliminar,
reduzir ou controlar os riscos detectados.  
</fo:block>
<fo:block font-size="12pt" text-align="justify"
line-height="130%">
<fo:inline>
Este Plano permitirá auxiliar a
</fo:inline>
<fo:inline font-weight="bold">AUCHAN</fo:inline>
<fo:inline>-</fo:inline>
<fo:inline font-weight="bold">
Loja de Coimbra
</fo:inline>
<fo:inline>
na programação e acompanhamento das
referidas acções.
</fo:inline>
 
</fo:block>
<fo:block font-size="12pt" text-align="justify"
line-height="130%">
 
</fo:block>
<fo:block font-size="12pt" text-align="justify"
line-height="130%">
 
</fo:block>
<fo:block id="N65940" font-size="13pt"
font-weight="bold" padding-left="0.0555in" padding-top="0.0138in"
text-shadow="#000000 0.0626in 0.0626in" padding-bottom="0.0138in"
text-align="justify" border="0.0071in solid #000000"
background-color="#f2f2f2" padding-right="0.0555in">
10. CONSIDERAÇÕES FINAIS  
</fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt" text-align="justify"
line-height="130%">
<fo:inline>
A equipa técnica de Segurança e Higiene do
Trabalho da SIPRP agradece a colaboração de
todos os colaboradores da
</fo:inline>
<fo:inline font-weight="bold">AUCHAN</fo:inline>
<fo:inline>-</fo:inline>
<fo:inline font-weight="bold">
Loja de Coimbra
</fo:inline>
<fo:inline>
durante a realização desta auditoria,
ficando à disposição para qualquer
esclarecimento.
</fo:inline>
 
</fo:block>
<fo:block font-size="12pt" line-height="130%">
 
</fo:block>
<fo:block font-size="12pt" line-height="130%">
 
</fo:block>
<fo:block font-size="12pt" line-height="130%">
 
</fo:block>
<fo:block font-size="12pt" line-height="130%">
Lisboa, 29 de Abril de 2008  
</fo:block>
<fo:block font-size="12pt" line-height="130%">
 
</fo:block>
<fo:table table-layout="fixed" width="2.825in">
<fo:table-column column-width="2.825in" />
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-bottom="0in"
padding-left="0.075in" border-left="none" border-bottom="none"
padding-top="0in" border-top="0.0069in solid #000000"
display-align="before" writing-mode="lr-tb"
padding-right="0.075in" border-right="none">
<fo:block font-size="12pt"
font-weight="bold" margin-right="0in" text-indent="0.2134in"
text-align="center" margin-left="-0.2134in">
 
</fo:block>
<fo:block font-size="12pt"
font-weight="bold" margin-right="0in" text-indent="0.2134in"
text-align="center" margin-left="-0.2134in">
Sónia Campos  
</fo:block>
<fo:block font-size="12pt"
margin-right="-0.0937in" text-indent="0in" text-align="center"
margin-left="0in">
Ergonomista  
</fo:block>
<fo:block font-size="12pt"
margin-right="-0.0937in" text-indent="0in" text-align="center"
margin-left="0in">
Téc. Sup. Seg. Hig. do Trabalho
 
</fo:block>
<fo:block font-size="12pt"
margin-right="-0.0937in" text-indent="0in" text-align="center"
margin-left="0in">
(CAP nº 0601/6505/02)  
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font-size="12pt" text-align="justify">
 
</fo:block>
<fo:block font-size="12pt" line-height="130%">
 
</fo:block>
<fo:block font-size="12pt" font-weight="bold"
margin-right="0in" text-indent="0.2134in"
margin-left="-0.2134in">
 
</fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block id="evolute_endofdoc" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
</fo:page-sequence>-->
<fo:page-sequence master-reference="Standard_3" initial-page-number="auto">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="12pt">
<fo:inline padding-left="1cm" white-space-collapse="false"> </fo:inline>
<fo:inline padding-left="1cm" white-space-collapse="false"> </fo:inline>
 
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="12pt" border-bottom="none" border-top="0.0071in solid #000000" border-right="none" border-left="none">
<fo:inline>
Avaliação Periódica de Riscos Laborais
<fo:inline padding-left="1cm" white-space-collapse="false"> </fo:inline>
<fo:inline padding-left="1cm" white-space-collapse="false"> </fo:inline>
</fo:inline>
<fo:inline>
<fo:inline>113</fo:inline>
</fo:inline>
 
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block id="N65910" font-size="13pt" font-weight="bold" padding-left="0.0555in" padding-top="0.0138in" text-shadow="#000000 0.0626in 0.0626in" padding-bottom="0.0138in" text-align="justify" border="0.0071in solid #000000" background-color="#f2f2f2" padding-right="0.0555in">9. PLANO DE ACTUAÇÃO  </fo:block>
<fo:block font-size="12pt" text-align="justify"> </fo:block>
<fo:block font-size="12pt" text-align="justify" line-height="130%">A partir dos resultados da avaliação de riscos,
é elaborado um outro documento (Plano de
Actuação), que inclui a listagem das acções que
deverão ser realizadas de modo a eliminar,
reduzir ou controlar os riscos detectados.  </fo:block>
<fo:block font-size="12pt" text-align="justify" line-height="130%">
<fo:inline>Este Plano permitirá auxiliar a</fo:inline>
<fo:inline font-weight="bold">AUCHAN</fo:inline>
<fo:inline>-</fo:inline>
<fo:inline font-weight="bold">Loja de Coimbra</fo:inline>
<fo:inline>na programação e acompanhamento das
referidas acções.</fo:inline>
 
</fo:block>
<fo:block font-size="12pt" text-align="justify" line-height="130%"> </fo:block>
<fo:block font-size="12pt" text-align="justify" line-height="130%"> </fo:block>
<fo:block id="N65940" font-size="13pt" font-weight="bold" padding-left="0.0555in" padding-top="0.0138in" text-shadow="#000000 0.0626in 0.0626in" padding-bottom="0.0138in" text-align="justify" border="0.0071in solid #000000" background-color="#f2f2f2" padding-right="0.0555in">10. CONSIDERAÇÕES FINAIS  </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block font-size="12pt" text-align="justify" line-height="130%">
<fo:inline>A equipa técnica de Segurança e Higiene do
Trabalho da SIPRP agradece a colaboração de
todos os colaboradores da</fo:inline>
<fo:inline font-weight="bold">AUCHAN</fo:inline>
<fo:inline>-</fo:inline>
<fo:inline font-weight="bold">Loja de Coimbra</fo:inline>
<fo:inline>durante a realização desta auditoria,
ficando à disposição para qualquer
esclarecimento.</fo:inline>
 
</fo:block>
<fo:block font-size="12pt" line-height="130%"> </fo:block>
<fo:block font-size="12pt" line-height="130%"> </fo:block>
<fo:block font-size="12pt" line-height="130%"> </fo:block>
<fo:block font-size="12pt" line-height="130%">Lisboa, 29 de Abril de 2008  </fo:block>
<fo:block font-size="12pt" line-height="130%"> </fo:block>
<fo:table table-layout="fixed" width="2.825in">
<fo:table-column column-width="2.825in" />
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-bottom="0in" padding-left="0.075in" border-left="none" border-bottom="none" padding-top="0in" border-top="0.0069in solid #000000" display-align="before" writing-mode="lr-tb" padding-right="0.075in" border-right="none">
<fo:block font-size="12pt" font-weight="bold" margin-right="0in" text-indent="0.2134in" text-align="center" margin-left="-0.2134in"> </fo:block>
<fo:block font-size="12pt" font-weight="bold" margin-right="0in" text-indent="0.2134in" text-align="center" margin-left="-0.2134in">Sónia Campos  </fo:block>
<fo:block font-size="12pt" margin-right="-0.0937in" text-indent="0in" text-align="center" margin-left="0in">Ergonomista  </fo:block>
<fo:block font-size="12pt" margin-right="-0.0937in" text-indent="0in" text-align="center" margin-left="0in">Téc. Sup. Seg. Hig. do Trabalho
 </fo:block>
<fo:block font-size="12pt" margin-right="-0.0937in" text-indent="0in" text-align="center" margin-left="0in">(CAP nº 0601/6505/02)  </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font-size="12pt" text-align="justify"> </fo:block>
<fo:block font-size="12pt" line-height="130%"> </fo:block>
<fo:block font-size="12pt" font-weight="bold" margin-right="0in" text-indent="0.2134in" margin-left="-0.2134in"> </fo:block>
<fo:block font-size="12pt"> </fo:block>
<fo:block id="evolute_endofdoc" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>

@ -23,13 +23,12 @@ import java.util.Locale;
import javax.xml.transform.TransformerFactory;
import siprp.printer.Printer;
import siprp.util.fop.FOPCreator;
import siprp.util.fop.FOPPrinter;
import siprp.util.fop.PDFCreator;
import com.evolute.utils.Singleton;
import com.evolute.utils.date.DateUtils;
import com.evolute.utils.fop.FOPCreator;
import com.evolute.utils.fop.FOPPrinter;
import com.evolute.utils.fop.FOPPrinterConstants;
import com.evolute.utils.fop.PDFCreator;
import com.evolute.utils.strings.StringPlainer;
import com.evolute.utils.ui.DialogException;
import com.evolute.utils.xml.SimpleXMLElement;

@ -1,74 +1,63 @@
<?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"/>
<xsl:template match="LISTA_FICHAS">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-before extent="30pt"/>
<fo:region-body margin-top="30pt"/>
<fo:region-after extent="6pt"
padding="6pt 1in"
display-align="after"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="14pt" text-align="center" font-weight="bold">
RELA&#xc7;&#xc3;O DE FICHAS DE APTID&#xc3;O ENVIADAS
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%" space-before.optimum="10pt"
border="1pt solid #000000">
<fo:table-column/>
<fo:table-column column-width="100pt"/>
<fo:table-column column-width="100pt"/>
<fo:table-body >
<fo:table-row>
<fo:table-cell border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" font-weight="bold" space-before="5pt" space-after="5pt">
NOME
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" font-weight="bold" space-before="5pt" space-after="5pt">
DATA EXAME
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="8pt" font="Arial" text-align="center" font-weight="bold" space-before="5pt" space-after="5pt">
PR&#xd3;XIMO EXAME
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="FICHA">
<fo:table-row>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" space-before="2pt">
<xsl:value-of select="NOME" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" space-before="2pt">
<xsl:value-of select="DATA_EXAME" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" space-before="2pt">
<xsl:value-of select="DATA_PROXIMO_EXAME" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
<fo:block font-size="8pt" text-align="left">
<xsl:value-of select="DATA_EXTENSO" />
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
<xsl:template match="LISTA_FICHAS">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body margin-top="30pt" />
<fo:region-before extent="30pt" />
<fo:region-after extent="6pt" padding="6pt 1in" display-align="after" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="14pt" text-align="center" font-weight="bold">RELAÇÃO DE FICHAS DE APTIDÃO ENVIADAS</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%" space-before.optimum="10pt" border="1pt solid #000000">
<fo:table-column />
<fo:table-column column-width="100pt" />
<fo:table-column column-width="100pt" />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" font-weight="bold" space-before="5pt" space-after="5pt">NOME</fo:block>
</fo:table-cell>
<fo:table-cell border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" font-weight="bold" space-before="5pt" space-after="5pt">DATA EXAME</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="8pt" font="Arial" text-align="center" font-weight="bold" space-before="5pt" space-after="5pt">PRÓXIMO EXAME</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="FICHA">
<fo:table-row>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" space-before="2pt">
<xsl:value-of select="NOME" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" border-right-color="black" border-right-style="solid" border-right-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" space-before="2pt">
<xsl:value-of select="DATA_EXAME" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin">
<fo:block font-size="8pt" font="Arial" text-align="center" space-before="2pt">
<xsl:value-of select="DATA_PROXIMO_EXAME" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
<fo:block font-size="8pt" text-align="left">
<xsl:value-of select="DATA_EXTENSO" />
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>

@ -1,313 +1,283 @@
<?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"/>
<xsl:template match="fax">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm"
margin-top="1.5cm" margin-bottom="1.5cm" margin-left="2cm" margin-right="2cm">
<fo:region-body margin-top="60pt" margin-bottom="20pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="14pt" text-align="right" font-weight="bold">
FAX
</fo:block>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">N&#xba; de P&#xe1;ginas (inclu&#xed;ndo esta)</fo:inline>
/ <fo:inline font-size="8pt">Number of pages (including this one): </fo:inline>
<fo:inline font-weight="bold">
<fo:page-number-citation ref-id="endofdoc"/>
</fo:inline>
</fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="100pt"/>
<fo:table-column column-width="120pt"/>
<fo:table-column column-width="120pt"/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Data </fo:inline>
/ <fo:inline font-size="8pt">Date: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="data" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Para </fo:inline>
/ <fo:inline font-size="8pt">To: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="contacto-nome" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Empresa </fo:inline>
/ <fo:inline font-size="8pt">Company: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="contacto-empresa" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">N&#xba; Fax </fo:inline>
/ <fo:inline font-size="8pt">Fax number: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="contacto-fax" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">De </fo:inline>
/ <fo:inline font-size="8pt">From: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="nome" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">
E-mail:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="email" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">N&#xba; Fax </fo:inline>
/ <fo:inline font-size="8pt">Fax number: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="fax" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">N&#xba; Tel. </fo:inline>
/ <fo:inline font-size="8pt">Phone number: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="telefone" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" number-columns-spanned="4">
</fo:table-cell>
</fo:table-row>
<fo:table-row height="5pt">
<fo:table-cell number-columns-spanned="4">
<fo:block font-size="10pt" text-align="left">
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" space-before="2pt">
<fo:inline font-weight="bold">Assunto </fo:inline>
/ <fo:inline font-size="8pt">Subject: </fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="assunto" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed" width="100%" space-before="20pt">
<fo:table-column column-width="50pt"/>
<fo:table-column column-width="170pt"/>
<fo:table-column column-width="50pt"/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">
Cliente:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="cliente" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">
Local:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="local" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">
Data:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="data-marcacao" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">
Hora:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="hora-marcacao" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font-size="10pt" text-align="left" space-before="20pt">
Exmos. Senhores,
</fo:block>
<fo:block font-size="10pt" text-align="left" space-before="10pt">
Informo que o<xsl:if test="numero-trabalhadores &gt; 1">s</xsl:if>
seguinte<xsl:if test="numero-trabalhadores &gt; 1">s</xsl:if>
colaborador<xsl:if test="numero-trabalhadores &gt; 1">es</xsl:if>
<xsl:if test="numero-trabalhadores &gt; 1"> ir&#xe3;o</xsl:if>
<xsl:if test="numero-trabalhadores = 1"> ir&#xe1;</xsl:if>
comparecer nas vossas instala&#xe7;&#xf5;es para colheita:
</fo:block>
<fo:table space-before="10pt">
<fo:table-column column-width="200pt"/>
<fo:table-column />
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" font-weight="bold" text-align="center" space-before="2pt">
NOME DO FUNCION&#xc1;RIO
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" font-weight="bold" space-before="2pt">
DATA_NASCIMENTO
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" font-weight="bold" text-align="center" space-before="2pt">
PERFIL
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="trabalhador">
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" text-align="left" space-before="2pt">
<xsl:value-of select="nome" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" text-align="center" space-before="2pt">
<xsl:value-of select="data-nascimento" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" text-align="right" space-before="2pt">
<xsl:value-of select="perfil" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
<xsl:for-each select="perfil">
<fo:block font-size="10pt" text-align="justify" space-before="10pt">
<fo:inline font-weight="bold" text-decoration="underline">
PERFIL <xsl:value-of select="nome" />
</fo:inline>:
<xsl:for-each select="ecd">
<xsl:if test="position() &gt; 1">, </xsl:if>
<xsl:value-of select="." />
</xsl:for-each>
</fo:block>
</xsl:for-each>
<fo:table space-before="20pt">
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="12pt" text-align="LEFT" space-before="2pt">
AGRADE&#xc7;O QUE ESTA LISTAGEM NOS SEJA REENVIADA COM INDICA&#xc7;&#xc3;O DAS
EVENTUAIS FALTAS OCORRIDAS
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font-size="10pt" text-align="left" space-before="10pt">
Sem outro assunto de momento, aproveitamos para apresentar os nossos melhores cumprimentos,
</fo:block>
<fo:block font-size="10pt" text-align="left" space-before="30pt">
<xsl:value-of select="nome"/>
</fo:block>
<fo:block id="endofdoc"></fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
<xsl:template match="fax">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1.5cm" margin-bottom="1.5cm" margin-left="2cm" margin-right="2cm">
<fo:region-body margin-top="60pt" margin-bottom="20pt" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="14pt" text-align="right" font-weight="bold">FAX</fo:block>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Nº de Páginas (incluíndo esta)</fo:inline>
/
<fo:inline font-size="8pt">Number of pages (including this one):</fo:inline>
<fo:inline font-weight="bold">
<fo:page-number-citation ref-id="endofdoc" />
</fo:inline>
</fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="100pt" />
<fo:table-column column-width="120pt" />
<fo:table-column column-width="120pt" />
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Data</fo:inline>
/
<fo:inline font-size="8pt">Date:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="data" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Para</fo:inline>
/
<fo:inline font-size="8pt">To:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="contacto-nome" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Empresa</fo:inline>
/
<fo:inline font-size="8pt">Company:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="contacto-empresa" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Nº Fax</fo:inline>
/
<fo:inline font-size="8pt">Fax number:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="contacto-fax" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">De</fo:inline>
/
<fo:inline font-size="8pt">From:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="nome" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">E-mail:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="email" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Nº Fax</fo:inline>
/
<fo:inline font-size="8pt">Fax number:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="fax" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<fo:inline font-weight="bold">Nº Tel.</fo:inline>
/
<fo:inline font-size="8pt">Phone number:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="telefone" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-top-color="black" border-top-style="solid" border-top-width="thin" number-columns-spanned="4" />
</fo:table-row>
<fo:table-row height="5pt">
<fo:table-cell number-columns-spanned="4">
<fo:block font-size="10pt" text-align="left" />
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" space-before="2pt">
<fo:inline font-weight="bold">Assunto</fo:inline>
/
<fo:inline font-size="8pt">Subject:</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="assunto" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed" width="100%" space-before="20pt">
<fo:table-column column-width="50pt" />
<fo:table-column column-width="170pt" />
<fo:table-column column-width="50pt" />
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">Cliente:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="cliente" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">Local:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="local" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">Data:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="data-marcacao" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left" font-weight="bold">Hora:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="hora-marcacao" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font-size="10pt" text-align="left" space-before="20pt">Exmos. Senhores,</fo:block>
<fo:block font-size="10pt" text-align="left" space-before="10pt">
Informo que o
<xsl:if test="numero-trabalhadores &gt; 1">s</xsl:if>
seguinte
<xsl:if test="numero-trabalhadores &gt; 1">s</xsl:if>
colaborador
<xsl:if test="numero-trabalhadores &gt; 1">es</xsl:if>
<xsl:if test="numero-trabalhadores &gt; 1">irão</xsl:if>
<xsl:if test="numero-trabalhadores = 1">irá</xsl:if>
comparecer nas vossas instalações para colheita:
</fo:block>
<fo:table space-before="10pt">
<fo:table-column column-width="200pt" />
<fo:table-column />
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" font-weight="bold" text-align="center" space-before="2pt">NOME DO FUNCIONÁRIO</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" font-weight="bold" space-before="2pt">DATA_NASCIMENTO</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" font-weight="bold" text-align="center" space-before="2pt">PERFIL</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="trabalhador">
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" text-align="left" space-before="2pt">
<xsl:value-of select="nome" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" text-align="center" space-before="2pt">
<xsl:value-of select="data-nascimento" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt" text-align="right" space-before="2pt">
<xsl:value-of select="perfil" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
<xsl:for-each select="perfil">
<fo:block font-size="10pt" text-align="justify" space-before="10pt">
<fo:inline font-weight="bold" text-decoration="underline">
PERFIL
<xsl:value-of select="nome" />
</fo:inline>
:
<xsl:for-each select="ecd">
<xsl:if test="position() &gt; 1">,</xsl:if>
<xsl:value-of select="." />
</xsl:for-each>
</fo:block>
</xsl:for-each>
<fo:table space-before="20pt">
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="12pt" text-align="LEFT" space-before="2pt">AGRADEÇO QUE ESTA LISTAGEM NOS SEJA REENVIADA COM INDICAÇÃO DAS
EVENTUAIS FALTAS OCORRIDAS</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font-size="10pt" text-align="left" space-before="10pt">Sem outro assunto de momento, aproveitamos para apresentar os nossos melhores cumprimentos,</fo:block>
<fo:block font-size="10pt" text-align="left" space-before="30pt">
<xsl:value-of select="nome" />
</fo:block>
<fo:block id="endofdoc" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>

@ -1,110 +1,94 @@
<?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"/>
<xsl:template match="lista-presencas">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
<fo:region-body margin-top="16pt" margin-bottom="12pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="presenca">
<xsl:choose>
<xsl:when test="position() mod 2 = 0" >
<fo:block break-after="page" >
<xsl:apply-templates select="." />
</fo:block>
</xsl:when>
<xsl:otherwise >
<fo:block space-after="40pt">
<xsl:apply-templates select="." />
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="presenca">
<fo:table table-layout="fixed" width="100%">
<fo:table-column />
<fo:table-body>
<fo:table-row height="350pt" >
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-size="14pt" font-weight="bold" space-after="4pt" space-before="8pt" padding-left="8pt">
Realiza&#xe7;&#xe3;o de ECDs
</fo:block>
<fo:block font-size="12pt" font-weight="bold" padding-left="8pt">
<xsl:value-of select="trabalhador" />
</fo:block>
<fo:block font-size="10pt" space-after="4pt" padding-left="8pt">
( <xsl:value-of select="empresa" /> )
</fo:block>
<fo:block font-size="12pt" font-weight="bold" space-after="4pt" padding-left="8pt">
data: <xsl:value-of select="data" />
</fo:block>
<fo:block font-size="12pt" font-weight="bold" space-after="8pt" padding-left="8pt">
hora de entrada: __h__m
</fo:block>
<fo:block padding-left="8pt" padding-right="8pt" space-after="8pt">
<fo:table>
<fo:table-column column-width="200pt"/>
<fo:table-column column-width="100pt"/>
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-size="12pt" font-weight="bold" text-align="center" >
ECD
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-size="12pt" font-weight="bold" text-align="center" >
R&#xfa;brica
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-size="12pt" font-weight="bold" text-align="center" >
Motivo de n&#xe3;o realiza&#xe7;&#xe3;o
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="ecd">
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-size="10pt" >
<xsl:value-of select="." />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-weight="bold" text-align="center" >
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
<fo:block font-weight="bold" text-align="center" >
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block font-size="12pt" font-weight="bold" space-after="8pt" padding-left="8pt">
hora de sa&#xed;da: __h__m
</fo:block>
<fo:block font-size="12pt" font-weight="bold" padding-left="8pt">
assinatura do trabalhador:________________________________________
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
<xsl:template match="lista-presencas">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
<fo:region-body margin-top="16pt" margin-bottom="12pt" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="presenca">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<fo:block break-after="page">
<xsl:apply-templates select="." />
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block space-after="40pt">
<xsl:apply-templates select="." />
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="presenca">
<fo:table table-layout="fixed" width="100%">
<fo:table-column />
<fo:table-body>
<fo:table-row height="350pt">
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="14pt" font-weight="bold" space-after="4pt" space-before="8pt" padding-left="8pt">Realização de ECDs</fo:block>
<fo:block font-size="12pt" font-weight="bold" padding-left="8pt">
<xsl:value-of select="trabalhador" />
</fo:block>
<fo:block font-size="10pt" space-after="4pt" padding-left="8pt">
(
<xsl:value-of select="empresa" />
)
</fo:block>
<fo:block font-size="12pt" font-weight="bold" space-after="4pt" padding-left="8pt">
data:
<xsl:value-of select="data" />
</fo:block>
<fo:block font-size="12pt" font-weight="bold" space-after="8pt" padding-left="8pt">hora de entrada: __h__m</fo:block>
<fo:block padding-left="8pt" padding-right="8pt" space-after="8pt">
<fo:table>
<fo:table-column column-width="200pt" />
<fo:table-column column-width="100pt" />
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="12pt" font-weight="bold" text-align="center">ECD</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="12pt" font-weight="bold" text-align="center">Rúbrica</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="12pt" font-weight="bold" text-align="center">Motivo de não realização</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="ecd">
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-size="10pt">
<xsl:value-of select="." />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-weight="bold" text-align="center" />
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" border-width="thin">
<fo:block font-weight="bold" text-align="center" />
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block font-size="12pt" font-weight="bold" space-after="8pt" padding-left="8pt">hora de saída: __h__m</fo:block>
<fo:block font-size="12pt" font-weight="bold" padding-left="8pt">assinatura do trabalhador:________________________________________</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
</xsl:stylesheet>

@ -2,12 +2,15 @@ package siprp.planoactuacao.print;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
import com.evolute.utils.fop.PDFCreator;
import siprp.Main;
import siprp.util.fop.PDFCreator;
import com.evolute.utils.xml.XSLTransformer;
public class PlanoActuacaoPDFCreator
@ -27,7 +30,16 @@ public class PlanoActuacaoPDFCreator
"siprp/planoactuacao/print/plano_actuacao_alargado.xsl"
: "siprp/planoactuacao/print/plano_actuacao.xsl" ),
new ByteArrayInputStream( foBaos.toByteArray() ) );
byte pdf[] = PDFCreator.getPDFCreator().createPdfFromFo( fo );
FileOutputStream fos = new FileOutputStream("/home/jneto/Desktop/a.fo");
fos.write(fo);
PDFCreator.setUserConfig(Main.fopConfigFile);
PDFCreator pdfCreator = PDFCreator.getPDFCreator();
byte pdf[] = pdfCreator.createPdfFromFo( fo );
return pdf;
}

@ -421,7 +421,8 @@ public class PlanoActuacaoPrintDataProvider
new Expression[]{},
new String[]{ "hs_relatorio_medida.id", "hs_relatorio_medida.description" },
new Field( "hs_relatorio_medida.risco_id" ).isEqual( riscoId ).and(
new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) ),
new Field( "hs_relatorio_medida.deleted_date" ).isEqual( null ) )
.and(new Field("hs_relatorio_medida.description").isDifferent("")),
new String[]{ "hs_relatorio_medida.id" },
null,
null,

@ -4,7 +4,8 @@ import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.evolute.utils.fop.PDFCreator;
import siprp.util.fop.PDFCreator;
import com.evolute.utils.xml.XSLTransformer;
public class TestPrint

@ -0,0 +1,64 @@
/*
* FOPCreator.java
*
* Created on 25 de Maio de 2005, 15:36
*/
package siprp.util.fop;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
/**
*
* @author lflores
*/
public class FOPCreator
{
private static final Object LOCK = new Object();
private static FOPCreator fopCreator;
/** Creates a new instance of FOPPrinter */
private FOPCreator()
{
}
public static FOPCreator getFOPCreator()
{
synchronized( LOCK )
{
if( fopCreator == null )
{
fopCreator = new FOPCreator();
}
}
return fopCreator;
}
public void createFOfromXML( InputStream xml, InputStream xslt, OutputStream fo )
throws IOException, TransformerException
{
try
{
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer( new StreamSource( xslt ) );
Source src = new StreamSource( xml );
Result res = new StreamResult( fo );
transformer.transform( src, res );
}
finally
{
fo.close();
}
}
}

@ -0,0 +1,495 @@
/*
* FOPPrinter.java
*
* Created on 25 de Maio de 2005, 15:43
*/
package siprp.util.fop;
import java.awt.print.Book;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Hashtable;
import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.ServiceUI;
import javax.print.SimpleDoc;
import javax.print.attribute.DocAttributeSet;
import javax.print.attribute.HashDocAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Sides;
import javax.swing.JOptionPane;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.render.awt.AWTRenderer;
/**
* Utilities to preview and print FO files in form of generated .fo files
*
* @author lflores
* @author João Neto
*/
public class FOPPrinter implements FOPPrinterConstants
{
public FopFactory getFopfactory()
{
return fopfactory;
}
private static final Object LOCK = new Object();
// private final Translator translator = new SecureResourceBundle( null );
// private final AWTRenderer renderer = new AWTRenderer( translator );
private final FopFactory fopfactory;
private final FOUserAgent foUserAgent;
private final TransformerFactory factory = TransformerFactory.newInstance();
private static final DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE;
private Transformer transformer = null;
private static File userConfig = null;
public static File getUserConfig()
{
return userConfig;
}
public static void setUserConfig(File userConfig)
{
FOPPrinter.userConfig = userConfig;
}
private static FOPPrinter fopPrinter = null;
/** Creates a new instance of FOPPrinter */
private FOPPrinter()
{
fopfactory = FopFactory.newInstance();
if (userConfig != null)
{
try
{
fopfactory.setUserConfig(userConfig);
} catch (Exception e)
{
System.err.println("Ignoring invalid user config file");
e.printStackTrace();
}
}
foUserAgent = new FOUserAgent(fopfactory);
fopfactory.setStrictValidation(false);
// driver.setLogger( new ConsoleLogger( ConsoleLogger.LEVEL_INFO ) );
}
public static FOPPrinter getFOPPrinter()
{
synchronized (LOCK)
{
if (fopPrinter == null)
{
fopPrinter = new FOPPrinter( );
}
}
return fopPrinter;
}
/**
* Creates a .fo and prints it
* @param xslFile
* @param xmlBytes
** @param preview
* Flag to activate document preview before printing. If false,
* the printing is immediately activated.
* @param printerDialog
* Flag to activate the printer choosing dialog. If false, the
* default or preferred printer is used.
* @throws Exception
*/
public void print(String xslFile, byte[] xmlBytes, boolean preview, boolean printerDialog ) throws Exception
{
InputStream input = getClass().getClassLoader().getResourceAsStream(xslFile);
print(input, xmlBytes,preview,printerDialog);
}
/**
* Creates a .fo and prints it
* @param xslStream
* @param xmlBytes
** @param preview
* Flag to activate document preview before printing. If false,
* the printing is immediately activated.
* @param printerDialog
* Flag to activate the printer choosing dialog. If false, the
* default or preferred printer is used.
* @throws Exception
*/
public void print(InputStream xslStream, byte[] xmlBytes, boolean preview, boolean printerDialog ) throws Exception
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FOPCreator.getFOPCreator().createFOfromXML(new ByteArrayInputStream(xmlBytes), xslStream, baos);
printFO( new ByteArrayInputStream( baos.toByteArray() ), preview, printerDialog );
}
/**
* Prints a single .fo document.
*
* @param fo
* The generated fo document
* @param preview
* Flag to activate document preview before printing. If false,
* the printing is immediately activated.
* @param dialog
* Flag to activate the printer choosing dialog. If false, the
* default or preferred printer is used.
* @throws Exception
* if the conversion fails
*/
public void printFO(InputStream fo, boolean preview, boolean dialog) throws Exception
{
printFO(new InputStream[]
{ fo }, preview, dialog);
}
/**
* Prints an array of .fo documents.
*
* @param fo
* The array of generated fo documents
* @param preview
* Flag to activate document preview before printing. If false,
* the printing is immediately activated.
* @param dialog
* Flag to activate the printer choosing dialog. If false, the
* default or preferred printer is used.
* @throws Exception
* if the conversion fails
*/
public void printFO(InputStream fo[], boolean preview, boolean dialog) throws Exception
{
printFO(fo, preview, dialog, null);
}
/**
* Prints a single .fo document with printing options.
*
* @param fo
* The generated fo document
* @param preview
* Flag to activate document preview before printing. If false,
* the printing is immediately activated.
* @param dialog
* Flag to activate the printer choosing dialog. If false, the
* default or preferred printer is used.
* @param options
* Printing options
* @see FOPPrinterConstants
* @throws Exception
* if the conversion fails
*/
public void printFO(InputStream fo, boolean preview, boolean dialog,
Hashtable<Object, Serializable> options) throws Exception
{
printFO(new InputStream[]
{ fo }, preview, dialog, options);
}
/**
* Prints an array of .fo documents with printing options.
*
* @param fo
* The array of generated fo documents
* @param preview
* Flag to activate document preview before printing. If false,
* the printing is immediately activated.
* @param dialog
* Flag to activate the printer choosing dialog. If false, the
* default or preferred printer is used.
* @param options
* Printing options
* @see FOPPrinterConstants
* @throws Exception
* if the conversion fails
*/
public void printFO(InputStream fo[], boolean preview, boolean dialog,
Hashtable<Object, Serializable> options) throws Exception
{
if (options == null)
{
options = new Hashtable<Object, Serializable>();
}
String defaultPrinter = System.getProperty("evutils.defaultprinter");
if (defaultPrinter != null)
{
options.put(FOP_PREFERRED_PRINTER_NAME, defaultPrinter);
}
if (fo.length > 1 && preview)
{
throw new Exception("Can't have preview with multi document print");
}
if (transformer == null)
{
transformer = factory.newTransformer();
}
// long tic = System.currentTimeMillis();
AWTRenderer renderer = new AWTRenderer();
foUserAgent.setRendererOverride(renderer);
if (!preview)
{
renderer.setPreviewDialogDisplayed(false);
}
renderer.setUserAgent(foUserAgent);
Result res[] = new Result[fo.length];
for (int i = 0; i < fo.length; ++i)
{
Source src = new StreamSource(fo[i]);
Fop fop = fopfactory.newFop(foUserAgent);
res[i] = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res[i]);
}
if (!preview)
{
Book book = new Book();
for (int i = 0; i < renderer.getNumberOfPages(); ++i)
{
book.append(renderer.getPrintable(i), renderer.getPageFormat(i));
}
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
PrintService service = chooseService(dialog, options, pras);
if (service != null)
{
// PrintJobAttributeSet pjas = new HashPrintJobAttributeSet();
DocAttributeSet das = new HashDocAttributeSet();
// das.add( new NumberUp( 2 ) );
Doc doc = new SimpleDoc(book, flavor, das);
DocPrintJob job = service.createPrintJob();
try
{
job.print(doc, pras);
}
catch (PrintException pe)
{
pe.printStackTrace();
}
}
}
}
public static PrintService chooseService(boolean dialog, Hashtable<Object, Serializable> options,
PrintRequestAttributeSet pras)
{
if (options.containsKey(FOP_DUPLEX_TYPE))
{
pras.add((Sides) options.get(FOP_DUPLEX_TYPE));
}
PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
boolean hasMandatory = options.containsKey(FOP_MANDATORY_PRINTER_NAME);
boolean hasPreferred = options.containsKey(FOP_PREFERRED_PRINTER_NAME);
String mandatoryName = (String) options.get(FOP_MANDATORY_PRINTER_NAME);
String preferredName = (String) options.get(FOP_PREFERRED_PRINTER_NAME);
PrintService mandatory = null;
PrintService preferred = null;
if (hasPreferred || hasMandatory)
{
for (int n = 0; n < printService.length; n++)
{
if (hasMandatory)
{
if (printService[n].getName().equals(mandatoryName))
{
mandatory = printService[n];
break;
}
}
else if (hasPreferred)
{
if (printService[n].getName().equals(preferredName))
{
preferred = printService[n];
break;
}
}
}
}
// long toc = System.currentTimeMillis();
// System.err.println( "PRINT FO INNER: " + ( toc - tic ) );
PrintService service;
if (!dialog && !hasMandatory && !hasPreferred)
{
service = defaultService;
}
else if (hasMandatory)
{
if (mandatory == null)
{
JOptionPane.showMessageDialog(null, "A impressora " + mandatoryName
+ " n\u00e3o est\u00e1 dispon\u00EDvel.", "Erro...",
JOptionPane.ERROR_MESSAGE);
service = null;
}
else
{
service = mandatory;
}
}
else if ((!dialog) && hasPreferred && preferred != null)
{
// pras.add((Sides) options.get(FOP_DUPLEX_TYPE));
service = preferred;
}
else if (hasPreferred && preferred != null)
{
// pras.add((Sides) options.get(FOP_DUPLEX_TYPE));
service = ServiceUI.printDialog(null, 200, 200, printService, preferred, flavor, pras);
}
else
{
if (printService == null || printService.length == 0)
{
JOptionPane.showMessageDialog(null,
"N\u00e3o existem impressoras dispon\u00edveis neste computador.", "Erro",
JOptionPane.ERROR_MESSAGE);
service = null;
}
else
{
service = ServiceUI.printDialog(null, 200, 200, printService, defaultService,
flavor, pras);
}
}
return service;
}
// private static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent)
// {
// final PreviewDialog frame = new PreviewDialog(foUserAgent);
// frame.validate();
// frame.addWindowListener(new WindowAdapter()
// {
// public void windowClosed(WindowEvent we)
// {
// frame.setVisible(false);
// }
// });
// // center window
// Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
// frame.setSize(screenSize);
// Dimension frameSize = frame.getSize();
//
// /*
// * if( frameSize.height > screenSize.height ) { frameSize.height =
// * screenSize.height; } if( frameSize.width > screenSize.width ) {
// * frameSize.width = screenSize.width; }
// */
// frame.setLocation((screenSize.width - frameSize.width) / 2,
// (screenSize.height - frameSize.height) / 2);
// return frame;
// }
// private PreviewDialog viewFO(InputStream fo) throws IOException,
// FOPException,
// TransformerException
// {
// PreviewDialog frame = createPreviewDialog(foUserAgent);
// frame.setVisible(true);
// // foUserAgent.getRendererOverride().s
//
//
// renderer.setProgressListener(frame);
// renderer.setComponent(frame);
// frame.progress("A Preparar ...");
// return frame;
// }
public static void main(String arg[]) throws Exception
{
// PipedInputStream pis = new PipedInputStream();
// final PipedOutputStream pos = new PipedOutputStream(pis);
// final FOPCreator creator = FOPCreator.getFOPCreator();
System.out.println("Creating FO");
// JFileChooser chooser = new JFileChooser();
// chooser.setDialogTitle("Select XML data file:");
// int returnVal = chooser.showOpenDialog(null);
// String dataFile = null;
// if (returnVal == JFileChooser.APPROVE_OPTION)
// {
// dataFile = chooser.getSelectedFile().getAbsolutePath();
// }
// chooser.setDialogTitle("Select XSL-FO template file:");
// returnVal = chooser.showOpenDialog(null);
// String templateFile = null;
// if (returnVal == JFileChooser.APPROVE_OPTION)
// {
// templateFile = chooser.getSelectedFile().getAbsolutePath();
// System.out.println(chooser.getSelectedFile().getAbsolutePath());
// }
// final String DATA = dataFile;
// final String TEMPLATE = templateFile;
// final String DATA = "/home/jneto/Desktop/boletim.xml";
// final String TEMPLATE = "/home/jneto/Desktop/boletim.xsl";
// Thread t = new Thread()
// {
// public void run()
// {
// try
// {
// creator.createFOfromXML(new FileInputStream(DATA),
// new FileInputStream(TEMPLATE), pos);
// System.out.println("FO created");
// } catch (Exception ex)
// {
// ex.printStackTrace();
// }
// }
// };
// t.start();
// t.wait(2);
System.out.println("Starting to print");
// Hashtable<Object, Serializable> options = new Hashtable<Object,
// Serializable>();
// options.put(FOP_DUPLEX_TYPE,
// javax.print.attribute.standard.Sides.TUMBLE);
// new FOPPrinter().printFO(pis, false, true, options);
new FOPPrinter().printFO(new FileInputStream("/home/jneto/Desktop/carta1.fo"), true,
true);
System.out.println("DONE");
}
}

@ -0,0 +1,19 @@
/*
* FOPPrinterConstants.java
*
* Created on 14 de Junho de 2005, 14:49
*/
package siprp.util.fop;
/**
* FOP Printer options
*
* @author fpalma
*/
public interface FOPPrinterConstants
{
public static final Object FOP_PREFERRED_PRINTER_NAME = new Integer( 1 );
public static final Object FOP_MANDATORY_PRINTER_NAME = new Integer( 2 );
public static final Object FOP_DUPLEX_TYPE = new Integer( 3 );
}

@ -0,0 +1,38 @@
package siprp.util.fop;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class Main
{
/**
* @param args
*/
public static void main(String[] args)
{
try
{
File userConfigFile = new File("/home/jneto/fopConf.xml");
FOPPrinter.setUserConfig(userConfigFile);
FOPPrinter fp = FOPPrinter.getFOPPrinter();
System.out.println(fp.getFopfactory().getFontBaseURL());
fp.printFO(new FileInputStream("/home/jneto/test.fo"), true, true);
} catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

@ -0,0 +1,191 @@
/*
* PDFCreator.java
*
* Created on 19 de Abril de 2006, 18:20
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.util.fop;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import javax.swing.JFileChooser;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.xmlgraphics.util.MimeConstants;
import com.evolute.utils.fop.FOPCreator;
/**
* PDFCreator creates PDF's using FO.
*
* @author Frederico Palma
* @author João Neto
* @version %I%, %G%
*/
public class PDFCreator
{
// private final Translator translator = new SecureResourceBundle( null );
private static final Object LOCK = new Object();
private static PDFCreator pdfCreator;
FopFactory fopFactory;
private static File userConfig;
public static PDFCreator getPDFCreator()
{
synchronized (LOCK)
{
if (pdfCreator == null)
{
pdfCreator = new PDFCreator();
}
}
return pdfCreator;
}
public static File getUserConfig()
{
return userConfig;
}
public static void setUserConfig(File userConfig)
{
PDFCreator.userConfig = userConfig;
}
public static void main(String arg[]) throws Exception
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final FOPCreator creator = FOPCreator.getFOPCreator();
System.out.println("Creating FO");
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Select XML data file:");
int returnVal = chooser.showOpenDialog(null);
String dataFile = null;
if (returnVal == JFileChooser.APPROVE_OPTION)
{
dataFile = chooser.getSelectedFile().getAbsolutePath();
}
chooser.setDialogTitle("Select XSL-FO template file:");
returnVal = chooser.showOpenDialog(null);
String templateFile = null;
if (returnVal == JFileChooser.APPROVE_OPTION)
{
templateFile = chooser.getSelectedFile().getAbsolutePath();
System.out.println(chooser.getSelectedFile().getAbsolutePath());
}
final String DATA = dataFile;
final String TEMPLATE = templateFile;
creator.createFOfromXML(new FileInputStream(DATA), new FileInputStream(TEMPLATE), baos);
// Thread t = new Thread() {
// public void run()
// {
// try
// {
// creator.createFOfromXML( new FileInputStream( DATA ),
// new FileInputStream( TEMPLATE ), baos );
// System.out.println( "FO created" );
// }
// catch( Exception ex )
// {
// ex.printStackTrace();
// }
// } };
// t.start();
// Thread.currentThread().sleep( 2 );
System.out.println("Starting to print");
// options.put( FOP_DUPLEX_TYPE,
// javax.print.attribute.standard.Sides.TUMBLE );
byte pdf[] = PDFCreator.getPDFCreator().createPdfFromFo(baos.toByteArray());
// new FOPPrinter().printFO( new FileInputStream( "c:\\simplecol.fo" ),
// true, false );
File pdfFile = new File("/home/jneto/Desktop/teste.pdf");
File foFile = new File("/home/jneto/Desktop/teste.fo");
pdfFile.createNewFile();
foFile.createNewFile();
FileOutputStream fos = new FileOutputStream(pdfFile);
FileOutputStream fofos = new FileOutputStream(foFile);
fos.write(pdf);
fofos.write(baos.toByteArray());
fos.close();
fofos.close();
System.out.println("DONE");
}
// /** Creates a new instance of PDFCreator */
// private PDFCreator()
// {
// fopFactory = FopFactory.newInstance();
// }
/** Creates a new instance of PDFCreator */
private PDFCreator()
{
fopFactory = FopFactory.newInstance();
if (userConfig != null)
{
try
{
fopFactory.setUserConfig(userConfig);
} catch (Exception e)
{
System.err.println("Ignoring invalid user config file");
e.printStackTrace();
}
}
}
/**
* Creates PDF content as an array of bytes, given FO content as an array of
* bytes.
*
* @param fo
* the byte[] with the FO content to convert
* @return the PDF content
* @throws Exception
* if the conversion fails
*
*/
public byte[] createPdfFromFo(byte[] fo) throws Exception
{
fopFactory.setStrictValidation(false);
ByteArrayOutputStream pdf = new ByteArrayOutputStream();
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, pdf);
Source src = new StreamSource(new ByteArrayInputStream(fo));
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
return pdf.toByteArray();
}
}

@ -0,0 +1,162 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Id: fop.xconf 447325 2006-09-18 08:55:33Z jeremias $ -->
<!--
This is an example configuration file for FOP.
This file contains the same settings as the default values
and will have no effect if used unchanged.
Relative config url's will be resolved relative to
the location of this file.
-->
<!-- NOTE: This is the version of the configuration -->
<fop version="1.0">
<strict-validation>false</strict-validation>
<!-- Base URL for resolving relative URLs -->
<base>.</base>
<!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
<source-resolution>72</source-resolution>
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>
<!-- Default page-height and page-width, in case
value is specified as auto -->
<default-page-settings height="11in" width="8.26in"/>
<!-- Information for specific renderers -->
<!-- Uses renderer mime type for renderers -->
<renderers>
<renderer mime="application/pdf">
<filterList>
<!-- provides compression using zlib flate (default is on) -->
<value>flate</value>
<!-- encodes binary data into printable ascii characters (default off)
This provides about a 4:5 expansion of data size -->
<!-- <value>ascii-85</value> -->
<!-- encodes binary data with hex representation (default off)
This filter is not recommended as it doubles the data size -->
<!-- <value>ascii-hex</value> -->
</filterList>
<fonts>
<!-- embedded fonts -->
<!--
This information must exactly match the font specified
in the fo file. Otherwise it will use a default font.
For example,
<fo:inline font-family="Arial" font-weight="bold" font-style="normal">
Arial-normal-normal font
</fo:inline>
for the font triplet specified by:
<font-triplet name="Arial" style="normal" weight="bold"/>
If you do not want to embed the font in the pdf document
then do not include the "embed-url" attribute.
The font will be needed where the document is viewed
for it to be displayed properly.
possible styles: normal | italic | oblique | backslant
possible weights: normal | bold | 100 | 200 | 300 | 400
| 500 | 600 | 700 | 800 | 900
(normal = 400, bold = 700)
-->
<!--
<font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
<font-triplet name="ArialMT" style="normal" weight="normal"/>
</font>
<font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
<font-triplet name="Arial" style="normal" weight="bold"/>
<font-triplet name="ArialMT" style="normal" weight="bold"/>
</font>
-->
<auto-detect/>
</fonts>
<!-- This option lets you specify additional options on an XML handler -->
<!--xml-handler namespace="http://www.w3.org/2000/svg">
<stroke-text>false</stroke-text>
</xml-handler-->
</renderer>
<renderer mime="application/postscript">
<!-- This option forces the PS renderer to rotate landscape pages -->
<!--auto-rotate-landscape>true</auto-rotate-landscape-->
<!-- This option lets you specify additional options on an XML handler -->
<!--xml-handler namespace="http://www.w3.org/2000/svg">
<stroke-text>false</stroke-text>
</xml-handler-->
</renderer>
<renderer mime="application/vnd.hp-PCL">
</renderer>
<!-- MIF does not have a renderer
<renderer mime="application/vnd.mif">
</renderer>
-->
<renderer mime="image/svg+xml">
<format type="paginated"/>
<link value="true"/>
<strokeText value="false"/>
</renderer>
<renderer mime="application/awt">
</renderer>
<renderer mime="image/png">
<!--transparent-page-background>true</transparent-page-background-->
</renderer>
<renderer mime="image/tiff">
<!--transparent-page-background>true</transparent-page-background-->
<!--compression>CCITT T.6</compression-->
</renderer>
<renderer mime="text/xml">
</renderer>
<!-- RTF does not have a renderer
<renderer mime="text/rtf">
</renderer>
-->
<renderer mime="text/plain">
<pageSize columns="80"/>
</renderer>
</renderers>
</fop>
Loading…
Cancel
Save