Example usage for com.lowagie.text Font ITALIC

List of usage examples for com.lowagie.text Font ITALIC

Introduction

In this page you can find the example usage for com.lowagie.text Font ITALIC.

Prototype

int ITALIC

To view the source code for com.lowagie.text Font ITALIC.

Click Source Link

Document

this is a possible style.

Usage

From source file:org.unitime.timetable.util.PdfFont.java

License:Open Source License

private static Font createFont(float size, boolean fixed, boolean bold, boolean italic) {
    String font = null;//w  ww  . ja  va  2 s. c o m
    if (fixed)
        font = ApplicationProperty.PdfFontFixed.value();
    else if (bold) {
        if (italic)
            font = ApplicationProperty.PdfFontBoldItalic.value();
        else
            font = ApplicationProperty.PdfFontBold.value();
    } else if (italic)
        font = ApplicationProperty.PdfFontItalic.value();
    else
        font = ApplicationProperty.PdfFontNormal.value();
    if (font != null && !font.isEmpty()) {
        try {
            BaseFont base = BaseFont.createFont(font, BaseFont.IDENTITY_H, true);
            if (base != null)
                return new Font(base, size);
        } catch (Throwable t) {
        }
    }
    font = (fixed ? ApplicationProperty.PdfFontFixed.value() : ApplicationProperty.PdfFontNormal.value());
    if (font != null && !font.isEmpty()) {
        try {
            BaseFont base = BaseFont.createFont(font, BaseFont.IDENTITY_H, true);
            if (base != null)
                return new Font(base, size, italic && bold ? Font.BOLDITALIC
                        : italic ? Font.ITALIC : bold ? Font.BOLD : Font.NORMAL);
        } catch (Throwable t) {
        }
    }
    if (fixed)
        return FontFactory.getFont(bold ? italic ? FontFactory.COURIER_BOLDOBLIQUE : FontFactory.COURIER_BOLD
                : italic ? FontFactory.COURIER_OBLIQUE : FontFactory.COURIER, size);
    else
        return FontFactory
                .getFont(bold ? italic ? FontFactory.HELVETICA_BOLDOBLIQUE : FontFactory.HELVETICA_BOLD
                        : italic ? FontFactory.HELVETICA_OBLIQUE : FontFactory.HELVETICA, size);
}

From source file:oscar.eform.util.EFormPDFServlet.java

License:Open Source License

