Example usage for com.itextpdf.text Paragraph setSpacingBefore

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

Introduction

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

Prototype

public void setSpacingBefore(float spacing) 

Source Link

Usage

From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java

License:Open Source License

private Paragraph createP(String s) {
    Paragraph p = createParagraph(s);
    p.setSpacingAfter(0);
    p.setSpacingBefore(0);
    return p;
}

From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java

License:Open Source License

private Paragraph getAlaysisDescription(String analysisName, Paragraph analysisDesc) {
    Paragraph res = createParagraph("%b" + analysisName + "% ");
    res.add(Chunk.NEWLINE);/*  w w w .  j  av a  2  s  .  c  o m*/

    analysisDesc.setSpacingAfter(0);
    analysisDesc.setSpacingBefore(0);
    res.add(analysisDesc);
    return res;
}

From source file:fenix.planner.pdf.PDFGenerator.java

License:Open Source License

private void parseAndAddFreeText(String text) throws DocumentException {
    List currentList = null;// ww  w  .j  a v a2s  .  c o m
    for (String line : text.split("\n")) {
        if (line.startsWith("- ")) {
            if (currentList == null) {
                currentList = new List(false, 10f);
                currentList.setListSymbol("\u2022");
            }
            ListItem item = new ListItem();
            currentList.add(item);
            parseAndAddBodyTextLineToParagraph(item, line.substring(2), freeTextFont);
        } else {
            if (currentList != null && !currentList.isEmpty()) {
                currentList.getLastItem().setSpacingAfter(5);
                currentList.getFirstItem().setSpacingBefore(5);
                document.add(currentList);
                currentList = null;
            }
            Paragraph p = new Paragraph();
            p.setSpacingAfter(5);
            p.setSpacingBefore(5);
            parseAndAddBodyTextLineToParagraph(p, line, freeTextFont);
            document.add(p);
        }
    }
}

From source file:generators.InvoiceGenerator.java

/**
 * Generate Invoice pdf file//from  w w  w  .  j  a  va  2  s  . co m
 *
 * @param order the order
 * @throws DocumentException the document exception
 * @throws IOException       the io exception
 */
