Package com.itextpdf.text

Examples of com.itextpdf.text.Document


    @Override
    public void doExport(OutputStream out) throws JspException
    {
        try
        {
            Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40);
            this.initItextWriter(document, out);
            document.open();
            PdfPTable table = new PdfPTable(this.model.getNumberOfColumns());
            ItextTableWriter writer = new ItextTableWriter(table, document);
            writer.writeTable(this.model, "-1");
            document.add(table);
            document.close();
        }
        catch (Exception e)
        {
            throw new ItextGenerationException(e);
        }
View Full Code Here


    String day = dayForm.format(new Date());
    String date = day + " " + Statics.currentMonth + " " + Statics.currentYear;
    String time = timeForm.format(new Date());
    String datetime = "am " + date + " um " + time + " Uhr";

    document = new Document();
    writer = PdfWriter.getInstance(document, out);
    addMetaData();
    document.open();

    addTitlePages(datetime);
View Full Code Here

    PdfCopyFieldsImp(OutputStream os, char pdfVersion) throws DocumentException {
        super(new PdfDocument(), os);
        pdf.addWriter(this);
        if (pdfVersion != 0)
            super.setPdfVersion(pdfVersion);
        nd = new Document();
        nd.addDocListener(pdf);
    }
View Full Code Here

        //initialize();
    }

    public void generatePDF() throws DocumentException, IOException {
        if (this.getIsPDF() == 1) {
            Document document = new Document(PageSize.A4.rotate());
            document.setPageSize(PageSize.A4);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            PdfWriter.getInstance(document, baos);


            document.open();

            /* Add MTAMS LOGO */
            String url = FacesContext.getCurrentInstance().getExternalContext().getRealPath("resources/img/logo.PNG");
            Image image = Image.getInstance(url);
            document.add(image);

            document.addTitle("MTAMS - Application");
            document.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date()));

            /* Add PDF Content */
            pdfContent(document);
            document.close();

            /* Ouput PDF as attachment */
            String fileName = (this.profileRef.getFamilyname()
                    + this.profileRef.getIdtravelerprofile()
                    + "Approval");
View Full Code Here

    private Font bigFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
    private Font mediumFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD);
    private Font bold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);

    public void generatePDF() throws DocumentException, IOException {
        Document document = new Document(PageSize.A4.rotate());
        document.setPageSize(PageSize.A4);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter.getInstance(document, baos);


        document.open();

        /* Add MTAMS LOGO */
        String url = FacesContext.getCurrentInstance().getExternalContext().getRealPath("resources/img/logo.PNG");
        Image image = Image.getInstance(url);
        document.add(image);

        document.addTitle("MTAMS - Application");
        document.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date()));

        /* Add PDF Content */
        pdfContent(document);
        document.close();

        /* Ouput PDF as attachment */
        String fileName = (this.travelerP.getFamilyname()
                + this.travelerP.getIdtravelerprofile()
                + "ForexForm");
View Full Code Here

     */
    public ApplicationBean() {
    }

    public void generatePDF() throws DocumentException, IOException {
        Document document = new Document(PageSize.A4.rotate());
        document.setPageSize(PageSize.A4);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter.getInstance(document, baos);


        document.open();

        /* Add MTAMS LOGO */
        String url = FacesContext.getCurrentInstance().getExternalContext().getRealPath("resources/img/logo.PNG");
        Image image = Image.getInstance(url);
        document.add(image);

        document.addTitle("MTAMS - Application");
        document.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date()));

        /* Add PDF Content */
        pdfContent(document);
        document.close();

        /* Ouput PDF as attachment */
        String fileName = (this.profileRef.getFamilyname()
                + this.profileRef.getIdtravelerprofile()
                + "ApplicationDetails");
View Full Code Here

       }
   
   
      
      
    Document doc=new Document();
    ByteArrayOutputStream ba=new ByteArrayOutputStream();
    try {
      //ManyToOne mo=new ManyToOne();
      //process s1;
      List<process> list=main.viewRecord(temp);
     
      System.out.println(list.size());
     
      PdfWriter.getInstance(doc, ba);
      doc.open();
      PdfPTable table=new PdfPTable(i);
      Iterator it =list.iterator();
            while(it.hasNext())
            {
              Object o[]=(Object [])it.next();
             
              //                   System.out.println(o[0] + "==" + o[1]);
                 
               //  String str=(String) it.next();
                 for(int j=0; j<i; j++ )
                 {
                   System.out.println(o[j]);
                  
        //table.addCell(o[j]);//String.valueOf(list.get(i).getProcessName()));
        table.addCell(String.valueOf(o[j]));
       
      }}
            System.out.println("loop complate");
      doc.add(table);
      System.out.println("add table complate");
     
      doc.close();
      System.out.println("document complate");
     
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

    try {
      Assert.notNull(source, "source");
      Assert.greaterOrEqual(start, 1, "start");

      PdfReader reader = new PdfReader(source);
      Document document = new Document(reader.getPageSizeWithRotation(1));
      InputOutputStream outputStream = new InputOutputStream();
      PdfCopy writer = new PdfCopy(document, outputStream);
      int pageCount = reader.getNumberOfPages();

      Assert.lessOrEqual(start, pageCount, "start");

      int endPage = end;
      if (endPage > pageCount) {
        endPage = pageCount;
      }

      document.open();

      for (int i = start; i <= endPage; i++) {
        PdfImportedPage page = writer.getImportedPage(reader, i);
        writer.addPage(page);
      }

      document.close();
      writer.close();
      reader.close();

      return outputStream.getInputStream();
    } catch (IOException e) {
View Full Code Here

  public InputStream merge(final InputStream[] sources) {
    try {
      Assert.notNull(sources, "sources");
      Assert.notEmpty(sources, "sources");

      Document document = new Document();
      InputOutputStream outputStream = new InputOutputStream();
      PdfCopy writer = new PdfCopy(document, outputStream);

      document.open();

      for (InputStream source : sources) {
        PdfReader reader = new PdfReader(source);
        int pageCount = reader.getNumberOfPages();
        for (int i = 1; i <= pageCount; i++) {
          PdfImportedPage page = writer.getImportedPage(reader, i);
          writer.addPage(page);
        }
        reader.close();
      }

      document.close();
      writer.close();

      return outputStream.getInputStream();
    } catch (IOException e) {
      throw new PDFException(e);
View Full Code Here

      PdfReader reader = new PdfReader(source);
      int pageCount = reader.getNumberOfPages();
      List<InputStream> list = new LinkedList<InputStream>();

      Document document = null;
      InputOutputStream outputStream = null;
      PdfCopy writer = null;
      for (int i = 1; i <= pageCount; i++) {
        if ((document == null) || ((i % size) == 0)) {
          if (document != null) {
            document.close();
            writer.close();
            list.add(outputStream.getInputStream());
          }
          document = new Document(reader.getPageSizeWithRotation(1));
          outputStream = new InputOutputStream();
          writer = new PdfCopy(document, outputStream);
        }
        PdfImportedPage page = writer.getImportedPage(reader, i);
        writer.addPage(page);
      }

      if (document != null) {
        document.close();
        writer.close();
        list.add(outputStream.getInputStream());
      }

      reader.close();
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Document

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.