private void writeContent(Properties printCfg, Properties props, Properties measurements, float height,
        PdfContentByte cb) throws Exception {
    for (Enumeration e = printCfg.propertyNames(); e.hasMoreElements();) {
        StringBuilder temp = new StringBuilder(e.nextElement().toString());
        String[] cfgVal = printCfg.getProperty(temp.toString()).split(" *, *");

        String[] fontType = null;
        int fontFlags = 0;
        if (cfgVal[4].indexOf(";") > -1) {
            fontType = cfgVal[4].split(";");
            if (fontType[1].trim().equals("italic"))
                fontFlags = Font.ITALIC;
            else if (fontType[1].trim().equals("bold"))
                fontFlags = Font.BOLD;
            else if (fontType[1].trim().equals("bolditalic"))
                fontFlags = Font.BOLDITALIC;
            else/*from   www  . java2  s. c  o  m*/
                fontFlags = Font.NORMAL;
        } else {
            fontFlags = Font.NORMAL;
            fontType = new String[] { cfgVal[4].trim() };
        }

        String encoding = null;
        if (fontType[0].trim().equals("BaseFont.HELVETICA")) {
            fontType[0] = BaseFont.HELVETICA;
            encoding = BaseFont.CP1252; //latin1 encoding
        } else if (fontType[0].trim().equals("BaseFont.HELVETICA_OBLIQUE")) {
            fontType[0] = BaseFont.HELVETICA_OBLIQUE;
            encoding = BaseFont.CP1252;
        } else if (fontType[0].trim().equals("BaseFont.ZAPFDINGBATS")) {
            fontType[0] = BaseFont.ZAPFDINGBATS;
            encoding = BaseFont.ZAPFDINGBATS;
        } else {
            fontType[0] = BaseFont.COURIER;
            encoding = BaseFont.CP1252;
        }

        BaseFont bf = BaseFont.createFont(fontType[0], encoding, BaseFont.NOT_EMBEDDED);
        String propValue = props.getProperty(temp.toString());
        //if not in regular config then check measurements
        if (propValue == null) {
            propValue = measurements.getProperty(temp.toString(), "");
        }

        ColumnText ct = new ColumnText(cb);
        // write in a rectangle area
        if (cfgVal.length >= 9) {
            Font font = new Font(bf, Integer.parseInt(cfgVal[5].trim()), fontFlags);
            ct.setSimpleColumn(Integer.parseInt(cfgVal[1].trim()),
                    (height - Integer.parseInt(cfgVal[2].trim())), Integer.parseInt(cfgVal[7].trim()),
                    (height - Integer.parseInt(cfgVal[8].trim())), Integer.parseInt(cfgVal[9].trim()),
                    (cfgVal[0].trim().equals("left") ? Element.ALIGN_LEFT
                            : (cfgVal[0].trim().equals("right") ? Element.ALIGN_RIGHT : Element.ALIGN_CENTER)));

            ct.setText(new Phrase(12, propValue, font));
            ct.go();
            continue;
        }

        // draw line directly
        if (temp.toString().startsWith("__$line")) {
            cb.setRGBColorStrokeF(0f, 0f, 0f);
            cb.setLineWidth(Float.parseFloat(cfgVal[4].trim()));
            cb.moveTo(Float.parseFloat(cfgVal[0].trim()), Float.parseFloat(cfgVal[1].trim()));
            cb.lineTo(Float.parseFloat(cfgVal[2].trim()), Float.parseFloat(cfgVal[3].trim()));
            cb.stroke();

        } else if (temp.toString().startsWith("__")) {
            cb.beginText();
            cb.setFontAndSize(bf, Integer.parseInt(cfgVal[5].trim()));
            cb.showTextAligned(
                    (cfgVal[0].trim().equals("left") ? PdfContentByte.ALIGN_LEFT
                            : (cfgVal[0].trim().equals("right") ? PdfContentByte.ALIGN_RIGHT
                                    : PdfContentByte.ALIGN_CENTER)),
                    (cfgVal.length >= 7 ? (cfgVal[6].trim()) : propValue), Integer.parseInt(cfgVal[1].trim()),
                    (height - Integer.parseInt(cfgVal[2].trim())), 0);
            cb.endText();
        } else { // write prop text
            cb.beginText();
            cb.setFontAndSize(bf, Integer.parseInt(cfgVal[5].trim()));
            cb.showTextAligned(
                    (cfgVal[0].trim().equals("left") ? PdfContentByte.ALIGN_LEFT
                            : (cfgVal[0].trim().equals("right") ? PdfContentByte.ALIGN_RIGHT
                                    : PdfContentByte.ALIGN_CENTER)),
                    (cfgVal.length >= 7 ? ((propValue.equals("") ? "" : cfgVal[6].trim())) : propValue),
                    Integer.parseInt(cfgVal[1].trim()), (height - Integer.parseInt(cfgVal[2].trim())), 0);

            cb.endText();
        }
    }
}

From source file:ro.nextreports.engine.exporter.RtfExporter.java

License:Apache License

private void updateFont(Font fnt, Map<String, Object> style) {
    if (style != null) {
        if (style.containsKey(StyleFormatConstants.FONT_FAMILY_KEY)) {
            String val = (String) style.get(StyleFormatConstants.FONT_FAMILY_KEY);
            fnt.setFamily(val);
        }/*w  ww . j a  v a2s  . com*/
        if (style.containsKey(StyleFormatConstants.FONT_SIZE)) {
            Float val = (Float) style.get(StyleFormatConstants.FONT_SIZE);
            fnt.setSize(val);
        }
        if (style.containsKey(StyleFormatConstants.FONT_COLOR)) {
            Color val = (Color) style.get(StyleFormatConstants.FONT_COLOR);
            fnt.setColor(val);
        }
        if (style.containsKey(StyleFormatConstants.FONT_STYLE_KEY)) {
            if (StyleFormatConstants.FONT_STYLE_NORMAL.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
                fnt.setStyle(com.lowagie.text.Font.NORMAL);
            }
            if (StyleFormatConstants.FONT_STYLE_BOLD.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
                fnt.setStyle(com.lowagie.text.Font.BOLD);
            }
            if (StyleFormatConstants.FONT_STYLE_ITALIC.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
                fnt.setStyle(com.lowagie.text.Font.ITALIC);
            }
            if (StyleFormatConstants.FONT_STYLE_BOLDITALIC
                    .equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
                fnt.setStyle(com.lowagie.text.Font.BOLDITALIC);
            }
        }
    }
}

