List of usage examples for com.lowagie.text.pdf PdfContentByte beginText
public void beginText()
From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java
License:Open Source License
/** * Adds the Volunteer's name to the Badge. * * @param content to be added//ww w . ja v a 2 s. c om * @param name concatenated String of forename and surname */ private static void addVolunteerName(PdfContentByte content, String name) throws DocumentException, IOException { content.beginText(); content.moveText(183, 470); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1257, false); content.setFontAndSize(bf, 16); content.setColorFill(Color.BLACK); content.showText(name); content.endText(); }
From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java
License:Open Source License
/** * Adds the RBC Region's title (e.g. London and the Home Counties) to the * bottom of the badge./* w w w. j a v a2 s . com*/ * * @param content to be added * @param rbcRegion RBC region */ private static void addRBCRegionFooter(PdfContentByte content) throws DocumentException, IOException { content.beginText(); content.moveText(183, 345); BaseFont bf = BaseFont.createFont(); content.setFontAndSize(bf, 9); content.setColorFill(Color.DARK_GRAY); content.showText(VolunteerBadgePdfView.BADGE_RBC_REGION); content.endText(); }
From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java
License:Open Source License
/** * Adds a department to the Badge. The badge only shows the first * departmental assignment of a Volunteer, not all their departmental * assignments./*from ww w .j a v a 2s.c o m*/ * * @param content to be added * @param department of the volunteer */ private static void addDepartment(PdfContentByte content, String department) throws DocumentException, IOException { content.beginText(); content.moveText(183, 453); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1257, false); content.setFontAndSize(bf, 14); content.showText(department); content.endText(); }
From source file:wikitopdf.pdf.PdfTitleWrapper.java
License:Open Source License
public final void addPrologue() throws DocumentException { PdfContentByte cb = pdfWriter.getDirectContent(); BaseFont times = null;/* w w w . jav a2s. c o m*/ try { wikiFontSelector.getTitleFontSelector().process(""); times = wikiFontSelector.getCommonFont().getBaseFont(); } catch (Exception ex) { ex.printStackTrace(); } cb.beginText(); cb.setFontAndSize(times, 32); cb.setTextMatrix(pdfDocument.right() - 130, 500); cb.showText("Wikipedia"); cb.endText(); cb.beginText(); cb.setFontAndSize(times, 8); cb.setTextMatrix(pdfDocument.right() - 50, 490); cb.showText("table of contents"); cb.endText(); String copyrightText = "Copyright (c) 2013 WIKIMEDIA FOUNDATION. \r\n" + "Permission is granted to copy, distribute and/or modify this document under the \r\n" + "terms of the GNU Free Documentation License, Version 1.2 or any later version \r\n" + "published by the Free Software Foundation; with no Invariant Sections, no \r\n" + "Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included \r\n" + "in the section entitled \"GNU Free Documentation License\"."; cb.beginText(); cb.setFontAndSize(times, 8); String[] textArr = copyrightText.split("\r\n"); for (int i = 0; i < textArr.length; i++) { cb.setTextMatrix(pdfDocument.left() - 10, 100 - (i * 10)); cb.showText(textArr[i]); } cb.endText(); pdfDocument.newPage(); cb.beginText(); cb.setFontAndSize(times, 8); cb.setTextMatrix(pdfDocument.left() - 19, 100); cb.showText(""); cb.endText(); }