Package com.lowagie.text

Examples of com.lowagie.text.Font


  public static Chunk getSmallHeaderChunk(String text, float fontsize) {
    return getChunk(text, HEADER_FONT_FAMILY, fontsize, HEADER_FONT_STYLE);
  }

  public static Chunk getChunk(String text, int family, float size, int style) {
    Font font = new Font(family, size, style);
    Chunk chunk = new Chunk(text, font);
    return chunk;
  }
View Full Code Here


     * @param chunk The chunk whose content is to be rendered bold.
     * @param color The font color desired.
     */
    private void setBoldStyle(Chunk chunk, Color color)
    {
        Font font = chunk.getFont();
        chunk.setFont(FontFactory.getFont(font.getFamilyname(), font.getSize(), Font.BOLD, color));
    }
View Full Code Here

                options.getLocation());
          sap.setLayer2Text(buf.toString());
          ;
        }
        if (FontUtils.getL2BaseFont() != null) {
          sap.setLayer2Font(new Font(FontUtils.getL2BaseFont(), options.getL2TextFontSize()));
        }
        options.log("console.setL4Text");
        sap.setLayer4Text(options.getL4Text());
        options.log("console.setRender");
        sap.setRender(options.getRenderMode().getRender());
View Full Code Here

   */
  public void execute() {
    try {
            String line = null;
            Document document;
            Font f;
            Rectangle pagesize = (Rectangle)getValue("pagesize");
            if ("LANDSCAPE".equals(getValue("orientation"))) {
                f = FontFactory.getFont(FontFactory.COURIER, 10);
                document = new Document(pagesize.rotate(), 36, 9, 36, 36);
            }
View Full Code Here

        }
        return cons;
    }

    public ByteArrayOutputStream getConversationPDF(Conversation conversation) {
        Font red = FontFactory
            .getFont(FontFactory.HELVETICA, 12f, Font.BOLD, new Color(0xFF, 0x00, 0x00));
        Font blue = FontFactory
            .getFont(FontFactory.HELVETICA, 12f, Font.ITALIC, new Color(0x00, 0x00, 0xFF));
        Font black = FontFactory.getFont(FontFactory.HELVETICA, 12f, Font.BOLD, Color.BLACK);

        Map<String, Font> colorMap = new HashMap<String, Font>();
        if (conversation != null) {
            Collection<JID> set = conversation.getParticipants();
            int count = 0;
View Full Code Here

        return buildPDFContent(conversation, colorMap);
    }

    private ByteArrayOutputStream buildPDFContent(Conversation conversation,
                                                  Map<String, Font> colorMap) {
        Font roomEvent = FontFactory
            .getFont(FontFactory.HELVETICA, 12f, Font.ITALIC, new Color(0xFF, 0x00, 0xFF));

        try {
            Document document = new Document(PageSize.A4, 50, 50, 50, 50);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            PdfWriter writer = PdfWriter.getInstance(document, baos);
            writer.setPageEvent(new PDFEventListener());
            document.open();


            Paragraph p = new Paragraph(
                LocaleUtils.getLocalizedString("archive.search.pdf.title", "monitoring"),
                FontFactory.getFont(FontFactory.HELVETICA,
                    18, Font.BOLD));
            document.add(p);
            document.add(Chunk.NEWLINE);

            ConversationInfo coninfo = new ConversationUtils()
                .getConversationInfo(conversation.getConversationID(), false);

            String participantsDetail;
            if (coninfo.getAllParticipants() == null) {
                participantsDetail = coninfo.getParticipant1() + ", " + coninfo.getParticipant2();
            }
            else {
                participantsDetail = String.valueOf(coninfo.getAllParticipants().length);
            }

            Paragraph chapterTitle = new Paragraph(
                LocaleUtils
                    .getLocalizedString("archive.search.pdf.participants", "monitoring") +
                    " " + participantsDetail,
                FontFactory.getFont(FontFactory.HELVETICA, 12,
                    Font.BOLD));

            document.add(chapterTitle);


            Paragraph startDate = new Paragraph(
                LocaleUtils.getLocalizedString("archive.search.pdf.startdate", "monitoring") +
                    " " +
                    coninfo.getDate(),
                FontFactory.getFont(FontFactory.HELVETICA, 12,
                    Font.BOLD));
            document.add(startDate);


            Paragraph duration = new Paragraph(
                LocaleUtils.getLocalizedString("archive.search.pdf.duration", "monitoring") +
                    " " +
                    coninfo.getDuration(),
                FontFactory.getFont(FontFactory.HELVETICA, 12,
                    Font.BOLD));
            document.add(duration);


            Paragraph messageCount = new Paragraph(
                LocaleUtils
                    .getLocalizedString("archive.search.pdf.messagecount", "monitoring") +
                    " " +
                    conversation.getMessageCount(),
                FontFactory.getFont(FontFactory.HELVETICA, 12,
                    Font.BOLD));
            document.add(messageCount);
            document.add(Chunk.NEWLINE);


            Paragraph messageParagraph;

            for (ArchivedMessage message : conversation.getMessages()) {
                String time = JiveGlobals.formatTime(message.getSentDate());
                String from = message.getFromJID().getNode();
                if (conversation.getRoom() != null) {
                    from = message.getToJID().getResource();
                }
                String body = message.getBody();
                String prefix;
                if (!message.isRoomEvent()) {
                    prefix = "[" + time + "] " + from + ":  ";
                    Font font = colorMap.get(message.getFromJID().toString());
                    if (font == null) {
                        font = colorMap.get(message.getFromJID().toBareJID());
                    }
                    if (font == null) {
                        font = FontFactory.getFont(FontFactory.HELVETICA, 12f, Font.BOLD, Color.BLACK);
View Full Code Here

      }
    }
    System.setProperty("java.awt.headless", "true");
    String plotFile = outputFile;
    PdfDoc doc = new PdfDoc(plotFile);
    Font font = FontFactory.getFont(FontFactory.COURIER, 16, Font.ITALIC, Color.BLUE);

    Map<Integer, String> inMap = new HashMap<Integer, String>();
    inMap.put(new Integer(2), "Time to fill RAM Buffer (ms)");
    inMap.put(new Integer(3), "Average Flush Rate (per second)");
    inMap.put(new Integer(4), "Items Flushed");
View Full Code Here

        document.add(new Chunk("\n"));
        PdfPTable mapInfo = new PdfPTable(1);
        {
            mapInfo.getDefaultCell().setBorderWidth(0);

            Paragraph header = new Paragraph("Información resultado\n\n", new Font(Font.HELVETICA, 14, Font.BOLDITALIC));
            PdfPCell cell = new PdfPCell(header);
            cell.setColspan(1);
            cell.setBorderWidth(0);
            mapInfo.addCell(cell);

            PdfPTable subTable = new PdfPTable(1);
            subTable.getDefaultCell().setBorderWidth(0);

            Paragraph p = new Paragraph();
            Font f = new Font(Font.COURIER, 12);

            Iterator iterator = params.keySet().iterator();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                String name = key + ":";
                while (name.length() < 23) {
                    name += " ";
                }
                p.add(new Chunk(" " + name + params.get(key) + "\n", f));
            }

            subTable.addCell(p);
            mapInfo.addCell(subTable);
            mapInfo.setWidthPercentage(100);
            document.add(mapInfo);
        }

        //add system information
        PdfPTable systemInfo = new PdfPTable(1);
        {
            systemInfo.getDefaultCell().setBorderWidth(0);

            Paragraph header = new Paragraph("\n\nInformación Sistema\n\n", new Font(Font.HELVETICA, 14, Font.BOLDITALIC));
            PdfPCell cell = new PdfPCell(header);
            cell.setColspan(1);
            cell.setBorderWidth(0);
            systemInfo.addCell(cell);

            PdfPTable subTable = new PdfPTable(1);
            subTable.getDefaultCell().setBorderWidth(0);

            Paragraph p = new Paragraph();
            Font f = new Font(Font.COURIER, 12);

            Iterator iterator = systemProperties.keySet().iterator();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                String name = key + ":";
                while (name.length() < 23) {
                    name += " ";
                }
                p.add(new Chunk(" " + name + systemProperties.get(key) + "\n", f));
            }

            subTable.addCell(p);
            systemInfo.addCell(subTable);
            systemInfo.setWidthPercentage(100);
            document.add(systemInfo);
        }

        document.setMargins(40, 40, 30, 30);
        document.setPageSize(PageSize.A4.rotate());
        document.newPage();

        if (image != null) {
            Image img = Image.getInstance(image, null);
            img.setAlignment(Element.ALIGN_CENTER);
            document.add(img);
        }


        document.setMargins(40,40,170,60);
        document.setPageSize(PageSize.A4);
        document.newPage();

        //list table with the path through the cities and distances between them
        document.add(new Paragraph("Rutas del Problema\n\n",new Font(Font.HELVETICA, 14, Font.BOLDITALIC)));

        //create font for header and cities.
        //TODO: how to create unicode font without having to transfer .ttf file ?
        Font tableHeaderFont=new Font(BaseFont.createFont(
              BaseFont.HELVETICA,
              BaseFont.CP1250,
              BaseFont.EMBEDDED),
              12, Font.BOLD);

        //create tabe and set properties
        PdfPTable datatable = new PdfPTable(6);
        int headerwidths[] = { 5, 31, 16, 16, 16, 16}; // percentage
        datatable.setWidths(headerwidths);
        datatable.setWidthPercentage(100); // percentage
        datatable.getDefaultCell().setPadding(2);
        datatable.getDefaultCell().setBorderWidth(1);
        datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

        //header row
        PdfPCell c1=new PdfPCell(new Phrase("Barrio",tableHeaderFont));
        c1.setColspan(2);
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setVerticalAlignment(Element.ALIGN_CENTER);

        datatable.addCell(c1);
        datatable.addCell(new Phrase("X\n",tableHeaderFont));
        datatable.addCell(new Phrase("Y\n",tableHeaderFont));
        datatable.addCell(new Phrase("Distancia\n[m]",tableHeaderFont));
        datatable.addCell(new Phrase("Total\n[m]",tableHeaderFont));
        datatable.setHeaderRows(1); // this is the end of the table header

        //create fixed with font for numbers
        Font numberFont=new Font(Font.COURIER, 11);

       
        //compute the distance between two cities and total distance
        double totalDistance=0;
        for (int i = 0; i < localidades.length; i++) {
View Full Code Here

            PdfPTable table = new PdfPTable(2);

            Paragraph p = new Paragraph();
            p.setLeading(0, 2);

            p.add(new Chunk("Servi Entrega\n", new Font(Font.HELVETICA, 16, Font.BOLDITALIC, Color.blue)));
            p.add(new Chunk("Reporte Gerencial\n\n", new Font(Font.HELVETICA, 12, Font.NORMAL)));
            Anchor link = new Anchor(projectURL, new Font(Font.HELVETICA, 11, Font.NORMAL));
            link.setReference(projectURL);
            p.add(link);

            p.add(new Chunk("\n\n" + parameters.get(PARAM_COMPUTATION_TIME) + "\n", new Font(Font.HELVETICA, 11, Font.NORMAL)));

            table.getDefaultCell().setBackgroundColor(Color.WHITE);
            table.getDefaultCell().setBorderWidth(0);

            PdfPCell cell = new PdfPCell(p);
View Full Code Here

      HeaderFooter hf = new HeaderFooter(new Phrase(headerString), false);
      document.setFooter(hf);
      document.open();
      BaseFont bf = BaseFont.createFont("C:\\WINDOWS\\Fonts\\Arial.ttf",
          BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      Font f1 = new Font(bf, 10);
      Paragraph paragraph = new Paragraph("SATIŞ RAPORU", f1);
      paragraph.setFont(new Font(14));
      paragraph.setSpacingAfter(20);
      paragraph.setAlignment(Element.ALIGN_CENTER);
      document.add(paragraph);
      Calendar calIlk = Calendar.getInstance();
      calIlk.setTime(ilkTarih.getDate());
      int ilkDay = calIlk.get(Calendar.DAY_OF_MONTH);
      int ilkMounth = calIlk.get(Calendar.MONTH) + 1;
      int ilkYear = calIlk.get(Calendar.YEAR);
      calIlk.setTime(sonTarih.getDate());
      int sonDay = calIlk.get(Calendar.DAY_OF_MONTH);
      int sonMounth = calIlk.get(Calendar.MONTH) + 1;
      int sonYear = calIlk.get(Calendar.YEAR);
      Paragraph tarih = new Paragraph("Baslangıç Tarihi" + "  " + ilkDay
          + "/" + ilkMounth + "/" + ilkYear + "    Bitiş Tarihi  "
          + sonDay + "/" + sonMounth + "/" + sonYear, f1);
      tarih.setFont(new Font(8));
      tarih.setSpacingAfter(20);
      tarih.setAlignment(Element.ALIGN_LEFT);
      document.add(tarih);
      PdfPTable tab = new PdfPTable(table.getColumnCount());

      tab.setWidthPercentage(100);

      for (int i = 0; i < table.getColumnCount(); i++) {
        PdfPCell cell = new PdfPCell(new Paragraph(
            table.getColumnName(i), f1));
        tab.addCell(cell);

      }
      Font f2 = new Font(bf, 8);
      for (int i = 0; i < count; i++) {
        for (int j = 0; j < table.getColumnCount(); j++) {
          Object obj1 = GetData(table, i, j);
          String value1 = obj1.toString();
          PdfPCell cell = new PdfPCell(new Paragraph(value1, f2));
          tab.addCell(cell);
        }
      }
      document.add(tab);

      Paragraph kdvTutarParag = new Paragraph("Toplam KDV Tutarı : "
          + kdvTutari.getText() + " TL");
      kdvTutarParag.setFont(new Font(10));
      kdvTutarParag.setSpacingBefore(20);
      kdvTutarParag.setAlignment(Element.ALIGN_RIGHT);
      document.add(kdvTutarParag);
      Paragraph iskontoTutarParag = new Paragraph(
          "Toplam İskonto Tutarı : " + iskontoTutari.getText()
              + " TL");
      iskontoTutarParag.setFont(new Font(10));
      iskontoTutarParag.setSpacingBefore(0);
      iskontoTutarParag.setAlignment(Element.ALIGN_RIGHT);
      document.add(iskontoTutarParag);
      Paragraph genelToplamParag = new Paragraph("Genel Toplam : "
          + genelToplam.getText() + " TL");
      genelToplamParag.setFont(new Font(10));
      genelToplamParag.setSpacingBefore(0);
      genelToplamParag.setAlignment(Element.ALIGN_RIGHT);
      document.add(genelToplamParag);

      document.close();
View Full Code Here

TOP

Related Classes of com.lowagie.text.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.