From source file:sim.util.media.chart.ChartGenerator.java

License:Academic Free License

/** Generates a new ChartGenerator with a blank chart.  Before anything else, buildChart() is called.  */
public ChartGenerator() {
    // create the chart
    buildChart();//from  w  w  w .  j  a v a  2  s. c om

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    split.setBorder(new EmptyBorder(0, 0, 0, 0));
    JScrollPane scroll = new JScrollPane();
    JPanel b = new JPanel();
    b.setLayout(new BorderLayout());
    b.add(seriesAttributes, BorderLayout.NORTH);
    b.add(new JPanel(), BorderLayout.CENTER);
    scroll.getViewport().setView(b);
    scroll.setBackground(getBackground());
    scroll.getViewport().setBackground(getBackground());
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    LabelledList list = new LabelledList("Chart");
    globalAttributes.add(list);

    JLabel j = new JLabel("Right-Click or Control-Click");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);
    j = new JLabel("on Chart for More Options");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);

    /*
      titleField = new JTextField();
      titleField.setText(chart.getTitle().getText());
      titleField.addKeyListener(new KeyListener()
      {
      public void keyReleased(KeyEvent keyEvent) {}
      public void keyTyped(KeyEvent keyEvent) {}
      public void keyPressed(KeyEvent keyEvent)
      {
      if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER)
      {
      setTitle(titleField.getText());
      }
      else if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE)
      titleField.setText(getTitle());
      }
      });
      titleField.addFocusListener(new FocusAdapter()
      {
      public void focusLost ( FocusEvent e )
      {
      setTitle(titleField.getText());
      }
      });
    */

    titleField = new PropertyField() {
        public String newValue(String newValue) {
            setTitle(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    titleField.setValue(chart.getTitle().getText());

    list.add(new JLabel("Title"), titleField);

    /*
      xLabel = new JTextField();
      xLabel.setText(getDomainAxisLabel());
      xLabel.addKeyListener(new KeyListener()
      {
      public void keyReleased(KeyEvent keyEvent) {}
      public void keyTyped(KeyEvent keyEvent) {}
      public void keyPressed(KeyEvent keyEvent)
      {
      if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER)
      {
      setDomainAxisLabel(xLabel.getText());
      }
      else if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE)
      xLabel.setText(getDomainAxisLabel());
      }
      });
      xLabel.addFocusListener(new FocusAdapter()
      {
      public void focusLost ( FocusEvent e )
      {
      setDomainAxisLabel(xLabel.getText());
      }
      });
    */
    xLabel = new PropertyField() {
        public String newValue(String newValue) {
            setDomainAxisLabel(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    xLabel.setValue(getDomainAxisLabel());

    list.add(new JLabel("X Label"), xLabel);

    /*
      yLabel = new JTextField();
      yLabel.setText(getRangeAxisLabel());
      yLabel.addKeyListener(new KeyListener()
      {
      public void keyReleased(KeyEvent keyEvent) {}
      public void keyTyped(KeyEvent keyEvent) {}
      public void keyPressed(KeyEvent keyEvent)
      {
      if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER)
      {
      setRangeAxisLabel(yLabel.getText());
      }
      else if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE)
      yLabel.setText(getRangeAxisLabel());
      }
      });
      yLabel.addFocusListener(new FocusAdapter()
      {
      public void focusLost ( FocusEvent e )
      {
      setRangeAxisLabel(yLabel.getText());
      }
      });
    */
    yLabel = new PropertyField() {
        public String newValue(String newValue) {
            setRangeAxisLabel(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    yLabel.setValue(getRangeAxisLabel());

    list.add(new JLabel("Y Label"), yLabel);

    xLog = new JCheckBox();
    xLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (xLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(xLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                chart.getXYPlot().setDomainAxis(logAxis);
            } else
                chart.getXYPlot().setDomainAxis(new NumberAxis(xLabel.getValue()));
        }
    });
    list.add(new JLabel("Log X axis"), xLog);

    yLog = new JCheckBox();
    yLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (yLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                chart.getXYPlot().setRangeAxis(logAxis);
            } else
                chart.getXYPlot().setRangeAxis(new NumberAxis(yLabel.getValue()));
        }
    });
    list.add(new JLabel("Log Y axis"), yLog);

    final JCheckBox legendCheck = new JCheckBox();
    legendCheck.setSelected(false);
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                LegendTitle title = new LegendTitle(chart.getXYPlot());
                title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0, 8, 0, 4));
                chart.addLegend(title);
            } else {
                chart.removeLegend();
            }
        }
    };
    legendCheck.addItemListener(il);
    list.add(new JLabel("Legend"), legendCheck);

    final JCheckBox aliasCheck = new JCheckBox();
    aliasCheck.setSelected(chart.getAntiAlias());
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            chart.setAntiAlias(e.getStateChange() == ItemEvent.SELECTED);
        }
    };
    aliasCheck.addItemListener(il);
    list.add(new JLabel("Antialias"), aliasCheck);

    JPanel pdfButtonPanel = new JPanel();
    pdfButtonPanel.setLayout(new BorderLayout());
    JButton pdfButton = new JButton("Save as PDF");
    pdfButtonPanel.add(pdfButton, BorderLayout.WEST);
    pdfButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog(frame, "Choose PDF file...", FileDialog.SAVE);
            fd.setFile(chart.getTitle().getText() + ".pdf");
            fd.setVisible(true);
            ;
            String fileName = fd.getFile();
            if (fileName != null) {
                Dimension dim = chartPanel.getPreferredSize();
                generatePDF(chart, dim.width, dim.height, fd.getDirectory() + fileName);
            }
        }
    });
    globalAttributes.add(pdfButtonPanel);

    // we add into an outer box so we can later on add more global seriesAttributes
    // as the user instructs and still have glue be last
    Box outerAttributes = Box.createVerticalBox();
    outerAttributes.add(globalAttributes);
    outerAttributes.add(Box.createGlue());

    p.add(outerAttributes, BorderLayout.NORTH);
    p.add(scroll, BorderLayout.CENTER);
    p.setMinimumSize(new Dimension(0, 0));
    p.setPreferredSize(new Dimension(200, 0));
    split.setLeftComponent(p);

    chartHolder.setMinimumSize(new Dimension(0, 0));
    split.setRightComponent(chartHolder);
    setLayout(new BorderLayout());
    add(split, BorderLayout.CENTER);

    // set the default to be white, which looks good when printed
    chart.setBackgroundPaint(Color.WHITE);
}

