iTextSharp.text.pdf.PdfContentByte.SetFontAndSize C# (CSharp) Метод

SetFontAndSize() публичный Метод

public SetFontAndSize ( BaseFont bf, float size ) : void
bf BaseFont
size float
Результат void
        public virtual void SetFontAndSize(BaseFont bf, float size)
        {
            if (!inText && autoControlTextBlocks) {
                BeginText(true);
            }
            CheckWriter();
            if (size < 0.0001f && size > -0.0001f)
                throw new ArgumentException(MessageLocalization.GetComposedMessage("font.size.too.small.1", size));
            state.size = size;
            state.fontDetails = writer.AddSimple(bf);
            PageResources prs = PageResources;
            PdfName name = state.fontDetails.FontName;
            name = prs.AddFont(name, state.fontDetails.IndirectReference);
            content.Append(name.GetBytes()).Append(' ').Append(size).Append(" Tf").Append_i(separator);
        }

Usage Example

Пример #1
1
// ---------------------------------------------------------------------------    
    /**
     * Draws a character representing an arrow at the current position.
     * @see com.itextpdf.text.pdf.draw.VerticalPositionMark#draw(
     *      com.itextpdf.text.pdf.PdfContentByte, float, float, float, float, float)
     */
    // i'm so stupid; originally forgot to override parent method and wondered
    // why the arrows weren't being drawn...
    public override void Draw(
      PdfContentByte canvas, float llx, float lly, float urx, float ury, float y
    ) {
      canvas.BeginText();
      canvas.SetFontAndSize(zapfdingbats, 12);
      if (left) {
        canvas.ShowTextAligned(Element.ALIGN_CENTER,
          ((char) 220).ToString(), llx - 10, y, 0
        );
      }
      else {
        canvas.ShowTextAligned(Element.ALIGN_CENTER,
          ((char) 220).ToString(), urx + 10, y + 8, 180
        );
      }
      canvas.EndText();
    }
All Usage Examples Of iTextSharp.text.pdf.PdfContentByte::SetFontAndSize
PdfContentByte