/** * Move the current point <I>(x, y)</I>, omitting any connecting line segment. * * @param x new x-coordinate * @param y new y-coordinate */ public void moveTo(final float x, final float y) { moveTo((double) x, (double) y); }
/** * Move the current point <I>(x, y)</I>, omitting any connecting line segment. * * @param x new x-coordinate * @param y new y-coordinate */ public void moveTo(final float x, final float y) { moveTo((double) x, (double) y); }
cb.moveTo(position.getLeft(), position.getTop()); cb.lineTo(position.getLeft(), position.getBottom()); cb.stroke(); if(leftBorder.getStyle().equals(BorderStyle.doublesolid)){ cb.moveTo(position.getLeft()+2, position.getTop()-2); cb.lineTo(position.getLeft()+2, position.getBottom()+2); cb.stroke(); cb.moveTo(position.getLeft(), position.getTop()); cb.lineTo(position.getRight(), position.getTop()); cb.stroke(); if(topBorder.getStyle().equals(BorderStyle.doublesolid)){ cb.moveTo(position.getLeft()+2, position.getTop()-2); cb.lineTo(position.getRight()-2, position.getTop()-2); cb.stroke(); cb.moveTo(position.getRight(), position.getTop()); cb.lineTo(position.getRight(), position.getBottom()); cb.stroke(); if(rightBorder.getStyle().equals(BorderStyle.doublesolid)){ cb.moveTo(position.getRight()-2, position.getTop()-2); cb.lineTo(position.getRight()-2, position.getBottom()+2); cb.stroke(); cb.moveTo(position.getLeft(), position.getBottom()); cb.lineTo(position.getRight(), position.getBottom()); cb.stroke(); if(bottomBorder.getStyle().equals(BorderStyle.doublesolid)){ cb.moveTo(position.getLeft()+2, position.getBottom()+2);
private void drawRulerLine(PdfContentByte cb, int height) { cb.moveTo(59, height); cb.lineTo(536, height); cb.stroke(); }
/** * Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, * starting at startAng degrees and covering extent degrees. Angles * start with 0 to the right (+x) and increase counter-clockwise. * * @param x1 a corner of the enclosing rectangle * @param y1 a corner of the enclosing rectangle * @param x2 a corner of the enclosing rectangle * @param y2 a corner of the enclosing rectangle * @param startAng starting angle in degrees * @param extent angle extent in degrees */ public void arc(final double x1, final double y1, final double x2, final double y2, final double startAng, final double extent) { ArrayList<double[]> ar = bezierArc(x1, y1, x2, y2, startAng, extent); if (ar.isEmpty()) return; double pt[] = ar.get(0); moveTo(pt[0], pt[1]); for (int k = 0; k < ar.size(); ++k) { pt = ar.get(k); curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]); } }
/** * Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, * starting at startAng degrees and covering extent degrees. Angles * start with 0 to the right (+x) and increase counter-clockwise. * * @param x1 a corner of the enclosing rectangle * @param y1 a corner of the enclosing rectangle * @param x2 a corner of the enclosing rectangle * @param y2 a corner of the enclosing rectangle * @param startAng starting angle in degrees * @param extent angle extent in degrees */ public void arc(final double x1, final double y1, final double x2, final double y2, final double startAng, final double extent) { ArrayList<double[]> ar = bezierArc(x1, y1, x2, y2, startAng, extent); if (ar.isEmpty()) return; double pt[] = ar.get(0); moveTo(pt[0], pt[1]); for (int k = 0; k < ar.size(); ++k) { pt = ar.get(k); curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]); } }
/** Draws a circle. The endpoint will (x+r, y). * * @param x x center of circle * @param y y center of circle * @param r radius of circle */ public void circle(final double x, final double y, final double r) { float b = 0.5523f; moveTo(x + r, y); curveTo(x + r, y + r * b, x + r * b, y + r, x, y + r); curveTo(x - r * b, y + r, x - r, y + r * b, x - r, y); curveTo(x - r, y - r * b, x - r * b, y - r, x, y - r); curveTo(x + r * b, y - r, x + r, y - r * b, x + r, y); }
/** Draws a circle. The endpoint will (x+r, y). * * @param x x center of circle * @param y y center of circle * @param r radius of circle */ public void circle(final double x, final double y, final double r) { float b = 0.5523f; moveTo(x + r, y); curveTo(x + r, y + r * b, x + r * b, y + r, x, y + r); curveTo(x - r * b, y + r, x - r, y + r * b, x - r, y); curveTo(x - r, y - r * b, x - r * b, y - r, x, y - r); curveTo(x + r * b, y - r, x + r, y - r * b, x + r, y); }
final PDFTarget pdfTarget = (PDFTarget) target; final PdfContentByte cb = pdfTarget.getContentByte(); cb.moveTo(h.x, -h.y); cb.curveTo(h.v1.x, -h.v1.y, h.v2.x, -h.v2.y, h.x, -h.y); cb.setRGBColorStroke(
final PDFTarget pdfTarget = (PDFTarget) target; final PdfContentByte cb = pdfTarget.getContentByte(); cb.moveTo(h.p1.x, -h.p1.y); cb.lineTo(h.p2.x, -h.p2.y); cb.lineTo(h.p3.x, -h.p3.y);
r = -r; float b = 0.4477f; moveTo(x + r, y); lineTo(x + w - r, y); curveTo(x + w - r * b, y, x + w, y + r * b, x + w, y + r);
r = -r; float b = 0.4477f; moveTo(x + r, y); lineTo(x + w - r, y); curveTo(x + w - r * b, y, x + w, y + r * b, x + w, y + r);
if (getLineColor() != null) canvas.setColorStroke(getLineColor()); canvas.moveTo(s + leftX, y + offset); canvas.lineTo(s + w + leftX, y + offset); canvas.stroke();
if (getLineColor() != null) canvas.setColorStroke(getLineColor()); canvas.moveTo(s + leftX, y + offset); canvas.lineTo(s + w + leftX, y + offset); canvas.stroke();
setLineWidth(1); setLineCap(0); moveTo(llx + 1f, lly + 1.5f); lineTo(urx - 1.5f, lly + 1.5f); lineTo(urx - 1.5f, ury - 1f); setLineWidth(1); setLineCap(0); moveTo(llx + 1f, lly + 1); lineTo(llx + 1f, ury - 1f); lineTo(urx - 1f, ury - 1f); setLineWidth(1); setLineCap(0); moveTo(llx + 2f, lly + 2f); lineTo(llx + 2f, ury - 2f); lineTo(urx - 2f, ury - 2f);
setLineWidth(1); setLineCap(0); moveTo(llx + 1f, lly + 1.5f); lineTo(urx - 1.5f, lly + 1.5f); lineTo(urx - 1.5f, ury - 1f); setLineWidth(1); setLineCap(0); moveTo(llx + 1f, lly + 1); lineTo(llx + 1f, ury - 1f); lineTo(urx - 1f, ury - 1f); setLineWidth(1); setLineCap(0); moveTo(llx + 2f, lly + 2f); lineTo(llx + 2f, ury - 2f); lineTo(urx - 2f, ury - 2f);
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); }