Hi All,
I am using pdfsharp to display some indic characters, the issue is that indic character set depends on the context of the unicode letters, so when i render the unicode text string, it gives me the character by character representation of the text i am trying to put in, instead of a glyph based represenation.
I am using an unicode opentype indic font and was also able to embed the font inside the pdf, but the final output is not correct, the characters are not shaping properly according to the rules of indic character display, instead they are just a bunch of indic character rendered on the PDF.
I also tried using TextRenderer class from .net, but even that's not helping. i also tried to get the graphics context by using the graphics property of the XGraphics object, even that fails.
this is a sample code that i have written
PdfDocument document = new PdfSharp.Pdf.PdfDocument();
PdfPage page = document.AddPage();
XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
XGraphics gfx = XGraphics.FromPdfPage(page);
Graphics g = gfx.Graphics;
gfx.MUH = PdfFontEncoding.Unicode;
gfx.MFEH = PdfFontEmbedding.Always;
XFont ft = new XFont("Chandas", 16, XFontStyle.Regular, options);
gfx.DrawString(str1, ft, XBrushes.Red, 10, 20, XStringFormat.Default);
// These two lines are not working
g.DrawString(str1, f, Brushes.Red, 10, 10);
TextRenderer.DrawText(g, "hehe", f, Point(10, 140), Color.Red);
document.Save(fileName);
document.Close();
can anyone help me on how to write complex scripts using PDFsharp.
Thanks
Ram
|