List of usage examples for com.itextpdf.text.pdf BaseFont COURIER_BOLD
String COURIER_BOLD
To view the source code for com.itextpdf.text.pdf BaseFont COURIER_BOLD.
Click Source Link
From source file:de.jost_net.JVerein.gui.control.FormularfeldControl.java
License:Open Source License
public SelectInput getFont() throws RemoteException { if (font != null) { return font; }// w ww . j a va2 s .c o m ArrayList<String> fonts = new ArrayList<String>(); fonts.add("FreeSans"); fonts.add("FreeSans-Bold"); fonts.add("FreeSans-BoldOblique"); fonts.add("FreeSans-Oblique"); fonts.add(BaseFont.HELVETICA); fonts.add(BaseFont.HELVETICA_BOLD); fonts.add(BaseFont.HELVETICA_BOLDOBLIQUE); fonts.add(BaseFont.HELVETICA_OBLIQUE); fonts.add(BaseFont.TIMES_ROMAN); fonts.add(BaseFont.TIMES_BOLD); fonts.add(BaseFont.TIMES_ITALIC); fonts.add(BaseFont.TIMES_BOLDITALIC); fonts.add(BaseFont.COURIER); fonts.add(BaseFont.COURIER_BOLD); fonts.add(BaseFont.COURIER_OBLIQUE); fonts.add(BaseFont.COURIER_BOLDOBLIQUE); font = new SelectInput(fonts, getFormularfeld().getFont()); return font; }
From source file:Excel.pdfsJavaGenerador.java
public void run() { Document documento = new Document(); documento.setPageSize(PageSize.A4.rotate()); int i = 1;// w w w . j a va 2 s. c om String arch = periodo + "_Iva Ventas.pdf"; File fich = new File(arch); FileOutputStream fichero; try { pdfsJavaGenerador pdf; ArrayList listado = new ArrayList(); String sql = "select * from ivaventas where periodo='" + periodo + "' order by numero"; Transaccionable tra = new ConeccionLocal(); ResultSet rs = tra.leerConjuntoDeRegistros(sql); while (rs.next()) { pdf = new pdfsJavaGenerador(); pdf.setComprobante(rs.getString("comprobante")); pdf.setFecha(rs.getString("fecha")); pdf.setNumeroFactura(rs.getString("numero")); pdf.setRazonSocial(rs.getString("cliente")); pdf.setCondicionIva(rs.getString("condicion")); pdf.setCuit(rs.getString("cuit")); pdf.setNeto(rs.getString("neto")); pdf.setIva(rs.getString("iva")); pdf.setTotal(rs.getString("total")); listado.add(pdf); } rs.close(); Integer totalItems = listado.size(); Integer totalPaginas = totalItems / 46; Integer contadorPaginas = 1; totalPaginas = totalPaginas + 1; System.out.println(" items " + totalItems + " paginas " + totalPaginas); fichero = new FileOutputStream(arch); PdfWriter writer = PdfWriter.getInstance(documento, fichero); documento.open(); //writer.addPageDictEntry(PdfName.ROTATE,PdfPage.SEASCAPE); writer.addPageDictEntry(PdfName.ROTATE, null); PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 12); cb.beginText(); //cb.setTextMatrix(250,820); //cb.showText("Subdiario de IVA Ventas"); cb.setFontAndSize(bf, 10); cb.setTextMatrix(20, 480); cb.showText("Periodo " + periodo); //cb.setTextMatrix(750,550); //cb.showText("Hoja "+contadorPaginas+" de "+totalPaginas); int renglon = 460; String vencimiento; String descripcion; String monto; String recargo; String total; String totalFinal; Double tot = 0.00; String razonSocial; int itt = 0; //aca empieza la iteracion //encabezados bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 8); cb.setTextMatrix(20, renglon); cb.showText("Cbte"); cb.setTextMatrix(50, renglon); cb.showText("Fecha"); cb.setTextMatrix(90, renglon); cb.showText("Nro Factura"); cb.setTextMatrix(150, renglon); cb.showText("Cliente"); cb.setTextMatrix(500, renglon); //tot=saldo.getCantidad() * saldo.getPrecioUnitario(); cb.showText("Cond"); cb.setTextMatrix(540, renglon); cb.showText("C.U.I.T."); cb.setTextMatrix(610, renglon); cb.showText("Neto"); cb.setTextMatrix(660, renglon); cb.showText("I.V.A."); cb.setTextMatrix(700, renglon); cb.showText("Imp. Int."); cb.setTextMatrix(760, renglon); cb.showText("Total"); renglon = renglon - 20; //fin encabezados bf = BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 6); Iterator itl = listado.listIterator(); //vencimiento="Esta cotizacin tendr vigencia 30 das "; Double montoCIva = 0.00; Double descuento = 0.00; Double descUnitario = 0.00; Double descTotal = 0.00; Double montoCIvaTotal = 0.00; Double descuentoTotal = 0.00; Double descUnitarioTotal = 0.00; Double descTotalTotal = 0.00; String descripcionArt = null; while (itl.hasNext()) { pdf = (pdfsJavaGenerador) itl.next(); //vencimiento=saldo.getVencimientoString(); /* descripcion="Numero Resumen de cta "; montoCIva=saldo.getPrecioUnitario() * 1.21; monto=Numeros.ConvertirNumero(montoCIva); recargo="10%"; total="nada"; */ //recargo=String.valueOf(saldo.getRecargo()); //tot=tot + saldo.getTotal(); //total=String.valueOf(saldo.getTotal()); cb.setTextMatrix(20, renglon); cb.showText(pdf.getComprobante()); cb.setTextMatrix(45, renglon); cb.showText(pdf.getFecha()); cb.setTextMatrix(90, renglon); cb.showText(pdf.getNumeroFactura()); cb.setTextMatrix(150, renglon); razonSocial = pdf.getRazonSocial(); cb.showText(razonSocial); cb.setTextMatrix(500, renglon); cb.showText(pdf.getCondicionIva()); cb.setTextMatrix(540, renglon); cb.showText(pdf.getCuit()); cb.setTextMatrix(600, renglon); if (pdf.getComprobante().equals("N.C.")) { String neto = pdf.getNeto(); String iva = pdf.getIva(); String totalP = pdf.getTotal(); pdf.setNeto("-" + neto.trim()); pdf.setIva("-" + iva.trim()); pdf.setTotal("-" + totalP.trim()); } montoCIva = montoCIva + Numeros.ConvertirStringADouble(pdf.getNeto()); descuento = descuento + Numeros.ConvertirStringADouble(pdf.getIva()); descTotal = descTotal + Numeros.ConvertirStringADouble(pdf.getTotal()); cb.showText(pdf.getNeto()); cb.setTextMatrix(650, renglon); cb.showText(pdf.getIva()); cb.setTextMatrix(710, renglon); cb.showText("0.00"); cb.setTextMatrix(750, renglon); cb.showText(pdf.getTotal()); //descuento=descuento+saldo.getDescuento(); renglon = renglon - 10; if (renglon < 30) { bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 7); cb.setTextMatrix(550, renglon); cb.showText("Subtotal:"); cb.setTextMatrix(600, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(montoCIva)); cb.setTextMatrix(650, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(descuento)); cb.setTextMatrix(710, renglon); cb.showText("0.00"); cb.setTextMatrix(750, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(descTotal)); montoCIvaTotal = montoCIvaTotal + montoCIva; descuentoTotal = descuentoTotal + descuento; descTotalTotal = descTotalTotal + descTotal; descuento = 0.00; descTotal = 0.00; montoCIva = 0.00; renglon = 460; cb.endText(); documento.newPage(); documento.setPageSize(PageSize.A4.rotate()); cb.beginText(); contadorPaginas++; cb.setFontAndSize(bf, 12); //cb.setTextMatrix(250,820); //cb.showText("Subdiario de IVA Ventas"); cb.setFontAndSize(bf, 10); cb.setTextMatrix(20, 480); cb.showText("Periodo " + periodo); //cb.setTextMatrix(750,550); //cb.showText("Hoja "+contadorPaginas+" de "+totalPaginas); //aca empieza la iteracion //encabezados bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 8); cb.setTextMatrix(20, renglon); cb.showText("Cbte"); cb.setTextMatrix(50, renglon); cb.showText("Fecha"); cb.setTextMatrix(90, renglon); cb.showText("Nro Factura"); cb.setTextMatrix(150, renglon); cb.showText("Cliente"); cb.setTextMatrix(500, renglon); //tot=saldo.getCantidad() * saldo.getPrecioUnitario(); cb.showText("Cond"); cb.setTextMatrix(540, renglon); cb.showText("C.U.I.T."); cb.setTextMatrix(610, renglon); cb.showText("Neto"); cb.setTextMatrix(660, renglon); cb.showText("I.V.A."); cb.setTextMatrix(700, renglon); cb.showText("Imp. Int."); cb.setTextMatrix(760, renglon); cb.showText("Total"); renglon = renglon - 20; //fin encabezados bf = BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 6); } } bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf, 7); cb.setTextMatrix(540, renglon); cb.showText("Subtotal:"); cb.setTextMatrix(600, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(montoCIva)); cb.setTextMatrix(650, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(descuento)); cb.setTextMatrix(710, renglon); cb.showText("0.00"); cb.setTextMatrix(750, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(descTotal)); renglon = renglon - 10; montoCIvaTotal = montoCIvaTotal + montoCIva; descuentoTotal = descuentoTotal + descuento; descTotalTotal = descTotalTotal + descTotal; cb.setTextMatrix(540, renglon); cb.showText("Total:"); cb.setTextMatrix(600, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(montoCIvaTotal)); cb.setTextMatrix(650, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(descuentoTotal)); cb.setTextMatrix(710, renglon); cb.showText("0.00"); cb.setTextMatrix(750, renglon); cb.showText(Numeros.ConvetirNumeroDosDigitos(descTotalTotal)); descuento = 0.00; descTotal = 0.00; montoCIva = 0.00; cb.endText(); documento.close(); File f = new File(arch); if (f.exists()) { Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + arch); } int confirmacion = 0; /* if(doc.getArchivo().isEmpty()){ }else{ confirmacion=JOptionPane.showConfirmDialog(null, "DESEA NOTIFICAR POR MAIL?"); if(confirmacion==0){ //JOptionPane.showMessageDialog(null,"acepto"); } } */ System.out.println("eligio " + confirmacion); } catch (FileNotFoundException ex) { Logger.getLogger(pdfsJavaGenerador.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(pdfsJavaGenerador.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(pdfsJavaGenerador.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(pdfsJavaGenerador.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:gravabncertificado.GerandoArquivoCarimbado_1.java
public static void GerandoArquivoCarimbadoPDF(String caminhoarquivo, String BN) throws InvalidPdfException { //Copiando arquivo informado. try {/*ww w.j a v a 2 s . c o m*/ // Adicionado parametro para nao retornar erro quando o documento for protegido. PdfReader.unethicalreading = true; //Cria o reader para o primeiro PDF PdfReader reader = new PdfReader(caminhoarquivo); // n recebe o numero total de paginas int n = reader.getNumberOfPages(); //Tamanho da primeira Pagina ; //Cria Segundo PDF Document document = new Document(PageSize.A4, 36, 36, 36, 36); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(caminhoarquivo.substring(0, caminhoarquivo.length() - 4) + "-C.pdf")); document.open(); // Adiciona conteudo ao PDF Carimbado. PdfContentByte cb = writer.getDirectContent(); int i = 0; int p = 0; String caminhodestino = (caminhoarquivo.substring(0, caminhoarquivo.length() - BN.length())); // DESABILITADO PORQUE O MOVER NAO ESTAVA FUNCIONANDO. File destinooriginal = new File(caminhodestino + "ORIGINAL\\"); if (!destinooriginal.exists()) { destinooriginal.mkdir(); } caminhodestino = (caminhodestino + "ORIGINAL\\" + BN); //TESTANDO NOVA FORMA DE COPIAR File origem = new File(caminhoarquivo); File destino = new File(caminhodestino); FileInputStream fis = new FileInputStream(origem); FileOutputStream fos = new FileOutputStream(destino); FileChannel inChannel = fis.getChannel(); FileChannel outChannel = fos.getChannel(); long transferFrom = outChannel.transferFrom(inChannel, 0, inChannel.size()); fis.close(); fos.close(); inChannel.close(); outChannel.close(); // Thread.sleep(10); BN = BN.substring(0, BN.length() - 4); while (i < n) { document.newPage(); p++; i++; PdfContentByte under = writer.getDirectContentUnder(); PdfImportedPage page1 = writer.getImportedPage(reader, i); cb.addTemplate(page1, 0, i * 0.2f); // Page 1: a rectangle /* RETANGULO DESATIVADO drawRectangle(under, 100, 50); under.setRGBColorFill(255, 220, 220); under.rectangle(width /50, 5, 118, 40); under.fill(); */ //CARIMBO DA BN BaseFont bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED); cb.beginText(); cb.setFontAndSize(bf, 14); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " ________________", width / 6, 44, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 32, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 22, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " NR", width / 6, 28, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " " + BN, width / 6, 16, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 12, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " ________________", width / 6, 14, 0); cb.endText(); } document.close(); writer.close(); reader.close(); origem.delete(); /* PdfContentByte under = writer.getDirectContentUnder(); // Page 1: a rectangle drawRectangle(under, 20, 20); under.setRGBColorFill(0xFF, 0xD7, 0x00); under.rectangle(5, 5, 15, 15); under.fill(); */ //document.newPage(); //COPIANDO ARQUIVO CARIMBADO /* DESABILITADO PORQUE NAO ESTAVA FUNCIONANDO. boolean bool; //caminhoarquivo = caminhoarquivo.replace("\\", "\\\\"); //caminhodestino = caminhodestino.replace("\\", "\\\\"); File origem = new File(caminhoarquivo); File destino = new File(caminhodestino); bool = origem.renameTo(destino); System.out.println(origem); System.out.println(caminhodestino); */ } catch (IOException | DocumentException ex) { } }
From source file:gravabncertificado007.CarimboCertificado.java
public void aplicaCarimboBin(String BN, String caminhoarquivo) throws DocumentException, IOException, RuntimeException { PdfReader.unethicalreading = true;//from w w w . j a v a 2 s .co m //Cria o reader para o primeiro PDF PdfReader reader = new PdfReader(caminhoarquivo); Rectangle psize = reader.getPageSize(1); float width = psize.getWidth(); float height = psize.getHeight(); Document document = new Document(new Rectangle(width, height)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(caminhoarquivo.substring(0, caminhoarquivo.length() - 4) + "-C.pdf")); document.open(); int i = 0; BN = BN.substring(BN.length() - 13, BN.length() - 4); PdfContentByte cb = writer.getDirectContent(); while (i < reader.getNumberOfPages()) { i++; document.newPage(); PdfContentByte under = writer.getDirectContentUnder(); PdfImportedPage page1 = writer.getImportedPage(reader, i); cb.addTemplate(page1, 0, i * 0.2f); //CARIMBO DA BN BaseFont bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED); cb.beginText(); cb.setFontAndSize(bf, 14); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " ________________", width / 6, 44, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 32, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 22, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " NR", width / 6, 28, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " " + BN, width / 6, 16, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 12, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " ________________", width / 6, 14, 0); cb.endText(); } document.close(); writer.close(); reader.close(); }
From source file:gravabncertificado007.CarimboCertificado.java
public void aplicaCariboGedi(String BN, String caminhoarquivo) throws DocumentException, IOException, RuntimeException { PdfReader.unethicalreading = true;/*ww w . j av a 2s. c om*/ //Cria o reader para o primeiro PDF PdfReader reader = new PdfReader(caminhoarquivo); Rectangle psize = reader.getPageSize(1); float width = psize.getWidth(); float height = psize.getHeight(); Document document = new Document(new Rectangle(width, height)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(caminhoarquivo.substring(0, caminhoarquivo.length() - 4) + "-G.pdf")); document.open(); int i = 0; BN = BN.substring(BN.length() - 13, BN.length() - 4); PdfContentByte cb = writer.getDirectContent(); while (i < reader.getNumberOfPages()) { i++; document.newPage(); PdfContentByte under = writer.getDirectContentUnder(); PdfImportedPage page1 = writer.getImportedPage(reader, i); cb.addTemplate(page1, 0, i * 0.2f); BaseFont bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED); cb.beginText(); cb.setFontAndSize(bf, 14); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " _________________ ", width / 6, 44, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 32, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 22, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " |Copia Controlada |", width / 6, 28, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 16, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 12, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " |_________________|", width / 6, 14, 0); cb.endText(); } document.close(); writer.close(); reader.close(); }
From source file:jati.GerandoArquivoCarimbado.java
public static void GerandoArquivoCarimbadoPDF(String caminhoarquivo, String BN) throws InvalidPdfException, IOException { //Copiando arquivo informado. try {//from w w w . ja va2 s.c om // Adicionado parametro para nao retornar erro quando o documento for protegido. PdfReader.unethicalreading = true; PdfWriter writer = PdfWriter.getInstance(montaraAquivo(caminhoarquivo), new FileOutputStream(caminhoarquivo.substring(0, caminhoarquivo.length() - 4) + "-C.pdf")); // ABRE O DOCUMENTO CRIADO PARA MANUSEIO montaraAquivo(caminhoarquivo).open(); //SUBSTRING RETIRA PARTE DO TEXTO ENTRE OS INDICES ESPECIFICADOS //caminhoDestino RECEBE UM NOVO CAMINHO RESULTANTE DOS INDICES DE CAMINHO.LENGTH - BN.LENGTH // QUE FORMAM UMA NOVA STRING String caminhodestino = (caminhoarquivo.substring(0, caminhoarquivo.length() - BN.length())); File destinooriginal = new File(caminhodestino + "ORIGINAL\\"); if (!destinooriginal.exists()) { destinooriginal.mkdir(); } caminhodestino = (caminhodestino + "ORIGINAL\\" + BN); //TESTANDO NOVA FORMA DE COPIAR File origem = new File(caminhoarquivo); File destino = new File(caminhodestino); FileInputStream fis = new FileInputStream(origem); FileOutputStream fos = new FileOutputStream(destino); FileChannel inChannel = fis.getChannel(); FileChannel outChannel = fos.getChannel(); long transferFrom = outChannel.transferFrom(inChannel, 0, inChannel.size()); fis.close(); fos.close(); inChannel.close(); outChannel.close(); // Thread.sleep(10); BN = BN.substring(0, BN.length() - 4); PdfContentByte cb = writer.getDirectContent(); int i = 0; while (i < reader.getNumberOfPages()) { montaraAquivo(caminhodestino).newPage(); i++; //PDFCONTETBYTE GERA UMA ESPECIE DE CODIGO DE BARRAS PdfContentByte under = writer.getDirectContentUnder(); PdfImportedPage page1 = writer.getImportedPage(reader, i); cb.addTemplate(page1, 0, i * 0.2f); //CARIMBO DA BN BaseFont bf = BaseFont.createFont(BaseFont.COURIER_BOLD, BaseFont.CP1250, BaseFont.NOT_EMBEDDED); cb.beginText(); cb.setFontAndSize(bf, 14); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " ________________", width / 6, 44, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 32, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 22, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " NR", width / 6, 28, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " " + BN, width / 6, 16, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " | |", width / 6, 12, 0); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " ________________", width / 6, 14, 0); cb.endText(); } montaraAquivo(caminhodestino).close(); writer.close(); reader.close(); origem.delete(); } catch (IOException | DocumentException ex) { } }