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

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

        PdfContentByte cb = writer.getDirectContent();
        cb.concatCTM(1f, 0f, 0f, -1f, 0f, PageSize.A4.height());

        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 {/* www  .j a v a2  s. c om*/
        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();
}

From source file:RawDataFromImageFileAndManipulationPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  ww w  . j av a  2 s.c om
        PdfWriter.getInstance(document, new FileOutputStream("RawDataFromImageFileAndManipulationPDF.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();

        for (int i = 0; i < imext.length; i++) {
            imext[i] = (byte) (imext[i] + 3);
        }

        Image img1 = Image.getInstance(100, 100, 3, 8, imext);
        img1.setAbsolutePosition(200, 200);
        document.add(img1);

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

From source file:TextRightLeftPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*  ww  w  .  ja  v a2 s . c  om*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TextRightLeftPDF.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_RIGHT, " Right", 250, 350, 0);
        cb.showTextAligned(PdfContentByte.ALIGN_LEFT, " Left", 250, 300, 0);

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

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {/*  ww w .j a  v a2s . c  om*/
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);

        HyperlinkListener hyperlinkListener = new ActivatedHyperlinkListener(editorPane);
        editorPane.addHyperlinkListener(hyperlinkListener);

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:SettingPageSizeAndMargins.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A5, 36, 72, 108, 180);
    try {//w ww .j ava  2s. c om
        PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeAndMargins.pdf"));
        document.open();

        document.add(new Paragraph("The left margin of this document is 36pt (0.5 inch);"));
        document.add(new Paragraph("the right margin 72pt (1 inch);"));
        document.add(new Paragraph("the top margin 108pt (1.5 inch);"));
        document.add(new Paragraph("the bottom margin 180pt (2.5 inch)."));

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

From source file:FontColorByPdfContentBytePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  www. j ava 2  s .  com
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("FontColorByPdfContentBytePDF.pdf"));
        document.open();

        BaseFont bf = FontFactory.getFont(FontFactory.COURIER).getCalculatedBaseFont(false);
        PdfContentByte cb = writer.getDirectContent();
        cb.beginText();
        cb.setColorFill(new Color(0x00, 0xFF, 0x00));
        cb.setFontAndSize(bf, 12);
        cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "Grass is green", 250, 700, 0);
        cb.endText();

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

From source file:XandYcoordinatesPdfContentByteText.java

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

        BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
        cb.beginText();
        cb.setFontAndSize(bf, 12);
        cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "text", 200, 300, 0);
        cb.endText();
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:RomanListsPDF.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("RomanListsPDF.pdf"));
        document.open();

        RomanList roman = new RomanList(35);
        roman.setRomanLower(true);
        roman.add(new ListItem("first item"));
        roman.add(new ListItem(
                "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "));

        document.add(roman);

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

From source file:ChangingDocumentMarginPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A5, 36, 72, 108, 180);
    try {//  w  w w. ja  v a2s .c o m
        PdfWriter.getInstance(document, new FileOutputStream("ChangingDocumentMarginPDF.pdf"));
        document.open();

        Paragraph paragraph = new Paragraph();
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        for (int i = 0; i < 60; i++) {
            paragraph.add("www.java2s.com has demo for Java, JavaScript, PDF.");
        }
        document.add(paragraph);

        document.setMargins(180, 108, 72, 36);
        document.add(new Paragraph("Now we change the margins. You will see the effect on the next page."));

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