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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 18 years ago
parent 81f0e007b5
commit c34689ec50

@ -2,7 +2,10 @@ package pdf;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.sql.Time;
import java.util.Calendar;
import java.util.Date;
@ -35,6 +38,30 @@ public class PdfGenerator
protected final Recomendacao recomendacoes[];
protected final Medida medidas[];
protected final Causa causa;
protected final URL urlSiprp;
protected final URL urlAuchan;
public static void main( String args[] )
throws Exception
{
byte[] pdf =
new PdfGenerator( "",
new Estabelecimento(),
new Utilizador(),
new Utilizador(),
new AnaliseAcidente(),
new Acidentado(),
new Seccao(),
new Recomendacao[ 0 ],
new Medida[ 0 ],
new Causa() ).generatePdf();
File pdfFile = new File( "/home/fpalma/Desktop/siprp.pdf" );
pdfFile.createNewFile();
FileOutputStream fos = new FileOutputStream( pdfFile );
fos.write( pdf );
fos.close();
System.out.println( "DONE" );
}
public PdfGenerator(
String imagePath,
@ -58,6 +85,8 @@ public class PdfGenerator
this.recomendacoes = recomendacoes;
this.medidas = medidas;
this.causa = causa;
this.urlSiprp = getClass().getResource( "siprp_logo.gif" );
this.urlAuchan = getClass().getResource( "auchan_logo.gif" );
}
public byte[] generatePdf()
@ -76,6 +105,12 @@ public class PdfGenerator
protected Element createXml()
{
Element rootElement = new Element( "AnaliseAcidente" );
Element logoTipoSIPRPElement = new Element( "LogotipoSIPRP" );
logoTipoSIPRPElement.setText( urlSiprp.toString() );
rootElement.addContent( logoTipoSIPRPElement );
Element logoTipoAuchanElement = new Element( "LogotipoAuchan" );
logoTipoAuchanElement.setText( urlAuchan.toString() );
rootElement.addContent( logoTipoAuchanElement );
Element numeroElement = new Element( "Numero" );
numeroElement.setText( analiseAcidente.getAnalise_nr() );
rootElement.addContent( numeroElement );

@ -47,8 +47,9 @@
border-style="solid" border-width="thin"
number-columns-spanned="1">
<fo:block>
<!--fo:external-graphic src="url('siprp_logo.gif')"/-->
imagem1
<xsl:variable name="LogotipoSIPRP" select="LogotipoSIPRP" />
<fo:external-graphic src="url('{$LogotipoSIPRP}')" text-align="center"
background-color="rgb(255,255,255)" height="50pt" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black"
@ -102,7 +103,9 @@
<fo:block font-size="8pt"
space-before="0.3cm" space-after="0.3cm" margin-left="0.2cm"
font-weight="bold">
imagem2<!--<fo:external-graphic src="url('auchan_logo.gif')"/> -->
<xsl:variable name="LogotipoAuchan" select="LogotipoAuchan" />
<fo:external-graphic src="url('{$LogotipoAuchan}')" text-align="center"
height="50pt" />
</fo:block>
</fo:table-cell>
</fo:table-row>
@ -385,7 +388,7 @@
space-after="0.1cm" margin-left="0.2cm" font-size="8pt">
<fo:inline
font-weight="bold">
Morada
Morada:
</fo:inline>
<xsl:value-of select="Acidentado/Morada" />
</fo:block>

Loading…
Cancel
Save