PdfCjkFontFamily

16 Dec 20251 minute to read

Public enum to define CJK font family.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Gets the first page
let page: PdfPage = document.getPage(0) as PdfPage;
// Create a new PDF CJK standard font
let font: PdfCjkStandardFont = document.embedFont(PdfCjkFontFamily.heiseiMinchoW3, 20, PdfFontStyle.regular, true);
// Create a new PDF string format
let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
// Draw the text
page.graphics.drawString('こんにちは世界', font, {x: 0, y: 180, width: page.size.width, height: 40}, new PdfBrush({r: 0, g: 0, b: 255}), format);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • hanyangSystemsGothicMedium - Specifies the hanyangSystemsGothicMedium CJK font family.
  • hanyangSystemsShinMyeongJoMedium - Specifies the hanyangSystemsShinMyeongJoMedium CJK font family.
  • heiseiKakuGothicW5 - Specifies the heiseiKakuGothicW5 CJK font family.
  • heiseiMinchoW3 - Specifies the heiseiMinchoW3 CJK font family.
  • monotypeHeiMedium - Specifies the monotypeHeiMedium CJK font family.
  • monotypeSungLight - Specifies the monotypeSungLight CJK font family.
  • sinoTypeSongLight - Specifies the sinoTypeSongLight CJK font family.