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:StrokeLineWidthPDF.java

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

        document.open();
        PdfContentByte cb = writer.getDirectContent();

        cb.setLineWidth(10f);
        cb.rectangle(100, 700, 100, 100);
        cb.stroke();

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

From source file:ShapeRectanglePDF.java

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

        document.open();
        PdfContentByte cb = writer.getDirectContent();

        cb.setLineWidth(10f);
        cb.rectangle(100, 700, 100, 100);
        cb.stroke();

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

From source file:Skew012.java

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

        document.open();

        Chunk italic = new Chunk("This is a chunk.");
        italic.setSkew(0f, 12f);
        document.add(italic);

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

From source file:ImageSequencePDF.java

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

        Image image = Image.getInstance("logo.png");
        for (int i = 0; i < 20; i++) {
            document.add(image);
        }

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

From source file:Skew450.java

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

        document.open();

        Chunk chunk = new Chunk("This is a chunk.");
        chunk.setSkew(45f, 0f);
        document.add(chunk);

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

From source file:ChunkWidthPDF.java

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

        Chunk c = new Chunk("Text Text Text Text Text Text Text Text Text Text");
        float w = c.getWidthPoint();
        System.out.println(
                "The width of the chunk: is " + String.valueOf(w) + " points or " + w / 72f + " inches.");
        document.add(c);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:Skew_450.java

public static void main(String[] args) {
    Document document = new Document();
    try {//  www  .  j  a v a 2 s .co  m
        PdfWriter.getInstance(document, new FileOutputStream("Skew_450.pdf"));

        document.open();

        Chunk chunk = new Chunk("This is a chunk.");
        chunk.setSkew(-45f, 0f);
        document.add(chunk);

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

From source file:TransformImagePDF.java

public static void main(String[] args) {
    Document.compress = false;//from   www .  j  a va2s  .c  o m
    Document document = new Document(PageSize.A4);
    try {
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TransformImagePDF.pdf"));
        document.open();

        PdfContentByte cb = writer.getDirectContent();
        Image img = Image.getInstance("logo.png");
        cb.addImage(img, 250, -50, -30, 550, 100, 100);

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

From source file:TrueTypeFromTTFFilePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w w  w. j a  va2s  .c om*/
        PdfWriter.getInstance(document, new FileOutputStream("TrueTypeFromTTFFilePDF.pdf"));
        document.open();

        BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.CP1252,
                BaseFont.NOT_EMBEDDED);
        Font font = new Font(bfComic, 12);
        String text1 = "arial.ttf";
        document.add(new Paragraph(text1, font));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:FontEncodingPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w  w w  . jav  a2 s .  c  o  m*/
        PdfWriter.getInstance(document, new FileOutputStream("FontEncodingPDF.pdf"));
        document.open();

        BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
        Font font = new Font(helvetica, 12, Font.NORMAL);
        Chunk chunk = new Chunk("BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED",
                font);
        document.add(chunk);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}