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

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

Introduction

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

Prototype

public void setColorStroke(final BaseColor color) 

Source Link

Document

Sets the stroke color.

Usage

From source file:PrefichaPDF.java

public static void drawRectangle(PdfContentByte content, float x, float y, float width, float height) {
    content.saveState();/*from   w w w.ja v a2  s .  c om*/
    PdfGState state = new PdfGState();
    content.setGState(state);
    content.setRGBColorFill(232, 232, 232);
    content.setColorStroke(BaseColor.LIGHT_GRAY);
    //        content.setr
    content.setLineWidth((float) .5);
    content.rectangle(x, y, width, height);
    content.fillStroke();
    content.restoreState();
}

From source file:PrefichaPDF.java

public static void drawRectangleSC(PdfContentByte content, float x, float y, float width, float height) {
    content.saveState();//w w w . j  a  v a 2 s .  c o  m
    PdfGState state = new PdfGState();
    //        state.setFillOpacity(0.6f);
    content.setGState(state);
    content.setRGBColorFill(0xFF, 0xFF, 0xFA);
    content.setColorStroke(BaseColor.LIGHT_GRAY);
    content.setLineWidth((float) .5);
    content.rectangle(x, y, width, height);
    content.fillStroke();
    content.restoreState();
}

From source file:PrefichaPDF.java

public static void drawRectangleText(PdfContentByte content, float x, float y, float width, float height) {
    content.saveState();/*  www . j  av a  2 s . co  m*/
    PdfGState state = new PdfGState();
    content.setGState(state);
    content.setRGBColorFill(0, 230, 255);
    content.setColorStroke(BaseColor.LIGHT_GRAY);
    content.setLineWidth((float) .5);
    content.rectangle(x, y, width, height);
    content.fillStroke();
    content.restoreState();
}

From source file:adams.flow.transformer.pdfproclet.Circle.java

License:Open Source License

/**
 * The actual processing of the document.
 *
 * @param generator   the context//  w  ww. ja v a  2  s  .com
 * @param file   the file to add
 * @return      true if successfully added
 * @throws Exception   if something goes wrong
 */
protected boolean doProcess(PDFGenerator generator, File file) throws Exception {
    PdfContentByte cb;

    cb = generator.getWriter().getDirectContent();
    cb.saveState();
    cb.setColorStroke(new BaseColor(m_Color.getRGB()));
    cb.setColorFill(new BaseColor(m_Color.getRGB()));
    cb.setLineWidth(m_LineWidth);
    cb.circle(m_X, m_Y, m_Radius);
    if (m_Fill)
        cb.fillStroke();
    else
        cb.stroke();
    cb.restoreState();

    return true;
}

From source file:adams.flow.transformer.pdfproclet.Line.java

License:Open Source License

/**
 * The actual processing of the document.
 *
 * @param generator   the context//from ww  w  .j  av  a2  s .  c o  m
 * @param file   the file to add
 * @return      true if successfully added
 * @throws Exception   if something goes wrong
 */
protected boolean doProcess(PDFGenerator generator, File file) throws Exception {
    PdfContentByte cb;

    cb = generator.getWriter().getDirectContent();
    cb.saveState();
    cb.setColorStroke(new BaseColor(m_Color.getRGB()));
    cb.setLineWidth(m_LineWidth);
    cb.moveTo(m_X1, m_Y1);
    cb.lineTo(m_X2, m_Y2);
    cb.stroke();
    cb.restoreState();

    return true;
}

From source file:adams.flow.transformer.pdfproclet.Rectangle.java

License:Open Source License

/**
 * The actual processing of the document.
 *
 * @param generator   the context//w  w  w  . j  a  va  2 s.  c  o m
 * @param file   the file to add
 * @return      true if successfully added
 * @throws Exception   if something goes wrong
 */
protected boolean doProcess(PDFGenerator generator, File file) throws Exception {
    PdfContentByte cb;

    cb = generator.getWriter().getDirectContent();
    cb.saveState();
    cb.setColorStroke(new BaseColor(m_Color.getRGB()));
    cb.setColorFill(new BaseColor(m_Color.getRGB()));
    cb.setLineWidth(m_LineWidth);
    cb.rectangle(m_X, m_Y, m_X + m_Width, m_Y + m_Height);
    if (m_Fill)
        cb.fillStroke();
    else
        cb.stroke();
    cb.restoreState();

    return true;
}

From source file:com.devox.GUI.PDF.ExportarAPDF.java

private static void drawLine(PdfContentByte contentByte) {
    contentByte.saveState();//from   www.  j  a v a2  s  .  co m
    contentByte.moveTo(550, 795);
    contentByte.lineTo(35, 795);
    contentByte.moveTo(550, 45);
    contentByte.lineTo(35, 45);
    contentByte.setLineWidth(3);
    contentByte.setColorStroke(new BaseColor(252, 204, 41));
    contentByte.stroke();
    contentByte.restoreState();

}

From source file:com.devox.GUI.PDF.ExportarAPDF.java

private static void drawLine2(PdfContentByte contentByte) {
    contentByte.saveState();//  www .j  a v a2 s .  c  om
    contentByte.moveTo(45, 35);
    contentByte.lineTo(795, 35);
    contentByte.moveTo(45, 550);
    contentByte.lineTo(795, 550);
    contentByte.setLineWidth(3);
    contentByte.setColorStroke(new BaseColor(252, 204, 41));
    contentByte.stroke();
    contentByte.restoreState();

}

From source file:com.vectorprint.report.itext.debug.DebugHelper.java

License:Open Source License

public static void debugBackground(PdfContentByte canvas, Rectangle rect, BaseColor color, String prefix,
        EnhancedMap settings, LayerManager layerAware) {
    canvas = canvas.getPdfWriter().getDirectContentUnder();
    int rgb = color.getRed() + color.getBlue() + color.getGreen();
    rect.setBackgroundColor(color);/*from   w w  w. j  av a2 s.  c  o  m*/
    canvas.rectangle(rect);
    layerAware.startLayerInGroup(DEBUG, canvas);
    debugFont(canvas, settings);
    BaseColor txtColor = (rgb < 150) ? color.brighter().brighter() : color.darker().darker();
    canvas.setColorFill(txtColor);
    canvas.setColorStroke(txtColor);
    canvas.beginText();
    canvas.showTextAligned(Element.ALIGN_LEFT, prefix + color.toString().replace(Color.class.getName(), ""),
            rect.getLeft() + rect.getWidth() / 2, rect.getTop() - rect.getHeight() / 2, 0);
    canvas.endText();
    canvas.endLayer();
}

From source file:com.vectorprint.report.itext.debug.DebugHelper.java

License:Open Source License

public static BaseFont debugFont(PdfContentByte canvas, EnhancedMap settings) {
    BaseFont bf = FontFactory.getFont(FontFactory.HELVETICA).getBaseFont();
    canvas.setFontAndSize(bf, 8);/*from w w  w.j  a  v a 2  s  . c  om*/
    canvas.setColorFill(
            itextHelper.fromColor(settings.getColorProperty(Color.MAGENTA, ReportConstants.DEBUGCOLOR)));
    canvas.setColorStroke(
            itextHelper.fromColor(settings.getColorProperty(Color.MAGENTA, ReportConstants.DEBUGCOLOR)));
    return bf;
}