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

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   w w  w  .java  2  s .c  o m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_3.pdf"));
        writer.setPdfVersion(PdfWriter.VERSION_1_3);
        //writer.setPdfVersion(PdfWriter.VERSION_1_4);
        //writer.setPdfVersion(PdfWriter.VERSION_1_5);
        //writer.setPdfVersion(PdfWriter.VERSION_1_6);
        document.open();
        document.add(new Paragraph("This is a PDF-1.3 document"));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:ImageAbsolutePositionsPDF.java

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

        Image png = Image.getInstance("logo.png");
        png.setAbsolutePosition(170, 250);

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

From source file:NegativeLeadingPDF.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("NegativeLeadingPDF.pdf"));
        document.open();
        document.add(new Phrase(16,
                "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "));
        document.add(new Phrase(-16,
                "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "));
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:FormSignaturePDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4);
    try {/*from   www .  j  av a2  s  . c  o  m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("FormSignaturePDF.pdf"));
        document.open();
        PdfAcroForm acroForm = writer.getAcroForm();
        document.add(new Paragraph("Hello World"));
        acroForm.addSignature("sig", 73, 705, 149, 759);

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

From source file:AddingAWTImagePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w w w .j av a2 s .  c  om*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddingAWTImagePDF.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();
        java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("logo.png");
        Image image = Image.getInstance(awtImage, null);
        image.setAbsolutePosition(100, 500);
        cb.addImage(image);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ExtraStyleUNDERLINEPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from   w  ww.j a  v  a2s .  co  m
        PdfWriter.getInstance(document, new FileOutputStream("ExtraStyleUNDERLINEPDF.pdf"));
        document.open();

        document.add(new Chunk("underline",
                FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.UNDERLINE)));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ImageScalingAbsolutePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*w  ww. j  ava 2  s  .co  m*/
        PdfWriter.getInstance(document, new FileOutputStream("ImageScalingAbsolutePDF.pdf"));
        document.open();
        Image png = Image.getInstance("logo.png");
        png.scaleAbsolute(160, 120);

        document.add(png);

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

From source file:Buffers.java

public static void main(String[] args) {
    try {//from ww w  . j a v a 2 s .  c o  m
        float[] floats = { 6.61E-39F, 9.918385E-39F };

        ByteBuffer bb = ByteBuffer.allocate(floats.length * 4);

        FloatBuffer fb = bb.asFloatBuffer();
        fb.put(floats);

        CharBuffer cb = bb.asCharBuffer();
        System.out.println(cb.toString());

    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}

From source file:UnicodeExamplePDF.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.getInstance(document, new FileOutputStream("UnicodeExamplePDF.pdf"));
        document.open();

        BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.IDENTITY_H,
                BaseFont.EMBEDDED);
        document.add(new Paragraph("Unicode: \u0418", new Font(bfComic, 12)));
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:RegisterFontPDF.java

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

    try {//from www  . j a  v  a  2 s. c o m
        System.out.println("These fonts were registered at the FontFactory:");
        for (Iterator i = FontFactory.getRegisteredFonts().iterator(); i.hasNext();) {
            System.out.println(i.next());
        }
        System.out.println("These are the families these fonts belong to:");
        for (Iterator i = FontFactory.getRegisteredFamilies().iterator(); i.hasNext();) {
            System.out.println((String) i.next());

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