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

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

        document.open();

        Paragraph p = new Paragraph("Text Rendering:");
        document.add(p);
        Chunk chunk = new Chunk("rendering test");
        chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_STROKE, 0.3f, new Color(0x00, 0x00, 0xFF));
        document.add(chunk);

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

From source file:RawDataFromImageFilePDF.java

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

        RandomAccessFile rf = new RandomAccessFile("logo.png", "r");
        int size = (int) rf.length();
        byte imext[] = new byte[size];
        rf.readFully(imext);
        rf.close();

        Image img1 = Image.getInstance(imext);
        img1.setAbsolutePosition(50, 500);
        document.add(img1);

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

From source file:ImagesAlignmentWithTextPDF.java

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

        Image imageRight = Image.getInstance("logo.png");
        imageRight.setAlignment(Image.RIGHT | Image.TEXTWRAP);

        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
        document.add(imageRight);
        for (int i = 0; i < 150; i++) {
            document.add(new Phrase("Text "));
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:TextPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//ww w . jav  a2s  . com
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TextPDF.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();

        cb.beginText();

        BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
        cb.setFontAndSize(bf, 12);

        cb.showTextAligned(PdfContentByte.ALIGN_CENTER, " Center", 250, 700, 0);

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

From source file:ZapfDingbatsLists.java

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

        ZapfDingbatsList z = new ZapfDingbatsList(42, 15);
        z.add(new ListItem("first item"));
        z.add(new ListItem("second item"));
        for (int i = 3; i < 20; i++) {
            z.add(i + "th item");
        }
        document.add(z);
        document.newPage();

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

From source file:ImagesTEXTWRAPPDF.java

public static void main(java.lang.String[] args) {
    Document document = new Document();
    try {/*w ww.ja va  2  s . c  o m*/
        PdfWriter.getInstance(document, new FileOutputStream("ImagesTEXTWRAPPDF.pdf"));
        document.open();

        Image imageRight = Image.getInstance("logo.png");
        imageRight.setAlignment(Image.TEXTWRAP);

        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
        document.add(imageRight);
        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:RenderingTEXT_RENDER_MODE_FILL_STROKE.java

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

        document.open();

        Paragraph p = new Paragraph("Text Rendering:");
        document.add(p);
        Chunk chunk = new Chunk("rendering test");
        chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, 100f, new Color(0xFF, 0x00, 0x00));
        document.add(chunk);

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

From source file:HTMLListsAtoEPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/* w w w . j  a v  a2 s  .  com*/
        HtmlWriter.getInstance(document, new FileOutputStream("HTMLListsAtoEPDF.html"));
        document.open();

        Paragraph paragraph = new Paragraph("A to E:");
        List list = new List(false, 10);
        list.add("A");
        list.add("B");
        list.add("C");
        list.add("D");
        list.add("E");
        paragraph.add(list);
        document.add(paragraph);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:XandYcoordinatesPdfContentByte.java

public static void main(String[] args) {
    Document document = new Document();
    try {/* ww w  .  ja  v a  2  s  .  c o  m*/
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("XandYcoordinatesPdfContentByte.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();

        cb.moveTo(216, 720);
        cb.lineTo(360, 360);
        cb.lineTo(360, 504);
        cb.lineTo(72, 144);
        cb.lineTo(144, 288);
        cb.stroke();

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

From source file:DrawLineCapPDF.java

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

        PdfContentByte cb = writer.getDirectContent();
        PdfTemplate template = cb.createTemplate(500, 200);
        template.setLineCap(1);
        template.setLineWidth(12f);
        template.arc(15f, 75f, 25f, 85f, 0f, 160f);
        template.stroke();
        template.setLineWidth(12f);

        cb.addTemplate(template, 0, 1, -1, 0, 500, 200);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}