Example usage for com.itextpdf.text.pdf PdfContentByte setLineDash

List of usage examples for com.itextpdf.text.pdf PdfContentByte setLineDash

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfContentByte setLineDash.

Prototype


public void setLineDash(final double unitsOn, final double unitsOff, final double phase) 

Source Link

Document

Changes the value of the line dash pattern.

Usage

From source file:ihm.panneaux.GenererPdf.java

public void applyLineDash(PdfContentByte canvas) {
    canvas.setLineCap(PdfContentByte.LINE_CAP_ROUND);
    canvas.setLineDash(0, 4, 2);
}

From source file:org.javad.stamp.pdf.SetTenant.java

License:Apache License

protected void drawSeparator(PdfContentByte content, float x, float y, float width, float height) {

    float sx = (getOrientation() == Orientation.HORIZONTAL) ? x
            : x + PdfUtil.convertFromMillimeters(getPadding() + 2);
    float dx = (getOrientation() == Orientation.HORIZONTAL) ? x
            : x + width - PdfUtil.convertFromMillimeters(getPadding() + 2);
    float sy = (getOrientation() == Orientation.HORIZONTAL)
            ? y + PdfUtil.convertFromMillimeters(getVerticalPadding() + 2)
            : y;//from ww w.  j  ava 2s.c  om
    float dy = (getOrientation() == Orientation.HORIZONTAL)
            ? y + height - PdfUtil.convertFromMillimeters(getVerticalPadding() + 2)
            : y;

    content.setLineWidth(0.5f);
    content.setColorStroke(BaseColor.GRAY);
    content.moveTo(sx, sy);
    content.setLineDash(5.0f, 2.0f, 0.0f);
    content.lineTo(dx, dy);
    content.stroke();
    content.setLineDash(1.0f, 0.0f, 0.0f);
}

From source file:org.javad.stamp.pdf.StampBox.java

License:Apache License

/**
 * Will draw the bisect lines within the content are of the output
 * rectangle.//from   ww w .j a  v  a2s .  c  o m
 *
 * @param content
 * @param rect
 */
@SuppressWarnings("incomplete-switch")
void drawBisect(PdfContentByte content, OutputBounds rect) {
    content.setLineWidth(0.5f);
    content.setColorStroke(BaseColor.GRAY);
    float dx1 = 0.0f;
    float dx2 = 0.0f;
    float dy1 = 0.0f;
    float dy2 = 0.0f;
    float xp = (int) PdfUtil.convertFromMillimeters(getPadding() + 2);
    float yp = (int) PdfUtil.convertFromMillimeters(getVerticalPadding() + 2);
    switch (bisect) {
    case top_left:
        dx1 = xp;
        dy1 = rect.height - yp;
        dx2 = rect.width - xp;
        dy2 = yp;
        break;
    case top_right:
        dx1 = xp;
        dy1 = yp;
        dx2 = rect.width - xp;
        dy2 = rect.height - yp;
        break;
    case vertical:
        dx1 = rect.width / 2;
        dy1 = yp;
        dx2 = dx1;
        dy2 = rect.height - yp;
    }
    content.moveTo(rect.x + dx1, rect.y + dy1);
    content.setLineDash(5.0f, 2.0f, 0.0f);
    content.lineTo(rect.x + dx2, rect.y + dy2);
    content.stroke();
    content.setLineDash(1.0f, 0.0f, 0.0f);
}