Example usage for com.lowagie.text.pdf PdfPTable setSpacingAfter

List of usage examples for com.lowagie.text.pdf PdfPTable setSpacingAfter

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPTable setSpacingAfter.

Prototype

public void setSpacingAfter(float spacing) 

Source Link

Document

Sets the spacing after this table.

Usage

From source file:com.qcadoo.report.internal.PdfHelperImpl.java

License:Open Source License

@Override
public void addDocumentHeader(final Document document, final String name, final String documenTitle,
        final String documentAuthor, final Date date, final String username) throws DocumentException {
    SimpleDateFormat df = new SimpleDateFormat(DateUtils.L_DATE_TIME_FORMAT, getLocale());
    LineSeparator line = new LineSeparator(3, 100f, ColorUtils.getLineDarkColor(), Element.ALIGN_LEFT, 0);
    document.add(Chunk.NEWLINE);/*w w  w.j  a  v  a2 s  .  c o m*/
    Paragraph title = new Paragraph(new Phrase(documenTitle, FontUtils.getDejavuBold17Light()));
    title.add(new Phrase(" " + name, FontUtils.getDejavuBold17Dark()));
    title.setSpacingAfter(7f);
    document.add(title);
    document.add(line);
    PdfPTable userAndDate = new PdfPTable(2);
    userAndDate.setWidthPercentage(100f);
    userAndDate.setHorizontalAlignment(Element.ALIGN_LEFT);
    userAndDate.getDefaultCell().setBorderWidth(0);
    Paragraph userParagraph = new Paragraph(new Phrase(documentAuthor, FontUtils.getDejavuRegular9Light()));
    userParagraph.add(new Phrase(" " + username, FontUtils.getDejavuRegular9Dark()));
    Paragraph dateParagraph = new Paragraph(df.format(date), FontUtils.getDejavuRegular9Light());
    userAndDate.addCell(userParagraph);
    userAndDate.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    userAndDate.addCell(dateParagraph);
    userAndDate.setSpacingAfter(14f);
    document.add(userAndDate);
}

From source file:com.qcadoo.report.internal.PdfHelperImpl.java

License:Open Source License

@Override
public void addDocumentHeader(final Document document, final String name, final String documenTitle,
        final String documentAuthor, final Date date) throws DocumentException {
    SimpleDateFormat df = new SimpleDateFormat(DateUtils.L_DATE_TIME_FORMAT, getLocale());
    LineSeparator line = new LineSeparator(2, 100f, ColorUtils.getLineDarkColor(), Element.ALIGN_LEFT, 0);
    document.add(Chunk.NEWLINE);/*from w w w.  j a v a 2 s.c o m*/
    Paragraph title = new Paragraph(new Phrase(documenTitle, FontUtils.getDejavuBold17Light()));
    title.add(new Phrase(" " + name, FontUtils.getDejavuBold17Dark()));
    title.setSpacingAfter(7f);
    document.add(title);
    document.add(line);
    PdfPTable userAndDate = new PdfPTable(2);
    userAndDate.setWidthPercentage(100f);
    userAndDate.setHorizontalAlignment(Element.ALIGN_LEFT);
    userAndDate.getDefaultCell().setBorderWidth(0);
    Paragraph userParagraph = new Paragraph(new Phrase(documentAuthor, FontUtils.getDejavuRegular9Light()));
    userParagraph.add(new Phrase(" " + getDocumentAuthor(), FontUtils.getDejavuRegular9Dark()));
    Paragraph dateParagraph = new Paragraph(df.format(date), FontUtils.getDejavuRegular9Light());
    userAndDate.addCell(userParagraph);
    userAndDate.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    userAndDate.addCell(dateParagraph);
    userAndDate.setSpacingAfter(14f);
    document.add(userAndDate);
}

From source file:com.qcadoo.report.internal.PdfHelperImpl.java

License:Open Source License