public void generate(Order order) throws DocumentException, IOException {
    Date invoiceDate = order.getDate();
    SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM YYYY");
    //        User guest = order.getGuest();
    User guest = new UserDAO().get(order.getUserId());
    guest.setOrder(order);
    System.out.println("invoice generator orderID: " + order.getId());
    Document document = new Document();
    Font defaultFont = new Font(Font.FontFamily.TIMES_ROMAN, 12);
    System.out.println(System.getProperty("user.dir"));
    PdfWriter writer = PdfWriter.getInstance(document,
            new FileOutputStream(System.getProperty("user.dir") + "/src/main/java/nl/ipsen3/invoice/"
                    + new SimpleDateFormat("dd-MM-yyyy").format(invoiceDate) + " - " + order.getId() + ".pdf"));
    document.setMargins(30, 30, 30, 65);
    writer.setPageEvent(new InvoiceEventListener());
    document.open();
    Paragraph header = new Paragraph("Lionsclub Oegstgeest/Warmond",
            new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD));
    header.setAlignment(Element.ALIGN_CENTER);
    document.add(header);
    AddressDAO addressDAO = new AddressDAO();
    Address userAddress = addressDAO.get(guest.getAddressId());
    Paragraph address = new Paragraph(guest.getFirstName() + " " + guest.getPrefixLastName() + " "
            + guest.getLastName() + "\n" + userAddress.getStreet() + " " + userAddress.getHouseNumber() + "\n"
            + userAddress.getZipCode() + " " + userAddress.getCity(), defaultFont);
    address.setSpacingBefore(35);
    address.setSpacingAfter(25);
    address.setLeading(15);
    document.add(address);

    Paragraph invoiceDetails = new Paragraph("Factuurdatum: " + sdf.format(invoiceDate) + "\n"
            + "FactuurNummer: " + order.getId() + " \n" + "Debiteurennummer: " + guest.getId(), defaultFont);

    invoiceDetails.setSpacingAfter(15);
    invoiceDetails.setLeading(15);
    document.add(invoiceDetails);

    Paragraph subject = new Paragraph("Betreft: Onderwerp factuur", defaultFont);
    subject.setSpacingAfter(30);
    document.add(subject);

    PdfPTable orderTable = new PdfPTable(10);
    PdfPCell wineCell = new PdfPCell(new Paragraph("Wijn", defaultFont));
    wineCell.setColspan(5);
    wineCell.setBorder(Rectangle.BOTTOM);
    orderTable.getDefaultCell().setPaddingBottom(10);
    orderTable.getDefaultCell().setBorder(Rectangle.BOTTOM);
    ;

    orderTable.addCell(new Paragraph("Code", defaultFont));
    orderTable.addCell(new Paragraph("Aantal", defaultFont));
    orderTable.addCell(wineCell);
    orderTable.addCell(new Paragraph("Jaar", defaultFont));
    orderTable.addCell(new Paragraph("Per Fles", defaultFont));
    orderTable.addCell(new Paragraph("Bedrag", defaultFont));

    orderTable.getDefaultCell().setPaddingBottom(0);
    orderTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    wineCell.setBorder(Rectangle.NO_BORDER);

    NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.GERMANY);

    for (WineOrder wineOrder : order.getWineOrders()) {
        orderTable.addCell(new Paragraph("" + wineOrder.getWine().getId(), defaultFont));
        orderTable.addCell(new Paragraph("" + wineOrder.getAmount(), defaultFont));
        wineCell.setPhrase(new Phrase(wineOrder.getWine().getName(), defaultFont));
        orderTable.addCell(wineCell);
        orderTable.addCell(new Paragraph("" + wineOrder.getWine().getYear(), defaultFont));
        orderTable.addCell(new Paragraph(
                " " + numberFormat.format(wineOrder.getWine().getPrice()).replace(" ", ""), defaultFont));
        orderTable.addCell(new Paragraph(" " + numberFormat
                .format(wineOrder.getAmount() * wineOrder.getWine().getPrice()).replace(" ", ""),
                defaultFont));

        orderTable.completeRow();
    }

    orderTable.addCell(" ");
    orderTable.completeRow();
    Font totalFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
    PdfPCell totalAmount = new PdfPCell(
            new Paragraph(" " + numberFormat.format(order.getTotalAmount()).replace(" ", ""), totalFont));
    totalAmount.setBorder(Rectangle.TOP);
    totalAmount.setPaddingTop(10);
    PdfPCell totalCell = new PdfPCell(new Paragraph("Totaal", totalFont));
    totalCell.setPaddingTop(10);
    totalCell.setBorder(Rectangle.NO_BORDER);
    orderTable.addCell(totalCell);
    PdfPCell fillerCell = new PdfPCell(new Paragraph(""));
    fillerCell.setColspan(8);
    fillerCell.setBorder(Rectangle.NO_BORDER);
    orderTable.addCell(fillerCell);
    orderTable.addCell(totalAmount);

    orderTable.setSpacingBefore(15);
    orderTable.setSpacingAfter(30);
    orderTable.setWidthPercentage(95);
    orderTable.setHorizontalAlignment(Element.ALIGN_CENTER);
    document.add(orderTable);

    Paragraph retrievalDetails = new Paragraph(
            "Wij verzoeken u vriendelijk het totaalbedrag binnen 7 dagen na factuurdatum over te maken op bankrekening <bankAccountNr> t.n.v <bankAccountName> onder vermelding van het factuurnummer",
            defaultFont);
    retrievalDetails.setLeading(15);
    retrievalDetails.setSpacingAfter(20);
    document.add(retrievalDetails);

    //        document.add(new Paragraph("U kunt uw wijnen ophalen op " +  sdf.format(invoiceDate) , defaultFont));
    //        document.add(new Paragraph("Adres:", defaultFont));
    //
    //        PdfPTable addressTable = new PdfPTable(1);
    //        addressTable.setSpacingBefore(5);
    //        addressTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    //        addressTable.getDefaultCell().setPaddingLeft(35);
    //        MerchantService merchantService = new MerchantService();
    //        Merchant merchant = merchantService.find(merchantService.all().get(0).getId());
    //        addressTable.addCell(new Paragraph(merchant.getName(), defaultFont));
    //        addressTable.addCell(new Paragraph(merchant.getAddress().getStreet()
    //                + " " + merchant.getAddress().getHouseNumber(), defaultFont));
    //        addressTable.addCell(new Paragraph(merchant.getAddress().getZipCode() + " " +
    //                merchant.getAddress().getCity(), defaultFont));
    //        addressTable.setHorizontalAlignment(Element.ALIGN_LEFT);
    //        document.add(addressTable);

    document.close();
    System.out.println(
            "Succesfully generated IPSEN2.invoice: " + order.getId() + " on Date: " + sdf.format(invoiceDate));
}

