List of usage examples for com.lowagie.text Font HELVETICA
int HELVETICA
To view the source code for com.lowagie.text Font HELVETICA.
Click Source Link
From source file:org.jcryptool.visual.crt.export.FileExporter.java
License:Open Source License
/** * creates the PDF output-file using iText library *//*w w w. ja v a2 s . co m*/ public void exportToPDF() { Font fontSupscript = new Font(Font.HELVETICA, 6, Font.NORMAL); Font fontSymbol = new Font(Font.SYMBOL, 12, Font.NORMAL); try { PdfWriter.getInstance(document, new FileOutputStream(file)); document.open(); document.add(new Paragraph("Chinese Remainder Theorem")); document.add(new Paragraph(" ")); document.add(new Paragraph("Equations:")); document.add(new Paragraph(" ")); for (int i = 0; i < valueA.length; i++) { document.add(new Paragraph("x = " + valueA[i] + " mod " + valueModuli[i])); } document.add(new Paragraph(" ")); document.add(new Paragraph("Compute")); document.add(new Paragraph(" ")); Chunk space = new Chunk(" "); Chunk spaceBig = new Chunk(" "); Chunk index = new Chunk("i", fontSupscript); index.setTextRise(-3.0f); Chunk m = new Chunk("m"); Chunk equal = new Chunk("="); Chunk openB = new Chunk("("); Chunk closeB = new Chunk(")"); Chunk p = new Chunk("P", fontSymbol); Chunk comma = new Chunk(","); Chunk range = new Chunk("i=0 to n-1"); Chunk bigM = new Chunk("M"); Chunk div = new Chunk("/"); document.add(m); document.add(space); document.add(equal); document.add(space); document.add(p); document.add(space); document.add(openB); document.add(space); document.add(m); document.add(index); document.add(space); document.add(closeB); document.add(comma); document.add(spaceBig); document.add(bigM); document.add(space); document.add(equal); document.add(space); document.add(m); document.add(space); document.add(div); document.add(space); document.add(m); document.add(index); document.add(comma); document.add(spaceBig); document.add(range); document.add(new Paragraph(" ")); document.add(new Paragraph("m = " + crt.getModulus())); document.add(new Paragraph(" ")); for (int i = 0; i < valueBigM.length; i++) { m = new Chunk("m"); index = new Chunk(String.valueOf(i), fontSupscript); index.setTextRise(-3.0f); Chunk value = new Chunk(valueBigM[i].toString()); document.add(m); document.add(index); document.add(new Chunk(" = ")); document.add(value); document.add(new Paragraph()); } document.add(new Paragraph(" ")); document.add(new Paragraph("To get the inverse you can use the extended euclidean.")); document.add(new Paragraph(" ")); Chunk y = new Chunk("y"); Chunk equiv = new Chunk("="); Chunk mod = new Chunk("mod"); index = new Chunk("i", fontSupscript); index.setTextRise(-3.0f); document.add(y); document.add(index); document.add(bigM); document.add(index); document.add(space); document.add(equiv); document.add(space); document.add(new Chunk("1")); document.add(space); document.add(mod); document.add(space); document.add(m); document.add(index); document.add(comma); document.add(spaceBig); document.add(range); document.add(new Paragraph(" ")); for (int i = 0; i < valueBigM.length; i++) { index = new Chunk(String.valueOf(i), fontSupscript); index.setTextRise(-3.0f); Chunk value = new Chunk(valueInverse[i].toString()); document.add(new Chunk("y")); document.add(index); document.add(new Chunk(" = ")); document.add(value); document.add(new Paragraph()); } document.add(new Paragraph(" ")); document.add(new Paragraph("To get one solution of the simultaneous congruences.")); document.add(new Paragraph(" ")); Chunk sum = new Chunk("S", fontSymbol); index = new Chunk("i", fontSupscript); index.setTextRise(-3.0f); document.add(new Chunk("x = ")); document.add(sum); document.add(space); document.add(new Chunk()); document.add(new Chunk("a")); document.add(index); document.add(new Chunk("y")); document.add(index); document.add(bigM); document.add(index); document.add(space); document.add(new Chunk("mod")); document.add(space); document.add(m); document.add(comma); document.add(spaceBig); document.add(range); document.add(new Chunk(".")); document.add(new Paragraph(" ")); document.add(new Paragraph("One solution is: " + crt.getFinalResult())); document.close(); } catch (FileNotFoundException e) { LogUtil.logError(e); } catch (DocumentException e) { LogUtil.logError(e); } }
From source file:org.mapfish.print.PDFUtils.java
License:Open Source License
public static BaseFont getBaseFont(String fontFamily, String fontSize, String fontWeight) { int myFontValue; float myFontSize; int myFontWeight; if (fontFamily.toUpperCase().contains("COURIER")) { myFontValue = Font.COURIER; } else if (fontFamily.toUpperCase().contains("HELVETICA")) { myFontValue = Font.HELVETICA; } else if (fontFamily.toUpperCase().contains("ROMAN")) { myFontValue = Font.TIMES_ROMAN; } else {/* w ww . j a v a2 s. com*/ myFontValue = Font.HELVETICA; } myFontSize = (float) Double.parseDouble(fontSize.toLowerCase().replaceAll("px", "")); if (fontWeight.toUpperCase().contains("NORMAL")) { myFontWeight = Font.NORMAL; } else if (fontWeight.toUpperCase().contains("BOLD")) { myFontWeight = Font.BOLD; } else if (fontWeight.toUpperCase().contains("ITALIC")) { myFontWeight = Font.ITALIC; } else { myFontWeight = Font.NORMAL; } Font pdfFont = new Font(myFontValue, myFontSize, myFontWeight); BaseFont bf = pdfFont.getCalculatedBaseFont(false); return bf; }
From source file:org.nuxeo.dam.pdf.export.PDFCreator.java
License:Open Source License
public boolean createPDF(String title, OutputStream out) throws ClientException { try {//from w w w . java 2 s . c o m Document document = new Document(); PdfWriter.getInstance(document, out); document.addTitle(title); document.addAuthor(Functions.principalFullName(currentUser)); document.addCreator(Functions.principalFullName(currentUser)); document.open(); document.add(new Paragraph("\n\n\n\n\n\n\n\n\n\n")); Font titleFont = new Font(Font.HELVETICA, 36, Font.BOLD); Paragraph titleParagraph = new Paragraph(title, titleFont); titleParagraph.setAlignment(Element.ALIGN_CENTER); document.add(titleParagraph); Font authorFont = new Font(Font.HELVETICA, 20); Paragraph authorParagraph = new Paragraph("By " + Functions.principalFullName(currentUser), authorFont); authorParagraph.setAlignment(Element.ALIGN_CENTER); document.add(authorParagraph); document.newPage(); boolean foundOnePicture = false; for (DocumentModel doc : docs) { if (!doc.hasSchema(PICTURE_SCHEMA)) { continue; } foundOnePicture = true; PictureResourceAdapter picture = doc.getAdapter(PictureResourceAdapter.class); Blob blob = picture.getPictureFromTitle(ORIGINAL_JPEG_VIEW); Rectangle pageSize = document.getPageSize(); if (blob != null) { Paragraph imageTitle = new Paragraph(doc.getTitle(), font); imageTitle.setAlignment(Paragraph.ALIGN_CENTER); document.add(imageTitle); Image image = Image.getInstance(blob.getByteArray()); image.scaleToFit(pageSize.getWidth() - 20, pageSize.getHeight() - 100); image.setAlignment(Image.MIDDLE); Paragraph imageParagraph = new Paragraph(); imageParagraph.add(image); imageParagraph.setAlignment(Paragraph.ALIGN_MIDDLE); document.add(imageParagraph); document.newPage(); } } if (foundOnePicture) { document.close(); return true; } } catch (Exception e) { throw ClientException.wrap(e); } return false; }
From source file:org.openswing.swing.export.java.ExportToPDFCallbacks14Impl.java
License:Open Source License
/** * @return Font to set for the specified generic cell *//*from w w w . jav a 2 s.co m*/ public Object getGenericComponentFont(int row, int col, Object value) { return new Font(Font.HELVETICA); }
From source file:org.openswing.swing.export.java.ExportToPDFCallbacks14Impl.java
License:Open Source License
/** * @return Font to set for the title */ public Object getFontTitle() { return new Font(Font.HELVETICA); }
From source file:org.openswing.swing.export.java.ExportToPDFCallbacks14Impl.java
License:Open Source License
/** * @param attributeName attribute name that identify column header * @return Font to set for the specified column header *///from w w w .j a v a2 s. c om public Object getHeaderFont(String attributeName) { return new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.BOLD); }
From source file:org.openswing.swing.export.java.ExportToPDFCallbacks14Impl.java
License:Open Source License
/** * @param attributeName attribute name that identify current column * @return Font to set for the specified cell */// w w w . ja v a2 s.c o m public Object getRowFont(String attributeName) { return new Font(Font.HELVETICA); }
From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java
License:Open Source License
private void addSummaryOfNeedsHeader(PdfPTable summaryOfNeedsTable, List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList, int loopNo) { PdfPCell headerCell = new PdfPCell(); headerCell.setPhrase(new Phrase("Summary of Needs" + (loopNo > 1 ? " (Contd.)" : ""), new Font(Font.HELVETICA, 20, Font.BOLD))); headerCell.setColspan(currentBeanList.size() * 3); headerCell.setVerticalAlignment(Element.ALIGN_TOP); headerCell.setBorder(0);/*from ww w . j av a 2 s.c om*/ headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(headerCell); Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE); //row1 PdfPCell c2 = null; c2 = new PdfPCell(); c2.setBorder(0); summaryOfNeedsTable.addCell(c2); if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } //row2 c2 = new PdfPCell(); c2.setBorder(0); summaryOfNeedsTable.addCell(c2); if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } }
From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java
License:Open Source License
private void addSummaryOfNeedsDomainHeader(PdfPTable summaryOfNeedsTable, List<OcanNeedRatingOverTimeNeedBreakdownBean> currentBeanList, int loopNo) { Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE); //row1/* w w w. j a v a2s . c om*/ PdfPCell c2 = null; c2 = new PdfPCell(); c2.setBorder(0); summaryOfNeedsTable.addCell(c2); if (loopNo > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setColspan(2); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n" + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } //row2 c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Domains", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); if (loopNo > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Consumer", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase("Staff", f)); c2.setHorizontalAlignment(Element.ALIGN_CENTER); summaryOfNeedsTable.addCell(c2); } }
From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java
License:Open Source License
private void addSummaryOfNeedsRow(PdfPTable summaryOfNeedsTable, String needType, String needTypeKey, List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList) { //row3// w w w .ja va 2 s . com PdfPCell c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLUE); c2.setPhrase(new Phrase(needType, new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE))); summaryOfNeedsTable.addCell(c2); if (currentBeanList.size() > 0) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.GREEN); c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(0).getConsumerNeedMap().get(needTypeKey)), new Font(Font.HELVETICA, 14, Font.BOLD))); c2.setHorizontalAlignment(Element.ALIGN_RIGHT); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.LIGHT_GRAY); c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(0).getStaffNeedMap().get(needTypeKey)), new Font(Font.HELVETICA, 14, Font.BOLD))); c2.setHorizontalAlignment(Element.ALIGN_RIGHT); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 1) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.GREEN); c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(1).getConsumerNeedMap().get(needTypeKey)), new Font(Font.HELVETICA, 14, Font.BOLD))); c2.setHorizontalAlignment(Element.ALIGN_RIGHT); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.LIGHT_GRAY); c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(1).getStaffNeedMap().get(needTypeKey)), new Font(Font.HELVETICA, 14, Font.BOLD))); c2.setHorizontalAlignment(Element.ALIGN_RIGHT); summaryOfNeedsTable.addCell(c2); } if (currentBeanList.size() > 2) { c2 = new PdfPCell(); c2.setBackgroundColor(Color.BLACK); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.GREEN); c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(2).getConsumerNeedMap().get(needTypeKey)), new Font(Font.HELVETICA, 14, Font.BOLD))); c2.setHorizontalAlignment(Element.ALIGN_RIGHT); summaryOfNeedsTable.addCell(c2); c2 = new PdfPCell(); c2.setBackgroundColor(Color.LIGHT_GRAY); c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(2).getStaffNeedMap().get(needTypeKey)), new Font(Font.HELVETICA, 14, Font.BOLD))); c2.setHorizontalAlignment(Element.ALIGN_RIGHT); summaryOfNeedsTable.addCell(c2); } }