Example usage for java.io IOException getMessage

List of usage examples for java.io IOException getMessage

Introduction

In this page you can find the example usage for java.io IOException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:SettingPageSizeLETTER.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w  ww . j  av  a 2 s  .  c  o  m
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeLETTER.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.LETTER);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN LETTER."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA8.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from ww w .j  av a2  s .co m*/
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA8.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A8);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A8."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA3.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("SettingPageSizeA3.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A3);
        document.newPage();
        document.add(new Paragraph("This PageSize is A3."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA7.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w w w.j a  va 2  s.co  m
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA7.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A7);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A7."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeA5.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from w  w  w.  j  a  v a 2  s .  c  om
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeA5.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.A5);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN A5."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SettingPageSizeB0.java

public static void main(String[] args) {
    Document document = new Document();
    try {// w  ww . ja  va 2  s .  co m
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeB0.pdf"));
        document.open();
        document.add(new Paragraph("First Page."));
        document.setPageSize(PageSize.B0);
        document.newPage();
        document.add(new Paragraph("This PageSize is DIN B0."));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:EncryptedPDFWithUserPasswordOwnerPassword.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w w  w.  jav  a 2 s .  com*/
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("EncryptedPDFWithUserPasswordOwnerPassword.pdf"));
        //setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) 
        writer.setEncryption(PdfWriter.STRENGTH128BITS, "java2s.com", "World",
                PdfWriter.AllowCopy | PdfWriter.AllowPrinting);

        document.open();

        document.add(new Paragraph("Hello World"));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:EncryptedPDFWithAllowCopyPrinting.java

public static void main(String[] args) {
    Document document = new Document();
    try {//w ww . j  a v  a  2s  .  co  m
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("EncryptedPDFWithAllowCopyPrinting.pdf"));
        //setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) 
        writer.setEncryption(PdfWriter.STRENGTH128BITS, "java2s.com", "World",
                PdfWriter.AllowCopy | PdfWriter.AllowPrinting);

        document.open();

        document.add(new Paragraph("Hello World"));
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:HelloWorldMultiplePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w w w.j ava 2s.  c om*/
        PdfWriter pdf = PdfWriter.getInstance(document, new FileOutputStream("HelloWorldMultiplePDF.pdf"));
        RtfWriter2 rtf = RtfWriter2.getInstance(document, new FileOutputStream("RTF_File.rtf"));
        HtmlWriter html = HtmlWriter.getInstance(document, new FileOutputStream("HTML_File.html"));

        document.open();
        document.add(new Paragraph("Some text"));

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:MirroringMarginsPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A5, 36, 72, 108, 180);
    try {/*from w  w w .jav  a  2  s .com*/
        PdfWriter.getInstance(document, new FileOutputStream("MirroringMarginsPDF.pdf"));
        document.open();

        document.add(new Paragraph("paragraph"));
        document.setMarginMirroring(true);
        document.add(new Paragraph("Starting on the next page, the margins will be mirrored."));
        for (int i = 0; i < 60; i++) {
            document.add(new Paragraph("paragraph"));
        }
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}