List of usage examples for com.itextpdf.text Font BOLD
int BOLD
To view the source code for com.itextpdf.text Font BOLD.
Click Source Link
From source file:nl.infosys.hartigehap.barSystem.domain.Bon.java
/** * Create the header for the PDF/*from w w w .j a va 2 s . c o m*/ * * @return header */ private Paragraph header() { Paragraph par = new Paragraph("Eetcafe de hartige hap", FontFactory.getFont("Times-Roman", 20, Font.BOLD)); par.setAlignment(Element.ALIGN_CENTER); return par; }
From source file:nl.infosys.hartigehap.barSystem.domain.Bon.java
/** * create the table for the PDF// w w w . ja va2s . c om * * @return table */ private Paragraph table() { Paragraph par = new Paragraph(); PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100); table.getDefaultCell().setBorder(0); PdfPCell cell; Font fontbold = FontFactory.getFont("Times-Roman", 13, Font.BOLD); Font normal = FontFactory.getFont("Times-Roman", 13); table.addCell(new Phrase("Product:", fontbold)); table.addCell(new Phrase("Prijs:", fontbold)); table.addCell(new Phrase("Aantal:", fontbold)); table.addCell(new Phrase("Totaalprijs:", fontbold)); for (ImmutableProduct product : bestelling.getProducten()) { table.addCell(new Phrase(product.getNaam(), normal)); table.addCell(new Phrase(product.getPrijsFormat(), normal)); table.addCell(new Phrase(String.valueOf(product.getAantal()), normal)); cell = new PdfPCell(new Phrase(product.getTotaalPrijsFormat(), normal)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); cell.setPaddingBottom(5); table.addCell(cell); } cell = new PdfPCell(new Phrase("Excl. BTW", fontbold)); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase(bestelling.getPrijsExclBtwFormat(), fontbold)); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase("BTW 21%", fontbold)); cell.setBorder(0); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(bestelling.getBtwBedragFormat(), fontbold)); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("Incl. BTW", fontbold)); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase(bestelling.getTotaalPrijsFormat(), fontbold)); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(Rectangle.TOP); table.addCell(cell); par.add(table); return par; }
From source file:nl.infosys.hartigehap.barSystem.presentation.BonGui.java
private Paragraph header() { Paragraph par = new Paragraph("Eetcafe de hartige hap", FontFactory.getFont("Times-Roman", 20, Font.BOLD)); par.setAlignment(Element.ALIGN_CENTER); return par;//from w w w. j a v a2s .c o m }
From source file:nl.infosys.hartigehap.barSystem.presentation.BonGui.java
private Paragraph table() { Paragraph par = new Paragraph(); PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100);//from ww w . j a v a2 s .c om table.getDefaultCell().setBorder(0); PdfPCell cell; Font fontbold = FontFactory.getFont("Times-Roman", 13, Font.BOLD); Font normal = FontFactory.getFont("Times-Roman", 13); table.addCell(new Phrase("Product:", fontbold)); table.addCell(new Phrase("Prijs:", fontbold)); table.addCell(new Phrase("Aantal:", fontbold)); table.addCell(new Phrase("Totaalprijs:", fontbold)); for (ImmutableProduct product : bestelling.getProducten()) { table.addCell(new Phrase(product.getNaam(), normal)); table.addCell(new Phrase(product.getPrijsFormat(), normal)); table.addCell(new Phrase(String.valueOf(product.getAantal()), normal)); cell = new PdfPCell(new Phrase(product.getTotaalPrijsFormat(), normal)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); cell.setPaddingBottom(5); table.addCell(cell); } cell = new PdfPCell(new Phrase("Excl. BTW", fontbold)); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase(bestelling.getPrijsExclBtwFormat(), fontbold)); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase("BTW 21%", fontbold)); cell.setBorder(0); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(bestelling.getBtwBedragFormat(), fontbold)); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("Incl. BTW", fontbold)); cell.setBorder(Rectangle.TOP); table.addCell(cell); cell = new PdfPCell(new Phrase(bestelling.getTotaalPrijsFormat(), fontbold)); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(Rectangle.TOP); table.addCell(cell); par.add(table); return par; }
From source file:numerical.CramersRule.java
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed JFileChooser jfc = new JFileChooser(); jfc.setCurrentDirectory(new File("/My Documents")); int return_val = jfc.showSaveDialog(rootPane); if (return_val == JFileChooser.APPROVE_OPTION) { Document doc = new Document(); try {//from w ww .j av a 2 s . c o m jfc.getSelectedFile(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(jfc.getSelectedFile() + ".pdf")); doc.open(); Font f = new Font(Font.FontFamily.TIMES_ROMAN, 12.0f, Font.NORMAL, BaseColor.BLACK); Font f1 = new Font(Font.FontFamily.TIMES_ROMAN, 18.0f, Font.BOLD, BaseColor.BLACK); Paragraph paragraph = new Paragraph(null, f); Paragraph title = new Paragraph(null, f1); title.add("Cramers Rule\n"); paragraph.add(txt_result.getText()); doc.add(title); doc.add(paragraph); doc.close(); writer.close(); JOptionPane.showMessageDialog(rootPane, "Successfully saved!"); } catch (FileNotFoundException | DocumentException | HeadlessException e) { System.err.println(e); } } }
From source file:numerical.Determinants.java
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed JFileChooser jfc = new JFileChooser(); jfc.setCurrentDirectory(new File("/My Documents")); int return_val = jfc.showSaveDialog(rootPane); if (return_val == JFileChooser.APPROVE_OPTION) { Document doc = new Document(); try {//www. j ava 2 s.c o m jfc.getSelectedFile(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(jfc.getSelectedFile() + ".pdf")); doc.open(); Font f = new Font(Font.FontFamily.TIMES_ROMAN, 12.0f, Font.NORMAL, BaseColor.BLACK); Font f1 = new Font(Font.FontFamily.TIMES_ROMAN, 18.0f, Font.BOLD, BaseColor.BLACK); Paragraph paragraph = new Paragraph(null, f); Paragraph title = new Paragraph(null, f1); title.add("Determinants \n"); paragraph.add(txt_result.getText()); doc.add(title); doc.add(paragraph); doc.close(); writer.close(); JOptionPane.showMessageDialog(rootPane, "Successfully saved!"); } catch (FileNotFoundException | DocumentException | HeadlessException e) { System.err.println(e); } } }
From source file:numerical.Fibonnaci.java
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed JFileChooser jfc = new JFileChooser(); jfc.setCurrentDirectory(new File("/My Documents")); int return_val = jfc.showSaveDialog(rootPane); if (return_val == JFileChooser.APPROVE_OPTION) { Document doc = new Document(); try {/*from w w w . ja v a 2 s . co m*/ jfc.getSelectedFile(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(jfc.getSelectedFile() + ".pdf")); doc.open(); Font f = new Font(Font.FontFamily.TIMES_ROMAN, 12.0f, Font.NORMAL, BaseColor.BLACK); Font f1 = new Font(Font.FontFamily.TIMES_ROMAN, 18.0f, Font.BOLD, BaseColor.BLACK); Paragraph paragraph = new Paragraph(null, f); Paragraph title = new Paragraph(null, f1); title.add("Fibonnaci\n"); paragraph.add("Sequence number: " + count + "\n"); paragraph.add("Result: "); paragraph.add(txt_result.getText()); doc.add(title); doc.add(paragraph); doc.close(); writer.close(); JOptionPane.showMessageDialog(rootPane, "Successfully saved!"); } catch (FileNotFoundException | DocumentException | HeadlessException e) { System.err.println(e); } } }
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);/*ww w .j av a 2 s.c om*/ 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);/*from w w w.ja v a 2s . co 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 w w w. j ava 2 s. c om*/ 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(); } }