List of usage examples for com.itextpdf.text.pdf BaseFont EMBEDDED
boolean EMBEDDED
To view the source code for com.itextpdf.text.pdf BaseFont EMBEDDED.
Click Source Link
From source file:bouttime.report.bracketsheet.CommonBracketSheet.java
License:Open Source License
public Boolean doPage(PdfContentByte cb, Dao dao, Group g, boolean doBoutNumbers) { if (!dao.isOpen()) { return false; }/*from w w w . j a v a 2s . co m*/ try { BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); drawBracket(cb, bf, dao, g, doBoutNumbers); } catch (DocumentException de) { logger.error("Document Exception", de); return false; } catch (IOException ioe) { logger.error("IO Exception", ioe); return false; } return true; }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetReport.java
License:Open Source License
public static Boolean doBlankPage(FileOutputStream fos, Dao dao, Integer numWrestlers) { if (!dao.isOpen()) { return false; }/*from w w w . j a v a 2s.c o m*/ // step 1: creation of a document-object Document document = new Document(); try { // step 2: creation of the writer if (fos == null) { return false; } PdfWriter writer = PdfWriter.getInstance(document, fos); // step 3: we open the document document.open(); // step 4: we grab the ContentByte and do some stuff with it PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); drawBracket(cb, bf, dao, null, numWrestlers); } catch (DocumentException de) { logger.error("Document Exception", de); return false; } catch (IOException ioe) { logger.error("IO Exception", ioe); return false; } // step 5: we close the document document.close(); return true; }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetReport.java
License:Open Source License
public static Boolean doPage(PdfContentByte cb, Dao dao, Group g) { if (!dao.isOpen()) { return false; }// w w w . j a v a 2 s .c o m try { BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); drawBracket(cb, bf, dao, g, 0); } catch (DocumentException de) { logger.error("Document Exception", de); return false; } catch (IOException ioe) { logger.error("IO Exception", ioe); return false; } return true; }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetUtil.java
License:Open Source License
public static void drawBoutHeader(PdfContentByte cb, BaseFont bf, float x, float y) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }//w w w. j a v a 2 s . c o m float width = boutRectWidth; float fontSize = 8; x += (width / 2); BracketSheetUtil.drawStringCentered(cb, bf, x, y, fontSize, "Round", 0); x += width; BracketSheetUtil.drawStringCentered(cb, bf, x, y, fontSize, "Bout", 0); x += boutLineLength + width; BracketSheetUtil.drawStringCentered(cb, bf, x, y, fontSize, "Winner", 0); x += boutLineLength + spaceForVS + boutRectWidth + (padForVS * 2); BracketSheetUtil.drawStringCentered(cb, bf, x, y, fontSize, "Winner", 0); }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetUtil.java
License:Open Source License
public static void drawBout(PdfContentByte cb, BaseFont bf, float x, float y, String red, boolean strikeRed, String green, boolean strikeGreen, String boutNum, String round, int winner) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }/*from w ww. java 2 s .c om*/ float width = boutRectWidth; float height = boutRectHeight; float length = boutLineLength; float fontSize = 12; float pad = padForVS; float linePad = 2; BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (boutRectHeight / 4), fontSize, round, 0); x += width; BracketSheetUtil.drawRectangle(cb, x, y, width, height, 1, 0); BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (boutRectHeight / 4), fontSize, boutNum, 0); x += width; BracketSheetUtil.drawHorizontalLine(cb, x, y, length, 1, 0); if (red != null) { BracketSheetUtil.drawString(cb, bf, x + boxPad, y + linePad, fontSize, red, strikeRed); } x += length; BracketSheetUtil.drawRectangle(cb, x, y, width, height, 1, 0); if (winner == 1) { BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (height / 4), fontSize, "X", 0); } x += width + pad; BracketSheetUtil.drawString(cb, bf, x, y + linePad, fontSize, "vs"); x += pad + spaceForVS; BracketSheetUtil.drawHorizontalLine(cb, x, y, length, 1, 0); if (green != null) { BracketSheetUtil.drawString(cb, bf, x + boxPad, y + linePad, fontSize, green, strikeGreen); } x += length; BracketSheetUtil.drawRectangle(cb, x, y, width, height, 1, 0); if (winner == 2) { BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (height / 4), fontSize, "X", 0); } }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetUtil.java
License:Open Source License
public static void drawWrestlerNameHeader(PdfContentByte cb, BaseFont bf, float x, float y, float width) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }// www . j av a2 s. co m float fontSize = 8; float mid; mid = x + (width / 2); BracketSheetUtil.drawStringCentered(cb, bf, mid, y, fontSize, "Wins", 0); mid += width; BracketSheetUtil.drawStringCentered(cb, bf, mid, y, fontSize, "Losses", 0); mid += width; BracketSheetUtil.drawStringCentered(cb, bf, mid, y, fontSize, "Place", 0); }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetUtil.java
License:Open Source License
public static void drawWrestlerNameLine(PdfContentByte cb, BaseFont bf, float x, float y, float length, int tablePad, float width, float height, int wins, int losses, Integer place) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }//from ww w .ja va2 s . c o m BracketSheetUtil.drawHorizontalLine(cb, x, y, length, 1, 0); x = x + length + tablePad; BracketSheetUtil.drawRectangle(cb, x, y, width, height, 1, 0); // wins if (wins >= 0) { BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (height / 4), 12, Integer.toString(wins), 0); } x += width; BracketSheetUtil.drawRectangle(cb, x, y, width, height, 1, 0); // losses if (losses >= 0) { BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (height / 4), 12, Integer.toString(losses), 0); } x += width; BracketSheetUtil.drawRectangle(cb, x, y, width, height, 1, 0); // place if (place != null) { BracketSheetUtil.drawStringCentered(cb, bf, x + (width / 2), y + (height / 4), 12, place.toString(), 0); } }
From source file:bouttime.report.bracketsheet.RoundRobinBracketSheetUtil.java
License:Open Source License
public static void drawTitle(PdfContentByte cb, BaseFont bf, float mid, float y, Group group, float rotation) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }//www .j a v a 2 s . c om if (group == null) { return; } String classification = group.getClassification(); if (classification == null) { classification = ""; } String div = group.getAgeDivision(); if (div == null) { div = ""; } String weightClass = group.getWeightClass(); if (weightClass == null) { weightClass = ""; } String title = String.format("%s %s %s", classification, div, weightClass); title.trim(); BracketSheetUtil.drawStringCentered(cb, bf, mid, y, 18, title, rotation); }
From source file:bouttime.utility.boutsheet.BoutSheetMaker.java
License:Open Source License
/** * @param args the command line arguments *//*w w w . j a va 2s . com*/ public static void main(String[] args) { // step 1: creation of a document-object // rotate to make page landscape Document document = new Document(PageSize.A4.rotate()); try { // step 2: creation of the writer PdfWriter writer; if (args.length >= 1) { writer = PdfWriter.getInstance(document, new FileOutputStream(args[0])); } else { System.err.println("ERROR : Must specify output file."); return; } // step 3: we open the document document.open(); // step 4: we grab the ContentByte and do some stuff with it PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); float pageWidth = cb.getPdfDocument().getPageSize().getWidth(); float midPage = pageWidth / 2; drawBout(cb, bf, 35, midPage - 35); drawBout(cb, bf, midPage + 35, pageWidth - 35); } catch (DocumentException de) { System.err.println(de.getMessage()); return; } catch (IOException ioe) { System.err.println(ioe.getMessage()); return; } // step 5: we close the document document.close(); if ((args.length == 3) && (Boolean.parseBoolean(args[2]))) { showPDF(args[0]); } }
From source file:bouttime.utility.bracketsheet.Bracket16Maker.java
License:Open Source License
/** * @param args the command line arguments * arg0 String filename for output file//from w w w.j a v a 2 s . co m * arg1 boolean value "true" will render/show PDF file in viewer, default is false * * For example : * Bracket2Maker /tmp/test.pdf true */ public static void main(String[] args) { // step 1: creation of a document-object Document document = new Document(); try { // step 2: creation of the writer PdfWriter writer; if (args.length >= 1) { writer = PdfWriter.getInstance(document, new FileOutputStream(args[0])); } else { System.err.println("ERROR : Must specify output file."); return; } // step 3: we open the document document.open(); // step 4: we grab the ContentByte and do some stuff with it PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); drawBracket(cb, bf); } catch (DocumentException de) { System.err.println(de.getMessage()); return; } catch (IOException ioe) { System.err.println(ioe.getMessage()); return; } // step 5: we close the document document.close(); if ((args.length == 2) && (Boolean.parseBoolean(args[1]))) { RoundRobinBracketMaker.showPDF(args[0]); } }