/** {@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); }
/** * Returns the width of a certain character of this font. * * @param character a certain character * @return a width in Text Space */ float width(int character) { if (image == null) return font.getWidthPoint(character, size) * hScale; else return image.getScaledWidth(); }
float width(String s) { if (image == null) return font.getWidthPoint(s, size) * hScale; else return image.getScaledWidth(); }
/** * Returns the width of a certain character of this font. * * @param character a certain character * @return a width in Text Space */ float width(int character) { if (image == null) return font.getWidthPoint(character, size) * hScale; else return image.getScaledWidth(); }
float width(String s) { if (image == null) return font.getWidthPoint(s, size) * hScale; else return image.getScaledWidth(); }
float width(String s) { if (image == null) return font.getWidthPoint(s, size) * hScale; else return image.getScaledWidth(); }
/** * Returns the width of a certain character of this font. * * @param character a certain character * @return a width in Text Space */ float width(int character) { if (image == null) return font.getWidthPoint(character, size) * hScale; else return image.getScaledWidth(); }
public int getWidth(FontContext context, FSFont font, String string) { BaseFont bf = ((ITextFSFont)font).getFontDescription().getFont(); float result = bf.getWidthPoint(string, font.getSize2D()); if (result - Math.floor(result) < TEXT_MEASURING_DELTA) { return (int)result; } else { return (int)Math.ceil(result); } }
public int getWidth(FontContext context, FSFont font, String string) { BaseFont bf = ((ITextFSFont)font).getFontDescription().getFont(); float result = bf.getWidthPoint(string, font.getSize2D()); if (result - Math.floor(result) < TEXT_MEASURING_DELTA) { return (int)result; } else { return (int)Math.ceil(result); } }
public int getWidth(FontContext context, FSFont font, String string) { BaseFont bf = ((ITextFSFont)font).getFontDescription().getFont(); float result = bf.getWidthPoint(string, font.getSize2D()); if (result - Math.floor(result) < TEXT_MEASURING_DELTA) { return (int)result; } else { return (int)Math.ceil(result); } }
public int getWidth(FontContext context, FSFont font, String string) { BaseFont bf = ((ITextFSFont)font).getFontDescription().getFont(); float result = bf.getWidthPoint(string, font.getSize2D()); if (result - Math.floor(result) < TEXT_MEASURING_DELTA) { return (int)result; } else { return (int)Math.ceil(result); } }
private float calculateFontSize(float w, float h) throws IOException, DocumentException { BaseFont ufont = getRealFont(); float fsize = fontSize; if (fsize == 0) { float bw = ufont.getWidthPoint(text, 1); if (bw == 0) fsize = 12; else fsize = w / bw; float nfsize = h / (1 - ufont.getFontDescriptor(BaseFont.DESCENT, 1)); fsize = Math.min(fsize, nfsize); if (fsize < 4) fsize = 4; } return fsize; }
private float calculateFontSize(float w, float h) throws IOException, DocumentException { BaseFont ufont = getRealFont(); float fsize = fontSize; if (fsize == 0) { float bw = ufont.getWidthPoint(text, 1); if (bw == 0) fsize = 12; else fsize = w / bw; float nfsize = h / (1 - ufont.getFontDescriptor(BaseFont.DESCENT, 1)); fsize = Math.min(fsize, nfsize); if (fsize < 4) fsize = 4; } return fsize; }
public int getWidth(FontContext context, FSFont font, String string) { BaseFont bf = ((ITextFSFont)font).getFontDescription().getFont(); float result = bf.getWidthPoint(string, font.getSize2D()); if (result - Math.floor(result) < TEXT_MEASURING_DELTA) { return (int)result; } else { return (int)Math.ceil(result); } }
public int getWidth(FontContext context, FSFont font, String string) { BaseFont bf = ((ITextFSFont)font).getFontDescription().getFont(); float result = bf.getWidthPoint(string, font.getSize2D()); if (result - Math.floor(result) < TEXT_MEASURING_DELTA) { return (int)result; } else { return (int)Math.ceil(result); } }
public void onOpenDocument(PdfWriter writer, Document document){ cb_ = writer.getDirectContent(); template_ = cb_.createTemplate(50,50); float width = document.right() - document.left(); headerX_ = (PAGEMARGIN_LEFT + width - PdfUtils.BASEFONT_GOTHIC.getWidthPoint(headerTitle_,size_))/2; headerY_ = document.top() + PAGEMARGIN_TOP/2; footerX_ = (PAGEMARGIN_LEFT + width - PdfUtils.BASEFONT_GOTHIC.getWidthPoint(FOOTERPREFIX + " " + FOOTERMIDDLE + " ",size_))/2; }
/** * Gets the width of the Chunk in points. * * @return a width in points */ public float getWidthPoint() { if (getImage() != null) { return getImage().getScaledWidth(); } return font.getCalculatedBaseFont(true).getWidthPoint(getContent(), font.getCalculatedSize()) * getHorizontalScaling(); }
/** * Gets the width of the Chunk in points. * * @return a width in points */ public float getWidthPoint() { if (getImage() != null) { return getImage().getScaledWidth(); } return font.getCalculatedBaseFont(true).getWidthPoint(getContent(), font.getCalculatedSize()) * getHorizontalScaling(); }
/** * Gets the width of the Chunk in points. * * @return a width in points */ public float getWidthPoint() { if (getImage() != null) { return getImage().getScaledWidth(); } return font.getCalculatedBaseFont(true).getWidthPoint(getContent(), font.getCalculatedSize()) * getHorizontalScaling(); }
/** {@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); }