diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java index c3caf031..041771b9 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/PdfGenerator.java @@ -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 ); diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl index da7c303e..c44fd26d 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl +++ b/trunk/AnaliseAcidentesTrabalho/src/java/pdf/analise_acidentes_trabalho.xsl @@ -47,8 +47,9 @@ border-style="solid" border-width="thin" number-columns-spanned="1"> - - imagem1 + + - imagem2 + + @@ -385,7 +388,7 @@ space-after="0.1cm" margin-left="0.2cm" font-size="8pt"> - Morada + Morada: