Example usage for com.itextpdf.text Rectangle NO_BORDER

List of usage examples for com.itextpdf.text Rectangle NO_BORDER

Introduction

In this page you can find the example usage for com.itextpdf.text Rectangle NO_BORDER.

Prototype

int NO_BORDER

To view the source code for com.itextpdf.text Rectangle NO_BORDER.

Click Source Link

Document

This represents a rectangle without borders.

Usage

From source file:gov.utah.dts.det.ccl.actions.reports.generators.FacilityLicenseDetailReport.java

private static PdfPTable getLicenseDetailTable() throws DocumentException {
    PdfPTable table = new PdfPTable(7);
    // format the table
    int headerwidths[] = { 11, 18, 15, 8, 17, 12, 19 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);//from  w ww  .  j  a  v  a  2s .co  m
    table.getDefaultCell().setLeading(fixedLeading, 0);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(PdfPTable.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);

    return table;
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java

private static void generateDocumentPage1(TrackingRecordScreeningLetter screeningLetter, Document document,
        PdfWriter writer) throws BadElementException, DocumentException, Exception {
    PdfPTable table = null;//from   w  w  w .  j av  a 2 s. c  o  m
    int headerwidths[] = {};
    Paragraph paragraph = null;
    List blist = null;
    ListItem item = null;
    ListItem subItem = null;
    SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");

    // LS Authorization Letter Page 1
    addLetterIdentifier(screeningLetter, document);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase("Office of Licensing Authorization", largefontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase("for Electronic Background Check", largefontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("Office of Licensing Information", mediumfontU));
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Type of Background Check Required and Agency Billing Code:", smallfont));
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    /*
     * Start of Billing information line generation
     */
    table = new PdfPTable(3);
    // format the table
    headerwidths = new int[] { 20, 45, 35 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(page1SeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

    // Add Billing Code
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling() != null
            && StringUtils.isNotBlank(
                    screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue())) {
        table.addCell(
                new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue(),
                        xlargefontB));
    } else {
        table.addCell(new Phrase(" ", xlargefontB));
    }

    // Add Fee information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Search Fee = ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee() != null) {
        paragraph.add(new Phrase(
                CommonUtils.fromDoubleToCurrency(
                        screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee()),
                smallfontB));
    } else {
        paragraph.add(SMALL_BLANK);
    }
    paragraph.add(new Phrase(" /  Scan Fee = ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee() != null) {
        paragraph
                .add(new Phrase(
                        CommonUtils.fromDoubleToCurrency(
                                screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee()),
                        smallfontB));
    }
    table.addCell(paragraph);

    // Add Facility Type information
    table.addCell(new Phrase("Licensed Treatment Programs", smallfont));
    // Add Billing Information Line Table to document
    document.add(table);
    /*
     * End of Billing information line table generation
     */

    // Add Check Number document line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Check Number  ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils
            .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber())) {
        paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber(),
                smallfontB));
    }
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    /*
     * Start of Check Issuer information line
     */
    table = new PdfPTable(2);
    // format the table
    headerwidths = new int[] { 40, 60 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(page1SeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

    // Add Issuer information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Issuer  ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils
            .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy())) {
        paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy(),
                smallfontB));
    }
    table.addCell(paragraph);

    // Add Program Name information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Program Name  ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getFacility() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility().getName())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getName(), smallfontB));
    }
    table.addCell(paragraph);
    // Add the Check Issuer table to the document
    document.add(table);
    /*
     * End of Check Issuer information line
     */

    /*
     * Start of Applicant information line generation
     */
    table = new PdfPTable(3);
    // format the table
    headerwidths = new int[] { 43, 20, 37 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(page1SeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);

    // Add Applicant name
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Applicant  ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getPerson() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFirstAndLastName())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName(), smallfontB));
    }
    table.addCell(paragraph);

    // Add Applicant ID
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("ID  ", smallfont));
    if (StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getPersonIdentifier())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getPersonIdentifier(), smallfontB));
    }
    table.addCell(paragraph);

    // Add DOB information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("DOB  ", smallfont));
    try {
        paragraph.add(
                new Phrase(df.format(screeningLetter.getTrackingRecordScreening().getBirthday()), smallfontB));
    } catch (NullPointerException e) {

    }
    table.addCell(paragraph);
    // Add Applicant Information Line Table to document
    document.add(table);
    /*
     * End of Applicant information line generation
     */

    // Add Facility Licensing Specialist Information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("OL Representative  ", smallfont));
    if (screeningLetter.getTrackingRecordScreening().getFacility() != null
            && screeningLetter.getTrackingRecordScreening().getFacility().getLicensingSpecialist() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility()
                    .getLicensingSpecialist().getFirstAndLastName())) {
        paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility()
                .getLicensingSpecialist().getFirstAndLastName(), smallfontB));
    }
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    // Add Distribution Line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase(
            "Distribution:  Original for the Applicant to turn in to the Live Scan Operator. Copy retained by Office of Licensing.",
            smallfont));
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    // Add Program & Applicatant header line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Program & Applicant Information and Instructions", smallfontBU));
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    // Add READ THIS CAREFULLY
    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("READ THIS CAREFULLY", mediumfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    /*
     * Start of instructions list section
     */
    blist = new List(false, 20);
    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("1.", mediumfont));
    item.add(new Phrase(
            "The Office of Licensing authorizes the applicant to submit her/his fingerprints for an electronic applicant background check ",
            smallfont));
    item.add(new Phrase(
            "at various sites throughout Utah using the Live Scan system. Please see the enclosed list for site information. Each site ",
            smallfont));
    item.add(new Phrase(
            "charges a fee for the electronic fingerprint scan. Scanning fees vary from site to site. This is a separate fee from the ",
            smallfont));
    item.add(new Phrase(
            "one submitted to the Department of Human Services for the actual criminal background search.",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("2.", mediumfont));
    item.add(new Phrase(
            "Complete electronic fingerprint submission within 15 days of the date of this authorization letter. If unused, ",
            smallfontB));
    item.add(new Phrase("requests for refunds will not be considered after 30 days. ", smallfontB));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("", smallfont));
    item.add(new Phrase(
            "Refund requests require a letter of explanation from the licensed program accompanied by this original authorization letter.",
            smallfontBU));
    item.setSpacingBefore(4.0f);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("", smallfont));
    item.add(new Phrase(
            "Failure to complete electronic fingerprint submission within this time will result in the denial of the background screening ",
            smallfontB));
    item.add(new Phrase(
            "clearance and the applicant will not be permitted to have direct access to children or vulnerable adults, will not be eligible ",
            smallfontB));
    item.add(new Phrase(
            "to provide services to programs licensed by the Utah Department of Human Services, Office of Licensing, and will not be ",
            smallfontB));
    item.add(new Phrase("eligible to proceed with foster care or adoption.", smallfontB));
    item.setSpacingBefore(4.0f);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("3.", mediumfont));
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("You will need to take with you:", smallfont));
    item.add(paragraph);
    List subList = new List(false, 10);
    subList.setIndentationLeft(10);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase("This original letter. Photocopies and facsimile (FAX) copies will not be accepted.",
            smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase(
            "Photo identification in the form of your driver license or state identification card issued by the Division of Motor Vehicles.",
            smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase("Social Security Card", smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(
            new Phrase("Cash or check as required (see site list for acceptable form of payment).", smallfont));
    subList.add(subItem);
    item.add(subList);
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("4.", mediumfont));
    item.add(new Phrase(
            "If the electronically submitted fingerprints are rejected, the Office of Licensing will notify the applicant/licensed program ",
            smallfont));
    item.add(new Phrase("of additional instructions for completing the nationwide background search.",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("5.", mediumfont));
    item.add(new Phrase("Legibly print the following information for the scanning operator:", smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    document.add(blist);

    document.add(getPage1WriteInLine1());
    document.add(getPage1WriteInLine2());
    document.add(getPage1WriteInLine3());

    blist = new List(false, 20);
    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("6.", mediumfont));
    item.add(new Phrase(
            "Applicant Signature ___________________________________________________  Date ________________",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);
    document.add(blist);

    paragraph = new Paragraph();
    paragraph.add(new Phrase(
            "A current list of Livescan sites is available at www.hslic.utah.gov/docs/livescan sites.pdf",
            smallfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(page1SeparatorSpace);
    document.add(paragraph);

    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling() != null
            && StringUtils.isNotBlank(
                    screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue())) {
        paragraph = new Paragraph();
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue(),
                        xlargefontB));
        paragraph.setAlignment(Element.ALIGN_RIGHT);
        paragraph.setSpacingBefore(page1SeparatorSpace);
        document.add(paragraph);
    }
    /*
     * End of instructions list section
     */
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java

private static PdfPTable getPage1WriteInLine1() throws BadElementException, DocumentException, Exception {
    PdfPTable table = new PdfPTable(2);
    PdfPTable dtl = null;/*w  w  w . j  a  va 2 s  .  com*/

    int headerwidths[] = { 4, 96 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(page1ListSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

    // Redefine the headerwidths for the detail table
    headerwidths = new int[] { 25, 25, 25, 25 }; // percentage

    dtl = new PdfPTable(4);
    dtl.setWidths(headerwidths); // percentage
    dtl.setWidthPercentage(100);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    dtl.getDefaultCell().setCellEvent(new FloatingLinedPdfPCell());
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(SMALL_BLANK);
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    dtl = new PdfPTable(4);
    dtl.setWidths(headerwidths); // percentage
    dtl.setWidthPercentage(100);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell());
    dtl.addCell(new Phrase("Last Name", smallfont));
    dtl.addCell(new Phrase("Full First Name", smallfont));
    dtl.addCell(new Phrase("Full Middle Name", smallfont));
    dtl.addCell(new Phrase("AKA", smallfont));
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    dtl = new PdfPTable(4);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell());
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("If no middle name, write NA.", smallfont));
    dtl.addCell(SMALL_BLANK);
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    return table;
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java

private static PdfPTable getPage1WriteInLine2() throws BadElementException, DocumentException, Exception {
    PdfPTable table = new PdfPTable(2);
    PdfPTable dtl = null;//w  ww  .j  av  a 2s.  c o m
    PdfPCell cell = null;

    int headerwidths[] = { 4, 96 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(page1ListSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

    dtl = new PdfPTable(12);
    headerwidths = new int[] { 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 9 }; // percentage
    dtl.setWidths(headerwidths); // percentage
    dtl.setWidthPercentage(100);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    dtl = new PdfPTable(12);
    headerwidths = new int[] { 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 9 }; // percentage
    dtl.setWidths(headerwidths); // percentage
    dtl.setWidthPercentage(100);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell());
    dtl.addCell(new Phrase("DOB", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Eye Color", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Hair Color", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Weight", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Height", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Gender", smallfont));
    dtl.addCell(SMALL_BLANK);
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    return table;
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java

private static PdfPTable getPage1WriteInLine3() throws BadElementException, DocumentException, Exception {
    PdfPTable table = new PdfPTable(2);
    PdfPTable dtl = null;/*from w  w w. java2 s . c o  m*/
    PdfPCell cell = null;

    int headerwidths[] = { 4, 96 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(page1ListSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

    dtl = new PdfPTable(7);
    headerwidths = new int[] { 24, 5, 21, 5, 16, 5, 24 }; // percentage
    dtl.setWidths(headerwidths); // percentage
    dtl.setWidthPercentage(100);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    cell = new PdfPCell(dtl.getDefaultCell());
    cell.setCellEvent(new FloatingLinedPdfPCell());
    cell.setPhrase(SMALL_BLANK);
    dtl.addCell(cell);
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    dtl = new PdfPTable(7);
    headerwidths = new int[] { 24, 5, 21, 5, 16, 5, 24 }; // percentage
    dtl.setWidths(headerwidths); // percentage
    dtl.setWidthPercentage(100);
    dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0);
    dtl.getDefaultCell().setPadding(0);
    dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell());
    dtl.addCell(new Phrase("Social Security Number", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Place of Birth", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Race", smallfont));
    dtl.addCell(SMALL_BLANK);
    dtl.addCell(new Phrase("Country of Citizenship", smallfont));
    table.addCell(SMALL_BLANK); // Leave first cell blank
    table.addCell(dtl);

    return table;
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java

private static PdfPTable getPage2HeaderTable() throws BadElementException, DocumentException, Exception {
    PdfPTable table = new PdfPTable(2);
    // format the tables
    int headerwidths[] = { 7, 93 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);/* w  ww  .  j a  v a 2 s  .com*/
    table.getDefaultCell().setLeading(fixedLeadingMedium, 0);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

    return table;
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorizationB1591.java

private static void generateDocumentPage1(TrackingRecordScreeningLetter screeningLetter, Document document,
        PdfWriter writer) throws BadElementException, DocumentException, Exception {
    PdfPTable table = null;//from w ww  .j  a  va2  s  .c  om
    int headerwidths[] = {};
    Paragraph paragraph = null;
    List blist = null;
    ListItem item = null;
    ListItem subItem = null;
    SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    StringBuilder sb;
    PdfContentByte over = writer.getDirectContent();

    // LS Authorization Letter Page 1
    addLetterIdentifier(document);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase("Office of Licensing Livescan Authorization", largefontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(30.0f);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("Office of Licensing Information", mediumfontBU));
    paragraph.setSpacingBefore(20.0f);
    document.add(paragraph);

    /*
     * Start of Office of Licensing Information generation
     */
    table = new PdfPTable(2);
    // format the table
    headerwidths = new int[] { 60, 40 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(pageSeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase("TYPE OF TRANSACTION: NFUF", largefontB));
    paragraph.add(Chunk.NEWLINE);
    paragraph.add(new Phrase("REASON FINGERPRINTED: UCA 62A-2-120", largefontB));
    paragraph.add(Chunk.NEWLINE);
    paragraph.add(new Phrase("BILLING CODE: B1591", largefontB));
    table.addCell(paragraph);
    paragraph = new Paragraph(fixedLeadingSmall);
    Calendar cal = Calendar.getInstance();
    cal.setTime(screeningLetter.getLetterDate());
    cal.add(Calendar.DAY_OF_MONTH, 16);
    paragraph.add(new Phrase("This Authorization Expires: " + df.format(cal.getTime()), smallfont));
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(paragraph);
    document.add(table);

    // Add Fee information
    paragraph = new Paragraph(fixedLeadingSmall);
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee() != null) {
        paragraph.add(new Phrase("Scan Fee = ", smallfont));
        paragraph
                .add(new Phrase(
                        CommonUtils.fromDoubleToCurrency(
                                screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee()),
                        smallfontB));
    } else {
        paragraph.add(new Phrase("Search Fee = ", smallfont));
        if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
                && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee() != null) {
            paragraph.add(new Phrase(
                    CommonUtils.fromDoubleToCurrency(
                            screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee()),
                    smallfontB));
        } else {
            paragraph.add(SMALL_BLANK);
        }
    }
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add Authorized Signature line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase(
            "Office of Licensing Authorized Signature ___________________________________________________  Date ________________",
            smallfont));
    paragraph.setSpacingBefore(18.0f);
    document.add(paragraph);

    // Stamp the document date over the Date line above
    // NOTE: Use showColumnBorders as a diagnostic to display borders of column where date will be placed on document.
    //showColumnBorders(over);
    ColumnText ct = new ColumnText(over);
    ct.setLeading(fixedLeadingSmall);
    ct.addText(new Phrase(df.format(screeningLetter.getLetterDate()), smallfont));
    // Write column to document
    ct.setAlignment(Element.ALIGN_CENTER);
    ct.setSimpleColumn(COLUMNS[0][0], COLUMNS[0][1], COLUMNS[0][2], COLUMNS[0][3]);
    ct.go();

    over.setLineWidth(3.0f);
    over.setCMYKColorStroke(166, 92, 0, 145);
    over.moveTo(document.getPageSize().getLeft(65), BOTTOM_SEPARATOR_EDGE);
    over.lineTo(document.getPageSize().getRight(65), BOTTOM_SEPARATOR_EDGE);
    over.stroke();

    // Add Program & Applicatant header line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Program & Applicant Information and Instructions", smallfontBU));
    paragraph.setSpacingBefore((2 * pageSeparatorSpace) + fixedLeadingSmall);
    document.add(paragraph);

    /*
     * Start of Applicant information line generation
     */
    table = new PdfPTable(3);
    // format the table
    headerwidths = new int[] { 43, 20, 37 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(pageSeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);

    // Add Applicant name
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Applicant: ", smallfontB));
    if (screeningLetter.getTrackingRecordScreening().getPerson() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFirstAndLastName())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName(), smallfontB));
    }
    table.addCell(paragraph);

    // Add Applicant ID
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("ID: ", smallfontB));
    if (StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getPersonIdentifier())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getPersonIdentifier(), smallfontB));
    }
    table.addCell(paragraph);

    // Add DOB information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("DOB: ", smallfontB));
    try {
        paragraph.add(
                new Phrase(df.format(screeningLetter.getTrackingRecordScreening().getBirthday()), smallfontB));
    } catch (NullPointerException e) {

    }
    table.addCell(paragraph);
    // Add Applicant Information Line Table to document
    document.add(table);
    /*
     * End of Applicant information line generation
     */

    // Add Application program line
    paragraph = new Paragraph(fixedLeadingSmall);
    sb = new StringBuilder();
    sb.append("Applicant Program: ");
    if (screeningLetter.getTrackingRecordScreening().getFacility() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility().getName())) {
        sb.append(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase());
    }
    paragraph.add(new Phrase(sb.toString(), smallfontB));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add Payment information line
    paragraph = new Paragraph(fixedLeadingSmall);
    sb = new StringBuilder();
    sb.append("Payment issued by: ");
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils
            .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy())) {
        sb.append(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy().toUpperCase());
    }
    sb.append("    ");
    sb.append("Check Number: ");
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils
            .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber())) {
        sb.append(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber().toUpperCase());
    }
    paragraph.add(new Phrase(sb.toString(), smallfontB));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add READ THIS CAREFULLY
    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("READ THIS CAREFULLY", largefontBU));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(pageSeparatorSpace + fixedLeadingLarge);
    document.add(paragraph);

    /*
     * Start of instructions list section
     */
    blist = new List(false, 20);
    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("1.", mediumfont));
    item.add(new Phrase(
            "The Office of Licensing authorizes the applicant to submit her/his fingerprints for an electronic applicant background check ",
            smallfont));
    item.add(new Phrase(
            "at various sites throughout Utah using the Live Scan system. Each site charges a fee for the electronic fingerprint scan. ",
            smallfont));
    item.add(new Phrase(
            "Scanning fees vary from site to site. This is a separate fee from the one submitted to the Department of Human Services for ",
            smallfont));
    item.add(new Phrase("the actual criminal background search.", smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("2.", mediumfont));
    item.add(new Phrase(
            "Complete electronic fingerprint submission within 15 days of the date of this authorization letter. If unused, ",
            smallfontB));
    item.add(new Phrase(
            "requests for refunds will not be considered after 30 days. Refund requests require a letter of explanation ",
            smallfontB));
    item.add(new Phrase(
            "from the licensed program accompanied by this original authorization letter. Failure to complete electronic ",
            smallfontB));
    item.add(new Phrase(
            "fingerprint submission within this time will result in the denial of the background screening clearance and ",
            smallfontB));
    item.add(new Phrase(
            "the applicant will not be permitted to have direct access to children or vulnerable adults, will not be eligible ",
            smallfontB));
    item.add(new Phrase(
            "to provide services to programs licensed by the Utah Department of Human Services, Office of Licensing, and will not be ",
            smallfontB));
    item.add(new Phrase("eligible to proceed with foster care or adoption.", smallfontB));
    item.setSpacingBefore(4.0f);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("3.", mediumfont));
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("You will need to take with you:", smallfont));
    item.add(paragraph);
    List subList = new List(false, 10);
    subList.setIndentationLeft(10);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase("This original letter. Photocopies and facsimile (FAX) copies will not be accepted.",
            smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase(
            "Photo I.D. in the form of your driver license or state identification card issued by the Division of Motor Vehicles.",
            smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(
            new Phrase("Cash or check as required (see site list for acceptable form of payment).", smallfont));
    subList.add(subItem);
    item.add(subList);
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("4.", mediumfont));
    item.add(new Phrase(
            "If the electronically submitted fingerprints are rejected, the Office of Licensing will notify the applicant/licensed program ",
            smallfont));
    item.add(new Phrase("of additional instructions for completing the nationwide background search.",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("5.", mediumfont));
    item.add(new Phrase(
            "Applicant Signature ___________________________________________________  Date ________________",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);
    document.add(blist);
    /*
     * End of instructions list section
     */

    paragraph = new Paragraph();
    paragraph.add(new Phrase(
            "A current list of Livescan sites is available at www.hslic.utah.gov/docs/livescan sites.pdf",
            smallfont));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("Live Scan Operator: Keep this original for auditing purposes.", mediumfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);
}

From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorizationB1606.java

private static void generateDocumentPage1(TrackingRecordScreeningLetter screeningLetter, Document document,
        PdfWriter writer) throws BadElementException, DocumentException, Exception {
    PdfPTable table = null;//from  w  w  w. j ava  2 s.  c o m
    int headerwidths[] = {};
    Paragraph paragraph = null;
    List blist = null;
    ListItem item = null;
    ListItem subItem = null;
    SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    StringBuilder sb;
    PdfContentByte over = writer.getDirectContent();

    // LS Authorization Letter Page 1
    addLetterIdentifier(document);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase("Office of Licensing Livescan Authorization", largefontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(30.0f);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("Office of Licensing Information", mediumfontBU));
    paragraph.setSpacingBefore(20.0f);
    document.add(paragraph);

    /*
     * Start of Office of Licensing Information generation
     */
    table = new PdfPTable(2);
    // format the table
    headerwidths = new int[] { 60, 40 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(pageSeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    paragraph = new Paragraph(fixedLeadingLarge);
    paragraph.add(new Phrase("TYPE OF TRANSACTION: FANC", largefontB));
    paragraph.add(Chunk.NEWLINE);
    paragraph.add(new Phrase("REASON FINGERPRINTED: UCA 53-10-108", largefontB));
    paragraph.add(Chunk.NEWLINE);
    paragraph.add(new Phrase("BILLING CODE: B1606", largefontB));
    table.addCell(paragraph);
    paragraph = new Paragraph(fixedLeadingSmall);
    Calendar cal = Calendar.getInstance();
    cal.setTime(screeningLetter.getLetterDate());
    cal.add(Calendar.DAY_OF_MONTH, 16);
    paragraph.add(new Phrase("This Authorization Expires: " + df.format(cal.getTime()), smallfont));
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(paragraph);
    document.add(table);

    // Add Fee information
    paragraph = new Paragraph(fixedLeadingSmall);
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee() != null) {
        paragraph.add(new Phrase("Scan Fee = ", smallfont));
        paragraph
                .add(new Phrase(
                        CommonUtils.fromDoubleToCurrency(
                                screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee()),
                        smallfontB));
    } else {
        paragraph.add(new Phrase("Search Fee = ", smallfont));
        if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
                && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee() != null) {
            paragraph.add(new Phrase(
                    CommonUtils.fromDoubleToCurrency(
                            screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee()),
                    smallfontB));
        } else {
            paragraph.add(SMALL_BLANK);
        }
    }
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add Authorized Signature line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase(
            "Office of Licensing Authorized Signature ___________________________________________________  Date ________________",
            smallfont));
    paragraph.setSpacingBefore(18.0f);
    document.add(paragraph);

    // Stamp the document date over the Date line above
    // NOTE: Use showColumnBorders as a diagnostic to display borders of column where date will be placed on document.
    //showColumnBorders(over);
    ColumnText ct = new ColumnText(over);
    ct.setLeading(fixedLeadingSmall);
    ct.addText(new Phrase(df.format(screeningLetter.getLetterDate()), smallfont));
    // Write column to document
    ct.setAlignment(Element.ALIGN_CENTER);
    ct.setSimpleColumn(COLUMNS[0][0], COLUMNS[0][1], COLUMNS[0][2], COLUMNS[0][3]);
    ct.go();

    over.setLineWidth(3.0f);
    over.setCMYKColorStroke(166, 92, 0, 145);
    over.moveTo(document.getPageSize().getLeft(65), BOTTOM_SEPARATOR_EDGE);
    over.lineTo(document.getPageSize().getRight(65), BOTTOM_SEPARATOR_EDGE);
    over.stroke();

    // Add Program & Applicatant header line
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Program & Applicant Information and Instructions", smallfontBU));
    paragraph.setSpacingBefore((2 * pageSeparatorSpace) + fixedLeadingSmall);
    document.add(paragraph);

    /*
     * Start of Applicant information line generation
     */
    table = new PdfPTable(3);
    // format the table
    headerwidths = new int[] { 43, 20, 37 }; // percentage
    table.setWidths(headerwidths); // percentage
    table.setWidthPercentage(100);
    table.setSpacingBefore(pageSeparatorSpace);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE);

    // Add Applicant name
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("Applicant: ", smallfontB));
    if (screeningLetter.getTrackingRecordScreening().getPerson() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFirstAndLastName())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName(), smallfontB));
    }
    table.addCell(paragraph);

    // Add Applicant ID
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("ID: ", smallfontB));
    if (StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getPersonIdentifier())) {
        paragraph.add(
                new Phrase(screeningLetter.getTrackingRecordScreening().getPersonIdentifier(), smallfontB));
    }
    table.addCell(paragraph);

    // Add DOB information
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("DOB: ", smallfontB));
    try {
        paragraph.add(
                new Phrase(df.format(screeningLetter.getTrackingRecordScreening().getBirthday()), smallfontB));
    } catch (NullPointerException e) {

    }
    table.addCell(paragraph);
    // Add Applicant Information Line Table to document
    document.add(table);
    /*
     * End of Applicant information line generation
     */

    // Add Application program line
    paragraph = new Paragraph(fixedLeadingSmall);
    sb = new StringBuilder();
    sb.append("Applicant Program: ");
    if (screeningLetter.getTrackingRecordScreening().getFacility() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility().getName())) {
        sb.append(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase());
    }
    paragraph.add(new Phrase(sb.toString(), smallfontB));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add Payment information line
    paragraph = new Paragraph(fixedLeadingSmall);
    sb = new StringBuilder();
    sb.append("Payment issued by: ");
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils
            .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy())) {
        sb.append(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy().toUpperCase());
    }
    sb.append("    ");
    sb.append("Check Number: ");
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils
            .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber())) {
        sb.append(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber().toUpperCase());
    }
    paragraph.add(new Phrase(sb.toString(), smallfontB));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add READ THIS CAREFULLY
    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("READ THIS CAREFULLY", largefontBU));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(pageSeparatorSpace + fixedLeadingLarge);
    document.add(paragraph);

    /*
     * Start of instructions list section
     */
    blist = new List(false, 20);
    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("1.", mediumfont));
    item.add(new Phrase(
            "The Office of Licensing authorizes the applicant to submit her/his fingerprints for an electronic applicant background check ",
            smallfont));
    item.add(new Phrase(
            "at various sites throughout Utah using the Live Scan system. Each site charges a fee for the electronic fingerprint scan. ",
            smallfont));
    item.add(new Phrase(
            "Scanning fees vary from site to site. This is a separate fee from the one submitted to the Department of Human Services for ",
            smallfont));
    item.add(new Phrase("the actual criminal background search.", smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("2.", mediumfont));
    item.add(new Phrase(
            "Complete electronic fingerprint submission within 15 days of the date of this authorization letter. If unused, ",
            smallfontB));
    item.add(new Phrase(
            "requests for refunds will not be considered after 30 days. Refund requests require a letter of explanation ",
            smallfontB));
    item.add(new Phrase(
            "from the licensed program accompanied by this original authorization letter. Failure to complete electronic ",
            smallfontB));
    item.add(new Phrase(
            "fingerprint submission within this time will result in the denial of the background screening clearance and ",
            smallfontB));
    item.add(new Phrase(
            "the applicant will not be permitted to have direct access to children or vulnerable adults, will not be eligible ",
            smallfontB));
    item.add(new Phrase(
            "to provide services to programs licensed by the Utah Department of Human Services, Office of Licensing, and will not be ",
            smallfontB));
    item.add(new Phrase("eligible to proceed with foster care or adoption.", smallfontB));
    item.setSpacingBefore(4.0f);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("3.", mediumfont));
    paragraph = new Paragraph(fixedLeadingSmall);
    paragraph.add(new Phrase("You will need to take with you:", smallfont));
    item.add(paragraph);
    List subList = new List(false, 10);
    subList.setIndentationLeft(10);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase("This original letter. Photocopies and facsimile (FAX) copies will not be accepted.",
            smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(new Phrase(
            "Photo I.D. in the form of your driver license or state identification card issued by the Division of Motor Vehicles.",
            smallfont));
    subList.add(subItem);
    subItem = new ListItem(fixedLeadingSmall);
    subItem.add(
            new Phrase("Cash or check as required (see site list for acceptable form of payment).", smallfont));
    subList.add(subItem);
    item.add(subList);
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("4.", mediumfont));
    item.add(new Phrase(
            "If the electronically submitted fingerprints are rejected, the Office of Licensing will notify the applicant/licensed program ",
            smallfont));
    item.add(new Phrase("of additional instructions for completing the nationwide background search.",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);

    item = new ListItem(fixedLeadingSmall);
    item.setListSymbol(new Chunk("5.", mediumfont));
    item.add(new Phrase(
            "Applicant Signature ___________________________________________________  Date ________________",
            smallfont));
    item.setSpacingBefore(page1ListSpace);
    blist.add(item);
    document.add(blist);
    /*
     * End of instructions list section
     */

    paragraph = new Paragraph();
    paragraph.add(new Phrase(
            "A current list of Livescan sites is available at www.hslic.utah.gov/docs/livescan sites.pdf",
            smallfont));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeadingMedium);
    paragraph.add(new Phrase("Live Scan Operator: Keep this original for auditing purposes.", mediumfontB));
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);
}

