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
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