@Override
public void addDocumentHeaderThin(final Document document, final String name, final String documentTitle,
        final String documentAuthor, final Date date) throws DocumentException {
    SimpleDateFormat df = new SimpleDateFormat(DateUtils.L_DATE_TIME_FORMAT, getLocale());
    LineSeparator line = new LineSeparator(2, 100f, ColorUtils.getLineDarkColor(), Element.ALIGN_LEFT, 0);
    Paragraph title = new Paragraph(new Phrase(documentTitle, FontUtils.getDejavuBold14Light()));
    title.add(new Phrase(" " + name, FontUtils.getDejavuBold14Dark()));
    title.setSpacingAfter(7f);//from  w  w w . j av a2 s  .  c  o m
    document.add(title);
    document.add(line);
    PdfPTable userAndDate = new PdfPTable(2);
    userAndDate.setWidthPercentage(100f);
    userAndDate.setHorizontalAlignment(Element.ALIGN_LEFT);
    userAndDate.getDefaultCell().setBorderWidth(0);
    Paragraph userParagraph = new Paragraph(new Phrase(documentAuthor, FontUtils.getDejavuRegular9Light()));
    userParagraph.add(new Phrase(" " + getDocumentAuthor(), FontUtils.getDejavuRegular9Dark()));
    Paragraph dateParagraph = new Paragraph(df.format(date), FontUtils.getDejavuRegular9Light());
    userAndDate.addCell(userParagraph);
    userAndDate.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    userAndDate.addCell(dateParagraph);
    userAndDate.setSpacingAfter(10f);
    document.add(userAndDate);
}

From source file:fr.opensagres.xdocreport.itext.extension.ExtendedParagraph.java

License:Open Source License

protected PdfPTable createWrapperTable(PdfPCell wrapperCell, boolean addParagraph) {
    PdfPTable wrapperTable = null;
    // wrap this paragraph into a table if necessary
    if (wrapperCell != null) {
        // background color or borders were set
        if (addParagraph) {
            wrapperCell.addElement(this);
        }//from   w  w w.j a v  a  2 s.com
        wrapperTable = createTable(wrapperCell);
        if (getSpacingBefore() > 0.0f || getSpacingAfter() > 0.0f) {
            // top or bottom margin was set, promote it to enclosing table
            wrapperTable.setSpacingBefore(getSpacingBefore());
            setSpacingBefore(0.0f);
            wrapperTable.setSpacingAfter(getSpacingAfter());
            setSpacingAfter(0.0f);
        }
        if (getIndentationLeft() > 0.0f || getIndentationRight() > 0.0f) {
            // left or right margin was set, have to wrap the cell again
            PdfPCell outerCell = createCell();
            outerCell.setPaddingLeft(getIndentationLeft());
            setIndentationLeft(0.0f);
            outerCell.setPaddingRight(getIndentationRight());
            setIndentationRight(0.0f);
            outerCell.addElement(wrapperTable);
            wrapperTable = createTable(outerCell);
        }
    }
    return wrapperTable;
}

From source file:fr.opensagres.xdocreport.itext.extension.ExtendedPdfPTable.java

License:Open Source License

private PdfPTable createTable(PdfPCell cell) {
    PdfPTable table = new PdfPTable(1);
    table.setSpacingBefore(this.spacingBefore());
    table.setSpacingAfter(this.spacingAfter());
    table.setHorizontalAlignment(this.getHorizontalAlignment());
    table.setTotalWidth(cell.getPaddingLeft() + this.getTotalWidth() + cell.getPaddingRight());
    table.setLockedWidth(true);//from   w  w  w. j a v a 2s.  c o  m
    table.setSplitLate(false);
    table.addCell(cell);
    return table;
}

From source file:gov.medicaid.binders.IndividualDisclosureFormBinder.java

License:Apache License