From source file:textdisplay.TagFilter.java

License:Educational Community License

public void replaceTagsWithPDFEncoding(String[] tags, styles[] tagStyles, OutputStream os)
        throws DocumentException {
    //   FileWriter w = null;

    try {/* ww  w .  ja va  2  s.c  o  m*/
        BaseFont bf = BaseFont.createFont("/usr/Junicode.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

        Document doc = new Document();
        PdfWriter p = PdfWriter.getInstance(doc, os);
        doc.open();
        Paragraph para = new Paragraph();
        para.setFont(new Font(bf, 12, Font.NORMAL));
        //doc.add(para);
        Font italic = new Font(bf, 12, Font.ITALIC);
        Font bold = new Font(bf, 12, Font.BOLD);
        Font underlined = new Font(bf, 12, Font.UNDERLINE);

        StringBuilder chunkBuffer = new StringBuilder(""); //holds the next bit of content that will be added to the pdf as a chunk
        styles chunkStyle = null; //the style to be applied to chunkBuffer when it gets added to the document
        String chunkTag = "";
        Stack<String> wrappingTags = new Stack();
        Stack<styles> wrappingStyles = new Stack();
        String content = text;
        Boolean inTag = false; //is this inside a tag, meaning between the < and >
        String tagTextBuffer = ""; //the text of the tag, including name and any parameters
        Boolean beingTagged = false; //Is the parser currently reading character data that is surrounded by a tag that demands styling
        for (int charCounter = 0; charCounter < this.text.length(); charCounter++) {

            if (text.charAt(charCounter) == '>') {
                inTag = false;
                //if this was a self closing tag, dont do anything
                if (tagTextBuffer.contains("/>")) {
                    tagTextBuffer = "";
                } else {
                    //this is a closing tag, save the chunk and pop the tag and style off of the stack
                    if (tagTextBuffer.startsWith("/")) {
                        if (chunkStyle != null)
                            System.out.print(" closing tag " + tagTextBuffer + " with style "
                                    + chunkStyle.name() + "\n");
                        else
                            System.out.print(" closing tag " + tagTextBuffer + " with style null" + "\n");
                        if (chunkStyle == styles.paragraph)
                            chunkBuffer = new StringBuilder("\n" + chunkBuffer);
                        Chunk c = new Chunk(chunkBuffer.toString());
                        styleChunk(c, chunkStyle);

                        if (chunkStyle != styles.remove)
                            para.add(c);
                        chunkBuffer = new StringBuilder("");
                        chunkStyle = null;
                        chunkTag = "";
                        if (!wrappingStyles.empty()) {
                            chunkStyle = wrappingStyles.pop();
                            chunkTag = wrappingTags.pop();
                        }
                        tagTextBuffer = "";

                    } else {
                        //this is the closing bracket of an opening tag
                        String tagName = tagTextBuffer.split(" ")[0];
                        System.out.print("tag is " + tagName + "\n");
                        for (int i = 0; i < tags.length; i++) {

                            if (tags[i].compareTo(tagName) == 0) {
                                // this is a tag that is suposed to be styled in the pdf
                                if (chunkStyle != null) {
                                    //this tag is nested in a tag that was already applying styling. Add this chunk to the pdf and put the tag/style
                                    //for the previous tag on the stack, so when this new tag ends, the previous styling will resume.
                                    if (chunkStyle == styles.paragraph)
                                        chunkBuffer = new StringBuilder("\n" + chunkBuffer);
                                    Chunk c = new Chunk(chunkBuffer.toString());
                                    styleChunk(c, chunkStyle);
                                    if (chunkStyle != styles.remove)
                                        para.add(c);
                                    wrappingStyles.add(chunkStyle);
                                    wrappingTags.add(chunkTag);
                                    chunkTag = tagName;
                                    chunkStyle = tagStyles[i];
                                    chunkBuffer = new StringBuilder("");
                                } else {
                                    Chunk c = new Chunk(chunkBuffer.toString());
                                    para.add(c);
                                    chunkTag = tagName;
                                    chunkStyle = tagStyles[i];
                                    chunkBuffer = new StringBuilder("");
                                }
                            }
                        }
                        tagTextBuffer = "";
                    }
                }
            }
            if (inTag) {
                tagTextBuffer += text.charAt(charCounter);
            }
            if (text.charAt(charCounter) == '<') {
                if (inTag) {
                    //if we hit another < before hitting a > this was not a tag, so add the tagTextBuffer to the chunk. It was simply conent.
                    chunkBuffer.append(tagTextBuffer);
                    tagTextBuffer = "";
                }
                inTag = true;
            }
            if (!inTag && text.charAt(charCounter) != '>') {
                chunkBuffer.append(text.charAt(charCounter));
            }
        }
        Chunk c = new Chunk(chunkBuffer.toString());
        para.add(c);
        doc.newPage();
        doc.add(para);
        doc.newPage();
        doc.close();
    } catch (IOException ex) {
        Logger.getLogger(TagFilter.class.getName()).log(Level.SEVERE, null, ex);
    } finally {

    }

}

From source file:textdisplay.TagFilter.java

License:Educational Community License

/**Apply a style (font) to a chunk of pdf text*/
private void styleChunk(Chunk c, styles s) {
    try {/*from  w w  w .j  ava  2s .  c  o m*/

        BaseFont bf = BaseFont.createFont("/usr/Junicode.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        BaseFont ita = BaseFont.createFont("/usr/Junicode-Italic.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        BaseFont bol = BaseFont.createFont("/usr/Junicode-Italic.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        if (bf.charExists(540)) {
            System.out.print("font cant do 540\n");
        }
        Font italic = new Font(ita, 12, Font.ITALIC);
        Font bold = new Font(bol, 12, Font.BOLD);
        Font underlined = new Font(bf, 12, Font.UNDERLINE);
        Font superscript = new Font(bf, 9, Font.NORMAL);

        if (s == styles.bold) {
            c.setFont(bold);
        }
        if (s == styles.italic) {
            c.setFont(italic);
        }
        if (s == styles.underlined) {
            c.setFont(underlined);
        }
        if (s == styles.superscript) {
            c.setTextRise(7.0f);
            c.setFont(superscript);

        }

        //wipe out that content

    } catch (DocumentException ex) {
        Logger.getLogger(TagFilter.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(TagFilter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:za.co.equalpay.web.utils.PDFExportUtility.java

public void postProcess() throws MalformedURLException, IOException, DocumentException {
    // document.open();
    ///*from w w  w  .  j a v  a 2 s .  c o  m*/
    // ByteArrayOutputStream baos = new ByteArrayOutputStream();
    // PdfWriter writer = PdfWriter.getInstance(document, baos);
    //
    // writer.open();
    // PdfContentByte cb = writer.getDirectContent();
    // cb.addImage(image);

    ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext()
            .getContext();

    String fontPath = LogoPathFinder.getFontPath(servletContext, "Tahoma");
    BaseFont bf = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H, true);
    Font tahoma = new Font(bf, 16, Font.BOLDITALIC);
    tahoma.setColor(Color.GRAY);

    Font boldFont8 = new Font(bf, 8, Font.BOLD, Color.GRAY);
    Font normalFont8 = new Font(bf, 8, Font.NORMAL, Color.GRAY);

    Font boldFont10 = new Font(bf, 10, Font.BOLDITALIC, Color.GRAY);
    Font normalFont10 = new Font(bf, 10, Font.ITALIC, Color.GRAY);

    phrase = new Phrase();
    phrase.add(new Phrase("Exclusive Distributors of ", normalFont10));
    phrase.add(new Phrase("SAM Medical, CONTERRA, TACMED Solutions ", boldFont10));
    phrase.add(new Phrase("and ", normalFont10));
    phrase.add(new Phrase("NARP ", boldFont10));
    phrase.add(new Phrase("in South Africa.", normalFont10));

    Paragraph paragraph = new Paragraph(phrase);
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);

    document.add(paragraph);

    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100);

    // Terms & Conditions
    phrase = new Phrase();
    phrase.add(new Phrase("\n\n\n"));
    phrase.add(new Phrase("Terms and Conditions: ", boldFont8));
    phrase.add(new Phrase("\n"));
    phrase.add(new Phrase(
            "\n1.    Full Payment in Advance, unless arranged otherwise. Orders will only be processed once payment reflects in our Bank Account.",
            normalFont8));
    phrase.add(new Phrase("\n2.    Prices are net.", normalFont8));
    phrase.add(new Phrase("\n3.    Delivery will be ex stock, alternatively 4  6 weeks from date of order.",
            normalFont8));
    phrase.add(
            new Phrase("\n4.    Shipping Lead Time will depend on clients mode of Transport.", normalFont8));
    phrase.add(new Phrase("\n5.    Prices and Supply of Goods are Subject to availability of stock.",
            normalFont8));
    phrase.add(new Phrase("\n6.    Prices are subject to exchange rate and brand.", normalFont8));
    phrase.add(new Phrase("\n7.    Quotation is valid for 30 Days", boldFont8));
    phrase.add(new Phrase(
            "\n8.    All capital equipment carries a one year guarantee against defective material and workmanship",
            normalFont8));
    phrase.add(new Phrase("\n9.    E & OA accepted.", normalFont8));
    phrase.add(new Phrase("\n10.  Excluding Postage, Packaging or Freight Forwarding to relevant Country.",
            normalFont8));

    PdfPCell cell = new PdfPCell(phrase);
    cell.setBorder(0);
    table.addCell(cell);

    document.add(table);
}