PDF Mosaic: How to create multi-language PDF document


Home       Features       Download       Tutorial       Version History       License       Source Code

 

This sample shows how To Create Multi-language 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("Arial", 10);
      PDFFont font1 = new PDFFont("Sylfaen", 10);
      PDFFont font2 = new PDFFont("Vrinda", 10);
      PDFFont font3 = new PDFFont("Shruti", 10);
      PDFFont font4 = new PDFFont("Tunga", 10);
      PDFFont font5 = new PDFFont("MS Gothic", 10);
      PDFFont font6 = new PDFFont("Gulim", 10);
      PDFFont font7 = new PDFFont("Angsana New", 10);
      PDFFont font8 = new PDFFont("Latha", 10);
      PDFFont font9 = new PDFFont("Gautami", 10);
 
      PDFBrush brush = new PDFSolidBrush();
 
      canvas.DrawString("This phrase is written in English", font, brush, 20, 20);
      canvas.DrawString("Այս արտահայտությունը գրված է հայերեն", font1, brush, 20, 40);
      canvas.DrawString("এই শব্দগুচ্ছ বাংলা লখাে হযুছেলি", font2, brush, 20, 60);
      canvas.DrawString("Ez a kifejezés magyar nyelvű", font, brush, 20, 80);
      canvas.DrawString("Αυτή η φράση γράφτηκε στην ελληνική γλώσσα", font, brush, 20, 100);
      canvas.DrawString("ეს ფრაზა არის ქართულ ენაზე", font1, brush, 20, 120);
      canvas.DrawString("આ શબ્દસમૂહ ગુજરાતી માં લખાયેલ છે", font3, brush, 20, 140);
      canvas.DrawString("Questa frase è scritta in italiano", font, brush, 20, 160);
      canvas.DrawString("ಈ ನುಡೆಗಟ್ಟು ಕೆನಡಾದ ಭಾಷಾ ಬರೆದ", font4, brush, 20, 180);
      canvas.DrawString("這句話是寫在中國", font5, brush, 20, 200);
      canvas.DrawString("이 문구는 한국어로 작성된 것입니다.", font6, brush, 20, 220);
      canvas.DrawString("Dieser Satz ist in deutscher Sprache verfasst", font, brush, 20, 240);
      canvas.DrawString("วลีนี้ถูกเขียนในภาษาไทย", font7, brush, 20, 260);
      canvas.DrawString("இந்த சொற்றாெடர் தமிழில் எழதப்பட்ட", font8, brush, 20, 280);
      canvas.DrawString("ఈ పదబంధం తెలుగు భాషలో వరాయబడిన", font9, brush, 20, 300);
 
      document.Save("DrawText.pdf", true);
    }
  }
}

 

Visial Basic.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("Arial", 10)
    Dim font1 As New PDFFont("Sylfaen", 10)
    Dim font2 As New PDFFont("Vrinda", 10)
    Dim font3 As New PDFFont("Shruti", 10)
    Dim font4 As New PDFFont("Tunga", 10)
    Dim font5 As New PDFFont("MS Gothic", 10)
    Dim font6 As New PDFFont("Gulim", 10)
    Dim font7 As New PDFFont("Angsana New", 10)
    Dim font8 As New PDFFont("Latha", 10)
    Dim font9 As New PDFFont("Gautami", 10)
 
    Dim brush As New PDFSolidBrush()
 
    canvas.DrawString("This phrase is written in English", font, brush, 20, 20)
    canvas.DrawString("Այս արտահայտությունը գրված է հայերեն", font1, brush, 20, 40)
    canvas.DrawString("এই শব্দগুচ্ছ বাংলা লখাে হযুছেলি", font2, brush, 20, 60)
    canvas.DrawString("Ez a kifejezés magyar nyelvű", font, brush, 20, 80)
    canvas.DrawString("Αυτή η φράση γράφτηκε στην ελληνική γλώσσα", font, brush, 20, 100)
    canvas.DrawString("ეს ფრაზა არის ქართულ ენაზე", font1, brush, 20, 120)
    canvas.DrawString("આ શબ્દસમૂહ ગુજરાતી માં લખાયેલ છે", font3, brush, 20, 140)
    canvas.DrawString("Questa frase è scritta in italiano", font, brush, 20, 160)
    canvas.DrawString("ಈ ನುಡೆಗಟ್ಟು ಕೆನಡಾದ ಭಾಷಾ ಬರೆದ", font4, brush, 20, 180)
    canvas.DrawString("這句話是寫在中國", font5, brush, 20, 200)
    canvas.DrawString("이 문구는 한국어로 작성된 것입니다.", font6, brush, 20, 220)
    canvas.DrawString("Dieser Satz ist in deutscher Sprache verfasst", font, brush, 20, 240)
    canvas.DrawString("วลีนี้ถูกเขียนในภาษาไทย", font7, brush, 20, 260)
    canvas.DrawString("இந்த சொற்றாெடர் தமிழில் எழதப்பட்ட", font8, brush, 20, 280)
    canvas.DrawString("ఈ పదబంధం తెలుగు భాషలో వరాయబడిన", font9, brush, 20, 300)
 
    document.Save("DrawText.pdf", True)
  End Sub
End Module

 


Home       Features       Download       Tutorial       Version History       License       Source Code