Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfWriter


      Document document = new Document(PageSize.A4);

      try {
        OutputStream out = response.getOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, out);
        writer.setViewerPreferences(PdfWriter.PageLayoutSinglePage
            | PdfWriter.PageModeUseThumbs);

        document.open();
        int cpt = 0;
        while (rs.next()) {
View Full Code Here


          .executeQuery("SELECT user.* FROM user where id = " + id);
      Document document = new Document(PageSize.A4);

      try {
        OutputStream out = response.getOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, out);
        writer.setViewerPreferences(PdfWriter.PageLayoutSinglePage
            | PdfWriter.PageModeUseThumbs);

        document.open();

        rs.last();
View Full Code Here

        }
        Color col = props.getColorValue(PreviewProperty.BACKGROUND_COLOR);
        size.setBackgroundColor(new BaseColor(col.getRed(), col.getGreen(), col.getBlue()));

        Document document = new Document(size);
        PdfWriter pdfWriter = null;
        try {
            pdfWriter = PdfWriter.getInstance(document, stream);
            pdfWriter.setPdfVersion(PdfWriter.PDF_VERSION_1_5);
            pdfWriter.setFullCompression();

        } catch (DocumentException ex) {
            Exceptions.printStackTrace(ex);
        }
        document.open();
        PdfContentByte cb = pdfWriter.getDirectContent();
        cb.saveState();

        props.putValue(PDFTarget.LANDSCAPE, landscape);
        props.putValue(PDFTarget.PAGESIZE, size);
        props.putValue(PDFTarget.MARGIN_TOP, new Float((float) marginTop));
View Full Code Here

        PageBox firstPage = (PageBox) pages.get(0);
        com.itextpdf.text.Rectangle firstPageSize = new com.itextpdf.text.Rectangle(0, 0, firstPage.getWidth(c) / _dotsPerPoint,
                firstPage.getHeight(c) / _dotsPerPoint);

        com.itextpdf.text.Document doc = new com.itextpdf.text.Document(firstPageSize, 0, 0, 0, 0);
        PdfWriter writer = PdfWriter.getInstance(doc, os);
        if (_pdfVersion != null) {
            writer.setPdfVersion(_pdfVersion.charValue());
        }
        if (_pdfEncryption != null) {
            writer.setEncryption(_pdfEncryption.getUserPassword(), _pdfEncryption.getOwnerPassword(),
                    _pdfEncryption.getAllowedPrivileges(), _pdfEncryption.getEncryptionType());
        }
        _pdfDoc = doc;
        _writer = writer;
View Full Code Here

    public static void main( String[] args ) throws DocumentException, IOException
    {
      // step 1
      Document document = new Document();
        // step 2
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("pdf.pdf"));
        // step 3
        document.open();
        // step 4
        XMLWorkerHelper.getInstance().parseXHtml(writer, document,
                new FileInputStream("index.html"))
View Full Code Here

        try {
            fos = new FileOutputStream(file);
        } catch (FileNotFoundException e) {
            throw new RuntimeException("The file " + file + "could not be created", e);
        }
        PdfWriter writer;
        try {
            writer = PdfWriter.getInstance(document, fos);
        } catch (DocumentException e) {
            throw new RuntimeException("An error occurred while creating a PdfWriter object.", e);
        }
        document.open();
        PdfContentByte contentByte = writer.getDirectContent();
        Graphics2D g = new PdfGraphics2D(contentByte, (float) bounds.getWidth(), (float) bounds.getHeight(), fontMapper);
        g.translate(-bounds.getX(), -bounds.getY());
        drawable.draw(g);
        g.dispose();
        document.close();
View Full Code Here

            float ph = 800;
   
            // create PDF document and writer
           Document doc = new Document();
           try{
             PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(file));
             doc.open();

            PdfContentByte cb = writer.getDirectContent();

            // create a template
            PdfTemplate tp = cb.createTemplate(pw,ph);
            Graphics2D g2 = tp.createGraphicsShapes(pw,ph);
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.