From source file:gov.utah.dts.det.ccl.actions.facility.information.license.reports.LicenseLetter.java

private static void writePdf(License license, ByteArrayOutputStream ba, HttpServletRequest request)
        throws DocumentException, BadElementException, IOException {
    Document document = null;// ww  w.j av  a2s  .  c  om
    Paragraph paragraph = null;
    document = new Document(PageSize.LETTER, 50, 50, 190, 75);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");
    SimpleDateFormat df2 = new SimpleDateFormat("MM/dd/yyyy");
    Date today = new Date();
    StringBuilder sb;

    document.open();

    LetterheadStamper.stampLetter(writer, request);

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

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

    if (StringUtils.isNotBlank(license.getFacility().getSiteName())) {
        paragraph = getParagraph();
        paragraph.add(new Phrase(license.getFacility().getSiteName().toUpperCase(), mediumfont));
        document.add(paragraph);
    }

    paragraph = getParagraph();
    try {
        paragraph.add(new Phrase(license.getFacility().getMailingAddress().getAddressOne().toUpperCase(),
                mediumfont));
    } catch (Exception e) {
        paragraph.add(new Phrase("Mailing Address", mediumfont));
    }
    document.add(paragraph);

    try {
        if (StringUtils.isNotBlank(license.getFacility().getMailingAddress().getAddressTwo())) {
            // Add facility location address two
            paragraph = getParagraph();
            paragraph.add(new Phrase(license.getFacility().getMailingAddress().getAddressTwo().toUpperCase(),
                    mediumfont));
            document.add(paragraph);
        }
    } catch (Exception e) {
        // Skip if no address found
    }

    paragraph = getParagraph();
    try {
        paragraph.add(new Phrase(license.getFacility().getMailingAddress().getCityStateZip().toUpperCase(),
                mediumfont));
    } catch (Exception e) {
        paragraph.add(new Phrase("City, State Zipcode", mediumfont));
    }
    document.add(paragraph);

    // Add subject information
    paragraph = getParagraph();
    sb = new StringBuilder();
    sb.append("SUBJECT: LICENSE APPROVAL");
    if (license.getSubtype() != null && StringUtils.isNotBlank(license.getSubtype().getValue())) {
        sb.append(" - " + license.getSubtype().getValue().toUpperCase());
    }
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

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

    // Start letter detail
    paragraph = getParagraph();
    sb = new StringBuilder();
    sb.append("Your application to provide ");

    // Get the Service Code Definition
    String service = "";
    if (license.getSpecificServiceCode() != null
            && StringUtils.isNotBlank(license.getSpecificServiceCode().getValue())
            && DV_TREATMENT.equalsIgnoreCase(license.getSpecificServiceCode().getValue())) {
        service = DOMESTIC_VIOLENCE;
    }
    if (!license.getProgramCodeIds().isEmpty()) { // redmine 25410
        mentalHealthLoop: for (PickListValue pkv : license.getProgramCodeIds()) {
            String program = pkv.getValue();
            int idx = program.indexOf(" ");
            if (idx >= 0) {
                String code = program.substring(0, idx);
                if (MENTAL_HEALTH_CODES.indexOf(code + ":") >= 0) {
                    if (service.length() > 0) {
                        service += "/";
                    }
                    service += MENTAL_HEALTH;
                    break mentalHealthLoop;
                }
            }
        }
        substanceAbuseLoop: for (PickListValue pkv : license.getProgramCodeIds()) {
            String program = pkv.getValue();
            int idx = program.indexOf(" ");
            if (idx >= 0) {
                String code = program.substring(0, idx);
                if (SUBSTANCE_ABUSE_CODES.indexOf(code + ":") >= 0) {
                    if (service.length() > 0) {
                        service += "/";
                    }
                    service += SUBSTANCE_ABUSE;
                    break substanceAbuseLoop;
                }
            }
        }
    }
    if (license.getServiceCode() != null && StringUtils.isNotBlank(license.getServiceCode().getValue())) {
        if (service.length() > 0) {
            service += "/";
        }
        String code = license.getServiceCode().getValue();
        int idx = code.indexOf("-");
        if (idx > -1) {
            idx++;
            code = code.substring(idx).trim();
        }
        service += code;
    }
    sb.append(service);
    sb.append(" for ");
    if (license.getAgeGroup() == null || license.getAgeGroup().getValue().equalsIgnoreCase("Adult & Youth")) {
        // Adult & Youth
        if (license.getAdultTotalSlots() != null) {
            sb.append(license.getAdultTotalSlots().toString());
        }
        sb.append(" adult and youth clients");
    } else if (license.getAgeGroup().getValue().equalsIgnoreCase("Adult")) {
        // Adult
        if (license.getAdultTotalSlots() != null) {
            // Are male or female counts specified?
            sb.append(license.getAdultTotalSlots().toString());
            sb.append(" adult");
            if (license.getAdultFemaleCount() != null || license.getAdultMaleCount() != null) {
                // Does either the male or female count equal the total slot count?
                if ((license.getAdultFemaleCount() != null
                        && license.getAdultFemaleCount().equals(license.getAdultTotalSlots()))) {
                    sb.append(" female clients");
                } else if (license.getAdultMaleCount() != null
                        && license.getAdultMaleCount().equals(license.getAdultTotalSlots())) {
                    sb.append(" male clients");
                } else {
                    sb.append(" clients, ");
                    if (license.getAdultMaleCount() != null) {
                        sb.append(license.getAdultMaleCount().toString() + " male");
                    }
                    if (license.getAdultFemaleCount() != null) {
                        if (license.getAdultMaleCount() != null) {
                            sb.append(" and ");
                        }
                        sb.append(license.getAdultFemaleCount().toString() + " female");
                    }
                    if (license.getFromAge() != null || license.getToAge() != null) {
                        sb.append(",");
                    }
                }
            } else {
                sb.append(" clients");
            }
        } else {
            sb.append(" adult clients");
        }
    } else {
        // Youth
        if (license.getYouthTotalSlots() != null) {
            // Are male or female counts specified?
            sb.append(license.getYouthTotalSlots().toString());
            sb.append(" youth");
            if (license.getYouthFemaleCount() != null || license.getYouthMaleCount() != null) {
                // Does either the male or female count equal the total slot count?
                if ((license.getYouthFemaleCount() != null
                        && license.getYouthFemaleCount().equals(license.getYouthTotalSlots()))) {
                    sb.append(" female clients");
                } else if (license.getYouthMaleCount() != null
                        && license.getYouthMaleCount().equals(license.getYouthTotalSlots())) {
                    sb.append(" male clients");
                } else {
                    sb.append(" clients, ");
                    if (license.getYouthMaleCount() != null) {
                        sb.append(license.getYouthMaleCount().toString() + " male");
                    }
                    if (license.getYouthFemaleCount() != null) {
                        if (license.getYouthMaleCount() != null) {
                            sb.append(" and ");
                        }
                        sb.append(license.getYouthFemaleCount().toString() + " female");
                    }
                    if (license.getFromAge() != null || license.getToAge() != null) {
                        sb.append(",");
                    }
                }
            } else {
                sb.append(" clients");
            }
        } else {
            sb.append(" youth clients");
        }
    }
    if (license.getFromAge() != null || license.getToAge() != null) {
        sb.append(" ages ");
        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());
        }
    }
    if (StringUtils.isNotBlank(license.getCertificateComment())) {
        sb.append(" ");
        sb.append(license.getCertificateComment());
    }
    sb.append(" has been approved.");
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

    paragraph = getParagraph();
    sb = new StringBuilder();
    sb.append("The license is issued for the period from ");
    sb.append(df2.format(license.getStartDate()));
    sb.append(" to ");
    sb.append(df2.format(license.getEndDate()));
    sb.append(
            ". The enclosed license is subject to revocation for cause; or if there should be any change in the management, ownership, or address of the facility, ");
    sb.append(
            "the license is automatically void and should be returned to our office. The enclosed license must be posted in the facility.");
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

    paragraph = getParagraph();
    sb = new StringBuilder();
    sb.append(
            "The approval of your license is based upon reports submitted to this office by our staff and by the ");
    sb.append(
            "collaberative agencies which show that reasonable standards of care are maintained and the services ");
    sb.append("provided meet the requirements established by our State Standards.");
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

    paragraph = getParagraph();
    sb = new StringBuilder();
    sb.append(
            "During the period for which the license is granted, representatives from this office and other collaborative ");
    sb.append(
            "agencies may make periodic supervisory visits and will be available for consultation. Please feel free to ");
    sb.append("request assistance at any time.");
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(license.getFacility().getLicensingSpecialist().getFirstAndLastName(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase("Licensing Specialist", mediumfont));
    document.add(paragraph);

    paragraph = getParagraph();
    sb = new StringBuilder();
    sb.append("Enclosure: License #");
    if (license.getLicenseNumber() != null) {
        sb.append(license.getLicenseNumber().toString());
    }
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(paragraphSpacing);
    document.add(paragraph);

    // Check to see if Program Code starts with 'D'
    if (!license.getProgramCodeIds().isEmpty()) { // redmine 25410 multiple program codes
        sb = new StringBuilder();
        for (PickListValue pkv : license.getProgramCodeIds()) {
            if (pkv.getValue() != null && pkv.getValue().length() >= 4) {
                String code = pkv.getValue().substring(0, 4).toUpperCase();
                if (CC_PROGRAM_CODES.contains(code)) {
                    if (sb.length() > 0) {
                        sb.append(", ");
                    }
                    sb.append(code);
                }
            }
        }
        if (sb.length() > 0) {
            paragraph = getParagraph();
            paragraph.add(new Phrase("cc: " + sb.toString(), mediumfont));
            document.add(paragraph);
        }
    }

    document.close();
}

