Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfPCell


    @Override
    protected void writePostBodyFooter(TableModel model) throws DocumentException
    {
        Chunk cellContent = new Chunk(model.getFooter(), this.getFooterFont());
        this.setFooterFontStyle(cellContent);
        PdfPCell cell = new PdfPCell(new Phrase(cellContent));
        cell.setLeading(8, 0);
        cell.setBackgroundColor(this.getFooterBackgroundColor());
        cell.setHorizontalAlignment(this.getFooterHorizontalAlignment());
        cell.setColspan(model.getNumberOfColumns());
        table.addCell(cell);
    }
View Full Code Here


     * @return Cell
     * @throws BadElementException if errors occurs while generating content.
     */
    private PdfPCell getCell(Object value)
    {
        PdfPCell cell = new PdfPCell(new Phrase(new Chunk(StringUtils.trimToEmpty(value != null
            ? value.toString()
            : StringUtils.EMPTY), this.defaultFont)));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setLeading(8, 0);
        return cell;
    }
View Full Code Here

     */
    private PdfPCell getHeaderCell(String value)
    {
        Chunk cellContent = new Chunk(value, this.getHeaderFont());
        setHeaderFontStyle(cellContent);
        PdfPCell cell = new PdfPCell(new Phrase(cellContent));
        cell.setLeading(8, 0);
        cell.setHorizontalAlignment(this.getHeaderHorizontalAlignment());
        cell.setBackgroundColor(this.getHeaderBackgroundColor());
        return cell;
    }
View Full Code Here

     * @param value Value to display in the cell.
     * @return A cell with the given value.
     */
    private PdfPCell getCell(String value)
    {
        PdfPCell cell = new PdfPCell(new Phrase(new Chunk(value, this.font)));
        cell.setLeading(8, 0);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        return cell;
    }
View Full Code Here

     * @param  tag    a cell tag
     * @param  chain  the hierarchy chain
     * @return the created PdfPCell
     */
  public PdfPCell createPdfPCell(final String tag, final ChainedProperties chain) {
    PdfPCell cell = new PdfPCell((Phrase)null);
        // colspan
    String value = chain.getProperty(HtmlTags.COLSPAN);
        if (value != null)
            cell.setColspan(Integer.parseInt(value));
        // rowspan
        value = chain.getProperty(HtmlTags.ROWSPAN);
        if (value != null)
            cell.setRowspan(Integer.parseInt(value));
        // horizontal alignment
        if (tag.equals(HtmlTags.TH))
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        value = chain.getProperty(HtmlTags.ALIGN);
        if (value != null) {
            cell.setHorizontalAlignment(HtmlUtilities.alignmentValue(value));
        }
        // vertical alignment
        value = chain.getProperty(HtmlTags.VALIGN);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        if (value != null) {
            cell.setVerticalAlignment(HtmlUtilities.alignmentValue(value));
        }
        // border
        value = chain.getProperty(HtmlTags.BORDER);
        float border = 0;
        if (value != null)
            border = Float.parseFloat(value);
        cell.setBorderWidth(border);
        // cellpadding
        value = chain.getProperty(HtmlTags.CELLPADDING);
        if (value != null)
            cell.setPadding(Float.parseFloat(value));
        cell.setUseDescender(true);
        // background color
        value = chain.getProperty(HtmlTags.BGCOLOR);
        cell.setBackgroundColor(HtmlUtilities.decodeColor(value));
        return cell;
  }
