/* * Created on 17-nov-2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.tarisan.util; import java.awt.Color; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Vector; import com.itextpdf.text.*; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import com.tarisan.log.LogTarisan; import com.tarisan.log.NivelLog; import com.tarisan.control.ParametrosConfiguracion; import com.tarisan.data.Paciente; import com.tarisan.data.Tarjeta; import com.tarisan.data.Usuario; import com.tarisan.data.VTamovextTaclient; import com.tarisan.persistencia.PersistenciaParametros; /** * @author Roumen * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Print { //The 14 standard fonts in PDF private static Font fonts0 = FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.NORMAL); private static Font fonts1 = FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.ITALIC); private static Font fonts2 = FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.BOLD); private static Font fonts3 = FontFactory.getFont(FontFactory.COURIER, Font.DEFAULTSIZE, Font.BOLD | Font.ITALIC); private static Font fonts4 = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.NORMAL); private static Font fonts5 = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC); private static Font fonts6 = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD); private static Font fonts7 = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLDITALIC); private static Font fonts8 = FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL); private static Font fonts9 = FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.ITALIC); private static Font fonts10 = FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD); private static Font fonts11 = FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC); private static Font fonts12 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 14, Font.BOLD); private static Font fonts13 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL); private static Font fonts14 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.BOLD); private static Font fonts15 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.BOLD); private static Font fonts16 = FontFactory.getFont(FontFactory.SYMBOL, Font.DEFAULTSIZE, Font.NORMAL); private static Font fonts17 = FontFactory.getFont(FontFactory.ZAPFDINGBATS, Font.DEFAULTSIZE, Font.NORMAL); public Document pruebaPDF(int medico) throws DocumentException, IOException{ //Creamos el documento Document document = new Document(); //Fijamos Márgenes document.setMargins(40, 40, 5, 5); String strTexto = ""; // we create a writer that listens to the document String strFile = ""; strFile = ParametrosConfiguracion.ruta_pdf_peticiones_recetas + medico + ".pdf"; FileOutputStream foStream = new FileOutputStream(strFile); PdfWriter writer = PdfWriter.getInstance(document,foStream); document.open(); PdfPTable table = new PdfPTable(2); //Numero de columnas //Fijar anchura de la tabla table.setWidthPercentage(100); //Creamos el objeto generador de PDF Print print = new Print(); strTexto = "Impresión Recetas"; PdfPCell cell = null; cell = new PdfPCell(new Paragraph(strTexto, fonts15)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); //AÑADIR TABLA table.setHorizontalAlignment(Element.ALIGN_CENTER); document.add(table); // draw helper lines PdfContentByte cb = writer.getDirectContent(); cb.stroke(); // draw text String text = "Probando texto"; BaseFont bf = BaseFont.createFont(); cb.beginText(); cb.setFontAndSize(bf, 12); cb.setTextMatrix(50, 800); cb.showText(text); cb.endText(); //CERRAR DOCUMENTO // step 5: we close the document document.close(); return document; } public PdfPTable anadirCabecera(PdfPTable table, String strTexto) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirCabecera().INI"); try { //Inserción de la imagen de cabecera //Image jpgImage = Image.getInstance("../webapps/tarisan/img/logo_03_40p.jpg"); //Image jpgImage = Image.getInstance("webapps/tarisan/img/logo_imq_.jpg"); PdfPCell cell = null; /* if (jpgImage != null) { cell = new PdfPCell(jpgImage); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); } else { */ cell = new PdfPCell(new Paragraph(" "));// Parrafo en blanco cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph(" "));// Parrafo en blanco cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); LogTarisan.logger.log(NivelLog.INFO, "Imagen nula"); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); // } cell = new PdfPCell(new Paragraph(strTexto, fonts15)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); //LogTarisan.logger.log(NivelLog.INFO, "No se inserta imagen"); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirCabecera().FIN"); return table; } public Document anadirLogotipo(Document document,int intMedico, int x, int y) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirLogotipo().INI"); try { File imagenJPG = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".jpg"); File imagenPNG = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".png"); File imagenGIF = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".gif"); File imagenBMP = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".bmp"); if(imagenJPG.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".jpg"); imagen.setAbsolutePosition(x, y); document.add(imagen); }else if(imagenPNG.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".png"); imagen.setAbsolutePosition(x, y); document.add(imagen); } else if(imagenGIF.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".gif"); imagen.setAbsolutePosition(x, y); document.add(imagen); } else if(imagenBMP.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".bmp"); imagen.setAbsolutePosition(x, y); document.add(imagen); }else{ } } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirLogotipo().FIN"); return document; } /*public Document anadirLogotipo(Document document,int intMedico) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirLogotipo().INI"); try { File imagenJPG = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".jpg"); File imagenPNG = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".png"); File imagenGIF = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".gif"); File imagenBMP = new File(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".bmp"); if(imagenJPG.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".jpg"); imagen.setAbsolutePosition(45f, 780f); document.add(imagen); }else if(imagenPNG.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".png"); imagen.setAbsolutePosition(45f, 780f); document.add(imagen); } else if(imagenGIF.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".gif"); imagen.setAbsolutePosition(45f, 780f); document.add(imagen); } else if(imagenBMP.exists()) { Image imagen = Image.getInstance(ParametrosConfiguracion.ruta_logotipos+"/"+intMedico+".bmp"); imagen.setAbsolutePosition(45f, 780f); document.add(imagen); }else{ } } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirLogotipo().FIN"); return document; }*/ public PdfPTable anadirCabeceraDetalle(PdfPTable table, String strTexto, String strFecha) throws Exception { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirCabeceraDetalle().INI"); try { PdfPCell cell = new PdfPCell(new Paragraph(strTexto, fonts15)); //cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(3); table.addCell(cell); /* //Inserción de la imagen de cabecera Image jpgImage = Image.getInstance("../webapps/tarisan/img/logo_03_40p.jpg"); if (jpgImage != null) { cell = new PdfPCell(jpgImage); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); } else { LogTarisan.logger.log(NivelLog.INFO, "Imagen nula"); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); } */ LogTarisan.logger.log(NivelLog.INFO, "No se inserta imagen"); /* cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); */ cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("--- RELACIÓN ACTOS MÉDICOS REALIZADOS ---",fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("FECHA: " + strFecha,fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Paragraph("NOMBRE PACIENTE",fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Paragraph("ACTO REALIZADO",fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Paragraph("IMPORTE",fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(3); table.addCell(cell); } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirCabeceraDetalle().FIN"); return table; } public PdfPTable anadirDetallePaciente(PdfPTable table, Vector vSeleccion) throws Exception { PdfPCell cell = null; VTamovextTaclient vTamovextTaclient = null; double dblImporteTotal = 0; for(int i = 0; i < vSeleccion.size(); i++) { vTamovextTaclient = (VTamovextTaclient)vSeleccion.elementAt(i); dblImporteTotal += vTamovextTaclient.getPrecioActoMedico(); cell = new PdfPCell(new Paragraph(vTamovextTaclient.getNombre() + " " + vTamovextTaclient.getApellidos(),fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Paragraph(vTamovextTaclient.getDescripcionActoMedico(),fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Paragraph(Utilidades.formatearDouble(vTamovextTaclient.getPrecioActoMedico(),PersistenciaParametros.decimales),fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); } cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(3); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("IMPORTE...",fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Paragraph(Utilidades.formatearDouble(dblImporteTotal,PersistenciaParametros.decimales),fonts13)); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); return table; } public PdfPTable anadirInforme(PdfPTable table, String strInformeCabecera, String strInforme) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirCabecera().INI"); try { PdfPCell cell = new PdfPCell(new Paragraph(strInformeCabecera, fonts14)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); if (strInforme != null && strInforme.length() > 0) { cell = new PdfPCell(new Paragraph(strInforme, fonts13)); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirInforme().FIN"); return table; } public PdfPTable anadirMedicoPrescriptor (PdfPTable table, String strMedico, String strDireccion, String strEspecialidad, String strPoblacion, String strNumColegiado, String strTelefono) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirMedicoPrescriptor().INI"); try { PdfPCell cell = new PdfPCell(); cell = new PdfPCell(new Paragraph(" "));// Parrafo en blanco cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph(" "));// Parrafo en blanco cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("Medico: ", fonts14)); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(2); table.addCell(cell); if (strMedico != null && strMedico.length() > 0) { cell = new PdfPCell(new Paragraph(strMedico, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } if (strDireccion != null && strDireccion.length() > 0) { cell = new PdfPCell(new Paragraph(strDireccion, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } if (strEspecialidad != null && strEspecialidad.length() > 0) { cell = new PdfPCell(new Paragraph(strEspecialidad, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } if (strPoblacion != null && strPoblacion.length() > 0) { cell = new PdfPCell(new Paragraph(strPoblacion, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } if (strNumColegiado != null && strNumColegiado.length() > 0) { cell = new PdfPCell(new Paragraph(strNumColegiado, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } if (strTelefono != null && strTelefono.length() > 0) { cell = new PdfPCell(new Paragraph(strTelefono, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirMedicoPrescriptor().FIN"); return table; } public PdfPTable anadirAnalisis(PdfPTable table, ArrayList arrayListaElementosPrescripcion, String strTexto) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirAnalisis().INI"); try { PdfPCell cell = new PdfPCell(); cell = new PdfPCell(new Paragraph(strTexto, fonts14)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); cell.setBackgroundColor(new BaseColor(210, 210, 210)); table.addCell(cell); /* cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); */ cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); //Búcle Determinaciones String determinacion = ""; int contador = 0; for (int i=0;i 0) { cell = new PdfPCell(new Paragraph(determinacion, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); //cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } } int resto = contador % 2; if ( resto == 0 ) { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); //cell.setColspan(2); table.addCell(cell); } cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(2); table.addCell(cell); /* cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); */ cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } catch (Exception ex) { LogTarisan.logger.log(NivelLog.INFO, ex); } LogTarisan.logger.log(NivelLog.INFO, "Print.anadirAnalisis().FIN"); return table; } public PdfPTable anadirPaciente(PdfPTable table, String strNomPaciente, String strPoliza, String strAutorizacion, String strPoblacion) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirPaciente().INI"); PdfPCell cell = new PdfPCell(); cell = new PdfPCell(new Paragraph("Paciente: ", fonts14)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); if (strNomPaciente != null && strNomPaciente.length() > 0) { cell = new PdfPCell(new Paragraph(strNomPaciente, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (strPoliza != null && strPoliza.length() > 0) { cell = new PdfPCell(new Paragraph(strPoliza, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (strAutorizacion != null && strAutorizacion.length() > 0) { cell = new PdfPCell(new Paragraph(strAutorizacion, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (strPoblacion != null && strPoblacion.length() > 0) { cell = new PdfPCell(new Paragraph(strPoblacion, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); LogTarisan.logger.log(NivelLog.INFO, "Print.anadirPaciente().FIN"); return table; } public PdfPTable anadirPacienteFact(PdfPTable table, String strNomPaciente, String strPoliza, String strPoblacion, String strfecnac, String nif) { LogTarisan.logger.log(NivelLog.INFO, "Print.anadirPaciente().INI"); PdfPCell cell = new PdfPCell(); cell = new PdfPCell(new Paragraph("Paciente: ", fonts14)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Paragraph("")); cell.setColspan(2); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); if (strNomPaciente != null && strNomPaciente.length() > 0) { cell = new PdfPCell(new Paragraph(strNomPaciente, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (strPoliza != null && strPoliza.length() > 0) { cell = new PdfPCell(new Paragraph(strPoliza, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (strPoblacion != null && strPoblacion.length() > 0) { cell = new PdfPCell(new Paragraph(strPoblacion, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (strfecnac != null && strfecnac.length() > 0) { cell = new PdfPCell(new Paragraph("Fecha Nacimiento: "+strfecnac, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } if (nif != null && nif.length() > 0) { cell = new PdfPCell(new Paragraph("Nif: "+nif, fonts13)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorderColor(new BaseColor(255, 255, 255)); table.addCell(cell); } else { cell = new PdfPCell(new Paragraph(" ")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setColspan(2); table.addCell(cell); } cell = new PdfPCell(new Paragraph("")); cell.setBorderColor(new BaseColor(255, 255, 255)); cell.setBackgroundColor(new BaseColor(210, 210, 210)); cell.setColspan(2); table.addCell(cell); LogTarisan.logger.log(NivelLog.INFO, "Print.anadirPaciente().FIN"); return table; } }