/** {@inheritDoc} */ @Override public void onEndPage(PdfWriter writer, Document document) { final int pageN = writer.getPageNumber(); final String text = pageN + " / "; final float len = bf.getWidthPoint(text, 8); cb.beginText(); cb.setFontAndSize(bf, 8); final float width = document.getPageSize().getWidth(); cb.setTextMatrix(width / 2, 30); cb.showText(text); cb.endText(); cb.addTemplate(template, width / 2 + len, 30); }
/** * Gets the bounding width of this template. * * @return width the bounding width */ public float getWidth() { return bBox.getWidth(); }
/** * Gets the bounding width of this template. * * @return width the bounding width */ public float getWidth() { return bBox.getWidth(); }
/** * Gets the visibility status of the signature. * * @return the visibility status of the signature */ public boolean isInvisible() { return (rect == null || rect.getWidth() == 0 || rect.getHeight() == 0); }
private void drawLine(PdfContext context, Rectangle iconRect, Color strokeColor, float[] dashArray) { float baseWidth = iconRect.getWidth() / 10; context.drawRelativePath(new float[] {0f, 0.75f, 0.25f, 1f}, new float[]{0f, 0.25f, 0.75f, 1f}, iconRect, strokeColor, baseWidth * 2, dashArray); }
/** * This method compares to Rectangles. They are considered equal if width and height are the same * * @param rect1 The first Rectangle to compare * @param rect2 The second Rectangle to compare * @return <code>True</code> if the Rectangles equal, <code>false</code> otherwise */ private boolean rectEquals(Rectangle rect1, Rectangle rect2) { return (rect1.getWidth() == rect2.getWidth()) && (rect1.getHeight() == rect2.getHeight()); } }
/** * Gets the visibility status of the signature. * @return the visibility status of the signature */ public boolean isInvisible() { return (this.rect == null || this.rect.getWidth() == 0 || this.rect.getHeight() == 0); }
/** * Gets the visibility status of the signature. * @return the visibility status of the signature */ public boolean isInvisible() { return (rect == null || rect.getWidth() == 0 || rect.getHeight() == 0); }
/** Gets the maximum area that the barcode and the text, if * any, will occupy. The lower left corner is always (0, 0). * @return the size the barcode occupies. */ public Rectangle getBarcodeSize() { Rectangle rect = ean.getBarcodeSize(); rect.setRight(rect.getWidth() + supp.getBarcodeSize().getWidth() + n); return rect; }
/** Gets the maximum area that the barcode and the text, if * any, will occupy. The lower left corner is always (0, 0). * @return the size the barcode occupies. */ public Rectangle getBarcodeSize() { Rectangle rect = ean.getBarcodeSize(); rect.setRight(rect.getWidth() + supp.getBarcodeSize().getWidth() + n); return rect; }
private void drawBottomFrame(PdfAppearance app) { app.moveTo(borderWidth, borderWidth); app.lineTo(box.getWidth() - borderWidth, borderWidth); app.lineTo(box.getWidth() - borderWidth, box.getHeight() - borderWidth); app.lineTo(box.getWidth() - 2 * borderWidth, box.getHeight() - 2 * borderWidth); app.lineTo(box.getWidth() - 2 * borderWidth, 2 * borderWidth); app.lineTo(2 * borderWidth, 2 * borderWidth); app.lineTo(borderWidth, borderWidth); app.fill(); } /** Gets the border width in points.
private void drawBottomFrame(PdfAppearance app) { app.moveTo(borderWidth, borderWidth); app.lineTo(box.getWidth() - borderWidth, borderWidth); app.lineTo(box.getWidth() - borderWidth, box.getHeight() - borderWidth); app.lineTo(box.getWidth() - 2 * borderWidth, box.getHeight() - 2 * borderWidth); app.lineTo(box.getWidth() - 2 * borderWidth, 2 * borderWidth); app.lineTo(2 * borderWidth, 2 * borderWidth); app.lineTo(borderWidth, borderWidth); app.fill(); } /** Gets the border width in points.
/** * Initializes context size. * * @param rectangle rectangle */ public void initSize(Rectangle rectangle) { template = writer.getDirectContent().createTemplate(rectangle.getWidth(), rectangle.getHeight()); }
@Override public void calculateSize(PdfContext context) { Rectangle textSize = context.getTextSize(getText(), getFont()); margin = 0.25f * getFont().getSize(); setBounds(new Rectangle(textSize.getWidth() + 2 * margin, textSize.getHeight() + 2 * margin)); }
private void drawTopFrame(PdfAppearance app) { app.moveTo(borderWidth, borderWidth); app.lineTo(borderWidth, box.getHeight() - borderWidth); app.lineTo(box.getWidth() - borderWidth, box.getHeight() - borderWidth); app.lineTo(box.getWidth() - 2 * borderWidth, box.getHeight() - 2 * borderWidth); app.lineTo(2 * borderWidth, box.getHeight() - 2 * borderWidth); app.lineTo(2 * borderWidth, 2 * borderWidth); app.lineTo(borderWidth, borderWidth); app.fill(); }
private float getPageSizeRelativeToA3(PrintGetTemplateRequest request) { Rectangle r; if (request.getPageSize() != null) { r = PageSize.getRectangle(request.getPageSize()); } else { float width = request.getTemplate().getPage().getLayoutConstraint().getWidth(); float height = request.getTemplate().getPage().getLayoutConstraint().getHeight(); r = new Rectangle(0, 0, width, height); } return (r.getWidth() / PageSize.A3.getWidth() + r.getHeight() / PageSize.A3.getHeight()) / 2; }
public void fillRoundRectangle(Rectangle rect, Color color, float r) { template.saveState(); setFill(color); template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r); template.fill(); template.restoreState(); }
public void setSize(String size, boolean landscape) { Rectangle rect = null; if (landscape) { rect = PageSize.getRectangle(size).rotate(); } else { rect = PageSize.getRectangle(size); } setBounds(rect); getConstraint().setWidth(rect.getWidth()); getConstraint().setHeight(rect.getHeight()); }
private void formatTable(final PdfPTable table) { Rectangle page = document.getPageSize(); table.getDefaultCell().setVerticalAlignment(PdfCell.ALIGN_MIDDLE); table.getDefaultCell().setPaddingBottom(tablePaddingBottom); table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER); table.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin()); table.setSpacingBefore(20); }
Envelope createBbox() { double x1 = getMap().getLocation().x; double x2 = x1 + (getBounds().getWidth() / getMap().getPpUnit()); double y1 = getMap().getLocation().y; double y2 = y1 + (getBounds().getHeight() / getMap().getPpUnit()); return new Envelope(x1, x2, y1, y2); }