Example usage for java.io FileOutputStream FileOutputStream

List of usage examples for java.io FileOutputStream FileOutputStream

Introduction

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

Prototype

public FileOutputStream(FileDescriptor fdObj) 

Source Link

Document

Creates a file output stream to write to the specified file descriptor, which represents an existing connection to an actual file in the file system.

Usage

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document.compress = false;//from w w  w . ja  va 2  s. c  o m
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    PdfContentByte cb = writer.getDirectContent();
    cb.setColorStroke(new GrayColor(0.2f));
    cb.setColorFill(new GrayColor(0.9f));
    cb.moveTo(140, 700);
    cb.lineTo(240, 700);
    cb.lineTo(240, 800);
    cb.lineTo(140, 800);
    cb.closePathStroke();

    document.close();
}

From source file:Skew012.java

public static void main(String[] args) {
    Document document = new Document();
    try {//www.  ja  v  a2s  .  c o m
        PdfWriter.getInstance(document, new FileOutputStream("Skew012.pdf"));

        document.open();

        Chunk italic = new Chunk("This is a chunk.");
        italic.setSkew(0f, 12f);
        document.add(italic);

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

From source file:Skew450.java

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

        document.open();

        Chunk chunk = new Chunk("This is a chunk.");
        chunk.setSkew(45f, 0f);
        document.add(chunk);

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

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document.compress = false;//from   w  w  w  . j av  a 2  s .co  m
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    PdfContentByte cb = writer.getDirectContent();

    constructStar(cb, 30, 720);
    cb.eoFill();

    document.close();
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document.compress = false;//from  www  .  j a  va  2 s  . co  m
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    PdfContentByte cb = writer.getDirectContent();

    constructStar(cb, 30, 720);
    cb.newPath();

    document.close();
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    Document.compress = false;//  w w  w . jav  a  2s  .c  o  m
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    PdfContentByte cb = writer.getDirectContent();

    constructStar(cb, 30, 720);
    cb.fill();

    document.close();
}

From source file:MainClass.java

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

    constructStar(cb, 30, 720);
    cb.eoFillStroke();

    document.close();
}

From source file:ImagesDefaultWRAPInANewLinePDF.java

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

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

        for (int i = 0; i < 100; i++) {
            document.add(new Phrase("Text "));
        }
        document.add(Chunk.NEWLINE);
        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:ImagesBMPPDF.java

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

        document.add(new Paragraph("load a BMP image file"));
        Image img = Image.getInstance("logo.BMP");
        document.add(img);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:ImagesTIFPDF.java

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

        document.add(new Paragraph("load a tif image file"));
        Image img = Image.getInstance("logo.tif");
        document.add(img);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}