Class PdfCjkStandardFont
Represents the standard CJK fonts.
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.NET.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 |
---|
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
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
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. |