/** * add a line to the current path. * * @param xStart The start x coordinate. * @param yStart The start y coordinate. * @param xEnd The end x coordinate. * @param yEnd The end y coordinate. * @throws IOException If there is an error while adding the line. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #moveTo moveto(xStart,yStart)} followed by * {@link #lineTo lineTo(xEnd,yEnd)}. */ @Deprecated public void addLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: addLine is not allowed within a text block."); } moveTo(xStart, yStart); lineTo(xEnd, yEnd); }
/** * Draw a line on the page using the current stroking color and the current line width. * * @param xStart The start x coordinate. * @param yStart The start y coordinate. * @param xEnd The end x coordinate. * @param yEnd The end y coordinate. * @throws IOException If there is an error while drawing on the screen. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #moveTo moveto(xStart,yStart)} followed by * {@link #lineTo lineTo(xEnd,yEnd)} followed by {@link #stroke stroke()}. */ @Deprecated public void drawLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: drawLine is not allowed within a text block."); } moveTo(xStart, yStart); lineTo(xEnd, yEnd); stroke(); }
moveTo(x[i], y[i]);
contentStream.endText(); contentStream.moveTo(startX-2, startY-2); contentStream.lineTo(startX-2, startY+200+fontSize); contentStream.stroke(); contentStream.moveTo(startX-2, startY+200+fontSize); contentStream.lineTo(startX+100+stringWidth+2, startY+200+fontSize); contentStream.stroke(); contentStream.moveTo(startX+100+stringWidth+2, startY+200+fontSize); contentStream.lineTo(startX+100+stringWidth+2, startY-2); contentStream.stroke(); contentStream.moveTo(startX+100+stringWidth+2, startY-2); contentStream.lineTo(startX-2, startY-2); contentStream.stroke();
public void moveTo(float x1, float y1) { try { cs.moveTo(x1, y1); } catch (IOException e) { logAndThrow("moveTo", e); } }
public void moveTo(float x1, float y1) { try { cs.moveTo(x1, y1); } catch (IOException e) { logAndThrow("moveTo", e); } }
/** * add a line to the current path. * * @param xStart The start x coordinate. * @param yStart The start y coordinate. * @param xEnd The end x coordinate. * @param yEnd The end y coordinate. * @throws IOException If there is an error while adding the line. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #moveTo moveto(xStart,yStart)} followed by * {@link #lineTo lineTo(xEnd,yEnd)}. */ @Deprecated public void addLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: addLine is not allowed within a text block."); } moveTo(xStart, yStart); lineTo(xEnd, yEnd); }
/** * Draw a line on the page using the current stroking color and the current line width. * * @param xStart The start x coordinate. * @param yStart The start y coordinate. * @param xEnd The end x coordinate. * @param yEnd The end y coordinate. * @throws IOException If there is an error while drawing on the screen. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #moveTo moveto(xStart,yStart)} followed by * {@link #lineTo lineTo(xEnd,yEnd)} followed by {@link #stroke stroke()}. */ @Deprecated public void drawLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: drawLine is not allowed within a text block."); } moveTo(xStart, yStart); lineTo(xEnd, yEnd); stroke(); }
private void drawLine( PDPageContentStream content, float xstart, float ystart, float xend, float yend ){ content.moveTo(xstart, ystart); // moves "pencil" to a position content.lineTo(xend, yend); // creates an invisible line to another position content.stroke(); // makes the line visible }
/** * add a line to the current path. * * @param xStart The start x coordinate. * @param yStart The start y coordinate. * @param xEnd The end x coordinate. * @param yEnd The end y coordinate. * @throws IOException If there is an error while adding the line. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #moveTo moveto(xStart,yStart)} followed by * {@link #lineTo lineTo(xEnd,yEnd)}. */ @Deprecated public void addLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException { if (isInTextMode()) { throw new IllegalStateException("Error: addLine is not allowed within a text block."); } moveTo(xStart, yStart); lineTo(xEnd, yEnd); }
moveTo(x[i], y[i]);
/** * Draw a line on the page using the current stroking color and the current line width. * * @param xStart The start x coordinate. * @param yStart The start y coordinate. * @param xEnd The end x coordinate. * @param yEnd The end y coordinate. * @throws IOException If there is an error while drawing on the screen. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #moveTo moveto(xStart,yStart)} followed by * {@link #lineTo lineTo(xEnd,yEnd)} followed by {@link #stroke stroke()}. */ @Deprecated public void drawLine(float xStart, float yStart, float xEnd, float yEnd) throws IOException { if (isInTextMode()) { throw new IllegalStateException("Error: drawLine is not allowed within a text block."); } moveTo(xStart, yStart); lineTo(xEnd, yEnd); stroke(); }
moveTo(x[i], y[i]);
private void drawLine(float xStart, float yStart, float xEnd, float yEnd, LineStyle border) throws IOException { PDStreamUtils.setLineStyles(tableContentStream, border); tableContentStream.moveTo(xStart, yStart); tableContentStream.lineTo(xEnd, yEnd); tableContentStream.stroke(); tableContentStream.closePath(); }
case PathIterator.SEG_MOVETO: if (isFinite(coords, 2)) contentStream.moveTo(coords[0], coords[1]); break; case PathIterator.SEG_LINETO:
try { float titleWidth = font.getStringWidth(line) / 1000 * fontSize; stream.moveTo(textX, y); stream.lineTo(textX + titleWidth, y); stream.stroke();
@Override public void commit(PDPageContentStream stream) throws IOException { stream.setStrokingColor(style.color()); stream.setLineWidth(toFloat(style.width())); stream.moveTo(toFloat(x1), toFloat(y1)); stream.lineTo(toFloat(x2), toFloat(y2)); stream.stroke(); } }
PDDocument doc = new PDDocument(); PDPage pdpage = new PDPage(); doc.addPage(pdpage); PDPageContentStream stream = new PDPageContentStream(doc, pdpage, false, false); // move stuff a bit up and right stream.concatenate2CTM(AffineTransform.getTranslateInstance(100, 400)); stream.setStrokingColorSpace(PDDeviceRGB.INSTANCE); stream.setStrokingColor(Color.red); stream.setLineWidth(10f); stream.moveTo(1, 1); stream.addBezier32(111, 075, 200, 200); stream.addBezier32(352, 124, 80, 80); stream.addBezier32(432, 333, 300, 333); stream.stroke(); stream.close(); doc.save(filename); doc.close();
contentStream.endText(); contentStream.moveTo(startX-2, startY-2); contentStream.lineTo(startX-2, startY+200+fontSize); contentStream.stroke(); contentStream.moveTo(startX-2, startY+200+fontSize); contentStream.lineTo(startX+100+stringWidth+2, startY+200+fontSize); contentStream.stroke(); contentStream.moveTo(startX+100+stringWidth+2, startY+200+fontSize); contentStream.lineTo(startX+100+stringWidth+2, startY-2); contentStream.stroke(); contentStream.moveTo(startX+100+stringWidth+2, startY-2); contentStream.lineTo(startX-2, startY-2); contentStream.stroke();