List of usage examples for com.itextpdf.layout.property HorizontalAlignment RIGHT
HorizontalAlignment RIGHT
To view the source code for com.itextpdf.layout.property HorizontalAlignment RIGHT.
Click Source Link
From source file:com.asptt.plongee.resa.util.UtilsFSpdf.java
private Table createEntete(FicheSecurite fs, int numeroPage, int nbPage) throws java.io.IOException { float[] columnWidths = { 20, 27, 23, 23, 6 }; // table : premiere table pour les parametres de la plonge Table table = new Table(columnWidths); table.setMargins(0, 0, 0, 0);//from w w w. j a v a 2 s.c o m table.setWidthPercent(100); // entete style pour les entetes Style entete = new Style(); PdfFont fontEntete = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN); entete.setFont(fontEntete).setFontSize(12); entete.setFontColor(Color.BLACK); // style pour les libells Style libelle = new Style(); PdfFont fontLibelle = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN); libelle.setFont(fontLibelle).setFontSize(12); libelle.setFontColor(Color.RED); Paragraph entete1 = new Paragraph(); entete1.add(new Text("DATE\n").addStyle(entete)); entete1.add(new Text("DIRECTEUR DE PLONGEE\n").addStyle(entete)); entete1.add(new Text("PILOTE DU BATEAU\n").addStyle(entete)); entete1.add(new Text("LIEU DE PLONGEE\n").addStyle(entete)); entete1.add(new Text("METEO\n").addStyle(entete)); Paragraph libelle1 = new Paragraph(); libelle1.add(new Text(": " + ResaUtil.getDateString(fs.getDatePlongee()) + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getNomDP() + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getNomPilote() + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getSite() + "\n").addStyle(libelle)); libelle1.add(new Text(": " + fs.getMeteo() + "\n").addStyle(libelle)); Cell cellEntete1 = new Cell(); cellEntete1.add(entete1); cellEntete1.setBorderRight(Border.NO_BORDER); cellEntete1.setHorizontalAlignment(HorizontalAlignment.LEFT); table.addCell(cellEntete1); Cell cellLibelle1 = new Cell(); cellLibelle1.add(libelle1); cellLibelle1.setBorderLeft(Border.NO_BORDER); cellLibelle1.setTextAlignment(TextAlignment.LEFT); table.addCell(cellLibelle1); Paragraph titre = new Paragraph(); titre.add(new Text("ASPTT MARSEILLE\n").addStyle(entete)); titre.add(new Text("PLONGEE\n").addStyle(entete)); titre.add(new Text("---\n").addStyle(entete)); titre.add(new Text("Fiche de Scurit\n").addStyle(entete)); Cell cellTitre = new Cell(); cellTitre.add(titre); cellTitre.setTextAlignment(TextAlignment.CENTER); cellTitre.setVerticalAlignment(VerticalAlignment.MIDDLE); table.addCell(cellTitre); Paragraph entete2 = new Paragraph(); entete2.add(new Text("PLONGEE NUMERO\n").addStyle(entete)); entete2.add(new Text("NOMBRE DE PLONGEURS\n").addStyle(entete)); entete2.add(new Text("HEURE DE DEPART\n").addStyle(entete)); entete2.add(new Text("HEURES BATEAU\n").addStyle(entete)); entete2.add(new Text("Page \n").addStyle(entete)); Paragraph libelle2 = new Paragraph(); libelle2.add(new Text(": " + fs.getNumeroPlongee() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + fs.getNbPlongeurs() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + fs.getHhDepart() + ":" + fs.getMnDepart() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + fs.getNbHeuresBateau() + "\n").addStyle(libelle)); libelle2.add(new Text(": " + numeroPage + " / " + nbPage + "\n").addStyle(libelle)); Cell cellEntete2 = new Cell(); cellEntete2.add(entete2); cellEntete2.setBorderRight(Border.NO_BORDER); cellEntete2.setHorizontalAlignment(HorizontalAlignment.RIGHT); table.addCell(cellEntete2); Cell cellLibelle2 = new Cell(); cellLibelle2.add(libelle2); cellLibelle2.setBorderLeft(Border.NO_BORDER); cellLibelle2.setTextAlignment(TextAlignment.LEFT); table.addCell(cellLibelle2); return table; }
From source file:output.InvoicePDF.java
private Table quoteSection() throws IOException { Table table = new Table(new float[] { 2, 1, 1, 1, 5 }); table.setWidthPercent(100f);/*from ww w. jav a 2 s . c om*/ Cell cell; cell = new Cell(); cell.add("Category"); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); cell.setTextAlignment(TextAlignment.CENTER); table.addCell(cell); cell = new Cell(); cell.add("Rate"); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); cell.setTextAlignment(TextAlignment.CENTER); table.addCell(cell); cell = new Cell(); cell.add("per"); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); cell.setTextAlignment(TextAlignment.CENTER); table.addCell(cell); cell = new Cell(); cell.add("Rate Unit"); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); cell.setTextAlignment(TextAlignment.CENTER); table.addCell(cell); cell = new Cell(); cell.add("Short Description"); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); cell.setTextAlignment(TextAlignment.CENTER); table.addCell(cell); List<Double> totals = new ArrayList<>(); // Loop through table here ObservableList<InvoiceItems> invoiceItems = this.invoiceTableView.getItems(); invoiceItems.forEach((item) -> { table.addCell(new Cell().add(new Paragraph(item.getCategory()))); table.addCell(new Cell().add(new Paragraph(item.getCost()))); table.addCell(new Cell().add(new Paragraph(item.getCostUnit()))); table.addCell(new Cell().add(new Paragraph(item.getCostUnitTotal()))); table.addCell(new Cell().add(new Paragraph(item.getShortDescription()))); totals.add(Double.parseDouble(item.getCost()) * Double.parseDouble(item.getCostUnitTotal())); }); Double total = 0.0; total = totals.stream().map((d) -> d).reduce(total, (accumulator, _item) -> accumulator + _item); cell = new Cell(1, 1); cell.add("Total"); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); table.addCell(cell); cell = new Cell(1, 4); cell.add(String.valueOf(total)); cell.setFont(PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD)); cell.setHorizontalAlignment(HorizontalAlignment.RIGHT); table.addCell(cell); return table; }
From source file:wbs.jsf1.pdf.LottoReceiptBean.java
private Table getLosnummerTable(PdfFont font, PdfFont bold) { Table table = new Table(new float[] { 1, 1, 1 }) { };/* w w w . j a v a 2 s . c o m*/ table.setWidthPercent(100); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add(new Paragraph("Superzahl").setFont(font)).setBorder(Border.NO_BORDER) .setWidthPercent(55)); table.addCell( new Cell().add(new Paragraph("").setFont(font)).setBorder(Border.NO_BORDER).setWordSpacing(35)); String superzahl = String.valueOf(lottoscheinForPdfGenerierung.getLosnummer()); table.addCell(new Cell().add(new Paragraph(superzahl.substring(superzahl.length() - 1)).setFont(font)) .setBorder(Border.NO_BORDER).setWordSpacing(10).setHorizontalAlignment(HorizontalAlignment.RIGHT)); table.addCell(new Cell().add(new Paragraph("Losnummer").setFont(font)).setBorder(Border.NO_BORDER) .setWidthPercent(55)); table.addCell(new Cell().add(new Paragraph("Super6").setFont(font)).setBorder(Border.NO_BORDER) .setWordSpacing(35)); table.addCell( new Cell().add(new Paragraph(isGame(lottoscheinForPdfGenerierung.getIsSuper6())).setFont(font)) .setBorder(Border.NO_BORDER).setWordSpacing(10)); table.addCell(new Cell() .add(new Paragraph(String.valueOf(lottoscheinForPdfGenerierung.getLosnummer())).setFont(font)) .setBorder(Border.NO_BORDER).setWidthPercent(55)); table.addCell(new Cell().add(new Paragraph("Spiel77").setFont(font)).setBorder(Border.NO_BORDER) .setWordSpacing(35)); table.addCell( new Cell().add(new Paragraph(isGame(lottoscheinForPdfGenerierung.getIsSpiel77())).setFont(font)) .setBorder(Border.NO_BORDER).setWordSpacing(10)); return table; }
From source file:wbs.jsf1.pdf.LottoReceiptBean.java
private Table getBetragTable(PdfFont font, PdfFont bold) { Table table = new Table(new float[] { 1, 1 }) { };/* ww w . j ava 2 s. c om*/ table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("Betrag: ").setBorder(Border.NO_BORDER).setWidthPercent(80)); String formatedBetrag = FormatUtil.formatBetrag(lottoscheinForPdfGenerierung.getKosten(), FormatUtil.Formats.FORMAT_BETRAG, FormatUtil.Formats.PATTERN_BETRAG); table.addCell(new Cell().add("" + formatedBetrag).setBorder(Border.NO_BORDER).setWidthPercent(20) .setHorizontalAlignment(HorizontalAlignment.RIGHT)); return table; }
From source file:wbs.jsf1.pdf.LottoReceiptBean0.java
private Table getLosnummerTable(PdfFont font, PdfFont bold) { Table table = new Table(new float[] { 1, 1, 1 }) { };// w ww . ja v a2 s . com table.setWidthPercent(100); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add(new Paragraph("Superzahl").setFont(font)).setBorder(Border.NO_BORDER) .setWidthPercent(55)); table.addCell( new Cell().add(new Paragraph("").setFont(font)).setBorder(Border.NO_BORDER).setWordSpacing(35)); String superzahl = String.valueOf(zahlen.getLosnummer()); table.addCell(new Cell().add(new Paragraph(superzahl.substring(superzahl.length() - 1)).setFont(font)) .setBorder(Border.NO_BORDER).setWordSpacing(10).setHorizontalAlignment(HorizontalAlignment.RIGHT)); table.addCell(new Cell().add(new Paragraph("Losnummer").setFont(font)).setBorder(Border.NO_BORDER) .setWidthPercent(55)); table.addCell(new Cell().add(new Paragraph("Super6").setFont(font)).setBorder(Border.NO_BORDER) .setWordSpacing(35)); table.addCell(new Cell().add(new Paragraph(isGame(zahlen.getIsSuper6())).setFont(font)) .setBorder(Border.NO_BORDER).setWordSpacing(10)); table.addCell(new Cell().add(new Paragraph(String.valueOf(zahlen.getLosnummer())).setFont(font)) .setBorder(Border.NO_BORDER).setWidthPercent(55)); table.addCell(new Cell().add(new Paragraph("Spiel77").setFont(font)).setBorder(Border.NO_BORDER) .setWordSpacing(35)); table.addCell(new Cell().add(new Paragraph(isGame(zahlen.getIsSpiel77())).setFont(font)) .setBorder(Border.NO_BORDER).setWordSpacing(10)); return table; }
From source file:wbs.jsf1.pdf.LottoReceiptBean0.java
private Table getBetragTable(PdfFont font, PdfFont bold) { Table table = new Table(new float[] { 1, 1 }) { };//from www .j a v a2 s . c o m table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("").setBorder(Border.NO_BORDER)); table.addCell(new Cell().add("Betrag: ").setBorder(Border.NO_BORDER).setWidthPercent(80)); table.addCell(new Cell().add(zahlen.getKosten().toString() + " ").setBorder(Border.NO_BORDER) .setWidthPercent(20).setHorizontalAlignment(HorizontalAlignment.RIGHT)); return table; }