Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfCjkStandardFont

    Show / Hide Table of Contents

    Class PdfCjkStandardFont

    Represents the standard CJK fonts.

    Inheritance
    System.Object
    PdfFont
    PdfCjkStandardFont
    Inherited Members
    PdfFont.s_syncObject
    PdfFont.MeasureString(String)
    PdfFont.MeasureString(String, PdfStringFormat)
    PdfFont.MeasureString(String, PdfStringFormat, Int32, Int32)
    PdfFont.MeasureString(String, Single)
    PdfFont.MeasureString(String, Single, PdfStringFormat)
    PdfFont.MeasureString(String, Single, PdfStringFormat, Int32, Int32)
    PdfFont.MeasureString(String, SizeF)
    PdfFont.MeasureString(String, SizeF, PdfStringFormat)
    PdfFont.MeasureString(String, SizeF, PdfStringFormat, Int32, Int32)
    PdfFont.SetStyle(PdfFontStyle)
    PdfFont.ApplyFormatSettings(String, PdfStringFormat, Single)
    PdfFont.Name
    PdfFont.Size
    PdfFont.Height
    PdfFont.Style
    PdfFont.Bold
    PdfFont.Italic
    PdfFont.Strikeout
    PdfFont.Underline
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfCjkStandardFont : PdfFont, IPdfWrapper, IPdfCache
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
    //Set the standard font.
    PdfFont font = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20);
    //Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Set the standard font.
    Dim font As PdfFont = New PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20)
    'Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    Constructors

    PdfCjkStandardFont(PdfCjkFontFamily, Single)

    Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkFontFamily and size

    Declaration
    public PdfCjkStandardFont(PdfCjkFontFamily fontFamily, float size)
    Parameters
    Type Name Description
    PdfCjkFontFamily fontFamily

    The font family.

    System.Single size

    The size.

    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
    //Set the standard font.
    PdfFont font = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20);
    //Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Set the standard font.
    Dim font As PdfFont = New PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20)
    'Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    PdfCjkStandardFont(PdfCjkFontFamily, Single, PdfFontStyle)

    Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkFontFamily, size and style

    Declaration
    public PdfCjkStandardFont(PdfCjkFontFamily fontFamily, float size, PdfFontStyle style)
    Parameters
    Type Name Description
    PdfCjkFontFamily fontFamily

    The font family.

    System.Single size

    The size.

    PdfFontStyle style

    The style.

    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
    //Set the standard font.
    PdfFont font = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20, PdfFontStyle.Bold);
    //Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Set the standard font.
    Dim font As PdfFont = New PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20, PdfFontStyle.Bold)
    'Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    PdfCjkStandardFont(PdfCjkStandardFont, Single)

    Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkStandardFont and size

    Declaration
    public PdfCjkStandardFont(PdfCjkStandardFont prototype, float size)
    Parameters
    Type Name Description
    PdfCjkStandardFont prototype

    The prototype.

    System.Single size

    The size.

    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
    //Set the standard font.
    PdfCjkStandardFont cjkFont = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20);
    //Create PDF cjk font.
    PdfFont font = new PdfCjkStandardFont(cjkFont, 20);
    //Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Set the standard font.
    Dim cjkFont As New PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20)
    'Create PDF cjk font.
    Dim font As PdfFont = New PdfCjkStandardFont(cjkFont, 20)
    'Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    PdfCjkStandardFont(PdfCjkStandardFont, Single, PdfFontStyle)

    Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkFontFamily, size and style

    Declaration
    public PdfCjkStandardFont(PdfCjkStandardFont prototype, float size, PdfFontStyle style)
    Parameters
    Type Name Description
    PdfCjkStandardFont prototype

    The prototype.

    System.Single size

    The size.

    PdfFontStyle style

    The style.

    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
    //Set the standard font.
    PdfCjkStandardFont cjkFont = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20, PdfFontStyle.Bold);
    //Create PDF cjk font.
    PdfFont font = new PdfCjkStandardFont(cjkFont, 20);
    //Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Set the standard font.
    Dim cjkFont As New PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20, PdfFontStyle.Bold)
    'Create PDF cjk font.
    Dim font As PdfFont = New PdfCjkStandardFont(cjkFont, 20)
    'Draw the text.
    graphics.DrawString("こんにちは世界", font, PdfBrushes.Black, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    Properties

    FontFamily

    Gets the CJK font family.

    Declaration
    public PdfCjkFontFamily FontFamily { get; }
    Property Value
    Type Description
    PdfCjkFontFamily
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add a page to the document.
    PdfPage page = document.Pages.Add();
    //Create PDF graphics for the page.
    PdfGraphics graphics = page.Graphics;
     //Create new PDF cjk font.
     PdfCjkStandardFont font = new PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20, PdfFontStyle.Bold);
     //Draw the text.
     graphics.DrawString("The CJK font family name is " + font.FontFamily.ToString(), font, PdfBrushes.Black, new PointF(0, 0));
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = document.Pages.Add()
    'Create PDF graphics for the page.
    Dim graphics As PdfGraphics = page.Graphics
    'Create new PDF cjk font.
    Dim font As New PdfCjkStandardFont(PdfCjkFontFamily.HeiseiMinchoW3, 20, PdfFontStyle.Bold)
    'Draw the text.
    graphics.DrawString("The CJK font family name is " + font.FontFamily.ToString(), font, PdfBrushes.Black, New PointF(0, 0))
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    Methods

    EqualsToFont(PdfFont)

    Checks whether fonts are equals.

    Declaration
    protected override bool EqualsToFont(PdfFont font)
    Parameters
    Type Name Description
    PdfFont font

    Font to compare.

    Returns
    Type Description
    System.Boolean

    True if fonts are equal, False otherwise.

    Overrides
    PdfFont.EqualsToFont(PdfFont)

    GetCharWidth(Char, PdfStringFormat)

    Returns width of the char.

    Declaration
    protected override float GetCharWidth(char charCode, PdfStringFormat format)
    Parameters
    Type Name Description
    System.Char charCode

    Char symbol.

    PdfStringFormat format

    String format.

    Returns
    Type Description
    System.Single

    Width of the symbol.

    Overrides
    PdfFont.GetCharWidth(Char, PdfStringFormat)

    GetLineWidth(String, PdfStringFormat)

    Returns width of the line.

    Declaration
    protected override float GetLineWidth(string line, PdfStringFormat format)
    Parameters
    Type Name Description
    System.String line

    Text line.

    PdfStringFormat format

    String format.

    Returns
    Type Description
    System.Single

    Width of the line.

    Overrides
    PdfFont.GetLineWidth(String, PdfStringFormat)
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved