Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfWriter$PdfTrailer


        if (landscape) {
            size = new Rectangle(pageSize.rotate());
        }
        size.setBackgroundColor(new BaseColor(Lookup.getDefault().lookup(PreviewController.class).getModel().getBackgroundColor()));
        document = new Document(size);
        PdfWriter pdfWriter = PdfWriter.getInstance(document, stream);
        document.open();
        cb = pdfWriter.getDirectContent();
        cb.saveState();

        //Limits
        float minX = Float.POSITIVE_INFINITY;
        float maxX = Float.NEGATIVE_INFINITY;
View Full Code Here


    }
    else{
      document = new Document();
    }
   
    PdfWriter pdfWriter;
    try {
      pdfWriter = PdfWriter.getInstance(document, output);
      pdfWriter.setViewerPreferences(PdfWriter.PageLayoutSinglePage);

      document.open();
      addTitle(document);
      addTable(document);
View Full Code Here

      
      public void createPdf()
          throws IOException, DocumentException, SQLException {
        File file=new File("vipul.pdf");
        Document document = new Document();
          PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
          HeaderFooter event = new HeaderFooter();
          writer.setBoxSize("art", new Rectangle(36, 54, 559, 788));
          writer.setPageEvent(event);
         document.open();
         
      Paragraph p=new Paragraph();
      for (int i=0; i<=1000; i++){
      p.add("dnfkjnsdjkfjknsdkjfnknsdkfjbsdkjfs");}
View Full Code Here

        int n = reader.getNumberOfPages();
        Rectangle pageSize = reader.getPageSize(1);

        System.out.println("Input page size: " + pageSize);
        Document doc = new Document(PageSize.A4.rotate(), 0, 0, 0, 0);
        PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(output));
        doc.open();
        // splitLine(doc, writer);
        PdfContentByte cb = writer.getDirectContent();
        float bottom = (doc.top() - pageSize.getHeight()) / 2 + kOffset;
        float left = doc.right() / 2 - (pageSize.getWidth() + kTextWidth) / 2 - kMargin;
        float right = doc.right() / 2 - (pageSize.getWidth() - kTextWidth) / 2 + kMargin;

        for (int i = 0; i <= n;) {
View Full Code Here

        int n = reader.getNumberOfPages();
        Rectangle pageSize = reader.getPageSize(1);

        System.out.println("Input page size: " + pageSize);
        Document doc = new Document(PageSize.A4.rotate(), 0, 0, 0, 0);
        PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(output));
        doc.open();
        splitLine(doc, writer);
        int[] pages = new int[(n + 3) / 4 * 4];
        int x = 1, y = pages.length;
        for (int i = 0; i < pages.length;) {
            pages[i++] = y--;
            pages[i++] = x++;
            pages[i++] = x++;
            pages[i++] = y--;
        }
        PdfContentByte cb = writer.getDirectContent();
        float bottom = (doc.top() - pageSize.getHeight()) / 2 + kOffset;
        float left = doc.right() / 2 - (pageSize.getWidth() + kTextWidth) / 2 - kMargin;
        float right = doc.right() / 2 - (pageSize.getWidth() - kTextWidth) / 2 + kMargin;

        for (int i = 0; i < pages.length;) {
View Full Code Here

    try {

      doc = new Document();

      PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(
          file));
      writer.setPdfVersion(PdfWriter.PDF_VERSION_1_6);

      // opening the document for writing
      doc.open();

      Image _logo = Image
View Full Code Here

        Document document = null;

        try
        {
            document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("/home/matrix/Desktop/pv.pdf"));
            writer.setPdfVersion(PdfWriter.PDF_VERSION_1_6);
            //open document for writing
            document.open();
            Image _logo = Image.getInstance("/home/matrix/apps/workspace/reclaadmin/WebContent/VAADIN/themes/reindeer/layouts/images/logo.gif");
            Image logo = Image.getInstance("/home/matrix/apps/workspace/reclaadmin/WebContent/VAADIN/themes/reindeer/layouts/images/slogon.gif");
           
View Full Code Here

      BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1250,
          BaseFont.EMBEDDED);
      Font f = new Font(bf, 12, Font.NORMAL);

      document = new Document(PageSize.A4, 10, 10, 50, 50);
      PdfWriter instance = PdfWriter.getInstance(document, os);
      document.open();

      Paragraph paragraph = new Paragraph("Zestawienie czasu pracy pracownika za " + date
          + " - " + person, f);
      paragraph.setAlignment(Element.ALIGN_CENTER);
View Full Code Here

    try {

      FileOutputStream outputStream = new FileOutputStream(
           pdfPath+"/driveTogether.pdf");

      PdfWriter writer = PdfWriter.getInstance(doc, outputStream);
      // PdfWriter writer = PdfWriter.getInstance(doc, new
      // FileOutputStream(
      // "/home/surfacing/data/Output.pdf"));

      // Image image = Image.getInstance("banner5.png");
      // doc.open();
      // doc.add(image);

      doc.open();

      String pfad = FacesContext.getCurrentInstance()
      .getExternalContext()
      .getRealPath("/pdf/template.pdf");
     
     
      logger.info("Loading PDF-Template: "+pfad);
      PdfReader reader = new PdfReader(
          pfad  );

      PdfImportedPage page = writer.getImportedPage(reader, 1);

      PdfContentByte cb = writer.getDirectContent();
      cb.addTemplate(page, 0, 0);

      doHeader();

      doParagraph(trip, forUser);
View Full Code Here

            Rectangle newSize = new Rectangle(pageSize.getWidth()*2, pageSize.getHeight());
            // step 1: creation of a document-object
            Document document = new Document(newSize, 0, 0, 0, 0);
            // step 2: we create a writer that listens to the document
            ByteArrayOutputStream tmp = new ByteArrayOutputStream();
            PdfWriter writer = PdfWriter.getInstance(document, tmp);
            writer.setFullCompression();
            // step 3: we open the document
            document.open();
            // step 4: adding the content
            PdfContentByte cb = writer.getDirectContent();
            PdfImportedPage page;
            float offsetX;
            for (int p = 1; p <= total; p++) {
                offsetX = 0;
                if (p % 2 != 0) {
                    document.newPage();
                } else {
                    offsetX = pageSize.getWidth();
                }
                page = writer.getImportedPage(reader, p);
                cb.addTemplate(page, offsetX, 0);
            }
            // step 5: we close the document
            document.close();

View Full Code Here

TOP

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

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.