Example usage for java.lang Exception getMessage

List of usage examples for java.lang Exception getMessage

Introduction

In this page you can find the example usage for java.lang Exception getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:EndOfLineWithTextRenderModePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w w w.  j  a v a  2  s .  c o  m*/
        PdfWriter.getInstance(document, new FileOutputStream("EndOfLineWithTextRenderModePDF.pdf"));

        document.open();

        Chunk chunk = new Chunk(
                "1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0");
        chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_STROKE, 0.3f, new Color(30, 30, 30));
        document.add(chunk);

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:LINECAPROUNDPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//  w  w w  .j a va2  s. c o  m
        PdfWriter.getInstance(document, new FileOutputStream("LINECAPROUNDPDF.pdf"));
        document.open();

        Chunk chunk;
        chunk = new Chunk("Multiple lines");
        chunk.setUnderline(new Color(0xFF, 0x00, 0x00), 0.0f, 0.3f, 0.0f, 0.4f, PdfContentByte.LINE_CAP_ROUND);
        document.add(chunk);

    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:TextBackgroundPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*  w w  w  .  j av a2s .co m*/
        PdfWriter.getInstance(document, new FileOutputStream("TextBackgroundPDF.pdf"));
        document.open();
        Chunk high = new Chunk("highlighted");
        high.setBackground(new Color(0xFF, 0x00, 0x00));
        Paragraph p = new Paragraph("The following chunk is ");
        p.add(high);
        document.add(p);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:ParagraphAttributesSpaceBeforePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/* w  ww  .j av  a 2s  .  co  m*/
        PdfWriter.getInstance(document, new FileOutputStream("ParagraphAttributesSpaceBeforePDF.pdf"));
        document.open();
        Paragraph p = new Paragraph(
                "This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. ");

        p.setSpacingBefore(15f);
        document.add(p);
        document.add(p);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:ParagraphAttributesSpaceAfterPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w ww  .java 2s  . c o m*/
        PdfWriter.getInstance(document, new FileOutputStream("ParagraphAttributesSpaceAfterPDF.pdf"));
        document.open();
        Paragraph p = new Paragraph(
                "This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. ");

        p.setSpacingAfter(15f);
        document.add(p);
        document.add(p);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:UsingUnicodePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {// w ww.j  ava  2s.c o  m
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("UsingUnicodePDF.pdf"));
        document.open();

        document.add(new Phrase("\u0161"));
        document.add(new Phrase("\u0178"));
        document.add(new Phrase("\u017D"));
        document.add(new Phrase("\u017E"));

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:AddingAWTImageColorPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from   w  w w  . j  a  va  2s .c om
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddingAWTImageColorPDF.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();

        java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("logo.png");

        Image image = Image.getInstance(awtImage, new Color(0x00, 0x00, 0xFF), true);
        image.setAbsolutePosition(100, 500);
        cb.addImage(image);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:TableColumnRowCountPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w ww  .j av a2  s . co m*/
        PdfWriter.getInstance(document, new FileOutputStream("TableColumnRowCountPDF.pdf"));
        document.open();

        Table table = new Table(2, 2); // 2 rows, 2 columns
        table.addCell("0.0");
        table.addCell("0.1");
        table.addCell("1.0");
        table.addCell("1.1");
        document.add(table);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:NewPageChunkNEXTPAGEPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*w  ww.  java2s  . c o  m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("NewPageChunkNEXTPAGEPDF.pdf"));
        document.open();

        document.add(new Paragraph("A"));
        document.newPage();
        document.add(new Paragraph("B"));
        document.newPage();
        document.add(Chunk.NEXTPAGE);
        document.add(new Paragraph("C"));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:UsingRegisterFontPDF.java

public static void main(String[] args) {
    FontFactory.register("c:\\windows\\fonts\\comicbd.ttf");

    Document document = new Document();
    try {/*  w w w  .  j  a  v a  2s  . co m*/
        PdfWriter.getInstance(document, new FileOutputStream("UsingRegisterFontPDF.pdf"));
        document.open();

        Font font1 = FontFactory.getFont("ComicSansMS", BaseFont.WINANSI, 12);
        String text1 = "True Type font 'ComicSansMS'.";
        document.add(new Paragraph(text1, font1));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();

}