List of usage examples for com.itextpdf.text BaseColor WHITE
BaseColor WHITE
To view the source code for com.itextpdf.text BaseColor WHITE.
Click Source Link
From source file:ManagementPackage.Setting.java
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed // TODO add your handling code here: totalAdjustment = 0;//from ww w .ja va 2s.c om totalTotalPaid = 0; total = 0; Document doc = new Document(); try { long time = new Date().getTime(); PdfWriter.getInstance(doc, new FileOutputStream("Reports\\Monthly" + time + " " + formatedDate + ".pdf")); doc.open(); PdfPTable table = new PdfPTable(5); PdfPCell cell1 = new PdfPCell(new Paragraph("Shop Management System \n\n", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.WHITE))); cell1.setColspan(10); cell1.setPadding(10); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setBackgroundColor(BaseColor.BLACK); table.addCell(cell1); PdfPCell cell21 = new PdfPCell(new Paragraph("\n\n")); cell21.setColspan(10); cell21.setBorder(2); cell21.setBorderColorLeft(BaseColor.WHITE); table.addCell(cell21); PdfPCell cell2 = new PdfPCell(new Paragraph("Monthly Report\n")); cell2.setColspan(10); cell2.setPadding(10); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell2); PdfPCell cell4 = new PdfPCell(new Paragraph("Date: " + formatedDateTime)); cell4.setColspan(10); cell4.setPaddingBottom(10); cell4.setPaddingTop(10); cell4.setBorder(2); cell4.setHorizontalAlignment(Element.ALIGN_RIGHT); cell4.setBorderColorRight(BaseColor.WHITE); table.addCell(cell4); table.addCell("Transaction No"); table.addCell("Billed By"); table.addCell("Product Name"); table.addCell("Qty"); table.addCell("Amount (TK)"); String PrevTransNo = " "; String query = "select trans_no, product_name, qty, amount, trans_by from trans_details where date like '%" + month + "%'"; try { pst = con.prepareStatement(query); rs = pst.executeQuery(); while (rs.next()) { String NewTransNo = rs.getString("trans_no"); String product_name = rs.getString("product_name"); String qty = rs.getString("qty"); String amount = rs.getString("amount"); String trans_by = rs.getString("trans_by"); total = total + Float.parseFloat(amount); if (PrevTransNo.equals(NewTransNo)) table.addCell(" "); else { table.addCell(NewTransNo); String query1 = "select adjustment, total_paid from paid_amount where trans_no = '" + NewTransNo + "'"; pst1 = con1.prepareStatement(query1); rs1 = pst1.executeQuery(); String adjustment = rs1.getString("adjustment"); String total_paid = rs1.getString("total_paid"); totalAdjustment = totalAdjustment + Float.parseFloat(adjustment); totalTotalPaid = totalTotalPaid + Float.parseFloat(total_paid); rs1.close(); pst1.close(); } PrevTransNo = rs.getString("trans_no"); table.addCell(trans_by); table.addCell(product_name); table.addCell(qty); PdfPCell cellAmount = new PdfPCell(new Paragraph(amount)); cellAmount.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cellAmount); } rs.close(); pst.close(); } catch (SQLException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } PdfPCell cellb = new PdfPCell(new Paragraph(" ")); cellb.setColspan(10); cellb.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cellb); // PdfPCell celltxtTotal = new PdfPCell(new Paragraph("Total")); celltxtTotal.setColspan(3); celltxtTotal.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotal); PdfPCell celltxtTotal1 = new PdfPCell(new Paragraph("" + total)); celltxtTotal1.setColspan(2); celltxtTotal1.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotal1); PdfPCell celltxtAdjust = new PdfPCell(new Paragraph("Adjustment")); celltxtAdjust.setColspan(3); celltxtAdjust.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtAdjust); PdfPCell celltxtAdjust1 = new PdfPCell(new Paragraph("" + totalAdjustment)); celltxtAdjust1.setColspan(2); celltxtAdjust1.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtAdjust1); PdfPCell celltxtTotalPaid = new PdfPCell(new Paragraph("Total Paid")); celltxtTotalPaid.setColspan(3); celltxtTotalPaid.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotalPaid); PdfPCell celltxtTotalPaid1 = new PdfPCell(new Paragraph("" + totalTotalPaid)); celltxtTotalPaid1.setColspan(2); celltxtTotalPaid1.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotalPaid1); doc.add(table); doc.close(); //JOptionPane.showMessageDialog(null, "Report Created!"); // open PDF file File file = new File("Reports\\Monthly" + time + " " + formatedDate + ".pdf"); if (file.toString().endsWith(".pdf")) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file); else { Desktop desktop = Desktop.getDesktop(); desktop.open(file); } } catch (DocumentException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:ManagementPackage.Setting.java
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed // TODO add your handling code here: totalAdjustment = 0;//from w ww .j a v a 2s . co m totalTotalPaid = 0; total = 0; Document doc = new Document(); try { long time = new Date().getTime(); PdfWriter.getInstance(doc, new FileOutputStream("Reports\\Yearly" + time + " " + formatedDate + ".pdf")); doc.open(); PdfPTable table = new PdfPTable(5); PdfPCell cell1 = new PdfPCell(new Paragraph("Shop Management System \n\n", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.WHITE))); cell1.setColspan(10); cell1.setPadding(10); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setBackgroundColor(BaseColor.BLACK); table.addCell(cell1); PdfPCell cell21 = new PdfPCell(new Paragraph("\n\n")); cell21.setColspan(10); cell21.setBorder(2); cell21.setBorderColorLeft(BaseColor.WHITE); table.addCell(cell21); PdfPCell cell2 = new PdfPCell(new Paragraph("Yearly Report\n")); cell2.setColspan(10); cell2.setPadding(10); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell2); PdfPCell cell4 = new PdfPCell(new Paragraph("Date: " + formatedDateTime)); cell4.setColspan(10); cell4.setPaddingBottom(10); cell4.setPaddingTop(10); cell4.setBorder(2); cell4.setHorizontalAlignment(Element.ALIGN_RIGHT); cell4.setBorderColorRight(BaseColor.WHITE); table.addCell(cell4); table.addCell("Transaction No"); table.addCell("Billed By"); table.addCell("Product Name"); table.addCell("Qty"); table.addCell("Amount (TK)"); String PrevTransNo = " "; String query = "select trans_no, product_name, qty, amount, trans_by from trans_details where date like '%" + year + "%'"; try { pst = con.prepareStatement(query); rs = pst.executeQuery(); while (rs.next()) { String NewTransNo = rs.getString("trans_no"); String product_name = rs.getString("product_name"); String qty = rs.getString("qty"); String amount = rs.getString("amount"); String trans_by = rs.getString("trans_by"); total = total + Float.parseFloat(amount); if (PrevTransNo.equals(NewTransNo)) table.addCell(" "); else { table.addCell(NewTransNo); String query1 = "select adjustment, total_paid from paid_amount where trans_no = '" + NewTransNo + "'"; pst1 = con1.prepareStatement(query1); rs1 = pst1.executeQuery(); String adjustment = rs1.getString("adjustment"); String total_paid = rs1.getString("total_paid"); totalAdjustment = totalAdjustment + Float.parseFloat(adjustment); totalTotalPaid = totalTotalPaid + Float.parseFloat(total_paid); rs1.close(); pst1.close(); } PrevTransNo = rs.getString("trans_no"); table.addCell(trans_by); table.addCell(product_name); table.addCell(qty); PdfPCell cellAmount = new PdfPCell(new Paragraph(amount)); cellAmount.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cellAmount); } rs.close(); pst.close(); } catch (SQLException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } PdfPCell cellb = new PdfPCell(new Paragraph(" ")); cellb.setColspan(10); cellb.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cellb); // PdfPCell celltxtTotal = new PdfPCell(new Paragraph("Total")); celltxtTotal.setColspan(3); celltxtTotal.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotal); PdfPCell celltxtTotal1 = new PdfPCell(new Paragraph("" + total)); celltxtTotal1.setColspan(2); celltxtTotal1.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotal1); PdfPCell celltxtAdjust = new PdfPCell(new Paragraph("Adjustment")); celltxtAdjust.setColspan(3); celltxtAdjust.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtAdjust); PdfPCell celltxtAdjust1 = new PdfPCell(new Paragraph("" + totalAdjustment)); celltxtAdjust1.setColspan(2); celltxtAdjust1.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtAdjust1); PdfPCell celltxtTotalPaid = new PdfPCell(new Paragraph("Total Paid")); celltxtTotalPaid.setColspan(3); celltxtTotalPaid.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotalPaid); PdfPCell celltxtTotalPaid1 = new PdfPCell(new Paragraph("" + totalTotalPaid)); celltxtTotalPaid1.setColspan(2); celltxtTotalPaid1.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(celltxtTotalPaid1); doc.add(table); doc.close(); //JOptionPane.showMessageDialog(null, "Report Created!"); // open PDF file File file = new File("Reports\\Yearly" + time + " " + formatedDate + ".pdf"); if (file.toString().endsWith(".pdf")) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file); else { Desktop desktop = Desktop.getDesktop(); desktop.open(file); } } catch (DocumentException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:modelo.DTO.PDF_Registro2.java
public static void generar() throws DocumentException, FileNotFoundException, BadElementException, IOException { Rectangle pageSize = new Rectangle(816f, 1056f); //ancho y alto miPDF = new Document(pageSize, 0, 0, 0, 0); PdfWriter.getInstance(miPDF, new FileOutputStream(PDF_Registro2.rutaDestino + ".pdf")); miPDF.open();/*from w w w. j a v a 2 s. com*/ miPDF.addTitle("Registro"); miPDF.addAuthor("Universidad Tecnolgica de Len"); miPDF.addSubject("Constancia de Registro"); miPDF.addKeywords("1"); //Inicio //Image foto = Image.getInstance("src/imagens/Registro.png"); String thisIp = InetAddress.getLocalHost().getHostAddress(); Image foto = Image.getInstance("http://" + thisIp + ":8084/ExamenParcial2Web/imagenes/Registro.png"); foto.setAlignment(Chunk.ALIGN_MIDDLE); foto.scaleToFit(816, 754); miPDF.add(foto); PdfPTable ta = new PdfPTable(2); PdfPCell celda; celda = new PdfPCell(new Paragraph("\nClave:\n\n", FontFactory.getFont("arial", 12, Font.BOLD))); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\n" + clave + "\n\n")); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\nNombre:\n\n", FontFactory.getFont("arial", 12, Font.BOLD))); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\n" + nombre + "\n\n")); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\nE-mail:\n\n", FontFactory.getFont("arial", 12, Font.BOLD))); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\n" + email + "\n\n")); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\nUT:\n\n", FontFactory.getFont("arial", 12, Font.BOLD))); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); celda = new PdfPCell(new Paragraph("\n" + procedencia + "\n\n")); celda.setBorderColor(BaseColor.WHITE); ta.addCell(celda); miPDF.add(ta); miPDF.close(); //Fin miPDF.close(); }
From source file:Operaciones.Destajo.java
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma);/*from w ww .ja v a 2s .c o m*/ Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); //Orden ord=buscaApertura(); PDF reporte = new PDF(); Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyyHH-mm-ss");//YYYY-MM-DD HH:MM:SS String valor = dateFormat.format(fecha); File folder = new File("reportes/" + ord); folder.mkdirs(); reporte.Abrir(PageSize.LETTER.rotate(), "Valuacin", "reportes/" + ord + "/" + valor + "-destajo.pdf"); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; float tam[] = new float[] { 150, 50, 100, 300 }; PdfPTable tabla = reporte.crearTabla(4, tam, 100, Element.ALIGN_LEFT); DecimalFormat formatoPorcentaje = new DecimalFormat("#,##0.00"); formatoPorcentaje.setMinimumFractionDigits(2); cabecera(reporte, bf, tabla); session.beginTransaction().begin(); Orden dato = (Orden) session.get(Orden.class, Integer.parseInt(this.ord)); List cuentas = null; for (int x = 0; x < t_datos.getRowCount(); x++) { tabla.addCell(reporte.celda(t_datos.getValueAt(x, 1).toString(), font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(formatoPorcentaje.format((Double) t_datos.getValueAt(x, 2)), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(formatoPorcentaje.format((Double) t_datos.getValueAt(x, 3)), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(t_datos.getValueAt(x, 4).toString(), font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); } session.beginTransaction().rollback(); tabla.setHeaderRows(1); reporte.agregaObjeto(tabla); reporte.cerrar(); reporte.visualizar("reportes/" + ord + "/" + valor + "-destajo.pdf"); } catch (Exception e) { System.out.println(e); e.printStackTrace(); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto."); } if (session != null) if (session.isOpen()) { session.flush(); session.clear(); session.close(); } }
From source file:Operaciones.Destajo.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma);//w w w.j av a 2 s . c o m Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); //Orden ord=buscaApertura(); PDF reporte = new PDF(); Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyyHH-mm-ss");//YYYY-MM-DD HH:MM:SS String valor = dateFormat.format(fecha); File folder = new File("reportes/" + ord); folder.mkdirs(); reporte.Abrir(PageSize.LETTER.rotate(), "Valuacin", "reportes/" + ord + "/" + valor + "-destajo.pdf"); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; float tam[] = new float[] { 150, 50, 100, 300 }; PdfPTable tabla = reporte.crearTabla(4, tam, 100, Element.ALIGN_LEFT); cabecera(reporte, bf, tabla); session.beginTransaction().begin(); Orden dato = (Orden) session.get(Orden.class, Integer.parseInt(this.ord)); List cuentas = null; for (int x = 0; x < 21; x++) { tabla.addCell(reporte.celda(" \n ", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(" \n ", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(" \n ", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda(" \n ", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); } session.beginTransaction().rollback(); tabla.setHeaderRows(1); reporte.agregaObjeto(tabla); reporte.cerrar(); reporte.visualizar("reportes/" + ord + "/" + valor + "-destajo.pdf"); } catch (Exception e) { System.out.println(e); e.printStackTrace(); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto."); } if (session != null) if (session.isOpen()) { session.flush(); session.clear(); session.close(); } }
From source file:Operaciones.Destajo.java
public void cabecera(PDF reporte, BaseFont bf, PdfPTable tabla) { Session session = HibernateUtil.getSessionFactory().openSession(); try {//from www. jav a2s . co m reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); reporte.contenido.roundRectangle(160, 515, 210, 45, 5); reporte.contenido.roundRectangle(380, 515, 375, 45, 5); reporte.contenido.roundRectangle(35, 480, 720, 30, 5); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 14); reporte.contenido.setColorFill(BaseColor.BLACK); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, con.getEmpresa(), 160, 580, 0); reporte.contenido.setFontAndSize(bf, 8); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Hoja de Avance", 160, 570, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 760, 580, 0); Orden dato = (Orden) session.get(Orden.class, Integer.parseInt(ord)); Foto foto = (Foto) session.createCriteria(Foto.class) .add(Restrictions.eq("orden.idOrden", Integer.parseInt(ord))).addOrder(Order.desc("fecha")) .setMaxResults(1).uniqueResult(); if (foto != null) { reporte.agregaObjeto(reporte.crearImagen( "ordenes/" + dato.getIdOrden() + "/" + foto.getDescripcion(), 0, -60, 120, 80, 0)); } else { } //************************datos de la orden**************************** reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Orden:" + dato.getIdOrden(), 164, 550, 0); if (dato.getFecha() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Apertura:" + dato.getFecha(), 285, 550, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Apertura:", 285, 550, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Compaia:" + dato.getCompania().getIdCompania() + " " + dato.getCompania().getNombre(), 164, 540, 0); if (dato.getSiniestro() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Siniestro:" + dato.getSiniestro(), 164, 530, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Siniestro:", 164, 530, 0); if (dato.getFechaSiniestro() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "F. Siniestro:" + dato.getFechaSiniestro(), 285, 530, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "F.Siniestro:", 285, 530, 0); if (dato.getPoliza() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Poliza:" + dato.getPoliza(), 164, 520, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Poliza:", 164, 520, 0); if (dato.getInciso() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Inciso:" + dato.getInciso(), 285, 520, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Inciso:", 285, 520, 0); //********************************************************** //************datos de la unidad reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Unidad:" + dato.getTipo().getTipoNombre(), 385, 550, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Modelo:" + dato.getModelo(), 664, 550, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Marca:" + dato.getMarca().getMarcaNombre(), 385, 540, 0); if (dato.getNoEconomico() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Economico:" + dato.getNoEconomico(), 664, 540, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Economico:", 664, 540, 0); if (dato.getNoMotor() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N Motor:" + dato.getNoMotor(), 385, 530, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N Motor:", 385, 530, 0); if (dato.getNoSerie() != null) reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N Serie:" + dato.getNoSerie(), 385, 520, 0); else reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "N Serie:", 385, 520, 0); //************************************************************* switch (this.global) { case "h": reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Especialidad: Hojalateria", 40, 495, 0); break; case "m": reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Especialidad: Mecanica", 40, 495, 0); break; case "s": reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Especialidad: Suspension", 40, 495, 0); break; case "e": reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Especialidad: electrico", 40, 495, 0); break; case "p": reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Especialidad: Pintura", 40, 495, 0); break; } reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Empleado:" + t_responsable.getText(), 165, 495, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Fecha Asignacin:" + t_asignacion.getText(), 430, 495, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Fecha Limite:" + t_limite.getText(), 600, 495, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Monto x Hora: $" + t_monto.getText(), 40, 485, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Horas Totales: " + t_horas.getText(), 165, 485, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, "Importe a Pagar: $" + t_importe.getText(), 600, 485, 0); reporte.finTexto(); //agregamos renglones vacios para dejar un espacio reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; tabla.addCell(reporte.celda("Fecha Avance", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("% de Avance", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Importe Pagado", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); tabla.addCell(reporte.celda("Notas", font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) { session.flush(); session.clear(); session.close(); } }
From source file:org.javad.stamp.pdf.StampBox.java
License:Apache License
/** * Will draw a black frame shape for a given stamp box. The current * supported shapes include/*from w ww . j a va2 s . c o m*/ * <ul><li>rectangle</li> * <li>triangle</li> * <li>diamond</li> * </ul> * * @param content * @param rect */ void drawShape(PdfContentByte content, OutputBounds rect) { content.setColorFill(BaseColor.WHITE); drawPath(content, rect); content.fill(); if (isBorder()) { content.setColorStroke(BaseColor.BLACK); content.setLineWidth(0.8f); drawPath(content, rect); content.stroke(); } content.setColorFill(BaseColor.BLACK); }
From source file:org.openlmis.web.view.pdf.requisition.RequisitionPdfModel.java
License:Open Source License
private PdfPTable getTableFor(List<? extends LineItem> lineItems, Boolean fullSupply, List<? extends Column> columnList) throws DocumentException, NoSuchFieldException, IllegalAccessException, IOException { Template template = Template.getInstance(columnList); List<? extends Column> visibleColumns = template.getPrintableColumns(fullSupply); PdfPTable table = prepareTable(visibleColumns); boolean odd = true; LineItem previousLineItem = null;/*from w ww . ja v a 2 s .com*/ for (LineItem lineItem : lineItems) { if (previousLineItem == null || !lineItem.compareCategory(previousLineItem)) { table.addCell(categoryRow(visibleColumns.size(), lineItem)); previousLineItem = lineItem; } if (lineItem.isRnrLineItem()) { PrintRnrLineItem printRnrLineItem = new PrintRnrLineItem((RnrLineItem) lineItem); printRnrLineItem.calculate(rnrColumnList, lossesAndAdjustmentsTypes, numberOfMonths, requisition.getStatus()); } String currencySymbol = messageService.message(LABEL_CURRENCY_SYMBOL); if (!configService.getBoolValue("RNR_PRINT_REPEAT_CURRENCY_SYMBOL")) { currencySymbol = ""; } List<PdfPCell> cells = getCells(visibleColumns, lineItem, currencySymbol); odd = !odd; for (PdfPCell cell : cells) { cell.setBackgroundColor(odd ? BaseColor.WHITE : ROW_GREY_BACKGROUND); table.addCell(cell); } } return table; }
From source file:org.openlmis.web.view.pdf.requisition.RequisitionPdfModel.java
License:Open Source License
private void setBlankFooter(PdfPTable table, Integer visibleColumnsSize) { PdfPCell cell = new PdfPCell(new Phrase(" ")); cell.setBorder(0);//from w w w . java 2 s . c o m cell.setColspan(visibleColumnsSize); cell.setBackgroundColor(BaseColor.WHITE); table.addCell(cell); }
From source file:org.sharegov.cirm.utils.PDFViewReport.java
License:Apache License
private BaseColor addColor(Integer i) { if (i == null) return null; if (i % 2 == 0) return BaseColor.LIGHT_GRAY; else//from w w w. java2 s. c om return BaseColor.WHITE; }