List of usage examples for com.itextpdf.text Phrase Phrase
private Phrase(final boolean dummy)
From source file:clases.Funciones.java
public void ReGenerateReporte_Service(int id_service) { int id = 0, id_cliente = 0; double total = 0; String id_vehiculo = "", s_solicitado = "", s_realizado = "", productos = ""; boolean p_urgente = false; try {/*from w w w. j av a 2s .c om*/ coneccion = new Conexion(); try (ResultSet rs = coneccion.Consulta( "SELECT id, id_cliente, id_vehiculo, s_solicitado, s_realizado, productos, total, p_urgente FROM services where id = " + id_service + " ")) { if (rs.next()) { id = rs.getInt(1); id_cliente = rs.getInt(2); id_vehiculo = rs.getString(3); s_solicitado = rs.getString(4); s_realizado = rs.getString(5); productos = rs.getString(6); total = rs.getDouble(7); p_urgente = rs.getBoolean(8); } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SQLException ex) { Alert(ex.getMessage()); } int Folio = id; JTable t_client = new JTable(); JTable t_vehiculos = new JTable(); Table_LoadClient(t_client, id_cliente); Table_LoadCar(t_vehiculos, id_vehiculo); Document documento = new Document(PageSize.LETTER, 10, 10, 10, 10); FileOutputStream ficheroPdf; File ruta = null; com.itextpdf.text.Image imagen = null; try { imagen = com.itextpdf.text.Image.getInstance(p.ReturnPropiedad(p.Ruta_logo)); char rt = p.ReturnPropiedad(p.Ruta_SaveReports) .charAt(p.ReturnPropiedad(p.Ruta_SaveReports).length() - 1); if ("/".equalsIgnoreCase(String.valueOf(rt))) { ruta = new File(p.ReturnPropiedad(p.Ruta_SaveReports) + ReturnNombreUsuario().replace(" ", "_") + "_" + GetFechaAndHourActual().replace(" ", "_").replace(":", "_").replace("-", "_") + ".pdf"); } else { ruta = new File(p.ReturnPropiedad(p.Ruta_SaveReports) + "/" + ReturnNombreUsuario().replace(" ", "_") + "_" + GetFechaAndHourActual().replace(" ", "_").replace(":", "_").replace("-", "_") + ".pdf"); } ficheroPdf = new FileOutputStream(ruta); PdfWriter.getInstance(documento, ficheroPdf).setInitialLeading(20); } catch (DocumentException | IOException ex) { Alert("Verifique las rutas de guardado de reportes y logo."); } try { documento.open(); imagen.setAlignment(Element.ALIGN_CENTER); imagen.scaleToFit(200, 100); String membrete = "REPORTE DE SERVICIO NO: " + Folio + "\n\n"; membrete += ReturnDatosFisicos(this.Datos_Nombre) + "\n"; membrete += "DIRECCION: " + ReturnDatosFisicos(this.Datos_Direccion) + "\n"; membrete += "RFC: " + ReturnDatosFisicos(this.Datos_Rfc) + "\n"; membrete += "TELEFONO: " + ReturnDatosFisicos(this.Datos_Telefono) + "\n"; membrete += "GENERO DOCUMENTO: " + ReturnNombreUsuario() + "\n"; membrete += "GENERADO: " + GetFechaAndHourActual() + "\n"; PdfPTable HeaderDatos = new PdfPTable(2); HeaderDatos.setWidthPercentage(100); documento.add(new Paragraph("\n")); PdfPCell cell = new PdfPCell(new Phrase(membrete)); cell.setBorder(0); HeaderDatos.addCell(cell); cell = new PdfPCell(imagen); cell.setBorder(0); cell.setHorizontalAlignment(1); cell.setVerticalAlignment(1); HeaderDatos.addCell(cell); documento.add(HeaderDatos); documento.add(new Paragraph("\n")); ///////// //Tabla_Clientes String Client_header = "CLIENTE"; Paragraph Title = new Paragraph(Client_header.toUpperCase()); Title.setAlignment(1); documento.add(Title); documento.add(new Paragraph(" ")); PdfPTable tabla = new PdfPTable(t_client.getColumnCount()); tabla.setWidthPercentage(100); for (int i = 0; i < t_client.getColumnCount(); i++) { Paragraph header = new Paragraph(t_client.getColumnName(i)); header.setAlignment(1); tabla.addCell(header); } for (int i = 0; i < t_client.getRowCount(); i++) { for (int a = 0; a < t_client.getColumnCount(); a++) { Paragraph campo = new Paragraph(String.valueOf(t_client.getValueAt(i, a))); campo.setAlignment(1); tabla.addCell(campo); } } documento.add(tabla); documento.add(new Paragraph(" ")); //Tabla_Vehiculos String Vehiculos_header = "VEHICULO"; Paragraph Title1 = new Paragraph(Vehiculos_header.toUpperCase()); Title1.setAlignment(1); documento.add(Title1); documento.add(new Paragraph(" ")); PdfPTable tabla_vehiculos = new PdfPTable(t_vehiculos.getColumnCount()); tabla_vehiculos.setWidthPercentage(100); for (int i = 0; i < t_vehiculos.getColumnCount(); i++) { Paragraph header = new Paragraph(t_vehiculos.getColumnName(i)); header.setAlignment(1); tabla_vehiculos.addCell(header); } for (int i = 0; i < t_vehiculos.getRowCount(); i++) { for (int a = 0; a < t_vehiculos.getColumnCount(); a++) { Paragraph campo = new Paragraph(String.valueOf(t_vehiculos.getValueAt(i, a))); campo.setAlignment(1); tabla_vehiculos.addCell(campo); } } documento.add(tabla_vehiculos); documento.add(new Paragraph("SERVICIO SOLICITADO: " + s_solicitado.toUpperCase())); documento.add(new Paragraph("SERVICIO REALIZADO: " + s_realizado.toUpperCase())); String var = ""; if (p_urgente) { var = "URGENTE"; } else { var = "PROGRAMAR"; } documento.add(new Paragraph("PRIORIDAD: " + var)); //Tabla de servicios y productos String Service_header = "\nSERVICIOS Y PRODUCTOS UTILIZADOS"; Paragraph Title2 = new Paragraph(Service_header.toUpperCase()); Title2.setAlignment(1); documento.add(Title2); documento.add(new Paragraph(" ")); JTable t_productos = new JTable(); Table_LoadProductsServicio(t_productos); String[] result = productos.replace("+", ",").split(","); if (result.length >= 1) { for (String r : result) { if (!r.equalsIgnoreCase("") || !r.isEmpty()) { if (ExistProduct(r)) { Table_AddProductsServicio(t_productos, r); } } } } PdfPTable tabla_PRODUCTS = new PdfPTable(t_productos.getColumnCount()); tabla_PRODUCTS.setWidthPercentage(100); for (int i = 0; i < t_productos.getColumnCount(); i++) { Paragraph header = new Paragraph(t_productos.getColumnName(i)); header.setAlignment(1); tabla_PRODUCTS.addCell(header); } for (int i = 0; i < t_productos.getRowCount(); i++) { for (int a = 0; a < t_productos.getColumnCount(); a++) { Paragraph campo = new Paragraph(String.valueOf(t_productos.getValueAt(i, a))); campo.setAlignment(1); tabla_PRODUCTS.addCell(campo); } } documento.add(tabla_PRODUCTS); documento.add(new Paragraph("")); // documento.add(new Paragraph("COSTO TOTAL DE SERVICIO $ " + total)); documento.add( new Paragraph("FECHA Y HORA DE ENTREGA: ____________________________________________________")); documento.add( new Paragraph("NOMBRE Y FIRMA DEL QUE REALIZA: _____________________________________________")); documento.add( new Paragraph("CONFORMIDAD, NOMBRE Y FIRMA DE QUIEN RECIBE: _______________________________")); documento.add( new Paragraph("PROXIMO SERVICIO: ___________________________________________________________")); Paragraph footer = new Paragraph("SOFTWARE Y MAS ! - WWW.CYBERCHOAPAS.COM"); footer.setAlignment(1); documento.add(footer); documento.close(); Desktop.getDesktop().open(ruta); } catch (IOException | DocumentException ex) { Alert(ex.getMessage()); } catch (ClassNotFoundException | SQLException | InstantiationException | IllegalAccessException ex) { Alert(ex.getMessage()); } }
From source file:classes.PdfFiles.java
private static void createTable(Document document, java.util.List<Product> selling_list) { /*Create table*/ PdfPTable table = new PdfPTable(4); /*Create price*/ Double price = 0.0;//from w w w . j ava2 s.c o m /*Add cells*/ PdfPCell c1 = new PdfPCell(new Phrase("Nazwa")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Cena")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("VAT")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Ilosc")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); /*Add cells for each product*/ for (Product p : selling_list) { table.addCell(p.getName()); table.addCell(Double.toString(p.getRetail_price())); table.addCell(Double.toString(p.getVat())); table.addCell(Integer.toString(p.getQuantity())); } Function f = new Function(); /*Get price*/ price = f.getPriceFromProductList(selling_list); try { /*Add table*/ Paragraph p = new Paragraph(); p.add(table); addEmptyLine(p, 2); Paragraph p2 = new Paragraph(Double.toString(price) + " PLN"); p2.setAlignment(Element.ALIGN_RIGHT); p.add(p2); document.add(p); } catch (DocumentException ex) { JOptionPane.showMessageDialog(null, "Error genrating Invoice"); Logger.getLogger(PdfFiles.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:climbingcompranking.model.ranking.RankingGenerator.java
License:Open Source License
public void createRankingPDF(String competitionName, CompetitionType compType) { doTheRanking(compType);/*from w w w . ja v a 2s.c o m*/ try { Document document = new Document(PageSize.A4.rotate()); // Landscape Date date = new Date(); String dateStr = ""; if (Locale.getDefault().equals(Locale.FRANCE)) { dateStr = new SimpleDateFormat("dd-MM-yyyy").format(date); } else { dateStr = new SimpleDateFormat("yyyy-MM-dd").format(date); } PdfWriter.getInstance(document, new FileOutputStream("data/pdf/" + competitionName + '-' + dateStr + ".pdf")); document.open(); // Meta data document.addTitle(competitionName); document.addSubject(competitionName + " ranking."); document.addKeywords(competitionName + ", ranking, climbingcompetition, climbcompranking"); document.addAuthor("ClimbingCompRanking - https://github.com/Yaty/ClimbingCompRanking"); document.addCreator("ClimbingCompRanking - https://github.com/Yaty/ClimbingCompRanking"); document.addCreationDate(); document.setMargins(0, 0, 0, 0); PdfPCell club = new PdfPCell(new Phrase(I18n.MODEL.getString("Club"))); PdfPCell climberName = new PdfPCell(new Phrase(I18n.MODEL.getString("ClimberName"))); PdfPCell ranking = new PdfPCell(new Phrase(I18n.MODEL.getString("Ranking"))); for (Map.Entry<Category, ArrayList<Climber>> climbersCategory : climbersMap.entrySet()) { if (climbersCategory.getValue().isEmpty()) continue; document.newPage(); // Title Paragraph title = new Paragraph( competitionName + " : " + climbersCategory.getKey().getCategoryName()); title.setAlignment(Element.ALIGN_CENTER); title.setFont(new Font(Font.FontFamily.HELVETICA, 36)); title.setSpacingAfter(20); // Table PdfPTable table = null; switch (compType) { case BOULDERING: case LEAD: case SPEED: table = new PdfPTable(3); // Club | Full name | Ranking table.addCell(club); table.addCell(climberName); table.addCell(ranking); for (Climber climber : climbersCategory.getValue()) { table.addCell(new PdfPCell(new Phrase(climber.getClubName()))); table.addCell(new PdfPCell(new Phrase(climber.getFullName()))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getOverallRank())))); } break; case LEAD_AND_BOULDERING: table = new PdfPTable(6); // Club | Full name | Ranking table.addCell(club); table.addCell(climberName); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("LeadRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("BoulderingRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("Sum")))); table.addCell(ranking); for (Climber climber : climbersCategory.getValue()) { table.addCell(new PdfPCell(new Phrase(climber.getClubName()))); table.addCell(new PdfPCell(new Phrase(climber.getFullName()))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getLeadRank())))); table.addCell( new PdfPCell(new Phrase(String.valueOf(climber.getRank().getBoulderingRank())))); table.addCell(new PdfPCell( new Phrase(String.valueOf(climber.getRank().getTotalPoints(compType))))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getOverallRank())))); } break; case SPEED_AND_BOULDERING: table = new PdfPTable(6); // Club | Full name | Ranking table.addCell(club); table.addCell(climberName); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("SpeedRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("BoulderingRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("Sum")))); table.addCell(ranking); for (Climber climber : climbersCategory.getValue()) { table.addCell(new PdfPCell(new Phrase(climber.getClubName()))); table.addCell(new PdfPCell(new Phrase(climber.getFullName()))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getSpeedRank())))); table.addCell( new PdfPCell(new Phrase(String.valueOf(climber.getRank().getBoulderingRank())))); table.addCell(new PdfPCell( new Phrase(String.valueOf(climber.getRank().getTotalPoints(compType))))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getOverallRank())))); } break; case SPEED_AND_LEAD: table = new PdfPTable(6); // Club | Full name | Ranking table.addCell(club); table.addCell(climberName); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("SpeedRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("LeadRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("Sum")))); table.addCell(ranking); for (Climber climber : climbersCategory.getValue()) { table.addCell(new PdfPCell(new Phrase(climber.getClubName()))); table.addCell(new PdfPCell(new Phrase(climber.getFullName()))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getSpeedRank())))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getLeadRank())))); table.addCell(new PdfPCell( new Phrase(String.valueOf(climber.getRank().getTotalPoints(compType))))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getOverallRank())))); } break; case COMBINED: table = new PdfPTable(7); // Club | Full name | Ranking table.addCell(club); table.addCell(climberName); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("LeadRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("BoulderingRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("SpeedRanking")))); table.addCell(new PdfPCell(new Phrase(I18n.MODEL.getString("Sum")))); table.addCell(ranking); for (Climber climber : climbersCategory.getValue()) { table.addCell(new PdfPCell(new Phrase(climber.getClubName()))); table.addCell(new PdfPCell(new Phrase(climber.getFullName()))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getLeadRank())))); table.addCell( new PdfPCell(new Phrase(String.valueOf(climber.getRank().getBoulderingRank())))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getSpeedRank())))); table.addCell(new PdfPCell( new Phrase(String.valueOf(climber.getRank().getTotalPoints(compType))))); table.addCell(new PdfPCell(new Phrase(String.valueOf(climber.getRank().getOverallRank())))); } break; } // Alignment for (PdfPRow row : table.getRows()) { PdfPCell[] cells = row.getCells(); for (PdfPCell cellToAlign : cells) { cellToAlign.setHorizontalAlignment(Element.ALIGN_CENTER); cellToAlign.setVerticalAlignment(Element.ALIGN_CENTER); } } table.setHorizontalAlignment(Element.ALIGN_CENTER); table.setHeaderRows(1); document.add(title); document.add(table); } document.close(); } catch (DocumentException | FileNotFoundException ex) { Logger.getLogger(RankingGenerator.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:co.com.realtech.mariner.util.files.PDFUtils.java
public static File agregarTexto(byte[] bytes, String text) { File temp = null;/*from w w w . j a v a 2s .co m*/ try { temp = File.createTempFile("archivo", ".pdf"); OutputStream oos = new FileOutputStream(temp); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, oos); document.open(); PdfContentByte cb = writer.getDirectContent(); ByteArrayInputStream bis = new ByteArrayInputStream(bytes); //InputStream targetStream = new FileInputStream(initialFile); // Load existing PDF PdfReader reader = new PdfReader(bis); PdfImportedPage page = writer.getImportedPage(reader, 1); // Copy first page of existing PDF into output PDF document.setPageSize(reader.getPageSize(1)); document.newPage(); cb.addTemplate(page, 0, 0); ColumnText ct = new ColumnText(cb); Phrase myText = new Phrase(text); Font fuente = new Font(); fuente.setSize(6); myText.setFont(fuente); ct.setSimpleColumn(myText, 0, -1, document.right(), document.top(), -10, Element.ALIGN_RIGHT); ct.go(); ColumnText ct2 = new ColumnText(cb); Phrase myText2 = new Phrase(text); Font fuente2 = new Font(); fuente2.setSize(6); myText2.setFont(fuente); ct2.setSimpleColumn(myText, 0, -1, document.right(), document.top(), 248, Element.ALIGN_RIGHT); ct2.go(); ColumnText ct3 = new ColumnText(cb); Phrase myText3 = new Phrase(text); Font fuente3 = new Font(); fuente3.setSize(6); myText3.setFont(fuente); ct3.setSimpleColumn(myText, 0, -1, document.right(), document.top(), 505, Element.ALIGN_RIGHT); ct3.go(); document.close(); } catch (Exception e) { System.out.println("e = " + e); } return temp; }
From source file:com.afrisoftech.lib.HeaderFooterHelper.java
public void onEndPage(PdfWriter writer, Document document) { PdfContentByte cb = writer.getDirectContent(); // Phrase header = new Phrase("this is a header", ffont); // Phrase footer = new Phrase("this is a footer", ffont); ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, header, (document.right() - document.left()) / 2 + document.leftMargin(), document.top() + 10, 0); ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, new Phrase(footer.getContent() + " " + String.valueOf(writer.getPageNumber())), (document.right() - document.left()) / 2 + document.leftMargin(), document.bottom() - 10, 0); }
From source file:com.alnaser.view.GestionProduit.java
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("!!!!!!!"); try {/* w w w . jav a 2 s.c om*/ OutputStream file = new FileOutputStream(new File("D:\\Test.pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); // a table with three columns PdfPTable table = new PdfPTable(7); // the cell object PdfPCell cell, cel2, cel3, cel4, cel5, cel6, cel7; // we add a cell with colspan 3 cell = new PdfPCell(new Phrase("Code")); cel2 = new PdfPCell(new Phrase("Ref")); cel3 = new PdfPCell(new Phrase("Desg")); cel4 = new PdfPCell(new Phrase("Four")); cel5 = new PdfPCell(new Phrase("Remise")); cel6 = new PdfPCell(new Phrase("Prix")); cel7 = new PdfPCell(new Phrase("Stock")); table.addCell(cell); table.addCell(cel2); table.addCell(cel3); table.addCell(cel4); table.addCell(cel5); table.addCell(cel6); table.addCell(cel7); for (Produit p : list) { table.addCell(p.getCodeProduit()); table.addCell(p.getReference()); table.addCell(p.getDeseignation()); table.addCell(p.getFournisseur()); table.addCell(p.getRemise() + ""); table.addCell(p.getPrix() + ""); table.addCell(p.getStock() + ""); } document.add(table); document.add(new Paragraph(new Date().toString())); document.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.alokomkar.aliensonearth.report.AbstractPdfReport.java
/** * @param document// w ww .j av a 2 s . c o m * Virtual Function for adding Line Separator. */ protected void addLineSeperator(Document document) { LineSeparator ls = new LineSeparator(); try { document.add(new Chunk(ls)); document.add(new Phrase("\n")); } catch (DocumentException e) { e.printStackTrace(); } }
From source file:com.app.gpo.pdf.utils.PDForderLabelCard.java
License:Open Source License
@Override protected void buildPdfDocument(Map<String, Object> model, Document doc, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception { // get data model which is passed by the Spring container OrderItem orderItem = (OrderItem) model.get("orderItem"); Font font = FontFactory.getFont(FontFactory.HELVETICA, BaseFont.CP1250, BaseFont.EMBEDDED); font.setSize(20);/* w ww . j av a2 s . c o m*/ Font font2 = FontFactory.getFont(FontFactory.HELVETICA, BaseFont.CP1250, BaseFont.EMBEDDED); font2.setSize(12); String utf = orderItem.getorderItemName(); byte[] data = utf.getBytes("CP1250"); String ascii = new String(data); String code = orderItem.getorderNumber(); Paragraph numberText = new Paragraph(code, font); numberText.setAlignment(Element.ALIGN_CENTER); doc.add(new Phrase("\n")); Paragraph nameText = new Paragraph(ascii, font2); nameText.setAlignment(Element.ALIGN_CENTER); // document.newPage() /*BarcodeEAN barcode = new BarcodeEAN(); barcode.setCodeType(Barcode.CODE128); barcode.setCode(code); Rectangle barcodeRect = new Rectangle(400,200); barcode.placeBarcode(barcodeRect, BaseColor.BLACK, BaseColor.YELLOW); doc.add(barcode.createImageWithBarcode(writer.getDirectContent(), BaseColor.BLACK, BaseColor.GRAY));*/ doc.add(numberText); doc.add(new Phrase("\n")); doc.add(nameText); }
From source file:com.app.gpo.pdf.utils.PDForderLabelCards.java
License:Open Source License
@Override protected void buildPdfDocument(Map<String, Object> model, Document doc, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception { // get data model which is passed by the Spring container List<OrderItem> orderItemList = (List<OrderItem>) model.get("orderItemList"); Font font = FontFactory.getFont(FontFactory.HELVETICA, BaseFont.CP1250, BaseFont.EMBEDDED); font.setSize(18);// w w w. j a v a 2 s .co m Font font2 = FontFactory.getFont(FontFactory.HELVETICA, BaseFont.CP1250, BaseFont.EMBEDDED); font2.setSize(12); Iterator<OrderItem> it = orderItemList.iterator(); while (it.hasNext()) { OrderItem orderItem = it.next(); String utf = orderItem.getorderItemName(); byte[] data = utf.getBytes("CP1250"); String ascii = new String(data); String code = orderItem.getorderNumber(); Paragraph numberText = new Paragraph(code, font); numberText.setAlignment(Element.ALIGN_CENTER); doc.add(new Phrase("\n")); Paragraph nameText = new Paragraph(ascii, font2); nameText.setAlignment(Element.ALIGN_CENTER); // document.newPage() /*BarcodeEAN barcode = new BarcodeEAN(); barcode.setCodeType(Barcode.CODE128); barcode.setCode(code); Rectangle barcodeRect = new Rectangle(400,200); barcode.placeBarcode(barcodeRect, BaseColor.BLACK, BaseColor.YELLOW); doc.add(barcode.createImageWithBarcode(writer.getDirectContent(), BaseColor.BLACK, BaseColor.GRAY));*/ doc.add(numberText); doc.add(new Phrase("\n")); doc.add(nameText); doc.newPage(); } }
From source file:com.ashish.medicine.admin.invoice.InvoiceAction.java
public void addBlankLine(Document document) throws DocumentException, MalformedURLException, IOException { Phrase p = new Phrase("\n"); document.add(p);/* ww w . j av a 2s . c o m*/ }