Example usage for com.itextpdf.text.pdf PdfPCell setTop

List of usage examples for com.itextpdf.text.pdf PdfPCell setTop

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPCell setTop.

Prototype

public void setTop(final float ury) 

Source Link

Document

Sets the upper right y-coordinate.

Usage

From source file:se.billes.pdf.renderer.model.text.TableParagraph.java

License:Open Source License

@Override
public void onRender(PdfPCell cell) throws PdfRenderException {

    PdfPTable table = new PdfPTable(widths.length);

    try {// w  w  w  .j a  va  2 s  .  c  o  m
        table.setTotalWidth(getTotalWidthsAsPs());
        table.setLockedWidth(true);
        table.setSpacingAfter(0f);

        for (AbstractParagraph tableCell : cells) {

            PdfPCell c = new PdfPCell();
            float[] padding = new float[] { 0f, 0f, 0f, 0f };
            if (tableCell instanceof TableCell) {
                padding = ((TableCell) tableCell).getPadding();
            }
            c.setBorderWidth(0f);
            c.setLeft(0);
            c.setTop(0);
            c.setRight(0);
            c.setBottom(0);
            c.setUseAscender(true);
            c.setIndent(0);
            c.setHorizontalAlignment(Element.ALIGN_LEFT);
            c.setVerticalAlignment(Element.ALIGN_TOP);
            c.setPaddingLeft(SizeFactory.millimetersToPostscriptPoints(padding[0]));
            c.setPaddingBottom(SizeFactory.millimetersToPostscriptPoints(padding[3]));
            c.setPaddingRight(SizeFactory.millimetersToPostscriptPoints(padding[2]));
            c.setPaddingTop(SizeFactory.millimetersToPostscriptPoints(padding[1]));
            c.setBorder(0);
            tableCell.onRender(c);

            table.addCell(c);

        }
        cell.addElement(table);
    } catch (Exception e) {
        throw new PdfRenderException(e);
    }
}

From source file:se.billes.pdf.renderer.request.factory.CellFactory.java

License:Open Source License

public PdfPCell createCell(Block block) {
    float[] margins = block.getMargins();
    PdfPCell cell = new PdfPCell();
    cell.setBorderWidth(0);/* www.ja v a  2 s.c o m*/
    cell.setVerticalAlignment(VerticalAlign.getByName(block.getVerticalAlign()).getAlignment());
    cell.setLeft(0);
    cell.setTop(0);
    cell.setRight(0);
    cell.setBottom(0);
    cell.setUseAscender(block.isUseAscender());
    cell.setIndent(0);
    cell.setPaddingLeft(SizeFactory.millimetersToPostscriptPoints(margins[0]));
    cell.setPaddingBottom(SizeFactory.millimetersToPostscriptPoints(margins[3]));
    cell.setPaddingRight(SizeFactory.millimetersToPostscriptPoints(margins[1]));
    cell.setPaddingTop(SizeFactory.millimetersToPostscriptPoints(margins[2]));
    cell.setFixedHeight(SizeFactory.millimetersToPostscriptPoints(block.getPosition()[3]));
    cell.setBorder(0);
    cell.setCellEvent(new CellBlockEvent().createEvent(block));
    cell.setRotation(block.getRotation());
    return cell;
}

From source file:se.billes.pdf.renderer.request.factory.CellFactory.java

License:Open Source License

public PdfPCell getFillCell() {
    PdfPCell fillCell = new PdfPCell();
    fillCell.setBorderWidth(0f);// w w  w  .j a v a2s.c om
    fillCell.setLeft(0);
    fillCell.setTop(0);
    fillCell.setRight(0);
    fillCell.setBottom(0);
    fillCell.setUseAscender(true);
    fillCell.setIndent(0);
    fillCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    fillCell.setVerticalAlignment(Element.ALIGN_BOTTOM);
    fillCell.setPaddingLeft(0f);
    fillCell.setPaddingBottom(0f);
    fillCell.setPaddingRight(0f);
    fillCell.setPaddingTop(0f);
    fillCell.setBorder(0);
    renderEmptyCell(fillCell);

    return fillCell;
}