List of usage examples for com.itextpdf.text Element ALIGN_RIGHT
int ALIGN_RIGHT
To view the source code for com.itextpdf.text Element ALIGN_RIGHT.
Click Source Link
From source file:nl.infosys.hartigehap.barSystem.domain.Bon.java
/** * create the table for the PDF/* w w w. j a v a 2s.com*/ * * @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 table() { Paragraph par = new Paragraph(); PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100);/* ww w.j a v a 2 s.c o m*/ 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:nwk.com.br.documents.OrcamentoPdf.java
private Paragraph numPed(Orcamento orcamento) throws Exception { //cria uma linha com o numero do pedido Paragraph cod = new Paragraph("Oramento: " + orcamento.getId(), f); cod.setAlignment(Element.ALIGN_RIGHT); return cod;/*from w w w.j a v a2s. c om*/ }
From source file:nwk.com.br.documents.OrcamentoPdf.java
private PdfPTable dadosPagamento(Orcamento orcamento) throws Exception { Font fontTotal = new Font(Font.FontFamily.TIMES_ROMAN, 16); PdfPTable dPagamento = new PdfPTable(new float[] { 0.5f, 0.2f, 0.3f }); dPagamento.setWidthPercentage(100.0f);//seta o tamanho da tabela em relaao ao documento dPagamento.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); dPagamento.getDefaultCell().setBorder(0); //celula com espao em branco e com o Total PdfPCell spc = new PdfPCell(new Paragraph(" ")); PdfPCell total = new PdfPCell(new Paragraph("TOTAL: R$" + orcamento.getTotal(), fontTotal)); //alinha a celula total a esquerda total.setHorizontalAlignment(Element.ALIGN_RIGHT); spc.setColspan(3);/*from ww w . j av a2s .c o m*/ total.setBorder(0); spc.setBorder(0); if (orcamento.getFormaPagamento().equals("0")) { dPagamento.addCell(new Paragraph("Forma de Pagamento: A vista - Dinheiro", f)); } else if (orcamento.getFormaPagamento().equals("1")) { dPagamento.addCell(new Paragraph("Forma de Pagamento: A vista - Carto", f)); } else if (orcamento.getFormaPagamento().equals("2")) { dPagamento.addCell(new Paragraph("Forma de Pagamento: Parcelado", f)); } dPagamento.addCell(new Paragraph("Desconto: R$" + orcamento.getDesconto(), f)); dPagamento.addCell(total); return dPagamento; }
From source file:nz.ac.waikato.cms.doc.SimplePDFOverlay.java
License:Open Source License
/** * Parses the alignment string./*ww w . j a v a 2s .c o m*/ * * @param str the alignment string * @return the alignment, see {@link Element} */ protected int parseAlignment(String str) { switch (str) { case "UNDEFINED": return Element.ALIGN_UNDEFINED; case "LEFT": return Element.ALIGN_LEFT; case "CENTER": return Element.ALIGN_CENTER; case "RIGHT": return Element.ALIGN_RIGHT; case "JUSTIFIED": return Element.ALIGN_JUSTIFIED; default: m_Logger.warning("Unhandled alignment, falling back to LEFT: " + str); return Element.ALIGN_LEFT; } }
From source file:om.edu.squ.squportal.portlet.tsurvey.dao.pdf.TeachingSurveyPdfImpl.java
License:Open Source License
/** * /* ww w.j a v a2 s . com*/ * method name : getPdfCell * @param content * @param rowSpan * @param colSpan * @return * TeachingSurveyPdfImpl * return type : PdfPCell * * purpose : * * Date : Feb 22, 2016 12:52:28 PM */ private PdfPCell getPdfCell(String content, int rowSpan, int colSpan, Font font, String txtAlign) { PdfPCell cell = new PdfPCell(new Phrase(content, font)); if (rowSpan == 0 && colSpan != 0) { cell.setColspan(colSpan); } if (rowSpan != 0 && colSpan == 0) { cell.setRowspan(rowSpan); } if (txtAlign.equals(Constants.CENTER)) cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (null == txtAlign || txtAlign.equals(Constants.LEFT)) cell.setHorizontalAlignment(Element.ALIGN_LEFT); if (txtAlign.equals(Constants.RIGHT)) cell.setHorizontalAlignment(Element.ALIGN_RIGHT); return cell; }
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);/*www . ja v a 2 s.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); 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 ww .j a 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); 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 {/* w ww . j a v a2 s . 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.dspace.disseminate.CitationDocument.java
/** * Takes a DSpace {@link Bitstream} and uses its associated METADATA to * create a cover page./*from www . j a va 2 s. c o m*/ * * @param cDoc The cover page document to add cited information to. * @param writer * @param cMeta * METADATA retrieved from the parent collection. * @throws IOException * @throws DocumentException */ private void generateCoverPage(Document cDoc, PdfWriter writer, CitationMeta cMeta) throws DocumentException { cDoc.open(); writer.setCompressionLevel(0); Item item = cMeta.getItem(); //Set up some fonts Font helv26 = FontFactory.getFont(FontFactory.HELVETICA, 26f, BaseColor.BLACK); Font helv16 = FontFactory.getFont(FontFactory.HELVETICA, 16f, BaseColor.BLACK); Font helv12 = FontFactory.getFont(FontFactory.HELVETICA, 12f, BaseColor.BLACK); Font helv12_italic = FontFactory.getFont(FontFactory.HELVETICA_OBLIQUE, 12f, BaseColor.BLACK); Font helv11_bold = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 11f, BaseColor.BLACK); Font helv9 = FontFactory.getFont(FontFactory.HELVETICA, 9f, BaseColor.BLACK); // 1 - Header: // University Name // Repository Name repository.url Paragraph university = new Paragraph("The Ohio State University", helv11_bold); cDoc.add(university); PdfPTable repositoryTable = new PdfPTable(2); repositoryTable.setWidthPercentage(100); Chunk repositoryName = new Chunk("Knowledge Bank", helv11_bold); PdfPCell nameCell = new PdfPCell(); nameCell.setBorderWidth(0); nameCell.addElement(repositoryName); Chunk repositoryURL = new Chunk("kb.osu.edu", helv11_bold); repositoryURL.setAnchor("http://kb.osu.edu"); PdfPCell urlCell = new PdfPCell(); urlCell.setHorizontalAlignment(Element.ALIGN_RIGHT); urlCell.setBorderWidth(0); urlCell.addElement(repositoryURL); repositoryTable.addCell(nameCell); repositoryTable.addCell(urlCell); repositoryTable.setSpacingAfter(5); cDoc.add(repositoryTable); // Line Separator LineSeparator lineSeparator = new LineSeparator(); cDoc.add(lineSeparator); // 2 - Bread Crumbs // Community Name Collection Name PdfPTable breadcrumbTable = new PdfPTable(2); breadcrumbTable.setWidthPercentage(100); Chunk communityName = new Chunk(getOwningCommunity(item), helv9); PdfPCell commCell = new PdfPCell(); commCell.setBorderWidth(0); commCell.addElement(communityName); Chunk collectionName = new Chunk(getOwningCollection(item), helv9); PdfPCell collCell = new PdfPCell(); collCell.setHorizontalAlignment(Element.ALIGN_RIGHT); collCell.setBorderWidth(0); collCell.addElement(collectionName); breadcrumbTable.addCell(commCell); breadcrumbTable.addCell(collCell); breadcrumbTable.setSpacingBefore(5); breadcrumbTable.setSpacingAfter(5); cDoc.add(breadcrumbTable); // Line Separator cDoc.add(lineSeparator); // 3 - Metadata // date.issued // dc.title // dc.creator; dc.creator Paragraph dateIssued = new Paragraph(getFirstMetadata(item, "dc.date.issued"), helv12); dateIssued.setSpacingBefore(20); cDoc.add(dateIssued); Paragraph title = new Paragraph(item.getName(), helv26); title.setSpacingBefore(15); cDoc.add(title); Paragraph creators = new Paragraph(getAllMetadataSeperated(item, "dc.creator"), helv16); creators.setSpacingBefore(30); creators.setSpacingAfter(20); cDoc.add(creators); // Line Separator cDoc.add(lineSeparator); // 4 - Citation // dc.identifier.citation // dc.identifier.uri Paragraph citation = new Paragraph(getFirstMetadata(item, "dc.identifier.citation"), helv12); Chunk identifierChunk = new Chunk(getFirstMetadata(item, "dc.identifier.uri"), helv12); identifierChunk.setAnchor(getFirstMetadata(item, "dc.identifier.uri")); Paragraph identifier = new Paragraph(); identifier.add(identifierChunk); cDoc.add(citation); cDoc.add(identifier); // 5 - License // Downloaded from the Knowledge Bank, The Ohio State University's institutional repository Paragraph license = new Paragraph( "Downloaded from the Knowledge Bank, The Ohio State University's institutional repository", helv12_italic); license.setSpacingBefore(10); cDoc.add(license); cDoc.close(); }