@Override
public void renderPDF(EnrollmentType enrollment, Document document, Map<String, Object> model)
        throws DocumentException {

    // Provider Statement Section
    PdfPTable disclosureInfo = new PdfPTable(new float[] { 7, 1 });
    PDFHelper.setTableAsFullPage(disclosureInfo);

    String ns = NAMESPACE;// w  ww.ja  v a2 s.  c o  m

    if ("Y".equals(PDFHelper.value(model, ns, "bound"))) {
        PDFHelper.addLabelValueCell(disclosureInfo,
                "Have you ever been convicted of a criminal offense related to "
                        + "involvement in any program underMedicare, Medicaid, Title XX, or Title XXI in "
                        + "Minnesota or any other state or jurisdiction since the inception of these programs?",
                PDFHelper.formatBoolean(PDFHelper.value(model, ns, "criminalConvictionInd")));

        PDFHelper.addLabelValueCell(disclosureInfo,
                "Have you had civil money penalties or assessments "
                        + "imposed under section 1128A of the Social Security Act?",
                PDFHelper.formatBoolean(PDFHelper.value(model, ns, "civilPenaltyInd")));

        PDFHelper.addLabelValueCell(disclosureInfo,
                "Have you ever been excluded or terminated from participation in Medicare,  Medicaid, "
                        + "Children's Health Insurance Program (CHIP), or the Title XXI services program in Minnesota "
                        + "or any other state since the inception of these programs?",
                PDFHelper.formatBoolean(PDFHelper.value(model, ns, "previousExclusionInd")));

        disclosureInfo.setSpacingAfter(20);
        document.add(disclosureInfo);

        PdfPTable statementInfo = new PdfPTable(1);
        PDFHelper.setTableAsFullPage(statementInfo);

        PDFHelper.addCell(statementInfo,
                "I certify that the information provided on this form is accurate, complete and truthful. I will "
                        + "notify MHCP Provider Enrollment of any changes to this information. I acknowledge that any "
                        + "misrepresentations in the information submitted to MHCP, including false claims,  statements, "
                        + "documents, or concealment of a material fact, may be cause for denial or termination "
                        + "of participation as a Medicaid provider.");

        PdfPTable nameTable = new PdfPTable(new float[] { 1, 1, 4 });
        PDFHelper.setTableAsFullPage(nameTable);
        PDFHelper.addLabelValueCell(nameTable, "Provider Name", PDFHelper.value(model, ns, "name"));
        PDFHelper.addLabelValueCell(nameTable, "Provider Title", PDFHelper.value(model, ns, "title"));
        PDFHelper.addLabelValueCell(nameTable, "Provider Signature", "");
        PDFHelper.addLabelValueCell(nameTable, "Date", PDFHelper.value(model, ns, "date"));
        document.add(nameTable);
    }
}

From source file:gov.medicaid.services.impl.ExportServiceBean.java

License:Apache License

/**
 * Exports the search results into PDF.//ww  w.j a v  a 2s  . com
 * 
 * @param requests
 *            the list to be exported
 * @param status
 *            the status filter
 * @param outputStream
 *            the stream to export to
 * @throws PortalServiceException
 *             for any errors encountered
 */
