private PdfContentByte bulidCellBorder(PdfContentByte[] canvases,Border border){ PdfContentByte cb=canvases[PdfPTable.LINECANVAS]; cb.saveState(); BigDecimal w=new BigDecimal(border.getWidth()); cb.setLineWidth(w.divide(new BigDecimal(2),10,RoundingMode.HALF_UP).floatValue()); if(border.getStyle().equals(BorderStyle.dashed)){ cb.setLineDash(new float[]{2f,3f,1f},2); } String borderColor[]=border.getColor().split(","); cb.setColorStroke(new BaseColor(Integer.valueOf(borderColor[0]),Integer.valueOf(borderColor[1]),Integer.valueOf(borderColor[2]))); return cb; } }
/** * Changes the <VAR>line width</VAR>. * <P> * The line width specifies the thickness of the line used to stroke a path and is measured * in user space units.<BR> * * @param w a width */ public void setLineWidth(final float w) { setLineWidth((double) w); }
/** * Changes the <VAR>line width</VAR>. * <P> * The line width specifies the thickness of the line used to stroke a path and is measured * in user space units.<BR> * * @param w a width */ public void setLineWidth(final float w) { setLineWidth((double) w); }
private void drawRulers(PdfContentByte cb, float weight, int... heights) { cb.setLineWidth(weight); for (int height : heights) drawRulerLine(cb, height); }
private PdfContentByte bulidCellBorder(PdfContentByte[] canvases,Border border){ PdfContentByte cb=canvases[PdfPTable.LINECANVAS]; cb.saveState(); BigDecimal w=new BigDecimal(border.getWidth()); cb.setLineWidth(w.divide(new BigDecimal(2),10,RoundingMode.HALF_UP).floatValue()); if(border.getStyle().equals(BorderStyle.dashed)){ cb.setLineDash(new float[]{2f,3f,1f},2); } String borderColor[]=border.getColor().split(","); cb.setColorStroke(new BaseColor(Integer.valueOf(borderColor[0]),Integer.valueOf(borderColor[1]),Integer.valueOf(borderColor[2]))); return cb; } }
/** * @see com.itextpdf.text.pdf.draw.DrawInterface#draw(com.itextpdf.text.pdf.PdfContentByte, float, float, float, float, float) */ public void draw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y) { canvas.saveState(); canvas.setLineWidth(lineWidth); canvas.setLineCap(PdfContentByte.LINE_CAP_ROUND); canvas.setLineDash(0, gap, gap / 2); drawLine(canvas, llx, urx, y); canvas.restoreState(); }
color.getGreen(), color.getBlue()); cb.setLineWidth(getThickness(item)); if (color.getAlpha() < 255) { cb.saveState();
/** * @see com.itextpdf.text.pdf.draw.DrawInterface#draw(com.itextpdf.text.pdf.PdfContentByte, float, float, float, float, float) */ public void draw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y) { canvas.saveState(); canvas.setLineWidth(lineWidth); canvas.setLineCap(PdfContentByte.LINE_CAP_ROUND); canvas.setLineDash(0, gap, gap / 2); drawLine(canvas, llx, urx, y); canvas.restoreState(); }
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE); cb.setRGBColorStroke(outlineColor.getRed(), outlineColor.getGreen(), outlineColor.getBlue()); cb.setLineWidth(outlineSize); cb.setLineJoin(PdfContentByte.LINE_JOIN_ROUND); cb.setLineCap(PdfContentByte.LINE_CAP_ROUND);
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE); cb.setRGBColorStroke(outlineColor.getRed(), outlineColor.getGreen(), outlineColor.getBlue()); cb.setLineWidth(outlineSize); cb.setLineJoin(PdfContentByte.LINE_JOIN_ROUND); cb.setLineCap(PdfContentByte.LINE_CAP_ROUND);
strokeWidth = ((Float)textRender[1]).floatValue(); if (strokeWidth != 1) text.setLineWidth(strokeWidth); strokeColor = (BaseColor)textRender[2]; if (strokeColor == null) text.resetRGBColorStroke(); if (strokeWidth != 1) text.setLineWidth(1);
cb.setLineWidth(borderSize); cb.setRGBColorFill(color.getRed(), color.getGreen(), color.getBlue()); if (alpha < 1f) {
saveState(); setLineWidth(1); setLineCap(1); setColorStroke(new BaseColor(0xC0, 0xC0, 0xC0)); stroke(); setLineWidth(1); setLineCap(1); setColorStroke(new BaseColor(0xA0, 0xA0, 0xA0)); stroke(); setLineWidth(1); setLineCap(1); setColorStroke(new BaseColor(0x00, 0x00, 0x00)); if (on) { setLineWidth(1); setLineCap(1); setColorFill(new BaseColor(0x00, 0x00, 0x00));
saveState(); setLineWidth(1); setLineCap(1); setColorStroke(new BaseColor(0xC0, 0xC0, 0xC0)); stroke(); setLineWidth(1); setLineCap(1); setColorStroke(new BaseColor(0xA0, 0xA0, 0xA0)); stroke(); setLineWidth(1); setLineCap(1); setColorStroke(new BaseColor(0x00, 0x00, 0x00)); if (on) { setLineWidth(1); setLineCap(1); setColorFill(new BaseColor(0x00, 0x00, 0x00));
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); float lineWidth = fontSize * 0.04f; // 4% of font size cb.setLineWidth(lineWidth); resetMode = true; ensureStrokeColor(); cb.setLineWidth(1);
setLineWidth(1); setLineCap(0); rectangle(llx, lly, urx - llx, ury - lly); stroke(); setLineWidth(1); setLineCap(0); setColorFill(new BaseColor(0xFF, 0xFF, 0xFF)); setLineWidth(1); setLineCap(0); moveTo(llx + 1f, lly + 1.5f); setLineWidth(1); setLineCap(0); moveTo(llx + 1f, lly + 1); setLineWidth(1); setLineCap(0); moveTo(llx + 2f, lly + 2f);
break; canvas.setLineWidth(getLineWidth()); if (getLineColor() != null) canvas.setColorStroke(getLineColor());
break; canvas.setLineWidth(getLineWidth()); if (getLineColor() != null) canvas.setColorStroke(getLineColor());
public void drawFooter(PdfContentByte canvas, PageInfos pageInfos) { if (pageInfos.getRawPageNumber() == 1 && !footerOnFirstPage) return; if (drawLine) { BaseColor lineColor = styles.getColorOrDefault(HEADER_LINE_COLOR); canvas.saveState(); canvas.setColorStroke(lineColor); canvas.setLineWidth(1.2f); canvas.moveTo(rect.getLeft(), rect.getBottom() - 6); canvas.lineTo(rect.getRight(), rect.getBottom() - 6); canvas.stroke(); canvas.restoreState(); } float bottom = rect.getBottom() - 20; Phrase footer = footerText(pageInfos); if (footer != null) { showTextAligned(canvas, Element.ALIGN_LEFT, footer, rect.getLeft(), bottom, 0); } Font footerFont = styles.getFontOrDefault(FOOTER_FONT); Phrase page = new Phrase(pageInfos.getFormattedPageNumber(), footerFont); showTextAligned(canvas, Element.ALIGN_RIGHT, page, rect.getRight(), bottom, 0); }
} else { PdfContentByte cb = writer.getDirectContent(); cb.setLineWidth(1f); if (isLetter) { cb.moveTo(PageSize.LETTER.getLeft(50), vertPos);