How To Create CJK PDF Document in .NET

This sample shows how to create cjk PDF Document in .NET

C# :

using PDFMosaic;
using System.Drawing;

namespace DrawText
{
 class DrawText
 {
  static void Main()
  {
   PDFDocument document = new PDFDocument();
   document.Pages.Add(new PDFPage(PDFPaperFormat.A4));
   PDFCanvas canvas = document.Pages[0].Canvas;

   PDFFont font = new PDFFont("MingLiU", 14);

   PDFBrush brush = new PDFSolidBrush();

   canvas.DrawString("这条线是用中国传统", font, brush, 20, 20);
   canvas.DrawString("这条线是用简体中国", font, brush, 20, 40);

   document.Save("CJKText.pdf", true);
  }
 }
}

VB.NET :

Imports PDFMosaic
Imports System.Drawing

Module DrawText
 Sub Main()
  Dim document As New PDFDocument()
  document.Pages.Add(New PDFPage(PDFPaperFormat.A4))
  Dim canvas As PDFCanvas = document.Pages(0).Canvas

  Dim font As New PDFFont("MingLiU", 14)
         
  Dim brush As New PDFSolidBrush()

  canvas.DrawString("这条线是用中国传统", font, brush, 20, 20)
  canvas.DrawString("这条线是用简体中国", font1, brush, 20, 40)

  document.Save("CJKText.pdf", True)
 End Sub
End Module