/** * Fill a rectangle on the page using the current non stroking color. * * @param x The lower left x coordinate. * @param y The lower left y coordinate. * @param width The width of the rectangle. * @param height The height of the rectangle. * @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 #addRect} followed by {@link #fill()} instead. */ @Deprecated public void fillRect(float x, float y, float width, float height) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: fillRect is not allowed within a text block."); } addRect(x, y, width, height); fill(); }
public void addRect(float x, float y, float w, float h) { try { cs.addRect(x, y, w, h); } catch (IOException e) { logAndThrow("addRect", e); } }
public void addRect(float x, float y, float w, float h) { try { cs.addRect(x, y, w, h); } catch (IOException e) { logAndThrow("addRect", e); } }
/** * Fill a rectangle on the page using the current non stroking color. * * @param x The lower left x coordinate. * @param y The lower left y coordinate. * @param width The width of the rectangle. * @param height The height of the rectangle. * @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 #addRect} followed by {@link #fill()} instead. */ @Deprecated public void fillRect(float x, float y, float width, float height) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: fillRect is not allowed within a text block."); } addRect(x, y, width, height); fill(); }
public void fillRect(float x, float y, float w, float h) { try { cs.addRect(x, y, w, h); cs.fill(); } catch (IOException e) { logAndThrow("fillRect", e); } }
pcs.addRect(50, 500, 200, 200); pcs.setNonStrokingColor(patternColor1); pcs.fill(); patternCS2); pcs.addRect(300, 500, 100, 100); pcs.setNonStrokingColor(patternColor2green); pcs.fill(); patternName2, patternCS2); pcs.addRect(455, 505, 100, 100); pcs.setNonStrokingColor(patternColor2blue); pcs.fill();
public void fillRect(float x, float y, float w, float h) { try { cs.addRect(x, y, w, h); cs.fill(); } catch (IOException e) { logAndThrow("fillRect", e); } }
/** * Fill a rectangle on the page using the current non stroking color. * * @param x The lower left x coordinate. * @param y The lower left y coordinate. * @param width The width of the rectangle. * @param height The height of the rectangle. * @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 #addRect} followed by {@link #fill()} instead. */ @Deprecated public void fillRect(float x, float y, float width, float height) throws IOException { if (isInTextMode()) { throw new IllegalStateException("Error: fillRect is not allowed within a text block."); } addRect(x, y, width, height); fill(); }
cs.addRect(-5000, -5000, 10000, 10000); cs.fill();
void drawRect(PDPageContentStream content, Color color, Rectangle rect, boolean fill) { content.addRect(rect.x, rect.y, rect.width, rect.height); if (fill) { content.setNonStrokingColor(color); content.fill(); } else { content.setStrokingColor(color); content.stroke(); } }
public PDRectangle drawRectangle(final float x, final float y, final float width, final float height, final Color color) throws IOException { final float startingY = checkYAndSwitchPage(y, height); contentStream.setNonStrokingColor(color); contentStream.addRect(x, startingY, width, height); contentStream.fill(); return new PDRectangle(x, startingY, width, height); }
stream.setNonStrokingColor(color); stream.addRect(x, y, width, -height); stream.fill(); stream.closePath();
@Override public void commit(PDPageContentStream stream) throws IOException { stream.setNonStrokingColor(color); stream.addRect(toFloat(x), toFloat(y), toFloat(width), toFloat(height)); stream.fill(); } }
contents.addRect(paddingEdge.getLowerLeftX(), paddingEdge.getUpperRightY() - highlightBoxHeight * (selectedIndex - topIndex + 1) + 2, paddingEdge.getWidth(),
private void fillCellColor(Cell<T> cell, float yStart, float xStart, Iterator<Cell<T>> cellIterator) throws IOException { if (cell.getFillColor() != null) { this.tableContentStream.setNonStrokingColor(cell.getFillColor()); // y start is bottom pos yStart = yStart - cell.getHeight(); float height = cell.getHeight() - (cell.getTopBorder() == null ? 0 : cell.getTopBorder().getWidth()); float cellWidth = getWidth(cell, cellIterator); this.tableContentStream.addRect(xStart, yStart, cellWidth, height); this.tableContentStream.fill(); this.tableContentStream.closePath(); // Reset NonStroking Color to default value this.tableContentStream.setNonStrokingColor(Color.BLACK); } }
pcs.addRect(50, 500, 200, 200); pcs.setNonStrokingColor(patternColor1); pcs.fill(); patternCS2); pcs.addRect(300, 500, 100, 100); pcs.setNonStrokingColor(patternColor2green); pcs.fill(); patternName2, patternCS2); pcs.addRect(455, 505, 100, 100); pcs.setNonStrokingColor(patternColor2blue); pcs.fill();
private void applyShadingAsColor(PDShading shading) throws IOException { /* * If the paint has a shading we must create a tiling pattern and set that as * stroke color... */ PDTilingPattern pattern = new PDTilingPattern(); pattern.setPaintType(PDTilingPattern.PAINT_COLORED); pattern.setTilingType(PDTilingPattern.TILING_CONSTANT_SPACING_FASTER_TILING); PDRectangle anchorRect = bbox; pattern.setBBox(anchorRect); pattern.setXStep(anchorRect.getWidth()); pattern.setYStep(anchorRect.getHeight()); PDAppearanceStream appearance = new PDAppearanceStream(this.document); appearance.setResources(pattern.getResources()); appearance.setBBox(pattern.getBBox()); PDPageContentStream imageContentStream = new PDPageContentStream(document, appearance, ((COSStream) pattern.getCOSObject()).createOutputStream()); imageContentStream.addRect(0, 0, anchorRect.getWidth(), anchorRect.getHeight()); imageContentStream.clip(); imageContentStream.shadingFill(shading); imageContentStream.close(); PDColorSpace patternCS1 = new PDPattern(null); COSName tilingPatternName = xFormObject.getResources().add(pattern); PDColor patternColor = new PDColor(tilingPatternName, patternCS1); contentStream.setNonStrokingColor(patternColor); contentStream.setStrokingColor(patternColor); }