Class PdfCjkStandardFont
- Namespace
- Syncfusion.Pdf.Graphics
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents the standard CJK fonts.
public class PdfCjkStandardFont : PdfFont
- Inheritance
-
PdfCjkStandardFont
- Inherited Members
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, float)
Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkFontFamily and size
public PdfCjkStandardFont(PdfCjkFontFamily fontFamily, float size)
Parameters
fontFamily
PdfCjkFontFamilyThe font family.
size
floatThe 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, float, PdfFontStyle)
Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkFontFamily, size and style
public PdfCjkStandardFont(PdfCjkFontFamily fontFamily, float size, PdfFontStyle style)
Parameters
fontFamily
PdfCjkFontFamilyThe font family.
size
floatThe size.
style
PdfFontStyleThe 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, float)
Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkStandardFont and size
public PdfCjkStandardFont(PdfCjkStandardFont prototype, float size)
Parameters
prototype
PdfCjkStandardFontThe prototype.
size
floatThe 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, float, PdfFontStyle)
Initializes a new instance of the PdfCjkStandardFont class with the specified PdfCjkFontFamily, size and style
public PdfCjkStandardFont(PdfCjkStandardFont prototype, float size, PdfFontStyle style)
Parameters
prototype
PdfCjkStandardFontThe prototype.
size
floatThe size.
style
PdfFontStyleThe 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.
public PdfCjkFontFamily FontFamily { get; }
Property Value
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.
protected override bool EqualsToFont(PdfFont font)
Parameters
font
PdfFontFont to compare.
Returns
- bool
True if fonts are equal, False otherwise.
GetCharWidth(char, PdfStringFormat)
Returns width of the char.
protected override float GetCharWidth(char charCode, PdfStringFormat format)
Parameters
charCode
charChar symbol.
format
PdfStringFormatString format.
Returns
- float
Width of the symbol.
GetLineWidth(string, PdfStringFormat)
Returns width of the line.
protected override float GetLineWidth(string line, PdfStringFormat format)
Parameters
line
stringText line.
format
PdfStringFormatString format.
Returns
- float
Width of the line.