Example usage for com.itextpdf.text Paragraph setIndentationLeft

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

Introduction

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

Prototype

public void setIndentationLeft(float indentation) 

Source Link

Usage

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;/*from ww  w. j a  va2s  .c  o  m*/
    Paragraph paragraph = null;
    ListItem item = 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("FCR 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 = 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 " + screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + ":",
            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(
            "Enclosed is a fingerprint card for you to provide complete, accurate and legible identifying information. ",
            mediumfont));
    paragraph.add(
            new Phrase("Return the completed fingerprint card with 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(
            ", to the Office of Licensing within 5 working days of your receipt of this notice.", mediumfont));
    paragraph.setSpacingBefore(10);
    paragraph.setSpacingAfter(10);
    document.add(paragraph);

    // Add the fingerprint card procedures as an indented bullet list
    List procedure = new List(false, 10);
    procedure.setIndentationLeft(10);
    item = getListItem();
    item.add(new Phrase(
            "Prints should be taken by a local law enforcement office, or an agency approved by law enforcement.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "Use only this card showing identification from the Office of Licensing. We will be glad to give you replacement card if requested.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    procedure.add(
            new Phrase("If mailing the card back to us, return by regular mail (please do not fold the card).",
                    mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase("Fingerprint card must be completely filled out or it will be returned for completion.",
            mediumfont));
    procedure.add(item);
    document.add(procedure);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Failure to return the completed fingerprint card and fee within 5 working days will result in your background screening ",
            mediumfont));
    paragraph.add(new Phrase(
            "application being denied, and you will not be eligible to be associated with the licensed program in any capacity ",
            mediumfont));
    paragraph.add(new Phrase(
            "or will not be eligible to proceed 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, you can 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.FingerprintCardRequestLetterTX.java

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;/*from   w w  w. j a va2 s.c  o m*/
    Paragraph paragraph = null;
    ListItem item = 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("FCR 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(
            "Enclosed is a fingerprint card for the applicant to provide complete, accurate and legible identifying information. ",
            mediumfont));
    paragraph.add(
            new Phrase("Return the completed fingerprint card with 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(
            ", to the Office of Licensing within 5 working days of your receipt of this notice.", mediumfont));
    paragraph.setSpacingBefore(10);
    paragraph.setSpacingAfter(10);
    document.add(paragraph);

    // Add the fingerprint card procedures as an indented bullet list
    List procedure = new List(false, 10);
    procedure.setIndentationLeft(22);
    item = getListItem();
    item.add(new Phrase(
            "Prints should be taken by a local law enforcement office, or an agency approved by law enforcement.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "Use only this card showing identification from the Office of Licensing. We will be glad to give you a replacement card if requested.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase("If mailing the card back to us, return by regular mail (please do not fold the card).",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase("Fingerprint card must be completely filled out or it will be returned for completion.",
            mediumfont));
    procedure.add(item);
    document.add(procedure);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Failure to return the completed fingerprint card and fee within 5 working days will result in the background screening ",
            mediumfont));
    paragraph.add(new Phrase(
            "application being denied, and the applicant will not be eligible to be associated with the licensed program in any capacity ",
            mediumfont));
    paragraph.add(new Phrase(
            "or will not be eligible to proceed 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 = new Paragraph("Sincerely,", mediumfont);
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

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

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

    document.close();
}

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

private static void addLetterIdentifier(TrackingRecordScreeningLetter screeningLetter, Document document)
        throws BadElementException, DocumentException, Exception {
    // Add letter identifier and revision information
    Paragraph paragraph = new Paragraph(10.0f);
    if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null
            && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling() != null
            && StringUtils.isNotBlank(
                    screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue())) {
        paragraph.add(//from  www.  ja v a 2 s .c om
                new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue()
                        + " LS Author", smallfontT));
    } else {
        paragraph.add(new Phrase("LS Author", smallfontT));
    }
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 2/11", smallfontT));
    paragraph.setSpacingAfter(30);
    document.add(paragraph);

}

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

private static void addLetterIdentifier(Document document)
        throws BadElementException, DocumentException, Exception {
    // Add letter identifier and revision information
    Paragraph paragraph = new Paragraph(10.0f);
    paragraph.add(new Phrase("B1591 LS Author", smallfontT));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);/*from w  w  w  .ja  v a 2  s  .  c  o m*/
    paragraph.clear();
    paragraph.add(new Phrase("Rev 06/13", smallfontT));
    paragraph.setSpacingAfter(30);
    document.add(paragraph);

}

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

private static void addLetterIdentifier(Document document)
        throws BadElementException, DocumentException, Exception {
    // Add letter identifier and revision information
    Paragraph paragraph = new Paragraph(10.0f);
    paragraph.add(new Phrase("B1606 LS Author", smallfontT));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);/*from  w w  w .  j av  a2s. c  om*/
    paragraph.clear();
    paragraph.add(new Phrase("Rev 06/13", smallfontT));
    paragraph.setSpacingAfter(30);
    document.add(paragraph);

}

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

private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba,
        HttpServletRequest request) throws DocumentException, BadElementException, IOException {
    Document document = null;//from w  w  w  .  j a  v a2s. c  om
    Paragraph paragraph = null;
    ListItem item = null;
    document = new Document(PageSize.LETTER, 50, 50, 125, 0);
    PdfWriter writer = PdfWriter.getInstance(document, ba);
    StringBuilder sb = null;
    SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy");

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("MSO FC", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 3/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 = getParagraph();
    paragraph.add(new Phrase("RE: Notice of additional Criminal Background Screening information needed:",
            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 " + screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + ":",
            mediumfont));
    paragraph.setSpacingBefore(18);
    document.add(paragraph);

    // Start letter detail
    sb = new StringBuilder();
    sb.append(
            "As a follow-up to the request for background screening by the Department of Human Services, Office of Licensing, ");
    sb.append("this is to notify you that additional criminal background screening information is needed.");
    paragraph = getParagraph();
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Enclosed are two fingerprint cards for you to provide complete, accurate and legible identifying information. ",
            mediumfont));
    paragraph.add(new Phrase("Return the completed fingerprint cards with a $36.50 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 Resources, ", mediumfontI));
    paragraph.add(new Phrase(
            "to the Office of Licensing within 15 calendar days of your receipt of this notice.", mediumfont));
    paragraph.setSpacingBefore(10);
    paragraph.setSpacingAfter(10);
    document.add(paragraph);

    // Add the fingerprint card procedures as an indented bullet list
    List procedure = new List(false, 10);
    procedure.setIndentationLeft(10);
    item = getListItem();
    item.add(new Phrase(
            "Prints should be taken by a local law enforcement office, or an agency approved by law enforcement.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase("The FBI will reject a card with any highlighting.", mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "Use only these cards showing identification from the Office of Licensing. We will be glad to give you replacement cards if requested.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    procedure.add(new Phrase(
            "If mailing the cards back to us, return by regular mail (please do not fold the cards).",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "Fingerprint cards must be completely filled out or they will be returned for completion.",
            mediumfont));
    procedure.add(item);
    document.add(procedure);

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

    sb = new StringBuilder();
    sb.append(
            "Please allow up to 12 weeks for the completion of the clearance process. For assistance or inquiries, you can contact the Office of Licensing ");
    sb.append("at (801) 538-4242.");
    paragraph = getParagraph();
    paragraph.add(new Phrase(sb.toString(), 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("Background Screening Unit", 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.MultiStateOffenderLetterTX.java

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

    document.open();

    LetterheadStamper.stampLetter(writer, request);

    paragraph = getParagraph(10.0f);
    paragraph.add(new Phrase("MSO TX", smallfont));
    paragraph.setIndentationLeft(415);
    document.add(paragraph);
    paragraph.clear();
    paragraph.add(new Phrase("Rev 3/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 additional Criminal Background Screening information needed:",
            mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    // Add Screening Person's Name/ID
    sb = new StringBuilder();
    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
    sb = new StringBuilder();
    sb.append(
            "As a follow-up to the request for background screening by the Department of Human Services, Office of Licensing, ");
    sb.append("this is to notify you that additional criminal background screening information is needed.");
    paragraph = getParagraph();
    paragraph.add(new Phrase(sb.toString(), mediumfont));
    paragraph.setSpacingBefore(10);
    document.add(paragraph);

    paragraph = getParagraph();
    paragraph.add(new Phrase(
            "Enclosed are two fingerprint cards for the applicant to provide complete, accurate and legible identifying information. ",
            mediumfont));
    paragraph.add(new Phrase("Return the completed fingerprint cards with a $36.50 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 Resources, ", mediumfontI));
    paragraph.add(new Phrase(
            "to the Office of Licensing within 15 calendar days of your receipt of this notice. Do not put multiple fingerprints ",
            mediumfont));
    paragraph.add(new Phrase("with one payment, unless for a couple with the same last name.", mediumfont));
    paragraph.setSpacingBefore(10);
    paragraph.setSpacingAfter(10);
    document.add(paragraph);

    // Add the fingerprint card procedures as an indented bullet list
    List procedure = new List(false, 10);
    procedure.setIndentationLeft(22);
    item = getListItem();
    item.add(new Phrase(
            "Prints should be taken by a local law enforcement office, or an agency approved by law enforcement.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase("The FBI will reject a card with any highlighting.", mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "Use only these cards showing identification from the Office of Licensing. We will be glad to give you replacement cards if requested.",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "If mailing the cards back to us, return by regular mail (please do not fold the cards).",
            mediumfont));
    procedure.add(item);
    item = getListItem();
    item.add(new Phrase(
            "Fingerprint cards must be completely filled out or they will be returned for completion.",
            mediumfont));
    procedure.add(item);
    document.add(procedure);

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

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

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

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

    paragraph = new Paragraph();
    paragraph.add(new Phrase("Background Screening Unit", mediumfont));
    document.add(paragraph);

    document.close();
}

From source file:GUI.GestionProjects.java

private void button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button1ActionPerformed
    String IMAGE1 = lblPathImage.getText();
    Font red = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.RED);
    Chunk redText = new Chunk("Les information relatif au Projet : ", red);
    Font blue = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.BLUE);

    Document document = new Document();
    java.util.Date utilStartDate = jdateDeadLine.getDate();
    java.sql.Date sqlStartDate = new java.sql.Date(utilStartDate.getTime());
    try {//  w  w  w.j av  a 2s  . co m
        PdfWriter.getInstance(document, new FileOutputStream("Report.pdf"));
        document.open();

        Paragraph p1 = new Paragraph();
        p1.add(redText);
        p1.add(txtTitreProjet.getText());

        Chunk txtdesc = new Chunk("Decription du Projet: ", red);
        Paragraph p2 = new Paragraph();
        p2.add(txtdesc);
        p2.add(txtDescriptionProjet.getText());

        Chunk txtcat = new Chunk("Catgorie du Projet: ", red);
        Paragraph p3 = new Paragraph();
        p3.add(txtcat);
        p3.add(combo_Cat.getSelectedItem().toString());

        Chunk txtfin = new Chunk("Mode de finnancement du Projet: ", red);
        Paragraph p4 = new Paragraph();
        p4.add(txtfin);
        p4.add(ComboFinnancementProjet.getSelectedItem().toString());

        Chunk txtdate = new Chunk("Date DeadLine Projet: ", red);
        Paragraph p5 = new Paragraph();
        p5.add(txtdate);
        p5.add(sqlStartDate.toString());

        p1.setSpacingAfter(25);
        p1.setSpacingBefore(25);
        p1.setAlignment(Element.ALIGN_CENTER);
        p1.setIndentationLeft(50);
        p1.setIndentationRight(50);

        document.add(p1);
        document.add(p2);
        document.add(p3);
        document.add(p4);
        document.add(p5);

        if (Desktop.isDesktopSupported()) {
            try {
                File myFile = new File("Report.pdf");
                Desktop.getDesktop().open(myFile);
            } catch (IOException ex) {
                // no application registered for PDFs
            }
        }
    } catch (Exception e) {
        System.out.println(e);
    }
    document.close();
    // TODO add your handling code here:
}

From source file:ictproject.ReportGenerator.java

private Paragraph getParagraph(String name, String type) {
    Paragraph paragraph = new Paragraph();
    paragraph.setSpacingAfter(10);//from  www.  j a  v  a 2 s.c  o m

    switch (type) {
    case "pani ko sroth": {
        Paragraph para1 = new Paragraph("@= ljBfdfg kfgLsf >f]tx?sf] cj:yfM", fontNormal);
        para1.setAlignment(Element.ALIGN_CENTER);

        paragraph.add(para1);
        break;
    }
    case "pani janya rog ko bibaran": {
        Paragraph para1 = new Paragraph("%= kfgLhGo /f]ux?sf] ljj/0f M", fontNormal);
        para1.setAlignment(Element.ALIGN_CENTER);
        Paragraph para3 = new Paragraph(
                "uflj;:t/Lo kfgLhGo /f]ux?sf] ljj/0f :jf:Yo rf}sLaf6 jf dlxnf ;jo+;]ljsf af6 lng]", fontNormal);
        paragraph.add(para1);
        break;
    }
    case "actual budget": {
        Paragraph para1 = new Paragraph(
                "# -s_ ut tLg jif{sf nflu uflj;n] vfg]kfgL tyf ;/;kmfO If]qdf 5'6fPsf] jh]6 ljj/0fM",
                fontNormal);
        //              Paragraph para3=new Paragraph("uflj;sf] hDdf ;Defljt nufgL ? ",fontNormal);
        //              Paragraph para4=new Paragraph(getDistinctResult(name, "gabisaKoLagani", "actualBudget"));
        para1.setAlignment(Element.ALIGN_CENTER);
        Paragraph para5 = new Paragraph();
        para5.add(new Chunk("uflj;sf] hDdf ;Defljt nufgL ? ", fontNormal));
        para5.add(getDistinctResult(name, "gabisaKoLagani", "actualBudget"));
        paragraph.add(para1);
        paragraph.add(para5);
        break;
    }
    case "expected budget": {
        Paragraph para1 = new Paragraph(
                "# -v_ cfufdL # jif{sf nflu uflj;sf] vfg]kfgL tyf ;/;kmfO If]qdf x'g ;Sg] ;Defljt ah]6M",
                fontNormal);
        para1.setAlignment(Element.ALIGN_CENTER);
        Paragraph para5 = new Paragraph();
        para5.add(new Chunk("uflj;sf] hDdf ;Defljt nufgL ? ", fontNormal));
        para5.add(getDistinctResult(name, "gabisaKoLagani", "expectedBudget"));
        paragraph.add(para1);
        paragraph.add(para5);
        break;
    }
    case "janajatiAnusar": {
        Paragraph para2 = new Paragraph("uflj;sf] gfdMM" + converter(name), fontNormal);
        para2.setIndentationLeft(50);
        Paragraph para1 = new Paragraph("!= hfthftL cg';f/sf] 3/w'/L ljj/0fM", fontNormal);
        para1.setAlignment(Element.ALIGN_CENTER);
        paragraph.add(para2);
        paragraph.add(Chunk.NEWLINE);
        paragraph.add(Chunk.NEWLINE);
        paragraph.add(para1);
        break;
    }
    case "sauchalayKoAwasta": {
        Paragraph para1 = new Paragraph("$= zf}rfnosf] cj:yf M", fontNormal);//.  ? ",fontNormal);
        para1.setAlignment(Element.ALIGN_CENTER);
        paragraph.add(para1);
        break;
    }
    case "gulmi": {
        Paragraph para = new Paragraph();
        Paragraph para1 = new Paragraph("lhNnf ljsf; ;ldltsf] sfof{no", fontNormal);
        para1.setAlignment(Element.ALIGN_CENTER);

        Paragraph para3 = new Paragraph("u'NdL", fontNormal);
        para3.setAlignment(Element.ALIGN_CENTER);
        Paragraph para4 = new Paragraph("vfg]kfgL tyf ;/;kmfO OsfO{", fontNormal);
        para4.setAlignment(Element.ALIGN_CENTER);
        para.add(para1);
        para.add(para3);
        para.add(para4);
        return para;
    }
    case "name": {
        Paragraph para = new Paragraph(converter(name), fontNormal);
        para.setAlignment(Element.ALIGN_CENTER);
        return para;
    }

    }
    return paragraph;
}

From source file:KTCNPM.ExportFile.java

public void exportFile(ArrayList<String> list, ArrayList<String> listTAW, ArrayList<String> listTBF,
        ArrayList<String> listTCF, ArrayList<String> listEF, ArrayList<String> listG) throws IOException {
    Document document = new Document();

    try {/*from w ww  .  j  a v  a  2s .  c om*/
        String fileSRC = "E:\\KTCNPM.pdf";
        File file = new File(fileSRC);
        if (file.exists()) {
            file.delete();
        } else {
            file.createNewFile();
        }

        PdfWriter.getInstance(document, new FileOutputStream(fileSRC));
        document.open();

        Font f1 = new Font(
                BaseFont.createFont("/newpackage/vuArialBold.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
        Font f2 = new Font(
                BaseFont.createFont("/newpackage/vuArial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
        f2.setSize(9);
        f1.setSize(13);

        Paragraph paragraph2 = new Paragraph("", f2);
        Paragraph paragraph3 = new Paragraph();

        paragraph2.setIndentationLeft(80);
        paragraph2.setIndentationRight(80);
        paragraph2.setAlignment(Element.ALIGN_LEFT);
        paragraph2.setSpacingAfter(15);

        Phrase phrase2 = new Phrase("Tn phn m?m: Tnh chi ph phn m?m");
        Phrase phrase3 = new Phrase(" ");
        paragraph3.add(phrase3);
        paragraph2.add(phrase2);

        //Phu luc 3
        Phrase phrase5 = new Phrase(
                "Ph lc III: Bng tnh ton im cc tc nhn (actors) tng tc, trao i thng tin");
        Paragraph paragraph5 = new Paragraph("", f1);
        paragraph5.setIndentationLeft(80);
        paragraph5.setIndentationRight(80);
        paragraph5.setAlignment(Element.ALIGN_CENTER);
        paragraph5.setSpacingAfter(10);
        paragraph5.add(phrase5);

        document.add(paragraph5);
        document.add(paragraph2);

        PdfPTable table3 = new PdfPTable(5);

        table3.setWidthPercentage(400 / 5.23f);
        table3.setWidths(new int[] { 1, 5, 3, 2, 3 });
        for (int i = 0; i < listTAW.size(); i++) {
            Paragraph p = new Paragraph(listTAW.get(i), f2);
            PdfPCell data = new PdfPCell(p);
            table3.addCell(data);
        }
        document.add(table3);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        // phu luc 4
        Phrase phrase41 = new Phrase(
                "Ph lc IV: Bng tnh ton im cc tr?ng hp s dung (use case)");
        Paragraph paragraph41 = new Paragraph("", f1);
        paragraph41.setIndentationLeft(80);
        paragraph41.setIndentationRight(80);
        paragraph41.setAlignment(Element.ALIGN_CENTER);
        paragraph41.setSpacingAfter(10);
        paragraph41.add(phrase41);

        document.add(paragraph41);
        document.add(paragraph2);

        PdfPTable table4 = new PdfPTable(4);
        table4.setWidthPercentage(400 / 5.23f);
        table4.setWidths(new int[] { 1, 3, 3, 4 });
        for (int i = 0; i < listTBF.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listTBF.get(i), f2));
            table4.addCell(data);
        }
        document.add(table4);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        // phu luc 5
        Phrase phrase51 = new Phrase(
                "Ph lc V: Bng tnh ton h s phc tp k thut - cng ngh");
        Paragraph paragraph51 = new Paragraph("", f1);
        paragraph51.setIndentationLeft(80);
        paragraph51.setIndentationRight(80);
        paragraph51.setAlignment(Element.ALIGN_CENTER);
        paragraph51.setSpacingAfter(10);
        paragraph51.add(phrase51);

        document.add(paragraph51);
        document.add(paragraph2);

        PdfPTable table5 = new PdfPTable(5);
        table5.setWidthPercentage(400 / 5.23f);
        table5.setWidths(new int[] { 1, 6, 2, 2, 2 });
        for (int i = 0; i < listTCF.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listTCF.get(i), f2));
            table5.addCell(data);
        }
        document.add(table5);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        //phu luc 6
        Phrase phrase61 = new Phrase(
                "Ph lc VI: Bng tnh ton h s tc ng mi tr?ng v nhm lm vic, h s phc tp v? mi tr?ng");
        Paragraph paragraph61 = new Paragraph("", f1);
        paragraph61.setIndentationLeft(80);
        paragraph61.setIndentationRight(80);
        paragraph61.setAlignment(Element.ALIGN_CENTER);
        paragraph61.setSpacingAfter(10);
        paragraph61.add(phrase61);

        document.add(paragraph61);
        document.add(paragraph2);

        PdfPTable table6 = new PdfPTable(6);
        table6.setWidthPercentage(400 / 5.23f);
        table6.setWidths(new int[] { 1, 6, 2, 2, 2, 3 });
        for (int i = 0; i < listEF.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listEF.get(i), f2));
            table6.addCell(data);
        }
        document.add(table6);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        //phu luc 7
        Phrase phrase7 = new Phrase("Ph lc VII: Bng tnh ton gi tr phn m?m");
        Paragraph paragraph7 = new Paragraph("", f1);
        paragraph7.setIndentationLeft(80);
        paragraph7.setIndentationRight(80);
        paragraph7.setAlignment(Element.ALIGN_CENTER);
        paragraph7.setSpacingAfter(10);
        paragraph7.add(phrase7);

        document.add(paragraph7);
        document.add(paragraph2);

        PdfPTable table7 = new PdfPTable(5);
        table7.setWidthPercentage(400 / 5.23f);
        table7.setWidths(new int[] { 1, 5, 5, 4, 2 });
        for (int i = 0; i < listG.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listG.get(i), f2));
            table7.addCell(data);
        }
        document.add(table7);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        // phu luc 8
        Paragraph paragraph1 = new Paragraph("", f1);
        paragraph1.setIndentationLeft(80);
        paragraph1.setIndentationRight(80);
        paragraph1.setAlignment(Element.ALIGN_CENTER);
        paragraph1.setSpacingAfter(10);
        Phrase phrase1 = new Phrase("Ph lc VIII: Bng tng hp chi ph phn m?m");
        paragraph1.add(phrase1);
        document.add(paragraph1);
        document.add(paragraph2);
        PdfPTable table = new PdfPTable(5);
        table.setWidthPercentage(400 / 5.23f);
        table.setWidths(new int[] { 1, 5, 3, 4, 2 });

        for (int i = 0; i < list.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(list.get(i), f2));
            table.addCell(data);
        }
        document.add(table);
        document.close();

    } catch (DocumentException | FileNotFoundException e) {
    }
}