PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri May 24, 2024 11:12 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sat Apr 15, 2023 1:52 pm 
Offline

Joined: Sat Apr 15, 2023 12:55 pm
Posts: 1
I am trying to generate PDF document using pdfsharp with gujarati font (Noto Sans Gujarati - https://fonts.google.com/noto/specimen/Noto+Sans+Gujarati/)

I am writing text "સભ્યના બિલ ઓર્ડર નંબરની વિગતો" but on pdf it is shown differently, here is image
Image

But when you copy & paste that text you will get the exact text "સભ્યના બિલ ઓર્ડર નંબરની વિગતો" - just showing incorrectly

Here is the code,
Code:
XFont font_400 = new XFont("Noto Sans Gujarati", 12, XFontStyle.Regular, new XPdfFontOptions(PdfFontEncoding.Unicode));

using (PdfDocument document = new PdfDocument())
{
   document.Info.Title = "My Gujarati Test Document";
   document.Info.Author = "snj886";

   PdfPage page = document.AddPage();
   page.Size = PdfSharp.PageSize.A4;

   using (XGraphics gfx = XGraphics.FromPdfPage(page))
   {
      gfx.MUH = PdfFontEncoding.Unicode;
      XTextFormatter tf = new XTextFormatter(gfx);
      tf.Alignment = XParagraphAlignment.Left;
      tf.DrawString("સભ્યના બિલ ઓર્ડર નંબરની વિગતો", font_400, XBrushes.Black, new XRect(45, 45, page.Width - 90, 90), XStringFormats.TopLeft);
      gfx.DrawString("સભ્યના બિલ ઓર્ડર નંબરની વિગતો", font_400, XBrushes.Black, new XRect(45, 90, page.Width - 90, 90), XStringFormats.TopLeft);
   }

   document.Save("GujaratiTest.pdf");
   document.Close();
}


So, i think i am missing something to make it work correctly. please someone point me out.

thanks


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group