Example usage for java.lang System err

List of usage examples for java.lang System err

Introduction

In this page you can find the example usage for java.lang System err.

Prototype

PrintStream err

To view the source code for java.lang System err.

Click Source Link

Document

The "standard" error output stream.

Usage

From source file:NegativeLeadingPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  w ww  . ja va2s . co 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:ParagraphAttributesSpaceBeforePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {// ww  w  .  j  av a 2 s. 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:DrawRectanglePDF.java

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

        PdfContentByte cb = writer.getDirectContent();
        PdfTemplate template = cb.createTemplate(500, 200);
        template.setLineWidth(2f);
        template.rectangle(2.5f, 2.5f, 495f, 95f);
        template.stroke();
        template.setLineWidth(12f);

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

From source file:PaddingBordersPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   w  ww  .ja  v  a2 s  . c om*/
        PdfWriter.getInstance(document, new FileOutputStream("PaddingBordersPDF.pdf"));

        document.open();

        Table table = new Table(2);
        table.setBorderWidth(1);
        table.setPadding(10);
        Cell cell = new Cell("header");
        cell.setHeader(true);
        cell.setColspan(2);
        table.addCell(cell);
        table.addCell("1.1");
        table.addCell("2.1");

        table.addCell("3.1");
        table.addCell("1.2");

        table.addCell("2.2");
        table.addCell("3.2");
        document.add(table);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:Main.java

public static void main(String args[]) {
    try {/*from  w  w  w  .  j  a  v a  2  s  .  co  m*/
        MongoClient mongoClient = new MongoClient("localhost", 27017);
        DB db = mongoClient.getDB("test");
        System.out.println("Connect to database successfully");
        boolean auth = db.authenticate("myUserName", "myPassword".toCharArray());
        System.out.println("Authentication: " + auth);
        DBCollection coll = db.getCollection("mycol");
        System.out.println("Collection mycol selected successfully");
        BasicDBObject doc = new BasicDBObject("title", "MongoDB").append("description", "database")
                .append("likes", 100).append("url", "http://www.java2s.com");
        coll.insert(doc);
        System.out.println("Document inserted successfully");
    } catch (Exception e) {
        System.err.println(e.getClass().getName() + ": " + e.getMessage());
    }
}

From source file:com.tianjunwei.RestTemplateTest.java

public static void main(String[] args) {

    RestTemplate restTemplate = new RestTemplate();
    try {//from   w w  w  . ja va 2  s  .c  o m
        System.err.println(restTemplate.getForObject("http://localhost:8090/product/get.action", String.class));
    } catch (RestClientResponseException e) {
        System.err.println(e.getResponseBodyAsString());
    }

}

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

        PdfContentByte cb = writer.getDirectContent();

        ColumnText ct = new ColumnText(cb);
        ct.setSimpleColumn(60, 300, 100, 300 + 28 * 15, 15, Element.ALIGN_CENTER);
        ct.addText(new Phrase("col \n"));
        ct.addText(new Phrase("cool \n"));
        ct.addText(new Phrase("coool\n"));
        ct.addText(new Phrase("cooool\n"));
        ct.go();

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

From source file:AddingImageToTableCellPDF.java

public static void main(String[] args) {
    Document.compress = false;/*from   ww  w. ja  v a  2s  . co  m*/
    Document document = new Document();
    try {
        PdfWriter.getInstance(document, new FileOutputStream("AddingImageToTableCellPDF.pdf"));

        document.open();

        Image img = Image.getInstance("logo.png");
        img.scalePercent(10);

        PdfPTable table = new PdfPTable(3);
        PdfPCell cell = new PdfPCell();
        cell.addElement(new Chunk(img, 5, -5));

        table.addCell("a cell");
        table.addCell(cell);
        table.addCell("a cell");

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

From source file:PhraseWithLeadingLinePDF.java

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

        document.open();

        Phrase phrase0 = new Phrase();
        Phrase phrase1 = new Phrase("this is a phrase\n");

        Phrase phrase2 = new Phrase(24,
                "this is a phrase with leading 24. 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 Text Text Text Text Text \n");
        document.add(phrase0);
        document.add(phrase1);
        document.add(phrase2);
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:GStatePDF.java

public static void main(String[] args) {
    Document document = new Document();

    try {// ww  w.j  a va  2  s .  c om
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("GStatePDF.pdf"));
        document.open();

        PdfContentByte cb = writer.getDirectContent();
        PdfGState gs = new PdfGState();
        gs.setFillOpacity(0.5f);
        cb.setGState(gs);

        cb.setColorFill(Color.red);
        cb.circle(360.0f, 500.0f, 250.0f);
        cb.fill();
        gs.setFillOpacity(0.2f);
        cb.setGState(gs);
        cb.setColorFill(Color.blue);
        cb.circle(460.0f, 500.0f, 100.0f);
        cb.fill();
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}