Example usage for com.itextpdf.text Paragraph add

List of usage examples for com.itextpdf.text Paragraph add

Introduction

In this page you can find the example usage for com.itextpdf.text Paragraph add.

Prototype

@Override
public boolean add(Element o) 

Source Link

Document

Adds an Element to the Paragraph.

Usage

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

private static PdfPTable populateLicenseInformation(FacilityLicenseView license) throws DocumentException {
    Paragraph paragraph;
    PdfPTable datatable = getLicenseDetailTable();

    // Put License Number
    datatable.getDefaultCell().setPaddingLeft(4);
    datatable.getDefaultCell().setPaddingRight(2);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
    datatable.addCell(new Phrase("License No:", smallfontB));
    datatable.getDefaultCell().setPaddingLeft(4);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    if (license.getLicenseNumber() != null) {
        datatable.addCell(new Phrase(license.getLicenseNumber().toString(), smallfont));
    } else {/*w  w w  .  j av a 2 s. c  o  m*/
        datatable.addCell(BLANK);
    }

    // Put Service information
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
    datatable.addCell(new Phrase("Service: ", smallfontB));
    datatable.getDefaultCell().setColspan(3);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    if (StringUtils.isNotBlank(license.getServiceCodeDesc())) {
        datatable.addCell(new Phrase(license.getServiceCodeDesc(), smallfont));
    } else {
        datatable.addCell(BLANK);
    }

    // Put License Expiration
    paragraph = new Paragraph(fixedLeading);
    paragraph.add(new Phrase("Expires: ", smallfontB));
    if (license.getExpirationDate() != null) {
        paragraph.add(new Phrase(df.format(license.getExpirationDate()), smallfont));
    }
    datatable.getDefaultCell().setColspan(1);
    datatable.getDefaultCell().setPaddingRight(4);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
    datatable.addCell(paragraph);

    // Add the License SubType Information
    datatable.getDefaultCell().setPaddingLeft(4);
    datatable.getDefaultCell().setPaddingRight(2);
    datatable.addCell(new Phrase("Type:", smallfontB));
    datatable.getDefaultCell().setPaddingLeft(2);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    if (StringUtils.isNotBlank(license.getSubtype())) {
        datatable.addCell(new Phrase(license.getSubtype(), smallfont));
    } else {
        datatable.addCell(BLANK);
    }

    // Add Specific Service
    datatable.getDefaultCell().setPaddingLeft(2);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
    datatable.addCell(new Phrase("Specific Service: ", smallfontB));
    datatable.getDefaultCell().setPaddingRight(4);
    datatable.getDefaultCell().setColspan(4);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    if (StringUtils.isNotBlank(license.getSpecificServiceCode())) {
        datatable.addCell(new Phrase(license.getSpecificServiceCode(), smallfont));
    } else {
        datatable.addCell(BLANK);
    }

    // Add License Capacity Information
    datatable.getDefaultCell().setColspan(1);
    datatable.getDefaultCell().setPaddingLeft(4);
    datatable.getDefaultCell().setPaddingRight(2);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
    datatable.addCell(new Phrase("Age Group: ", smallfontB));
    datatable.getDefaultCell().setPaddingLeft(2);
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    if (StringUtils.isNotBlank(license.getAgeGroup())) {
        datatable.addCell(new Phrase(license.getAgeGroup(), smallfont));
    } else {
        datatable.addCell(BLANK);
    }

    // Add Age Group total capacity
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
    datatable.addCell(new Phrase("Capacity:", smallfontB));
    datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    if ("Youth".equalsIgnoreCase(license.getAgeGroup())) {
        // Youth capacity
        if (license.getYouthTotalSlots() != null) {
            datatable.addCell(new Phrase(license.getYouthTotalSlots().toString(), smallfont));
        } else {
            datatable.addCell(BLANK);
        }
    } else {
        // Adult capacity
        if (license.getAdultTotalSlots() != null) {
            datatable.addCell(new Phrase(license.getAdultTotalSlots().toString(), smallfont));
        } else {
            datatable.addCell(BLANK);
        }
    }

    // Add Age Group ages
    paragraph = new Paragraph(fixedLeading);
    paragraph.add(new Phrase("Ages: ", smallfontB));
    if (license.getFromAge() != null || license.getToAge() != null) {
        sb = new StringBuilder();
        if (license.getFromAge() != null) {
            sb.append(license.getFromAge().toString());
            if (license.getToAge() != null) {
                sb.append(" to " + license.getToAge().toString());
            } else {
                sb.append(" and Older");
            }
        } else {
            sb.append("to " + license.getToAge().toString());
        }
        paragraph.add(new Phrase(sb.toString(), smallfont));
    }
    datatable.addCell(paragraph);

    // Add Age Group Male and Female Counts
    if ("Adult".equalsIgnoreCase(license.getAgeGroup()) || "Youth".equalsIgnoreCase(license.getAgeGroup())) {
        if ("Adult".equalsIgnoreCase(license.getAgeGroup())) {
            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("Male: ", smallfontB));
            if (license.getAdultMaleCount() != null) {
                paragraph.add(new Phrase(license.getAdultMaleCount().toString(), smallfont));
            }
            datatable.addCell(paragraph);

            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("Female: ", smallfontB));
            if (license.getAdultFemaleCount() != null) {
                paragraph.add(new Phrase(license.getAdultFemaleCount().toString(), smallfont));
            }
            datatable.getDefaultCell().setPaddingRight(4);
            datatable.addCell(paragraph);
        } else {
            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("Male: ", smallfontB));
            if (license.getYouthMaleCount() != null) {
                paragraph.add(new Phrase(license.getYouthMaleCount().toString(), smallfont));
            }
            datatable.addCell(paragraph);

            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("Female: ", smallfontB));
            if (license.getYouthFemaleCount() != null) {
                paragraph.add(new Phrase(license.getYouthFemaleCount().toString(), smallfont));
            }
            datatable.getDefaultCell().setPaddingRight(4);
            datatable.addCell(paragraph);
        }
    } else {
        datatable.getDefaultCell().setColspan(2);
        datatable.addCell(BLANK);
    }

    // Add Program Code Information
    if (license.getProgramCodeIds() != null && license.getProgramCodeIds().size() > 0) {
        for (PickListValue prog : license.getProgramCodeIds()) {
            datatable.getDefaultCell().setColspan(1);
            datatable.getDefaultCell().setPaddingLeft(4);
            datatable.getDefaultCell().setPaddingRight(2);
            datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_RIGHT);
            datatable.addCell(new Phrase("Program:", smallfontB));
            datatable.getDefaultCell().setColspan(6);
            datatable.getDefaultCell().setPaddingRight(4);
            datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
            String program = getPickListValueDesc(prog);
            if (StringUtils.isNotBlank(program)) {
                datatable.addCell(new Phrase(program, smallfont));
            } else {
                datatable.addCell(BLANK);
            }
        }
    }

    return datatable;
}

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

