List of usage examples for com.itextpdf.text Element ALIGN_CENTER
int ALIGN_CENTER
To view the source code for com.itextpdf.text Element ALIGN_CENTER.
Click Source Link
From source file:com.softwaremagico.tm.pdf.complete.elements.CustomPdfTable.java
License:Open Source License
protected static PdfPCell createEmptyElementLine(int fontSize) { return createBasicElementLine("", fontSize, Element.ALIGN_CENTER); }
From source file:com.softwaremagico.tm.pdf.complete.elements.CustomPdfTable.java
License:Open Source License
protected PdfPCell createRectangle(String value) { if (value == null) { return createRectangle(); }/*from ww w.j ava2 s. co m*/ PdfPCell box = new PdfPCell(new Paragraph(value, new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.HANDWRITTING_DEFAULT_FONT_SIZE))); box.setVerticalAlignment(Element.ALIGN_MIDDLE); box.setHorizontalAlignment(Element.ALIGN_CENTER); box.setMinimumHeight(15); box.setBorder(0); box.setCellEvent( new CellCompleteBoxEvent(new Border[] { Border.TOP, Border.BOTTOM, Border.LEFT, Border.RIGHT })); return box; }
From source file:com.softwaremagico.tm.pdf.complete.elements.LateralHeaderPdfPTable.java
License:Open Source License
protected PdfPCell createLateralVerticalTitle(String title, int rowspan) { Font font = new Font(FadingSunsTheme.getTitleFont(), getTitleFontSize()); font.setColor(BaseColor.WHITE);/*from ww w .j av a2 s.com*/ Phrase content = new Phrase(title, font); PdfPCell titleCell = new PdfPCell(content); titleCell.setPadding(0); titleCell.setRowspan(rowspan); titleCell.setRotation(90); titleCell.setHorizontalAlignment(Element.ALIGN_CENTER); // titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); titleCell.setBackgroundColor(BaseColor.BLACK); return titleCell; }
From source file:com.softwaremagico.tm.pdf.complete.elements.LateralHeaderPdfPTable.java
License:Open Source License
protected static PdfPCell createTableSubtitleElement(String text, int height) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, BaseColor.WHITE, FadingSunsTheme.getSubtitleFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE); cell.setMinimumHeight(height);// ww w. j a va 2 s . com cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.elements.VerticalTable.java
License:Open Source License
protected static PdfPCell createSubtitleLine(String text, int fontSize) { return createSubtitleLine(text, fontSize, Element.ALIGN_CENTER); }
From source file:com.softwaremagico.tm.pdf.complete.elements.VerticalTable.java
License:Open Source License
protected static PdfPCell createValueLine(String text, int fontSize) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, BaseColor.WHITE, FadingSunsTheme.getHandwrittingFont(), fontSize); cell.setMinimumHeight(10);//w w w . ja v a2 s . co m cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.events.FooterEvent.java
License:Open Source License
/** * Adds a footer to every page// w w w . j a v a 2 s . c om * * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(com.itextpdf.text.pdf.PdfWriter, * com.itextpdf.text.Document) */ @Override public void onEndPage(PdfWriter writer, Document document) { if (writer.getPageNumber() % 2 == 0) { PdfContentByte cb = writer.getDirectContent(); Phrase footer = new Phrase( "Created using 'Think Machine'" + (Version.getVersion() != null ? " v" + Version.getVersion() : ""), new Font(FadingSunsTheme.getFooterFont(), FadingSunsTheme.FOOTER_FONT_SIZE)); ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, footer, (document.right() - document.left()) / 2 + document.leftMargin(), document.bottom() + 20, 0); } }
From source file:com.softwaremagico.tm.pdf.complete.events.PartyFooterEvent.java
License:Open Source License
/** * Adds a footer to every page// ww w .j ava2 s .c o m * * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(com.itextpdf.text.pdf.PdfWriter, * com.itextpdf.text.Document) */ @Override public void onEndPage(PdfWriter writer, Document document) { PdfContentByte cb = writer.getDirectContent(); Phrase footer = new Phrase( party.getPartyName() + " - Created using 'Think Machine'" + (Version.getVersion() != null ? " v" + Version.getVersion() : ""), new Font(FadingSunsTheme.getFooterFont(), FadingSunsTheme.FOOTER_FONT_SIZE)); ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, footer, (document.right() - document.left()) / 2 + document.leftMargin(), document.bottom() + bottomMargin, 0); }
From source file:com.softwaremagico.tm.pdf.complete.skills.CounterTable.java
License:Open Source License
protected PdfPCell createValue(String text, Font font, int alignment) { Phrase content = new Phrase(text, font); PdfPCell circleCell = new PdfPCell(content); // Not putting correctly the "o" at the center of the cell. // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment circleCell.setPaddingTop(-4f);//from w ww .j a v a 2 s .c o m circleCell.setHorizontalAlignment(Element.ALIGN_CENTER); circleCell.setVerticalAlignment(alignment); circleCell.setBorder(0); // Some position corrections. circleCell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / CIRCLES) + 1.3f); return circleCell; }
From source file:com.softwaremagico.tm.pdf.complete.skills.SkillsTable.java
License:Open Source License
protected static PdfPCell createCompactTitle(String text, int fontSize) { PdfPCell cell = getCell(text, 0, 2, Element.ALIGN_CENTER, BaseColor.WHITE, FadingSunsTheme.getTitleFont(), fontSize);// ww w . j a v a2s. c o m cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell; }