From source file:gov.utah.dts.det.ccl.actions.reports.generators.FacilityLicenseDetailReport.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 ava 2  s. c  o  m
    PdfPTable doctable;
    Paragraph paragraph;
    Facility facility;
    document = new Document(PageSize.LETTER, 40, 40, 50, 50);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    PageNumberEventLeft pageNumber = new PageNumberEventLeft();
    writer.setPageEvent(pageNumber);

    document.open();

    doctable = getDocumentTable(specialist, endDate);

    if (licenses != null && licenses.size() > 0) {
        boolean moreLicenses = true;
        boolean facilityIsChanging = true;
        int idx = 0;
        FacilityLicenseView license = licenses.get(idx);
        while (moreLicenses) {
            facility = license.getFacility();
            doctable.getDefaultCell().setPaddingBottom(4);
            doctable.getDefaultCell().setBorderWidthBottom(.5f);
            if (facilityIsChanging) {
                doctable.addCell(populateFacilityInformation(facility));
                facilityIsChanging = false;
            }

            // Check to see if the next record will change the facility so we can put the
            // proper bottom border.
            idx++;
            if (idx >= licenses.size()) {
                // this is the last license
                moreLicenses = false;
            } else {
                FacilityLicenseView next = licenses.get(idx);
                if (!next.getFacilityId().equals(license.getFacilityId())) {
                    facilityIsChanging = true;
                }
            }

            // Set the bottom border based on the previous check findings
            if (facilityIsChanging || !moreLicenses) {
                // Add a large bottom border
                doctable.getDefaultCell().setBorderWidthBottom(1.0f);
            }
            doctable.addCell(populateLicenseInformation(license));

            // Get the next license
            if (moreLicenses) {
                license = licenses.get(idx);
            }
        }
    } else {
        // No open applications
        paragraph = new Paragraph(fixedLeading);
        paragraph.setSpacingBefore(10);
        paragraph.setAlignment(Element.ALIGN_CENTER);
        paragraph.add(new Phrase("No active facility licenses found to display.", smallfont));
        doctable.addCell(paragraph);
    }

    // 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

private static void generateDocumentPage(FacilityLicenseView license, Date today, Document document,
        PdfWriter writer) throws BadElementException, DocumentException, Exception {
    PdfPTable table = null;/*www.  ja  v a 2  s .  c om*/
    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.trackingrecordscreening.letters.reports.FailureToProvideInformationLetterDSPDC.java

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;/*w w  w .  ja v a2  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  ww.ja v a 2s  .  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;/*  w  w w  .  ja v a2 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 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();
}