From source file:ihm.panneaux.GenererPdf.java

private void initComponement() throws FileNotFoundException, DocumentException, IOException {
    String DEST = "devis/devis-" + devis.getNumero() + ".pdf";
    OutputStream file = new FileOutputStream(new File(DEST));

    com.itextpdf.text.Document document = new com.itextpdf.text.Document();
    PdfWriter.getInstance((com.itextpdf.text.Document) document, file);
    // PAS TOUCHE
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(DEST));

    Rectangle rect = new Rectangle(30, 30, 550, 800);
    writer.setBoxSize("art", rect);
    HeaderFooterPageEvent event = new HeaderFooterPageEvent();
    writer.setPageEvent(event);/* w w w . jav  a  2  s  .co m*/
    document.open();
    PdfContentByte canvas = writer.getDirectContent();

    Image logo = Image.getInstance("images/logo.png");
    logo.scaleAbsolute(200, 57);

    // INFO DEVIS
    Image devisImg = Image.getInstance("images/imgDevis.png");
    devisImg.scaleAbsolute(110, 34);
    devisImg.setAbsolutePosition((PageSize.POSTCARD.getWidth() + 150),
            (PageSize.POSTCARD.getHeight() - devisImg.getScaledHeight()) * 2);
    Font fontImgDevis = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
    Phrase numeroInfo = new Phrase("Numro  " + devis.getNumero(), fontImgDevis);
    ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, numeroInfo, devisImg.getScaledWidth() + 413,
            devisImg.getScaledHeight() + 710, 0);
    Phrase dateInfo = new Phrase("Le  " + devis.getDate(), fontImgDevis);
    ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, dateInfo, devisImg.getScaledWidth() + 420,
            devisImg.getScaledHeight() + 695, 0);
    Image devisImgBordure = Image.getInstance("images/bordureDevis.png");
    devisImgBordure.setAbsolutePosition((devisImg.getScaledWidth() + 318), devisImg.getScaledHeight() + 660);
    devisImgBordure.scaleAbsolute(120, 122);

    // INFO ENTREPRISE
    Font fontEntreprise = new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.BOLD);
    Phrase coGerants = new Phrase("Co-grants : " + devis.getEntreprise().getCoGerant(), fontEntreprise);
    ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, coGerants, devisImg.getScaledWidth() + 210,
            devisImg.getScaledHeight() + 660, 0);
    Phrase siege = new Phrase("Sige : " + devis.getEntreprise().getSiege(), fontEntreprise);
    ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, siege, devisImg.getScaledWidth() + 149,
            devisImg.getScaledHeight() + 640, 0);
    Phrase tel = new Phrase("TEL : " + devis.getEntreprise().getTel(), fontEntreprise);
    ColumnText.showTextAligned(canvas, Element.ALIGN_RIGHT, tel, devisImg.getScaledWidth() + 113,
            devisImg.getScaledHeight() + 625, 0);
    Image bordureEntreprise = Image.getInstance("images/bordureEntreprise.png");
    bordureEntreprise.setAbsolutePosition(devisImg.getScaledWidth() - 80, devisImg.getScaledHeight() + 610);

    // INFO CLIENT
    Font fontClient = new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL);
    Phrase nomPrenom = new Phrase(devis.getClient().getNom() + " " + devis.getClient().getPrenom(), fontClient);
    Phrase commune = new Phrase(devis.getClient().getAdresse(), fontClient);
    Phrase adresse = new Phrase(devis.getClient().getCodePostale() + " " + devis.getClient().getCommune(),
            fontClient);
    ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, nomPrenom, PageSize.A4.getWidth() - 280,
            devisImg.getScaledHeight() + 595, 0);
    ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, commune, PageSize.A4.getWidth() - 280,
            devisImg.getScaledHeight() + 580, 0);
    ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, adresse, PageSize.A4.getWidth() - 280,
            devisImg.getScaledHeight() + 565, 0);

    document.add(logo);
    document.add(devisImg);
    document.add(devisImgBordure);
    document.add(bordureEntreprise);

    // AJOUT DES DONNEES DU TABLEAUX 

    float[] columnWidths = { 14, 3, 4, 3, 4 };
    Font fontCategorie = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
    fontCategorie.setColor(BaseColor.GREEN);

    PdfPTable table = new PdfPTable(columnWidths);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

    table.setTotalWidth(PageSize.A4.getWidth() - 15);

    table.setSpacingBefore(150);

    table.setLockedWidth(true);

    Font Categorie = new Font(FontFamily.HELVETICA, 13, Font.BOLD);
    Font Chantier = new Font(FontFamily.HELVETICA, 11, Font.UNDERLINE);

    PdfPCell cellChantier = new PdfPCell(new Phrase("CHANTIER : " + chantier, Chantier));
    cellChantier.setColspan(3);
    cellChantier.setBorder(Rectangle.NO_BORDER);
    table.addCell(cellChantier);
    table.addCell(" ");
    table.addCell(" ");

    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");

    table.addCell(new Phrase("Dsignation", Categorie));
    PdfPCell unite = new PdfPCell(new Phrase("Unite", Categorie));
    PdfPCell quantite = new PdfPCell(new Phrase("Quantite", Categorie));
    PdfPCell prixht = new PdfPCell(new Phrase("Prix HT", Categorie));
    PdfPCell pvtht = new PdfPCell(new Phrase("Pvt HT", Categorie));

    unite.setHorizontalAlignment(Element.ALIGN_CENTER);
    quantite.setHorizontalAlignment(Element.ALIGN_CENTER);
    prixht.setHorizontalAlignment(Element.ALIGN_CENTER);
    pvtht.setHorizontalAlignment(Element.ALIGN_CENTER);

    unite.setBorder(Rectangle.NO_BORDER);
    quantite.setBorder(Rectangle.NO_BORDER);
    prixht.setBorder(Rectangle.NO_BORDER);
    pvtht.setBorder(Rectangle.NO_BORDER);

    table.addCell(unite);
    table.addCell(quantite);
    table.addCell(prixht);
    table.addCell(pvtht);

    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");

    double htTotalParcour = 0;
    double ttcTotalParcour = 0;

    if (this.EquipementDeChantier.isEmpty() == false) {
        table.addCell(new Phrase("Equipement De Chantier", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");

        for (DevisContenu listeMaterielDevi : EquipementDeChantier) {

            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            /* BACKUP
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            table.addCell(listeMaterielDevi.getMateriel().getUnite());
            table.addCell(Double.toString(listeMaterielDevi.getQuantite()));
            table.addCell(Double.toString(listeMaterielDevi.getMateriel().getPrix())+"");
            table.addCell(Double.toString(listeMaterielDevi.getPvtHT())+"");
            */
            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
    }
    if (Couverture.isEmpty() == false) {
        table.addCell(new Phrase("Couverture", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : Couverture) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
    }
    if (CouvertureArdoise.isEmpty() == false) {
        table.addCell(new Phrase("Couverture Ardoise", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : CouvertureArdoise) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
    }
    if (CouvertureTuile.isEmpty() == false) {
        table.addCell(new Phrase("Couverture Tuile", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : CouvertureTuile) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
    }
    if (this.Demoussage.isEmpty() == false) {
        table.addCell(new Phrase("Demoussage", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : Demoussage) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");

    }
    if (this.Velux.isEmpty() == false) {
        table.addCell(new Phrase("Velux", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : Velux) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");

    }
    if (this.Zinguerie.isEmpty() == false) {
        table.addCell(new Phrase("Zinguerie", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : Zinguerie) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
    }
    if (Plancher.isEmpty() == false) {
        table.addCell(new Phrase("Plancher", fontCategorie));
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        for (DevisContenu listeMaterielDevi : Plancher) {
            table.addCell(listeMaterielDevi.getMateriel().getNom());
            PdfPCell cellunite = new PdfPCell(new Phrase(listeMaterielDevi.getMateriel().getUnite()));
            PdfPCell cellQuantite = new PdfPCell(new Phrase(Double.toString(listeMaterielDevi.getQuantite())));
            PdfPCell cellprix = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getMateriel().getPrix()) + ""));
            PdfPCell cellpvtHT = new PdfPCell(
                    new Phrase(Double.toString(listeMaterielDevi.getPvtHT()) + ""));
            cellunite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellQuantite.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellprix.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellpvtHT.setHorizontalAlignment(Element.ALIGN_CENTER);

            cellunite.setBorder(Rectangle.NO_BORDER);
            cellQuantite.setBorder(Rectangle.NO_BORDER);
            cellprix.setBorder(Rectangle.NO_BORDER);
            cellpvtHT.setBorder(Rectangle.NO_BORDER);

            table.addCell(cellunite);
            table.addCell(cellQuantite);
            table.addCell(cellprix);
            table.addCell(cellpvtHT);

            ttcTotalParcour += listeMaterielDevi.getPvtHT();
            htTotalParcour += listeMaterielDevi.getPvtHT();
        }
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
        table.addCell(" ");
    }

    ttcTotalParcour = (ttcTotalParcour * devis.getTva() / 100) + ttcTotalParcour;

    LineDash solid = new SolidLine();
    PdfPCell cell, cell2, cellSOUSTOTAL, cellhttotal, tva, getTva, totalttc, gettotalttc;

    table.addCell(new Phrase(" "));
    table.addCell(new Phrase(" "));
    table.addCell(new Phrase(" "));
    table.addCell(new Phrase(" "));

    cell = new PdfPCell(new Phrase(""));
    cell.setBorder(PdfPCell.NO_BORDER);
    cell.setCellEvent(new CustomBorder(null, null, null, solid));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    table.addCell(new Phrase(""));
    table.addCell(new Phrase(""));
    cellSOUSTOTAL = new PdfPCell(new Phrase("SOUS-TOTAL"));
    cellSOUSTOTAL.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    cellSOUSTOTAL.setBorder(Rectangle.NO_BORDER);
    table.addCell(cellSOUSTOTAL);
    table.addCell(new Phrase(""));
    double prixHT_2Chiffre = Math.round((htTotalParcour) * Math.pow(10, 2)) / Math.pow(10, 2);
    String httotal = String.valueOf(prixHT_2Chiffre);
    cellhttotal = new PdfPCell(new Phrase(httotal + ""));
    cellhttotal.setBorder(Rectangle.NO_BORDER);
    cellhttotal.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cellhttotal);

    table.addCell(new Phrase(""));
    table.addCell(new Phrase(""));
    tva = new PdfPCell(new Phrase("TVA"));
    tva.setBorder(Rectangle.NO_BORDER);
    tva.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(tva);

    getTva = new PdfPCell(new Phrase(devis.getTva() + "%"));
    getTva.setBorder(Rectangle.NO_BORDER);
    getTva.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(getTva);

    String tvaprix = String.valueOf(htTotalParcour * devis.getTva() / 100);
    double prixTVA_2Chiffre = Math.round(Double.parseDouble(tvaprix) * Math.pow(10, 2)) / Math.pow(10, 2);
    cell2 = new PdfPCell(new Phrase(Double.toString(prixTVA_2Chiffre) + ""));
    cell2.setBorder(PdfPCell.NO_BORDER);
    cell2.setCellEvent(new CustomBorder(null, null, null, solid));
    cell2.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell2);

    table.addCell("");
    table.addCell("");
    totalttc = new PdfPCell(new Phrase("Total TTC"));
    totalttc.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    totalttc.setBorder(PdfPCell.NO_BORDER);
    table.addCell(totalttc);
    table.addCell("");
    double prixTTC_2Chiffre = Math.round(ttcTotalParcour * Math.pow(10, 2)) / Math.pow(10, 2);
    String ttctotal = String.valueOf(Double.toString(prixTTC_2Chiffre));
    gettotalttc = new PdfPCell(new Phrase(ttctotal + ""));
    gettotalttc.setBorder(PdfPCell.NO_BORDER);
    gettotalttc.setHorizontalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(gettotalttc);

    table.setSpacingAfter(10);

    document.add(table);

    Pattern p = Pattern.compile("[.^\\.]+");
    String texte = devis.getInformationComplementaire();

    Font infoComptBlue = new Font(Font.getFamily("TIMES_ROMAN"), 8, Font.NORMAL);
    infoComptBlue.setColor(BaseColor.BLUE);
    Font infoComptRed = new Font(Font.getFamily("TIMES_ROMAN"), 8, Font.NORMAL);
    infoComptRed.setColor(BaseColor.RED);
    Font infoComptBlack = new Font(Font.getFamily("TIMES_ROMAN"), 8, Font.NORMAL);
    infoComptBlack.setColor(BaseColor.BLACK);

    Paragraph infoComp = new Paragraph();
    Image BonPourAccord = null;
    BonPourAccord = Image.getInstance("images/BonPourAccord.png");
    infoComp.setAlignment(Element.ALIGN_LEFT);
    BonPourAccord.setAlignment(Image.TEXTWRAP | Image.ALIGN_RIGHT);

    String[] phrase = p.split(texte);
    for (int i = 0; i < phrase.length; i++) {
        if (i == 0 || i == 1) {
            infoComp.add(new Paragraph(phrase[i], infoComptBlue));
        }
        if (i == 2 || i == 3 || i == 4 || i == 5) {
            infoComp.add(new Paragraph(phrase[i], infoComptRed));

        }
        if (i > 5 && i <= 11)
            infoComp.add(new Paragraph(phrase[i], infoComptBlack));
        if (i > 11)
            infoComp.add(new Paragraph(phrase[i], infoComptRed));
    }
    /* A OPTIMISER */

    float taille_tableau = table.calculateHeights() + table.getRowHeight(table.getLastCompletedRowIndex());

    if (taille_tableau > 386) {
        document.newPage();
    }
    document.add(BonPourAccord);
    document.add(infoComp);

    document.close();

    EnvoieDevis envoie = new EnvoieDevis(null, true, session, devis);
    this.CouvertureArdoise.clear();
    this.CouvertureTuile.clear();
    this.Demoussage.clear();
    this.EquipementDeChantier.clear();
    this.Velux.clear();
    this.Zinguerie.clear();
    this.Couverture.clear();
    this.Plancher.clear();
}

From source file:jsimpresos.ConexionCorteCaja.java

public void crearPdf(int idCorte) {
    try {//from  w ww  . j  a v  a2  s .com
        String query1 = "select * from detalleabono where idcorte=?";
        PreparedStatement st = this.getConexion().prepareStatement(query1);
        st.setInt(1, idCorte);
        ResultSet rs = st.executeQuery();
        ArrayList<Abono> abonos = new ArrayList();
        while (rs.next()) {
            abonos.add(new Abono(rs.getInt(1), rs.getDouble(2), rs.getString(3), rs.getString(4),
                    rs.getString(5), rs.getInt(6)));
        }
        String query2 = "select * from transaccionesmiembro where idcorte=?";
        PreparedStatement st2 = this.getConexion().prepareStatement(query2);
        st2.setInt(1, idCorte);
        ResultSet rs2 = st2.executeQuery();
        ArrayList<TransaccionesMiembro> transaccionesMiembro = new ArrayList();
        while (rs2.next()) {
            transaccionesMiembro.add(new TransaccionesMiembro(rs2.getInt(1), rs2.getString(2), rs2.getDouble(3),
                    rs2.getString(4), rs2.getInt(5)));
        }
        String query3 = "select * from cortesdecaja where idcorte =?";
        PreparedStatement st3 = this.getConexion().prepareStatement(query3);
        st3.setInt(1, idCorte);
        ResultSet rs3 = st3.executeQuery();
        String fecha = "";
        while (rs3.next()) {
            fecha = Fechas.convertirFecha(rs3.getString(2));
        }
        ArrayList<Abono> abonosEfectivo = new ArrayList();
        ArrayList<Abono> abonosTarjeta = new ArrayList();
        ArrayList<TransaccionesMiembro> recargasSaldo = new ArrayList();
        ArrayList<TransaccionesMiembro> transaccionesPaypal = new ArrayList();
        ArrayList<TransaccionesMiembro> registrosCliente = new ArrayList();
        for (int i = 0; i < abonos.size(); i++) {
            String tipo = abonos.get(i).getTipoPago();
            switch (tipo) {
            case "Efectivo":
                abonosEfectivo.add(abonos.get(i));
                break;
            case "Tarjeta":
                abonosTarjeta.add(abonos.get(i));
                break;
            }

        }
        for (int i = 0; i < transaccionesMiembro.size(); i++) {
            String tipo = transaccionesMiembro.get(i).getMovimiento();
            switch (tipo) {
            case "Recarga":
                recargasSaldo.add(transaccionesMiembro.get(i));
                break;
            case "Paypal":
                transaccionesPaypal.add(transaccionesMiembro.get(i));
                break;
            case "Registro":
                registrosCliente.add(transaccionesMiembro.get(i));
                break;
            }

        }
        int mayorEfectivo;
        if (abonosEfectivo.size() >= recargasSaldo.size() && abonosEfectivo.size() >= registrosCliente.size()) {
            mayorEfectivo = abonosEfectivo.size();
        } else {
            if (recargasSaldo.size() >= registrosCliente.size()) {
                mayorEfectivo = recargasSaldo.size();
            } else {
                mayorEfectivo = registrosCliente.size();
            }
        }
        int mayorOtros;
        if (abonosTarjeta.size() >= transaccionesPaypal.size()) {
            mayorOtros = abonosTarjeta.size();
        } else {
            mayorOtros = transaccionesPaypal.size();
        }
        Document documento = new Document();
        FileOutputStream ficheroPdf;
        try {
            File carpeta = new File("C:\\archivosPuntoDeVenta");
            if (!carpeta.exists()) {
                carpeta.mkdir();
            }
            ficheroPdf = new FileOutputStream("c:/archivosPuntoDeVenta/corte.pdf");
            PdfWriter.getInstance(documento, ficheroPdf).setInitialLeading(20);
            documento.setMargins(0, 0, 0, 0);
            documento.open();
            PdfPTable tabla = new PdfPTable(8);
            tabla.setWidths(new float[] { 20, 10, 10, 20, 10, 10, 20, 10 });
            tabla.setWidthPercentage(100);
            PdfPCell celdaVacia = new PdfPCell(new Paragraph(" "));
            celdaVacia.setBorder(Rectangle.NO_BORDER);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            PdfPCell celda1 = new PdfPCell(new Paragraph("Corte de caja del da " + fecha,
                    FontFactory.getFont("Arial", 12, Font.BOLD)));
            celda1.setColspan(3);
            celda1.setBorder(Rectangle.NO_BORDER);
            tabla.addCell(celda1);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            PdfPCell celda2 = new PdfPCell(
                    new Paragraph("Transacciones en efectivo: ", FontFactory.getFont("Arial", 11, Font.BOLD)));
            celda2.setColspan(3);
            celda2.setBorder(Rectangle.NO_BORDER);
            tabla.addCell(celda2);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            PdfPCell celda3 = new PdfPCell(
                    new Paragraph("Abonos en efectivo", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda3);
            PdfPCell celda4 = new PdfPCell(new Paragraph("Monto", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda4);
            tabla.addCell(celdaVacia);
            PdfPCell celda5 = new PdfPCell(
                    new Paragraph("Recargas de saldo", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda5);
            tabla.addCell(celda4);
            tabla.addCell(celdaVacia);
            PdfPCell celda6 = new PdfPCell(
                    new Paragraph("Registro de clientes", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda6);
            tabla.addCell(celda4);
            double totalAbonosEfectivo = 0;
            double totalRecargasSaldo = 0;
            double totalRegistrosCliente = 0;
            for (int i = 0; i <= mayorEfectivo; i++) {
                if (abonosEfectivo.size() > i) {
                    PdfPCell celda7 = new PdfPCell(
                            new Paragraph("Abono a la nota " + abonosEfectivo.get(i).getId(),
                                    FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda7);
                    PdfPCell celda8 = new PdfPCell(new Paragraph("$" + abonosEfectivo.get(i).getMonto(),
                            FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda8);
                    totalAbonosEfectivo += abonosEfectivo.get(i).getMonto();
                } else {
                    if (abonosEfectivo.size() == i) {
                        PdfPCell celda7 = new PdfPCell(new Paragraph("Total", FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda7);
                        PdfPCell celda8 = new PdfPCell(
                                new Paragraph("$" + totalAbonosEfectivo, FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda8);
                    } else {
                        tabla.addCell(celdaVacia);
                        tabla.addCell(celdaVacia);
                    }
                }
                tabla.addCell(celdaVacia);
                if (recargasSaldo.size() > i) {
                    PdfPCell celda7 = new PdfPCell(
                            new Paragraph("Recarga al cliente " + recargasSaldo.get(i).getIdMiembro(),
                                    FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda7);
                    PdfPCell celda8 = new PdfPCell(new Paragraph("$" + recargasSaldo.get(i).getMonto(),
                            FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda8);
                    totalRecargasSaldo += recargasSaldo.get(i).getMonto();
                } else {
                    if (recargasSaldo.size() == i) {
                        PdfPCell celda7 = new PdfPCell(new Paragraph("Total", FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda7);
                        PdfPCell celda8 = new PdfPCell(
                                new Paragraph("$" + totalRecargasSaldo, FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda8);
                    } else {
                        tabla.addCell(celdaVacia);
                        tabla.addCell(celdaVacia);
                    }
                }
                tabla.addCell(celdaVacia);
                if (registrosCliente.size() > i) {
                    PdfPCell celda7 = new PdfPCell(
                            new Paragraph("Registro del cliente " + registrosCliente.get(i).getIdMiembro(),
                                    FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda7);
                    PdfPCell celda8 = new PdfPCell(new Paragraph("$" + registrosCliente.get(i).getMonto(),
                            FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda8);
                    totalRegistrosCliente += registrosCliente.get(i).getMonto();
                } else {
                    if (recargasSaldo.size() == i) {
                        PdfPCell celda7 = new PdfPCell(new Paragraph("Total", FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda7);
                        PdfPCell celda8 = new PdfPCell(
                                new Paragraph("$" + totalRegistrosCliente, FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda8);
                    } else {
                        tabla.addCell(celdaVacia);
                        tabla.addCell(celdaVacia);
                    }
                }
            }
            PdfPCell celda9 = new PdfPCell(new Paragraph(
                    "Total de pagos en efectivo: $"
                            + (totalAbonosEfectivo + totalRecargasSaldo + totalRegistrosCliente),
                    FontFactory.getFont("Arial", 9, Font.BOLD)));
            celda9.setBorder(Rectangle.NO_BORDER);
            celda9.setColspan(8);
            tabla.addCell(celda9);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            PdfPCell celda10 = new PdfPCell(
                    new Paragraph("Otras transacciones: ", FontFactory.getFont("Arial", 11, Font.BOLD)));
            celda10.setColspan(3);
            celda10.setBorder(Rectangle.NO_BORDER);
            tabla.addCell(celda10);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            PdfPCell celda11 = new PdfPCell(
                    new Paragraph("Abonos con tarjeta", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda11);
            PdfPCell celda12 = new PdfPCell(
                    new Paragraph("Monto", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda12);
            tabla.addCell(celdaVacia);
            PdfPCell celda13 = new PdfPCell(
                    new Paragraph("Paypal", FontFactory.getFont("Arial", 10, Font.BOLD)));
            tabla.addCell(celda13);
            tabla.addCell(celda12);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            tabla.addCell(celdaVacia);
            double totalAbonosTarjeta = 0;
            double totalPaypal = 0;
            for (int i = 0; i <= mayorOtros; i++) {
                if (abonosTarjeta.size() > i) {
                    PdfPCell celda7 = new PdfPCell(
                            new Paragraph("Abono a la nota " + abonosTarjeta.get(i).getId(),
                                    FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda7);
                    PdfPCell celda8 = new PdfPCell(new Paragraph("$" + abonosTarjeta.get(i).getMonto(),
                            FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda8);
                    totalAbonosTarjeta += abonosTarjeta.get(i).getMonto();
                } else {
                    if (abonosTarjeta.size() == i) {
                        PdfPCell celda7 = new PdfPCell(new Paragraph("Total", FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda7);
                        PdfPCell celda8 = new PdfPCell(
                                new Paragraph("$" + totalAbonosTarjeta, FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda8);
                    } else {
                        tabla.addCell(celdaVacia);
                        tabla.addCell(celdaVacia);
                    }
                }
                tabla.addCell(celdaVacia);
                if (transaccionesPaypal.size() > i) {
                    PdfPCell celda7 = new PdfPCell(new Paragraph(
                            "Recarga con Paypal al cliente " + transaccionesPaypal.get(i).getIdMiembro(),
                            FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda7);
                    PdfPCell celda8 = new PdfPCell(new Paragraph("$" + transaccionesPaypal.get(i).getMonto(),
                            FontFactory.getFont("Arial", 9)));
                    tabla.addCell(celda8);
                    totalPaypal += transaccionesPaypal.get(i).getMonto();
                } else {
                    if (transaccionesPaypal.size() == i) {
                        PdfPCell celda7 = new PdfPCell(new Paragraph("Total", FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda7);
                        PdfPCell celda8 = new PdfPCell(
                                new Paragraph("$" + totalPaypal, FontFactory.getFont("Arial", 9)));
                        tabla.addCell(celda8);
                    } else {
                        tabla.addCell(celdaVacia);
                        tabla.addCell(celdaVacia);
                    }
                }
                tabla.addCell(celdaVacia);
                tabla.addCell(celdaVacia);
                tabla.addCell(celdaVacia);

            }
            documento.add(tabla);
            documento.close();
            abrirPDF();
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(null, "Error al generar el pdf");
        } catch (DocumentException ex) {
            JOptionPane.showMessageDialog(null, "Error al guardar pdf");
        }
    } catch (SQLException ex) {
        System.out.println(ex.getMessage());
        JOptionPane.showMessageDialog(null, "Error al conectar a la base de datos");
    }
}