PDF Mosaic: How to create PDF with unicode and CJK support


Home       Features       Download       Tutorial       Version History       License       PDF Mosaic Blog       Source Code

 

This sample shows how to create PDF Document in .NET with Unicode and CJK fonts.

How to create PDF Document in .NET with Unicode and CJK fonts in PDF Mosaic library
 

C# :

using PDFMosaic;
using System.Drawing;
 
namespace Fonts
{
    class Fonts
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            document.Pages.Add(new PDFPage(PDFPaperFormat.A4));
            PDFCanvas canvas = document.Pages[0].Canvas;
 
            PDFBrush brush = new PDFSolidBrush();
 
            PDFFont font = new PDFFont("Arial", 12);
 
            canvas.DrawString("English -- Hello, World!", font, brush, 10, 10);
            canvas.DrawString("Russian -- Привет, мир!", font, brush, 10, 30);
            canvas.DrawString("French -- Vous êtes le Phénix des hôtes de ces bois.", font, brush, 10, 50);
            canvas.DrawString("German -- In ihrem Aufgabenbereich lag die komplette Organisation des Sekretariat des Geschäftsführers", font, brush, 10, 70);
            canvas.DrawString("Spanish -- Texto de ejemplo", font, brush, 10, 90);
	    canvas.DrawString("Arabic -- هذا الخط مكتوب باللغة العربية", font, brush, 10, 110);
            canvas.DrawString("Turkish  -- Yukarda mavi gök, asağıda yağız yer yaratıldıkta", font, brush, 10, 130);
 
	    font = new PDFFont("Gulim", 12);
            canvas.DrawString("Chinese -- 這行是用繁體中文寫的", font, brush, 10, 180);          
 
            document.Save("Fonts.pdf", true);
        }
    }
}

 


Home       Features       Download       Tutorial       Version History       License       PDF Mosaic Blog       Source Code