public void export(List<UserRequest> requests, String status, OutputStream outputStream)
        throws PortalServiceException {
    PdfPTable resultTable;
    try {
        Document document = new Document();
        PdfWriter.getInstance(document, outputStream);
        document.open();

        resultTable = new PdfPTable(new float[] { 3, 8, 8, 8, 10, 25, 8, 8, 8 });
        resultTable.getDefaultCell().setBorder(0);
        resultTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_CENTER);

        resultTable.setTotalWidth(72 * 7);
        resultTable.setLockedWidth(true);

        resultTable.addCell(createHeaderCell("Enrollments", 9));
        resultTable.completeRow();

        addCenterCell(resultTable, "#");
        addCenterCell(resultTable, "NPI/UMPI");
        addCenterCell(resultTable, "Date Created");
        addCenterCell(resultTable, "Request Type");
        addCenterCell(resultTable, "Provider Type");
        addCenterCell(resultTable, "Provider Name");
        addCenterCell(resultTable, "Risk Level");
        addCenterCell(resultTable, "Status");
        addCenterCell(resultTable, "Status Date");
        resultTable.completeRow();

        int i = 0;
        for (UserRequest userRequest : requests) {
            addCenterCell(resultTable, String.valueOf(++i));
            addCenterCell(resultTable, userRequest.getNpi());
            addCenterCell(resultTable,
                    BinderUtils.formatCalendar(BinderUtils.toCalendar(userRequest.getCreateDate())));
            addCenterCell(resultTable, userRequest.getRequestType());
            addCenterCell(resultTable, userRequest.getProviderType());
            addCenterCell(resultTable, userRequest.getProviderName());
            addCenterCell(resultTable, userRequest.getRiskLevel());
            addCenterCell(resultTable, userRequest.getStatus());
            addCenterCell(resultTable,
                    BinderUtils.formatCalendar(BinderUtils.toCalendar(userRequest.getStatusDate())));
        }

        resultTable.setSpacingAfter(20);
        document.add(resultTable);

        document.close();
    } catch (DocumentException e) {
        throw new PortalServiceException("Export failed, see log for additional details.", e);
    }
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeClientInfo(Document doc) throws Exception {
    PdfPTable tb = new PdfPTable(2);
    tb.setWidthPercentage(100.0f);/*from   w ww  . j a v a2s.c  om*/
    tb.setSpacingAfter(20.0f);

    PdfPCell cl = new PdfPCell(
            new Phrase(this.client.getName() + "\n" + this.client.getAdress(), new Font(baseArial, 10)));
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase(this.we.getName() + "\n" + this.we.getAdress(), new Font(baseArial, 10)));
    tb.addCell(cl);

    doc.add(tb);

}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeTicketInfo(Document doc) throws Exception {
    Paragraph pg = new Paragraph("#" + tt.getUniqueId(), new Font(baseArial, 12, Font.BOLD));
    doc.add(pg);/*from   w  w  w.j  av a 2 s.  c om*/

    PdfPTable tb = new PdfPTable(1);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(5.0f);

    PdfPCell cl = new PdfPCell(new Phrase(tt.getName(), new Font(baseArial, 10, Font.BOLD)));

    tb.addCell(cl);

    if (clientPerson != null) {
        cl = new PdfPCell(new Phrase(
                "Prane: " + clientPerson.getName() + " (Telefono Nr: " + clientPerson.getPhoneNo() + ")",
                new Font(baseArial, 10)));
        tb.addCell(cl);
    }

    cl = new PdfPCell(new Phrase("Uduoties informacija: ", new Font(baseArial, 10)));
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase(tt.getDescription(), new Font(baseArial, 10)));

    tb.addCell(cl);

    doc.add(tb);
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeWorkerInfo(Document doc) throws Exception {

    PdfPTable tb = new PdfPTable(2);
    tb.setWidthPercentage(100.0f);/*from www. j  a  v a  2  s  .c o  m*/
    tb.setSpacingBefore(8.0f);
    tb.setSpacingAfter(8.0f);

    PdfPCell cl;

    cl = new PdfPCell(new Phrase("Atsakingas asmuo: " + me.getName(), new Font(baseArial, 10)));
    cl.setColspan(2);
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase("vykdymo data: " + timeFormat(tt.getDateClosed()), new Font(baseArial, 10)));
    tb.addCell(cl);

    if (tt.getWorktime() != null) {
        cl = new PdfPCell(new Phrase("Darbo valandos:" + tt.getWorktime(), new Font(baseArial, 10)));
        tb.addCell(cl);
    } else {
        cl = new PdfPCell(new Phrase("Darbo valandos: ", new Font(baseArial, 10)));
        tb.addCell(cl);
    }

    doc.add(tb);

    tb = new PdfPTable(2);

    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(50.0f);

    cl = new PdfPCell(new Phrase("Kliento paraas\n\n\n\n", new Font(baseArial, 10)));
    cl.setBorder(0);
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase("Uduot atliks darbuotojas\n\n\n\n", new Font(baseArial, 10)));
    cl.setBorder(0);
    tb.addCell(cl);
    doc.add(tb);

}