private static void writePdf(Person specialist, Date endDate, FacilityLicenseSummarySortBy sortBy,
        List<FacilityLicenseView> licenses, OutputStream ba) throws DocumentException, BadElementException {
    Document document = null;//w  w  w  . j av a  2 s .  c  o m
    PdfPTable doctable;
    PdfPTable datatable;
    PdfPTable factable;
    Paragraph paragraph;
    Facility facility;
    document = new Document(PageSize.A4);
    @SuppressWarnings("unused")
    PdfWriter writer = PdfWriter.getInstance(document, ba);

    document.open();

    doctable = getDocumentTable(specialist, endDate, sortBy);

    if (licenses != null && licenses.size() > 0) {
        doctable.getDefaultCell().setPaddingBottom(4);
        doctable.getDefaultCell().setBorderWidthBottom(.5f);
        for (FacilityLicenseView license : licenses) {
            facility = license.getFacility();
            datatable = getDetailTable();
            datatable.getDefaultCell().setPaddingLeft(4);
            datatable.getDefaultCell().setPaddingRight(2);
            datatable.getDefaultCell().setColspan(1);
            // Add Facility Name information
            if (StringUtils.isNotBlank(license.getFacilityName())) {
                datatable.addCell(new Phrase(license.getFacilityName(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add License Number information
            datatable.getDefaultCell().setPaddingLeft(2);
            if (license.getLicenseNumber() != null) {
                datatable.addCell(new Phrase(license.getLicenseNumber().toString(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add Service Code information
            if (StringUtils.isNotBlank(license.getServiceCodeCode())) {
                datatable.addCell(new Phrase(license.getServiceCodeCode(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add License Type information
            if (StringUtils.isNotBlank(license.getSubtype())) {
                datatable.addCell(new Phrase(license.getSubtype(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add License Expiration date information
            datatable.getDefaultCell().setPaddingRight(4);
            if (StringUtils.isNotBlank(license.getExpirationDateFormatted())) {
                datatable.addCell(new Phrase(license.getExpirationDateFormatted(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }

            // Add Mailing Location information
            sb = new StringBuilder();
            if (facility != null && facility.getMailingAddress() != null
                    && StringUtils.isNotBlank(facility.getMailingAddress().getAddressOne())) {
                sb.append(facility.getMailingAddress().getAddressOne());

                // add address two
                if (StringUtils.isNotBlank(facility.getMailingAddress().getAddressTwo())) {
                    if (sb.length() > 0) {
                        sb.append(" ");
                    }
                    sb.append(facility.getMailingAddress().getAddressTwo());
                }

                // Add city, state, zip
                if (StringUtils.isNotBlank(facility.getMailingAddress().getCityStateZip())) {
                    if (sb.length() > 0) {
                        sb.append(", ");
                    }
                    sb.append(facility.getMailingAddress().getCityStateZip());
                }
            }
            datatable.getDefaultCell().setColspan(5);
            datatable.getDefaultCell().setPaddingLeft(4);
            datatable.getDefaultCell().setPaddingRight(4);
            if (sb.length() > 0) {
                datatable.addCell(new Phrase(sb.toString().toUpperCase(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }

            //
            // Add Facility details information
            // 
            factable = getFacilityDetailsTable();

            // Add primary phone information
            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("Primary Phone: ", smallfontB));
            if (facility != null && facility.getPrimaryPhone() != null
                    && StringUtils.isNotBlank(facility.getPrimaryPhone().getFormattedPhoneNumber())) {
                paragraph.add(new Phrase(facility.getPrimaryPhone().getFormattedPhoneNumber(), smallfont));
            }
            factable.getDefaultCell().setPaddingLeft(4);
            factable.getDefaultCell().setPaddingRight(2);
            factable.addCell(paragraph);

            // Add SAFE Provider ID number
            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("SAFE: ", smallfontB));
            if (facility != null && facility.getSafeProviderId() != null) {
                paragraph.add(new Phrase(facility.getSafeProviderId().toString(), smallfontB));
            }
            factable.getDefaultCell().setColspan(2);
            factable.addCell(paragraph);

            // Add the facility information table to the details table
            datatable.getDefaultCell().setPadding(0);
            datatable.addCell(factable);
            // Add the detail to the document table
            doctable.addCell(datatable);
        }
    } else {
        // No open applications
        datatable = getDetailTable();
        datatable.getDefaultCell().setPaddingTop(10);
        datatable.getDefaultCell().setColspan(3);
        datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
        datatable.addCell(new Phrase("No expired licenses found to display.", smallfont));
        doctable.getDefaultCell().setPaddingBottom(0);
        doctable.getDefaultCell().setBorderWidthBottom(0);
        doctable.addCell(datatable);
    }

    // Add the document table to the document
    document.add(doctable);

    document.close();
}

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

public static ByteArrayOutputStream generate(java.util.List<FacilityLicenseView> licenses) {
    ByteArrayOutputStream ba = null;
    FacilityLicenseView license;//ww  w .  j a va2 s.c  o m
    Document document = null;
    Date today = new Date();
    try {
        ba = new ByteArrayOutputStream();
        document = new Document(PageSize.LETTER, 75, 75, 175, 50);
        PdfWriter writer = PdfWriter.getInstance(document, ba);

        document.open();

        if (licenses != null && licenses.size() > 0) {
            for (int i = 0; i < licenses.size(); i++) {
                license = licenses.get(i);
                generateDocumentPage(license, today, document, writer);
                // If there is another letter to print add a new page to the document
                if (i < licenses.size() - 1) {
                    document.newPage();
                }
            }
        } else {
            Paragraph paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("No renewal licenses were found to print.", mediumfont));
            document.add(paragraph);
        }

        document.close();
    } catch (Exception ex) {
        log.error(ex.getMessage());
        ba = null;
    }
    return ba;
}

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

private static void generateDocumentPage(FacilityLicenseView license, Date today, Document document,
        PdfWriter writer) throws BadElementException, DocumentException, Exception {
    PdfPTable table = null;//w w w .j  a va2  s.  co m
    int headerwidths[] = {};
    Paragraph paragraph = null;
    com.itextpdf.text.List blist = null;
    com.itextpdf.text.List subList = null;
    ListItem item = null;
    ListItem subItem = null;
    StringBuilder sb;
    PdfContentByte over = writer.getDirectContent();
    Facility facility = license.getFacility();
    Person licensingSpecialist = null;
    if (facility != null && facility.getLicensingSpecialist() != null) {
        licensingSpecialist = facility.getLicensingSpecialist();
    }

    // Add report date
    paragraph = new Paragraph(fixedLeading);
    paragraph.add(new Phrase(df.format(today), mediumfont));
    paragraph.setIndentationLeft(dateIndent);
    document.add(paragraph);

    // Add facility information
    paragraph = new Paragraph(fixedLeading);
    if (facility != null && StringUtils.isNotBlank(facility.getName())) {
        paragraph.add(new Phrase(facility.getName(), mediumfont));
    } else {
        paragraph.add(BLANK);
    }
    if (facility != null && facility.getMailingAddress() != null
            && StringUtils.isNotBlank(facility.getMailingAddress().getAddressOne())) {
        paragraph.add(Chunk.NEWLINE);
        paragraph.add(new Phrase(facility.getMailingAddress().getAddressOne(), mediumfont));
        if (StringUtils.isNotBlank(facility.getMailingAddress().getAddressTwo())) {
            paragraph.add(Chunk.NEWLINE);
            paragraph.add(new Phrase(facility.getMailingAddress().getAddressTwo(), mediumfont));
        }
        if (StringUtils.isNotBlank(facility.getMailingAddress().getCityStateZip())) {
            paragraph.add(Chunk.NEWLINE);
            paragraph.add(new Phrase(facility.getMailingAddress().getCityStateZip(), mediumfont));
        }
    }
    paragraph.setSpacingBefore(15);
    document.add(paragraph);

    // Add salutation
    paragraph = new Paragraph(fixedLeading);
    sb = new StringBuilder();
    sb.append("Dear ");
    if (StringUtils.isNotBlank(facility.getName())) {
        sb.append(facility.getName());
    }
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add due for renewal line
    paragraph = new Paragraph(fixedLeading);
    paragraph.add(new Phrase(
            "Your foster care license is due for renewal on " + df.format(license.getExpirationDate()),
            mediumfontB));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    document.add(paragraph);

    // Add first paragraph
    paragraph = new Paragraph(fixedLeading);
    sb = new StringBuilder();
    sb.append(
            "The Office of Licensing appreciates the services you have provided for DCFS and to the foster children ");
    sb.append(
            "who have been in your care. We hope that you will continue as foster parents for the next year. ");
    sb.append("To continue licensing please complete the following:");
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(pageSeparatorSpace);
    paragraph.setSpacingAfter(pageSeparatorSpace);
    document.add(paragraph);

    /*
     * Start of instructions list section
     */
    blist = new com.itextpdf.text.List(false, 20);
    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("1.", mediumfont));
    item.add(new Phrase("Complete the enclosed Renewal Resource Family Application.", mediumfont));
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("2.", mediumfont));
    sb = new StringBuilder();
    sb.append(
            "Complete the Utah Department of Human Services Office of Licensing Background Screening Application form for everyone ");
    sb.append("18 years of age and older living in the home. Each form must have an original signature.");
    item.add(new Phrase(sb.toString(), mediumfont));
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("3.", mediumfont));
    paragraph = new Paragraph(fixedLeading);
    paragraph.add(
            new Phrase("For everyone 18 years of age or older living in the home please attach:", mediumfont));
    item.add(paragraph);
    subList = new com.itextpdf.text.List(false, 18);
    subList.setIndentationLeft(10);
    subItem = new ListItem(fixedLeading);
    subItem.setListSymbol(new Chunk("(a)", mediumfontB));
    subItem.add(
            new Phrase("A legible copy of a current drivers license or a Utah State I.D. card.", mediumfontB));
    subList.add(subItem);
    subItem = new ListItem(fixedLeading);
    subItem.setListSymbol(new Chunk("(b)", mediumfontB));
    subItem.add(new Phrase("A legible copy of their social security card.", mediumfontB));
    subList.add(subItem);
    item.add(subList);
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("4.", mediumfont));
    item.add(new Phrase("Complete the enclosed Foster Care Renewal Information Form.", mediumfont));
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("5.", mediumfont));
    item.add(new Phrase("Provide copies of income verification (check stubs/or last year's income tax forms.)",
            mediumfontB));
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("6.", mediumfont));
    item.add(new Phrase("All paperwork must be returned 30 days before your license expires to:", mediumfontB));
    subList = new com.itextpdf.text.List(false, 0);
    subList.setListSymbol(new Chunk(" ", mediumfont));
    subList.setIndentationLeft(10);
    subItem = new ListItem(fixedLeading);
    subItem.add(new Phrase("Office of Licensing", mediumfont));
    subItem.setSpacingBefore(listItemSpace);
    subList.add(subItem);
    subItem = new ListItem(fixedLeading);
    if (licensingSpecialist != null && StringUtils.isNotBlank(licensingSpecialist.getFirstAndLastName())) {
        subItem.add(new Phrase(licensingSpecialist.getFirstAndLastName(), mediumfont));
    } else {
        subItem.add(new Phrase("<Facility Licensing Specialist>", mediumfont));
    }
    subList.add(subItem);
    if (licensingSpecialist != null && licensingSpecialist.getAddress() != null
            && StringUtils.isNotBlank(licensingSpecialist.getAddress().getAddressOne())) {
        subItem = new ListItem(fixedLeading);
        subItem.add(new Phrase(licensingSpecialist.getAddress().getAddressOne(), mediumfont));
        subList.add(subItem);
    }
    if (licensingSpecialist != null && licensingSpecialist.getAddress() != null
            && StringUtils.isNotBlank(licensingSpecialist.getAddress().getAddressTwo())) {
        subItem = new ListItem(fixedLeading);
        subItem.add(new Phrase(licensingSpecialist.getAddress().getAddressTwo(), mediumfont));
        subList.add(subItem);
    }
    if (licensingSpecialist != null && licensingSpecialist.getAddress() != null
            && StringUtils.isNotBlank(licensingSpecialist.getAddress().getCityStateZip())) {
        subItem = new ListItem(fixedLeading);
        subItem.add(new Phrase(licensingSpecialist.getAddress().getCityStateZip(), mediumfont));
        subList.add(subItem);
    }
    item.add(subList);
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("7.", mediumfont));
    item.add(new Phrase(
            "Please call and schedule an appointment with me for your annual health and safety check.",
            mediumfont));
    item.setSpacingAfter(listSpace);
    blist.add(item);

    item = new ListItem(fixedLeading);
    item.setListSymbol(new Chunk("8.", mediumfont));
    paragraph = new Paragraph(fixedLeading);
    sb = new StringBuilder();
    sb.append(
            "Complete the DCFS required renewal training of 12 hours for the primary provider and 4 hours for a spouse ");
    sb.append(
            "before your license expires. Please send all training to be approved and documented to the Utah Foster Care Foundation.");
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    item.add(paragraph);
    paragraph = new Paragraph(fixedLeading);
    sb = new StringBuilder();
    sb.append(
            "The Utah Foster Care Foundation will then provide verification of all completed required training ");
    sb.append("to your local licensor.");
    paragraph.add(new Phrase(sb.toString(), mediumfontB));
    item.add(paragraph);
    blist.add(item);

    document.add(blist);
    /*
     * End of instructions list section
     */

    // Add final paragraph
    paragraph = new Paragraph(fixedLeading);
    paragraph.setSpacingBefore(pageSeparatorSpace);
    paragraph.add(new Phrase(
            "Your license will expire if all renewal requirements are not completed by the end of the licensing month. ",
            mediumfont));
    paragraph.add(new Phrase(
            "A license expired beyond 30 days will require initiation of the background screening process again (including ",
            mediumfontB));
    paragraph.add(new Phrase("any necessary fingerprinting). ", mediumfontB));
    paragraph.add(new Phrase(
            "If you choose to discontinue providing services or have any questions, please contact me at ",
            mediumfont));
    if (licensingSpecialist.getWorkPhone() != null
            && StringUtils.isNotBlank(licensingSpecialist.getWorkPhone().getFormattedPhoneNumber())) {
        paragraph.add(new Phrase(licensingSpecialist.getWorkPhone().getFormattedPhoneNumber(), mediumfontB));
    }
    paragraph.add(new Phrase(".", mediumfontB));
    document.add(paragraph);

    // Add closing
    paragraph = new Paragraph(fixedLeading);
    paragraph.setIndentationLeft(rightIndent);
    paragraph.setSpacingBefore(2 * pageSeparatorSpace);
    paragraph.add(new Phrase("Sincerely,", mediumfont));
    document.add(paragraph);

    paragraph = new Paragraph(fixedLeading);
    paragraph.setIndentationLeft(rightIndent);
    paragraph.setSpacingBefore(3 * pageSeparatorSpace);
    if (licensingSpecialist != null && StringUtils.isNotBlank(licensingSpecialist.getFirstAndLastName())) {
        paragraph.add(new Phrase(licensingSpecialist.getFirstAndLastName(), mediumfont));
    } else {
        paragraph.add(new Phrase("<Facility Licensing Specialist>", mediumfont));
    }
    paragraph.add(Chunk.NEWLINE);
    paragraph.add(new Phrase("Foster Family Licensing Specialist", mediumfont));
    document.add(paragraph);

    // Add Enclosures
    paragraph = new Paragraph(fixedLeading);
    paragraph.setSpacingBefore(pageSeparatorSpace);
    paragraph.add(new Phrase("Enclosures", mediumfont));
    paragraph.add(Chunk.NEWLINE);
    paragraph.add(new Phrase("cc: Provider Record", mediumfont));
    document.add(paragraph);
}

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

private static void writePdf(Person specialist, Date endDate, List<FacilityLicenseView> licenses,
        OutputStream ba) throws DocumentException, BadElementException {
    Document document = null;//from  w w w  .j  a  v a 2  s .  c om
    PdfPTable doctable;
    PdfPTable datatable;
    PdfPTable factable;
    Paragraph paragraph;
    Facility facility;
    document = new Document(PageSize.A4);
    @SuppressWarnings("unused")
    PdfWriter writer = PdfWriter.getInstance(document, ba);

    document.open();

    doctable = getDocumentTable(specialist, endDate);

    if (licenses != null && licenses.size() > 0) {
        doctable.getDefaultCell().setPaddingBottom(4);
        doctable.getDefaultCell().setBorderWidthBottom(.5f);
        for (FacilityLicenseView license : licenses) {
            facility = license.getFacility();
            datatable = getDetailTable();
            datatable.getDefaultCell().setPaddingLeft(4);
            datatable.getDefaultCell().setPaddingRight(2);
            datatable.getDefaultCell().setColspan(1);
            // Add Facility Name information
            if (StringUtils.isNotBlank(license.getFacilityName())) {
                datatable.addCell(new Phrase(license.getFacilityName(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add License Number information
            datatable.getDefaultCell().setPaddingLeft(2);
            if (license.getLicenseNumber() != null) {
                datatable.addCell(new Phrase(license.getLicenseNumber().toString(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add Service Code information
            if (StringUtils.isNotBlank(license.getServiceCodeCode())) {
                datatable.addCell(new Phrase(license.getServiceCodeCode(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add License Type information
            if (StringUtils.isNotBlank(license.getSubtype())) {
                datatable.addCell(new Phrase(license.getSubtype(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }
            // Add License Expiration date information
            datatable.getDefaultCell().setPaddingRight(4);
            if (StringUtils.isNotBlank(license.getExpirationDateFormatted())) {
                datatable.addCell(new Phrase(license.getExpirationDateFormatted(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }

            // Add Mailing Location information
            sb = new StringBuilder();
            if (facility != null && facility.getMailingAddress() != null
                    && StringUtils.isNotBlank(facility.getMailingAddress().getAddressOne())) {
                sb.append(facility.getMailingAddress().getAddressOne());

                // add address two
                if (StringUtils.isNotBlank(facility.getMailingAddress().getAddressTwo())) {
                    if (sb.length() > 0) {
                        sb.append(" ");
                    }
                    sb.append(facility.getMailingAddress().getAddressTwo());
                }

                // Add city, state, zip
                if (StringUtils.isNotBlank(facility.getMailingAddress().getCityStateZip())) {
                    if (sb.length() > 0) {
                        sb.append(", ");
                    }
                    sb.append(facility.getMailingAddress().getCityStateZip());
                }
            }
            datatable.getDefaultCell().setColspan(5);
            datatable.getDefaultCell().setPaddingLeft(4);
            datatable.getDefaultCell().setPaddingRight(4);
            if (sb.length() > 0) {
                datatable.addCell(new Phrase(sb.toString().toUpperCase(), smallfont));
            } else {
                datatable.addCell(BLANK);
            }

            //
            // Add Facility details information
            // 
            factable = getFacilityDetailsTable();

            // Add primary phone information
            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("Primary Phone: ", smallfontB));
            if (facility != null && facility.getPrimaryPhone() != null
                    && StringUtils.isNotBlank(facility.getPrimaryPhone().getFormattedPhoneNumber())) {
                paragraph.add(new Phrase(facility.getPrimaryPhone().getFormattedPhoneNumber(), smallfont));
            }
            factable.getDefaultCell().setPaddingLeft(4);
            factable.getDefaultCell().setPaddingRight(2);
            factable.addCell(paragraph);

            // Add SAFE Provider ID number
            paragraph = new Paragraph(fixedLeading);
            paragraph.add(new Phrase("SAFE: ", smallfontB));
            if (facility != null && facility.getSafeProviderId() != null) {
                paragraph.add(new Phrase(facility.getSafeProviderId().toString(), smallfontB));
            }
            factable.getDefaultCell().setColspan(2);
            factable.addCell(paragraph);

            // Add the facility information table to the details table
            datatable.getDefaultCell().setPadding(0);
            datatable.addCell(factable);
            // Add the detail to the document table
            doctable.addCell(datatable);
        }
    } else {
        // No open applications
        datatable = getDetailTable();
        datatable.getDefaultCell().setPaddingTop(10);
        datatable.getDefaultCell().setColspan(3);
        datatable.getDefaultCell().setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
        datatable.addCell(new Phrase("No licenses due for renewal were found to display.", smallfont));
        doctable.getDefaultCell().setPaddingBottom(0);
        doctable.getDefaultCell().setBorderWidthBottom(0);
        doctable.addCell(datatable);
    }

    // Add the document table to the document
    document.add(doctable);

    document.close();
}

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;//  w ww  .  j a  v a  2 s . c  o m
    Paragraph paragraph = null;
    document = new Document(PageSize.LETTER, 50, 50, 125, 0);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("FPI DSPDC", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 7/12", smallfont));
    paragraph.setSpacingAfter(50);
    document.add(paragraph);

    // Add report date
    paragraph = getParagraph();
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont));
    paragraph.setIndentationLeft(350);
    document.add(paragraph);

    // Add facility name and address information
    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase(),
            mediumfont));
    paragraph.setSpacingBefore(5);
    document.add(paragraph);

    if (screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() != null) {
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressOne())) {
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getAddressOne().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressTwo())) {
            // Add facility location address two
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getAddressTwo().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getCityStateZip())) {
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getCityStateZip().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
    }

    // Add salutation
    paragraph = getParagraph();
    paragraph.add(new Phrase("Dear Director:", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add subject information
    paragraph = getParagraph();
    paragraph.add(new Phrase("RE: Notice of Agency Action", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add Screening Person's Name/ID
    paragraph = getParagraph(16.0f);
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " ("
            + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont));
    // Indent this line to line up with 'Notice' in subject line
    paragraph.setIndentationLeft(22);
    document.add(paragraph);

    // Add FPI Details Line
    paragraph.clear();
    paragraph.add(new Phrase(screeningLetter.getDetails(), mediumfont));
    document.add(paragraph);

    // Start letter detail
    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "In accordance with the Utah Administrative Procedures Act, Utah Code Ann. 63-46b-1 et. Seq, Utah Code Ann. 62A-2-101-116, ",
            mediumfont));
    paragraph.add(new Phrase(
            "Utah Code Ann. 62A-2-120 and Utah Department of Human Services rules, notice is hereby given of an Agency Action to deny the applicant's ",
            mediumfont));
    paragraph.add(new Phrase("background screening application.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "The named individual failed to provide this office with required information to complete a background clearance by the Department ",
            mediumfont));
    paragraph.add(new Phrase(
            "of Human Services, and therefore is not permitted to have direct access to children or vulnerable adults, is not eligible to provide services ",
            mediumfont));
    paragraph.add(new Phrase(
            "to programs licensed by the Utah Department of Human Services, Office of Licensing, and is not eligible to proceed with foster care or ",
            mediumfont));
    paragraph.add(new Phrase("adoption until all procedures are completed.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Please provide a copy of this letter to the applicant.", mediumfontB));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "If the person is an applicant for adoption or foster care services, no further action can be taken in the licensing ",
            mediumfont));
    paragraph.add(new Phrase("process unless the denial is reversed after all appeals are final.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "If the person is NOT an applicant for adoption or foster care services, you must immediately provide your Licensing Specialist ",
            mediumfont));
    paragraph.add(new Phrase(
            "with written notification as to how you intend to prevent the applicant from having any direct access to children or vulnerable adults.",
            mediumfont));
    paragraph.add(new Phrase(
            "The applicant is not authorized to have any direct access to children or vulnerable adults unless the denial is reversed after ",
            mediumfont));
    paragraph.add(new Phrase("all appeals are final.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Please direct any questions concerning this action to the Office of Licensing, Background Screening Unit, at ",
            mediumfont));
    paragraph.add(new Phrase("(801) 538-4242, or fax to me at (801) 538-4669.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Sincerely,", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getCreatedBy().getFirstAndLastName(), mediumfont));
    paragraph.setSpacingBefore(25);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Criminal Information Technician", mediumfont));
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("cc: Cathy Davis, DSPD", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("File", mediumfont));
    paragraph.setIndentationLeft(18);
    document.add(paragraph);

    document.close();
}

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;//  w  w  w  . ja  va2 s . c om
    Paragraph paragraph = null;
    document = new Document(PageSize.LETTER, 50, 50, 125, 0);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("FPI FC", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 7/12", smallfont));
    paragraph.setSpacingAfter(50);
    document.add(paragraph);

    // Add report date
    paragraph = getParagraph();
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont));
    paragraph.setIndentationLeft(350);
    document.add(paragraph);

    // Add facility name and address information
    paragraph = getParagraph();
    try {
        paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility()
                .getLicensingSpecialist().getFirstAndLastName().toUpperCase(), mediumfont));
    } catch (Exception e) {
        paragraph.add(new Phrase("(Licensing Specialist Name)", mediumfontB));
    }
    document.add(paragraph);
    if (StringUtils.isNotBlank(screeningLetter.getAddress().getAddressOne())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase(screeningLetter.getAddress().getAddressOne().toUpperCase(), mediumfont));
        document.add(paragraph);
    }
    if (StringUtils.isNotBlank(screeningLetter.getAddress().getAddressTwo())) {
        // Add facility location address two
        paragraph = getParagraph();
        paragraph.add(new Phrase(screeningLetter.getAddress().getAddressTwo().toUpperCase(), mediumfont));
        document.add(paragraph);
    }
    if (StringUtils.isNotBlank(screeningLetter.getAddress().getCityStateZip())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase(screeningLetter.getAddress().getCityStateZip().toUpperCase(), mediumfont));
        document.add(paragraph);
    }

    // Add salutation
    paragraph = getParagraph();
    paragraph.add(new Phrase("Dear Licensor:", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add subject information
    paragraph = getParagraph();
    paragraph.add(new Phrase("RE: Notice of Agency Action", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add Screening Person's Name/ID
    paragraph = getParagraph(16.0f);
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " ("
            + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont));
    // Indent this line to line up with 'Notice' in subject line
    paragraph.setIndentationLeft(22);
    document.add(paragraph);

    // Add FPI Details Line
    paragraph.clear();
    paragraph.add(new Phrase(screeningLetter.getDetails(), mediumfont));
    document.add(paragraph);

    // Start letter detail
    paragraph = getParagraph();
    paragraph.add(new Phrase("In accordance with the Utah Administrative Procedures Act, Utah Code Ann. ",
            mediumfont));
    paragraph.add(new Chunk("\u00A7", mediumfont));
    paragraph.add(new Phrase(" 63-46b-1 et. Seq, Utah Code Ann. ", mediumfont));
    paragraph.add(new Chunk("\u00A7", mediumfont));
    paragraph.add(new Phrase(" 62A-2-101-116, ", mediumfont));
    paragraph.add(new Phrase("Utah Code Ann. ", mediumfont));
    paragraph.add(new Chunk("\u00A7", mediumfont));
    paragraph.add(new Phrase(
            " 62A-2-120 and Utah Department of Human Services rules, notice is hereby given of an Agency Action to deny the applicant's ",
            mediumfont));
    paragraph.add(new Phrase("background screening application.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "The named individual failed to provide this office with required information to complete a background clearance by the Department ",
            mediumfont));
    paragraph.add(new Phrase(
            "of Human Services, and therefore is not eligible to provide services to children, or programs licensed to DHS OL.",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Please provide a copy of this letter to the applicant.", mediumfontB));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "If the person is an applicant for adoption or foster care services, no further action can be taken in the licensing ",
            mediumfont));
    paragraph.add(new Phrase("process unless the denial is reversed after all appeals are final.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Please direct any questions concerning this action to the Office of Licensing, Background Screening Unit, at ",
            mediumfont));
    paragraph.add(new Phrase("(801) 538-4242, or fax to me at (801) 538-4669. Thank you.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Sincerely,", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getCreatedBy().getFirstAndLastName(), mediumfont));
    paragraph.setSpacingBefore(25);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Criminal Information Technician", mediumfont));
    document.add(paragraph);

    document.close();
}

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;/*from w  ww .  java2s .  c  o m*/
    Paragraph paragraph = null;
    document = new Document(PageSize.LETTER, 50, 50, 125, 0);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("FPI TX", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 7/12", smallfont));
    paragraph.setSpacingAfter(50);
    document.add(paragraph);

    // Add report date
    paragraph = getParagraph();
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont));
    paragraph.setIndentationLeft(350);
    document.add(paragraph);

    // Add facility name and address information
    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase(),
            mediumfont));
    paragraph.setSpacingBefore(5);
    document.add(paragraph);
    if (screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() != null) {
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressOne())) {
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getAddressOne().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressTwo())) {
            // Add facility location address two
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getAddressTwo().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getCityStateZip())) {
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getCityStateZip().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
    }

    // Add salutation
    paragraph = getParagraph();
    paragraph.add(new Phrase("Dear Director:", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add subject information
    paragraph = getParagraph();
    paragraph.add(new Phrase("RE: Notice of Agency Action", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add Screening Person's Name/ID
    paragraph = getParagraph(16.0f);
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " ("
            + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont));
    // Indent this line to line up with 'Notice' in subject line
    paragraph.setIndentationLeft(22);
    document.add(paragraph);

    // Add FPI Details Line
    paragraph.clear();
    paragraph.add(new Phrase(screeningLetter.getDetails(), mediumfont));
    document.add(paragraph);

    // Start letter detail
    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "In accordance with the Utah Administrative Procedures Act, Utah Code Ann. 63-46b-1 et. Seq, Utah Code Ann. 62A-2-101-116, ",
            mediumfont));
    paragraph.add(new Phrase(
            "Utah Code Ann. 62A-2-120 and Utah Department of Human Services rules, notice is hereby given of an Agency Action to deny the applicant's ",
            mediumfont));
    paragraph.add(new Phrase("background screening application.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "The named individual failed to provide this office with required information to complete a background clearance by the Department ",
            mediumfont));
    paragraph.add(new Phrase(
            "of Human Services, and therefore is not permitted to have direct access to children or vulnerable adults, is not eligible to provide services ",
            mediumfont));
    paragraph.add(new Phrase(
            "to programs licensed by the Utah Department of Human Services, Office of Licensing, and is not eligible to proceed with foster care or ",
            mediumfont));
    paragraph.add(new Phrase("adoption until all procedures are completed.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Please provide a copy of this letter to the applicant.", mediumfontB));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "If the person is an applicant for adoption or foster care services, no further action can be taken in the licensing ",
            mediumfont));
    paragraph.add(new Phrase("process unless the denial is reversed after all appeals are final.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "If the person is NOT an applicant for adoption or foster care services, you must immediately provide your Licensing Specialist ",
            mediumfontB));
    paragraph.add(new Phrase(
            "with written notification as to how you intend to prevent the applicant from having any direct access to children or vulnerable adults.",
            mediumfontB));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "The applicant is not authorized to have any direct access to children or vulnerable adults unless the denial is reversed after ",
            mediumfont));
    paragraph.add(new Phrase("all appeals are final.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Please direct any questions concerning this action to the Office of Licensing, Background Screening Unit, at ",
            mediumfont));
    paragraph.add(new Phrase("(801) 538-4242, or fax to me at (801) 538-4669.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Sincerely,", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getCreatedBy().getFirstAndLastName(), mediumfont));
    paragraph.setSpacingBefore(25);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Criminal Information Technician", mediumfont));
    document.add(paragraph);

    if (screeningLetter.getTrackingRecordScreening() != null
            && screeningLetter.getTrackingRecordScreening().getFacility() != null
            && screeningLetter.getTrackingRecordScreening().getFacility().getLicensingSpecialist() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility()
                    .getLicensingSpecialist().getFirstAndLastName())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase("CC: " + screeningLetter.getTrackingRecordScreening().getFacility()
                .getLicensingSpecialist().getFirstAndLastName(), mediumfont));
        paragraph.setSpacingBefore(10);
        document.add(paragraph);
    }

    document.close();
}

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;/*from w ww .  jav  a  2  s.c  om*/
    Paragraph paragraph = null;
    document = new Document(PageSize.LETTER, 50, 50, 125, 0);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("FPF FC", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 2/12", smallfont));
    paragraph.setSpacingAfter(50);
    document.add(paragraph);

    // Add report date
    paragraph = getParagraph();
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont));
    paragraph.setIndentationLeft(350);
    document.add(paragraph);

    // Add applicant name and address information
    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName().toUpperCase(),
            mediumfont));
    paragraph.setSpacingBefore(5);
    document.add(paragraph);
    if (StringUtils.isNotBlank(screeningLetter.getAddress().getAddressOne())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase(screeningLetter.getAddress().getAddressOne().toUpperCase(), mediumfont));
        document.add(paragraph);
    }
    if (StringUtils.isNotBlank(screeningLetter.getAddress().getAddressTwo())) {
        // Add facility location address two
        paragraph = getParagraph();
        paragraph.add(new Phrase(screeningLetter.getAddress().getAddressTwo().toUpperCase(), mediumfont));
        document.add(paragraph);
    }
    if (StringUtils.isNotBlank(screeningLetter.getAddress().getCityStateZip())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase(screeningLetter.getAddress().getCityStateZip().toUpperCase(), mediumfont));
        document.add(paragraph);
    }

    // Add subject information
    paragraph = new Paragraph("RE: Notice of Criminal History Verification:", mediumfont);
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add Screening Person's Name/ID
    paragraph = getParagraph(16.0f);
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " ("
            + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont));
    // Indent this line to line up with 'Notice' in subject line
    paragraph.setIndentationLeft(22);
    document.add(paragraph);

    // Add salutation
    paragraph = getParagraph();
    paragraph.add(new Phrase("Dear Applicant:", mediumfont));
    paragraph.setSpacingBefore(18);
    document.add(paragraph);

    // Start letter detail
    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "As a follow-up to the request for background screening by the Department of Human Services, Office of Licensing, ",
            mediumfont));
    paragraph.add(new Phrase(
            "this is to notify you that additional criminal background screening information is needed.  Initial procedures ",
            mediumfont));
    paragraph.add(new Phrase(
            "indicate the possibility of a criminal record.  Therefore, further review is required (UCA 62A-2-120, and R501-14).",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "You submitted fingerprint cards previously. We have one fingerprint card in your file that we can ",
            mediumfont));
    paragraph.add(new Phrase(
            "use for the verification. To proceed with the verification, we request a $20 fee in the form of a ",
            mediumfont));
    paragraph.add(new Phrase("cashier's check, or money order ", mediumfontI));
    paragraph.add(new Phrase("(no personal checks) payable to the ", mediumfont));
    paragraph.add(new Phrase("Department of Human Services. ", mediumfontI));
    paragraph.add(new Phrase(
            "Submit the fee to the Office of Licensing within 5 working days of your receipt of this notice. Please be sure ",
            mediumfont));
    paragraph.add(
            new Phrase("the payment references your name and last four digits of your social security number.",
                    mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Failure to return the fee within 5 working days will result in the background screening application being denied, and you ",
            mediumfont));
    paragraph.add(new Phrase(
            "will not be eligible to be associated with the licensed program in any capacity or will not be eligible to proceed ",
            mediumfont));
    paragraph.add(new Phrase("with foster care or adoption until all clearance procedures are completed.",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Please allow up to 12 weeks for the completion of the clearance process. For assistance or inquiries, please contact the Office of Licensing ",
            mediumfont));
    paragraph.add(new Phrase("at (801) 538-4242.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Sincerely,", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getCreatedBy().getFirstAndLastName(), mediumfont));
    paragraph.setSpacingBefore(25);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Criminal Information Technician", mediumfont));
    document.add(paragraph);

    if (screeningLetter.getTrackingRecordScreening() != null
            && screeningLetter.getTrackingRecordScreening().getFacility() != null
            && screeningLetter.getTrackingRecordScreening().getFacility().getLicensingSpecialist() != null
            && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility()
                    .getLicensingSpecialist().getIntials())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase("CC: " + screeningLetter.getTrackingRecordScreening().getFacility()
                .getLicensingSpecialist().getIntials(), mediumfont));
        paragraph.setSpacingBefore(10);
        document.add(paragraph);
    }

    document.close();
}

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;//from w  ww  . j av  a 2  s . c  o m
    Paragraph paragraph = null;
    document = new Document(PageSize.LETTER, 50, 50, 125, 0);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("FPF TX", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 2/12", smallfont));
    paragraph.setSpacingAfter(50);
    document.add(paragraph);

    // Add report date
    paragraph = getParagraph();
    paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont));
    paragraph.setIndentationLeft(350);
    document.add(paragraph);

    // Add facility name and address information
    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase(),
            mediumfont));
    paragraph.setSpacingBefore(5);
    document.add(paragraph);
    if (screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() != null) {
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressOne())) {
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getAddressOne().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressTwo())) {
            // Add facility location address two
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getAddressTwo().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
        if (StringUtils.isNotBlank(
                screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getCityStateZip())) {
            paragraph = getParagraph();
            paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress()
                    .getCityStateZip().toUpperCase(), mediumfont));
            document.add(paragraph);
        }
    }

    // Add subject information
    paragraph = getParagraph();
    paragraph.add(new Phrase("RE: Notice of Criminal History Verification:", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add Screening Person's Name/ID
    paragraph = getParagraph(16.0f);
    paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " ("
            + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont));
    // Indent this line to line up with 'Notice' in subject line
    paragraph.setIndentationLeft(22);
    document.add(paragraph);

    // Add salutation
    paragraph = getParagraph();
    paragraph.add(new Phrase("Dear Director:", mediumfont));
    paragraph.setSpacingBefore(18);
    document.add(paragraph);

    // Start letter detail
    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "As a follow-up to the request for background screening by the Department of Human Services, Office of Licensing, ",
            mediumfont));
    paragraph.add(new Phrase(
            "this is to notify you that additional criminal background screening information is needed.  Initial procedures ",
            mediumfont));
    paragraph.add(new Phrase(
            "indicate the possibility of a criminal record.  Therefore, further review is required (UCA 62A-2-120, and R501-14).",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "The applicant submitted fingerprint cards previously. We have one fingerprint card on file that we can ",
            mediumfont));
    paragraph.add(new Phrase(
            "use for the verification. To proceed with the verification, we request a $20 fee in the form of a ",
            mediumfont));
    paragraph.add(new Phrase("cashier's check, money order, or program business check ", mediumfontI));
    paragraph.add(new Phrase("(no personal checks) payable to the ", mediumfont));
    paragraph.add(new Phrase("Department of Human Services. ", mediumfontI));
    paragraph.add(new Phrase(
            "Submit the fee to the Office of Licensing within 5 working days of your receipt of this notice. Please be sure ",
            mediumfont));
    paragraph.add(new Phrase(
            "the payment references the applicant's name and last four digits of the applicant's social security number.",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Failure to return the fee within 5 working days will result in the background screening application being denied, and the ",
            mediumfont));
    paragraph.add(new Phrase(
            "applicant will not be eligible to be associated with the licensed program in any capacity or will not be eligible to proceed ",
            mediumfont));
    paragraph.add(new Phrase("with foster care or adoption until all clearance procedures are completed.",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Please allow up to 12 weeks for the completion of the clearance process. For assistance or inquiries, please contact the Office of Licensing ",
            mediumfont));
    paragraph.add(new Phrase("at (801) 538-4242.", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Sincerely,", mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(screeningLetter.getCreatedBy().getFirstAndLastName(), mediumfont));
    paragraph.setSpacingBefore(25);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Criminal Information Technician", mediumfont));
    document.add(paragraph);

    document.close();
}