List of usage examples for com.itextpdf.text Chunk Chunk
public Chunk()
From source file:com.chaschev.itext.ChunkBuilder.java
License:Apache License
@Override public ChunkBuilder withNew() { element = new Chunk(); return this; }
From source file:com.masscustsoft.service.ToPdf.java
License:Open Source License
private Paragraph getParagraph(Map it) throws Exception { Paragraph p = new Paragraph(); String lb = MapUtil.getStr(it, "label", null); if (lb != null) { Chunk ch = new Chunk(); ch.setLocalDestination(lb);//from w w w.j av a 2 s . co m p.add(ch); } getChunks(p, it, null); List<Map> lst = (List) it.get("items"); if (lst != null) { for (Map item : lst) { Element el = getElement(item); if (el != null) p.add(el); } } applyFont(p, it); return p; }
From source file:com.skatettoo.reportes.Generador.java
private Object getHeader(String texto) { Paragraph p = new Paragraph(); Chunk c = new Chunk(); p.setAlignment(Element.ALIGN_CENTER); c.append(texto);//w ww .jav a 2 s.c o m p.add(c); return p; }
From source file:com.vectorprint.report.itext.DefaultElementProducer.java
License:Open Source License
/** * Create a piece of text (part of a Phrase), style it and ad the data. * * @param data// www. ja va 2 s . c om * @param stylers * @return * @throws VectorPrintException */ public Chunk createChunk(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { Chunk c = styleHelper.style(new Chunk(), data, stylers); if (data != null) { c.append(formatValue(data)); } if (notDelayedStyle(c, ADV + (++advancedTag), stylers) && debug) { c.setGenericTag(String.valueOf(++genericTag)); } return c; }
From source file:com.vectorprint.report.itext.EventHelper.java
License:Open Source License
/** * prints a footer table with a line at the top, a date and page numbering, second cell will be right aligned * * @see #PAGEFOOTERTABLEKEY/*from w w w . ja va 2s . c o m*/ * @see #PAGEFOOTERSTYLEKEY * * @param writer * @param document * @throws DocumentException * @throws VectorPrintException */ protected void renderFooter(PdfWriter writer, Document document) throws DocumentException, VectorPrintException, InstantiationException, IllegalAccessException { if (!debugHereAfter && !failuresHereAfter) { PdfPTable footerTable = elementProducer.createElement(null, PdfPTable.class, getStylers(PAGEFOOTERTABLEKEY)); footerTable.addCell(createFooterCell(ValueHelper.createDate(new Date()))); String pageText = writer.getPageNumber() + getSettings().getProperty(" of ", UPTO); PdfPCell c = createFooterCell(pageText); c.setHorizontalAlignment(Element.ALIGN_RIGHT); footerTable.addCell(c); footerTable.addCell(createFooterCell(new Chunk())); footerTable.writeSelectedRows(0, -1, document.getPageSize().getLeft() + document.leftMargin(), document.getPageSize().getBottom(document.bottomMargin()), writer.getDirectContentUnder()); footerBottom = document.bottom() - footerTable.getTotalHeight(); } }
From source file:controlador.generadorticket.GenerarpdfticketVE.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods./*ww w.j a v a 2s . c o m*/ * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); request.setCharacterEncoding("UTF-8");// Forzar a usar codificacin UTF-8 iso-8859-1 String Encabezado = (request.getParameter("encabezado")); String Encabezado1 = (request.getParameter("encabezado1")); String Encabezado2 = (request.getParameter("encabezado2")); String total = (request.getParameter("total")); String Tipo[] = request.getParameterValues("tipo"); String Costo[] = request.getParameterValues("costo"); String Observacion[] = request.getParameterValues("observacion"); String Fecha = (request.getParameter("Fecha")); String Municipio = (request.getParameter("Municipio")); String Cliente = (request.getParameter("Cliente")); String Estado = (request.getParameter("Estado")); String Direccion = (request.getParameter("Direccion")); String Localidad = (request.getParameter("Localidad")); String Venta = (request.getParameter("Id_venta")); Font fuente = new Font(Font.FontFamily.COURIER, 10); Paragraph P = new Paragraph(); Chunk c = new Chunk(); P.setAlignment(Element.ALIGN_CENTER); try { FileOutputStream Archivo = new FileOutputStream("/home/rcortes/Ejemplo.pdf"); Document doc = new Document(); PdfWriter.getInstance(doc, Archivo); doc.open(); doc.add(new Paragraph(Encabezado)); doc.add(new Paragraph(Encabezado1)); doc.add(new Paragraph(Encabezado2)); PdfPTable tabla1 = new PdfPTable(3); doc.add(new Paragraph(" ")); doc.add(new Paragraph("Venta: " + Venta)); doc.add(new Paragraph("Cliente: " + Cliente)); doc.add(new Paragraph("Estado: " + Estado)); doc.add(new Paragraph("Municipio: " + Municipio)); doc.add(new Paragraph("Localidad: " + Localidad)); doc.add(new Paragraph("Direccin: " + Direccion)); doc.add(new Paragraph(" ")); tabla1.addCell("Tipo"); tabla1.addCell("Monto"); tabla1.addCell("Observacin"); for (int i = 0; i < Tipo.length; i++) { tabla1.addCell(Tipo[i]); tabla1.addCell(Costo[i]); tabla1.addCell(Observacion[i]); } doc.add(tabla1); doc.add(new Paragraph(" ")); doc.add(new Paragraph("Total: " + total)); doc.close(); System.out.println("Se creo pdf\n"); } catch (DocumentException e) { System.out.println(e); } }
From source file:facturacion.pdf.FacturaPdf.java
@SuppressWarnings("unused") private Paragraph getHeader(String header) { Paragraph paragraph = new Paragraph(); Chunk chunk = new Chunk(); paragraph.setAlignment(Element.ALIGN_CENTER); chunk.append(header + getCurrentDateTime() + "\n"); chunk.setFont(fontBold);/*ww w . j a v a2 s . c o m*/ paragraph.add(chunk); return paragraph; }
From source file:facturacion.pdf.FacturaPdf.java
private Paragraph getInformation(String informacion) { Paragraph paragraph = new Paragraph(); Chunk chunk = new Chunk(); paragraph.setAlignment(Element.ALIGN_CENTER); chunk.append(informacion);// w w w . j ava2 s . c o m chunk.setFont(fontNormal); paragraph.add(chunk); return paragraph; }
From source file:facturacion.pdf.FacturaPdf.java
@SuppressWarnings("unused") private Paragraph getInformationFooter(String informacion) { Paragraph paragraph = new Paragraph(); Chunk chunk = new Chunk(); paragraph.setAlignment(Element.ALIGN_CENTER); chunk.append(informacion);/*from w ww.j a va 2 s . c o m*/ chunk.setFont(new Font(Font.FontFamily.COURIER, 8, Font.NORMAL)); paragraph.add(chunk); return paragraph; }
From source file:facturacion.pdf.FacturaPdf.java
private PdfPCell getCellBorderTop(String text) throws DocumentException, IOException { Chunk chunk = new Chunk(); chunk.append(text);/* w w w . ja v a2 s .co m*/ chunk.setFont(fontNormal); PdfPCell cell = new PdfPCell(new Paragraph(chunk)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(Rectangle.TOP); return cell; }