View Full Code Here

         * Personal Details
         */
        PdfPTable table = new PdfPTable(2); // 2 columns.

        ArrayList<PdfPCell> cellList = new ArrayList<PdfPCell>();
        cellList.add(new PdfPCell(new Phrase("Staff ID:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getStaffid())));
        cellList.add(new PdfPCell(new Phrase("Title:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getTitle())));
        cellList.add(new PdfPCell(new Phrase("Surname:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFamilyname())));
        cellList.add(new PdfPCell(new Phrase("First Name:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFirstname())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Travel Details
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Travel", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Application Name:")));
        cellList.add(new PdfPCell(new Phrase(this.appRef.getDescription())));
        cellList.add(new PdfPCell(new Phrase("Date of Initial Departure:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatedeparture()))));

        cellList.add(new PdfPCell(new Phrase("Date of Final Return:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatereturn()))));

        cellList.add(new PdfPCell(new Phrase("Purpose of Travel:")));
        cellList.add(new PdfPCell(new Phrase(this.travelRef.getDescription())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Itinerary Details
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Itinerary", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Destination", bold)));
        cellList.add(new PdfPCell(new Phrase("Leave Type", bold)));
        cellList.add(new PdfPCell(new Phrase("Travel Day/ Work Day", bold)));


        for (Itinerary i : hops) {
            //cellList.add(new PdfPCell(new Phrase(df.format(i.getDate()))));
            cellList.add(new PdfPCell(new Phrase("BLANK")));
            cellList.add(new PdfPCell(new Phrase(i.getDestinationCity())));
            cellList.add(new PdfPCell(new Phrase(i.getLeavetype())));
            cellList.add(new PdfPCell(new Phrase(i.getTravelday())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Quote CostCenter
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Cost Center:")));
        cellList.add(new PdfPCell(new Phrase(this.quoteRef.getCostcenter())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Flight Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("From", bold)));
        cellList.add(new PdfPCell(new Phrase("To", bold)));
        cellList.add(new PdfPCell(new Phrase("Airline", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        Flightquotes f = selectedFlgQte;
        cellList.add(new PdfPCell(new Phrase(f.getFlightfromCity())));
        cellList.add(new PdfPCell(new Phrase(f.getFlighttoCity())));
        cellList.add(new PdfPCell(new Phrase(f.getQuotesource())));
        cellList.add(new PdfPCell(new Phrase(f.getCurrency() + " " + f.getQuotecost().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Car Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Collect Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Return Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Rental Company", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        Carquotes c = selectedCarQte;
        cellList.add(new PdfPCell(new Phrase(df.format(c.getDatecollect()))));
        cellList.add(new PdfPCell(new Phrase(df.format(c.getDatereturn()))));
        cellList.add(new PdfPCell(new Phrase(c.getProvider())));
        cellList.add(new PdfPCell(new Phrase(c.getCurrency() + " " + c.getQuotecost().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Accommodation Quotes
         */
        table = new PdfPTable(5);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Accomodation Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Location", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkin Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkout Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Hotel", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        Accomodationquotes a = selectedAccQte;
        cellList.add(new PdfPCell(new Phrase(a.getCity())));
        cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckin()))));
        cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckout()))));
        cellList.add(new PdfPCell(new Phrase(a.getAccomodationprovider())));
        cellList.add(new PdfPCell(new Phrase(a.getCurrency() + " " + a.getQuotecost().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Approval Section
         */
        newLine(document);
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Approval", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Approved:")));
        cellList.add(new PdfPCell(new Phrase(this.getApproved() == 1 ? "YES" : "NO")));
        cellList.add(new PdfPCell(new Phrase("Authorizer Name:")));
        cellList.add(new PdfPCell(new Phrase(this.getApprovalName())));

        cellList.add(new PdfPCell(new Phrase("Authorizer Comments:")));
        cellList.add(new PdfPCell(new Phrase(this.getApprovalComment())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
View Full Code Here

         * Personal Details
         */
        PdfPTable table = new PdfPTable(2); // 2 columns.

        ArrayList<PdfPCell> cellList = new ArrayList<PdfPCell>();
        cellList.add(new PdfPCell(new Phrase("Passenger (Full Name):")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getFamilyname() + " " + this.travelerP.getFirstname())));
        cellList.add(new PdfPCell(new Phrase("Home Address Line 1:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getHomeaddress1())));
        cellList.add(new PdfPCell(new Phrase("Home Address Line 2:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getHomeaddress2())));
        cellList.add(new PdfPCell(new Phrase("City:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getCity())));
        cellList.add(new PdfPCell(new Phrase("Country:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getCountry())));
        cellList.add(new PdfPCell(new Phrase("Postal Code:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getPostalcode())));
        cellList.add(new PdfPCell(new Phrase("Telephone Number:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getMobilephone())));
        cellList.add(new PdfPCell(new Phrase("Fax:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getBusinessfax())));
        cellList.add(new PdfPCell(new Phrase("I.D:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getIdnumber())));


        cellList.add(new PdfPCell(new Phrase("Nationality Of Passport:")));
        cellList.add(new PdfPCell(new Phrase(this.travelD.getCountry())));
        cellList.add(new PdfPCell(new Phrase("Passport Number:")));
        cellList.add(new PdfPCell(new Phrase(this.travelD.getPassportnumber())));
        cellList.add(new PdfPCell(new Phrase("Company Contact:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getBusinessphone())));
        cellList.add(new PdfPCell(new Phrase("Destination:")));
        cellList.add(new PdfPCell(new Phrase(this.itinerary.getDestinationCity())));
        cellList.add(new PdfPCell(new Phrase("Date of Departure:")));
        cellList.add(new PdfPCell(new Phrase("")));
        //cellList.add(new PdfPCell(new Phrase(this.itinerary.getDatefrom().toString())));

        cellList.add(new PdfPCell(new Phrase("Date of Return:")));
        cellList.add(new PdfPCell(new Phrase("")));
        //cellList.add(new PdfPCell(new Phrase(this.itinerary.getDateto().toString())));
        cellList.add(new PdfPCell(new Phrase("Ticket Number/ Reference Number:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getTicketnum())));
        cellList.add(new PdfPCell(new Phrase("Voyager Number:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getVoyagernum())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Forex Breakdown
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Forex Breakdown", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Travellers Cheques:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCurrencycheque()
                + " "
                + this.viewForX.getTravelerscheques())));

        cellList.add(new PdfPCell(new Phrase("Foreign Cash:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCurrencycash()
                + " "
                + this.viewForX.getCash())));

        cellList.add(new PdfPCell(new Phrase("CC Type (VISA, DINERS, ETC):")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCctype())));

        cellList.add(new PdfPCell(new Phrase("Number:")));
        cellList.add(new PdfPCell(new Phrase("Please fill in here")));
        cellList.add(new PdfPCell(new Phrase("Last 3 digits:")));
        cellList.add(new PdfPCell(new Phrase("Please fill in here")));
        cellList.add(new PdfPCell(new Phrase("Expiry Date:")));
       
        cellList.add(new PdfPCell(new Phrase("Please fill in here")));
        //cellList.add(new PdfPCell(new Phrase(this.viewForX.getCcexpirydate().toString())));

        cellList.add(new PdfPCell(new Phrase("Amount:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCurrencycc()
                + " "
                + this.viewForX.getCcpaymentamount())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Delivery Information
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Delivery Information", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Delivery - Date and Time:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getDateofrequired().toString())));
        cellList.add(new PdfPCell(new Phrase("Date and Time: Will be confirmed by Forex Consultant:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getDatewillbeconfirmed().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Additional Information
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Additional Information", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Reason for trael:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getReasonfortravel())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
View Full Code Here

         * Personal Details
         */
        PdfPTable table = new PdfPTable(2); // 2 columns.

        ArrayList<PdfPCell> cellList = new ArrayList<PdfPCell>();
        cellList.add(new PdfPCell(new Phrase("Staff ID:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getStaffid())));
        cellList.add(new PdfPCell(new Phrase("Title:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getTitle())));
        cellList.add(new PdfPCell(new Phrase("Surname:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFamilyname())));
        cellList.add(new PdfPCell(new Phrase("First Name:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFirstname())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Travel Details
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Travel", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Application Name:")));
        cellList.add(new PdfPCell(new Phrase(this.appRef.getDescription())));
        cellList.add(new PdfPCell(new Phrase("Date of Initial Departure:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatedeparture()))));

        cellList.add(new PdfPCell(new Phrase("Date of Final Return:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatereturn()))));

        cellList.add(new PdfPCell(new Phrase("Purpose of Travel:")));
        cellList.add(new PdfPCell(new Phrase(this.travelRef.getDescription())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Itinerary Details
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Itinerary", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Destination", bold)));
        cellList.add(new PdfPCell(new Phrase("Leave Type", bold)));
        cellList.add(new PdfPCell(new Phrase("Travel Day/ Work Day", bold)));


        for (Itinerary i : hops) {
            //cellList.add(new PdfPCell(new Phrase(df.format(i.getDate()))));
            cellList.add(new PdfPCell(new Phrase("BLANK")));
            cellList.add(new PdfPCell(new Phrase(i.getDestinationCity())));
            cellList.add(new PdfPCell(new Phrase(i.getLeavetype())));
            cellList.add(new PdfPCell(new Phrase(i.getTravelday())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Quote CostCenter
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Cost Center:")));
        cellList.add(new PdfPCell(new Phrase(this.quoteRef.getCostcenter())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Flight Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("From", bold)));
        cellList.add(new PdfPCell(new Phrase("To", bold)));
        cellList.add(new PdfPCell(new Phrase("Airline", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        for (Flightquotes f : flights) {
            cellList.add(new PdfPCell(new Phrase(f.getFlightfromCity())));
            cellList.add(new PdfPCell(new Phrase(f.getFlighttoCity())));
            cellList.add(new PdfPCell(new Phrase(f.getQuotesource())));
            cellList.add(new PdfPCell(new Phrase(f.getCurrency() + " " + f.getQuotecost().toString())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Car Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Collect Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Return Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Rental Company", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        for (Carquotes c : cars) {
            cellList.add(new PdfPCell(new Phrase(df.format(c.getDatecollect()))));
            cellList.add(new PdfPCell(new Phrase(df.format(c.getDatereturn()))));
            cellList.add(new PdfPCell(new Phrase(c.getProvider())));
            cellList.add(new PdfPCell(new Phrase(c.getCurrency() + " " + c.getQuotecost().toString())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Accommodation Quotes
         */
        table = new PdfPTable(5);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Accomodation Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Location", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkin Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkout Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Hotel", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        for (Accomodationquotes a : hotels) {
            cellList.add(new PdfPCell(new Phrase(a.getCity())));
            cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckin()))));
            cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckout()))));
            cellList.add(new PdfPCell(new Phrase(a.getAccomodationprovider())));
            cellList.add(new PdfPCell(new Phrase(a.getCurrency() + " " + a.getQuotecost().toString())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
View Full Code Here

      h = height / rows - 50;
    } else {
      h = height - 50;
    }
    img.scaleToFit((width / columns) - 10, h);
    PdfPCell imgCell = new PdfPCell(img);
    imgCell.setBorder(0);
   
    /* title */
    Paragraph titleParagraph = new Paragraph(new Chunk(filename.substring(0, filename.indexOf('.'))));
    PdfPCell titleCell = new PdfPCell(titleParagraph);
    titleCell.setPaddingBottom(5F);
    titleCell.setBorder(0);
    titleCell.setFixedHeight(30F);
    switch(titlePosition) {
    case TopLeft:
    case BottomLeft:
      titleCell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
      break;
    case TopCenter:
    case BottomCenter:
      titleCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
      break;
    case TopRight:
    case BottomRight:
      titleCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
      break;
    }
   
    /* compose */
    PdfPTable t = new PdfPTable(new float[] {100F});
    switch(titlePosition) {
    case TopLeft:
    case TopCenter:
    case TopRight:
      titleCell.setVerticalAlignment(PdfPCell.ALIGN_BOTTOM);
      t.addCell(titleCell);
      t.addCell(imgCell);
      break;
    case BottomLeft:
    case BottomCenter:
    case BottomRight:
      titleCell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
      t.addCell(imgCell);
      t.addCell(titleCell);
      break;
    }
   
    /* add */
    PdfPCell tCell = new PdfPCell(t);
    tCell.setVerticalAlignment(PdfPCell.BOTTOM);
    tCell.setBorder(0);
    tCell.setPadding(5F);
    imageTable.addCell(tCell);
    mustAddTable = true;
    contentsMap.put(filename, String.valueOf(currentPageNumber));

    /* table finished ? */
 
View Full Code Here

    if(pageNumbers) {
      currentPageNumber = writer.getPageNumber();
      PdfContentByte cb = pwriter.getDirectContent();
      PdfPTable pageTable = new PdfPTable(new float[] {100F});
      pageTable.setTotalWidth(100F);
      PdfPCell c = new PdfPCell(new Paragraph("Seite " + writer.getPageNumber()));
      c.setBorder(0);
      c.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
      pageTable.addCell(c);
      pageTable.writeSelectedRows(0, -1, 480F, 30F, cb);
     
    }
  }
View Full Code Here

TOP

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

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.