Hi,
I'm trying PDF suite and there is a problem.
When creating a PDF file with KURDISH characters, words are rendering in a wrong way.
Here is my sample code:
var document = new PdfDocument();
var page = document.Pages.Add();
PdfStringFormat sf = new PdfStringFormat();
sf.TextDirection = PdfTextDirection.RightToLeft;
PdfGraphics gr = page.Graphics;
var stream = new MemoryStream(File.ReadAllBytes("fonts\\tahoma.ttf"));
var font = new PdfTrueTypeFont(stream, 10);
gr.DrawString("هێرش فیتەر وەرشەی ئاراس", font, new PdfSolidBrush(new PdfColor(0, 0, 0)), new PointF(10, 10), sf);
document.Save("D:\\1.pdf");
Hi mehdi,
We have checked the provided code snippet input text with the generated PDF document text. Both texts are similar. We have attached the text comparing snapshot for your reference,
|
|
If we check the given input text with different TrueType fonts. It shows the same result which was in the generated PDF document. We have attached the snapshot for your reference,
|
|
The reported issue does not from our library, it's from TTF file. We recommend to use the input text containing glyph style TrueType font to get a better result. Kindly let us know if you need any further assistance with this.
Regards,
Surya V
Hi Surya,
Thanks for reply.
I think there is a problem with the PDF library. I provided a sample project that creates a PDF document and a bitmap file with the same fonts and same drawing methods.
The text in the bitmap is rendered perfectly and correctly, but in the PDF, it is not.
The true type fonts are standard windows fonts. Please take a look at the attached project.
Regards,
Mehdi
Hi Mehdi,
Thanks for the details. We were found the difference when rendering Kurdish characters in PDF while compared to bitmap. Currently, we are analyzing this and we will update the further details on January 12th 2022.
Regards,
Surya V
Hi Surya,
Thanks for reply, I'm looking forward to new updates.
Regards,
Mehdi
|
var document = new PdfDocument();
var page = document.Pages.Add();
PdfStringFormat sf = new PdfStringFormat();
sf.ComplexScript = true;
sf.TextDirection = PdfTextDirection.RightToLeft;
PdfGraphics gr = page.Graphics;
var fontFiles = Directory.GetFiles("fonts");
var brush = PdfBrushes.Black;
var top = 10;
foreach (var file in fontFiles)
{
var stream = new MemoryStream(File.ReadAllBytes(file));
var font = new PdfTrueTypeFont(stream, 10);
gr.DrawString("هێرش فیتەر وەرشەی ئاراس", font, brush, new PointF(10, top), sf);
gr.DrawString(font.Name, font, brush, new PointF(170, top), sf);
top += 15;
} |
|
|
Hi Gowthamraj,
Thanks a lot. Problem solved.
Hi Gowthamraj...
im using FLutter, and I have same problem like Mehdi had regarding to rendering Kurdish Text.. i tried to apply the soluction mentioned earlier, but, there is not ComplexScript method available in PdfStringFormat class.. can you please provide the solution if there is an update in the syncfusion pdf generator package..
thanks
Currently, we do not have support to draw complex script language texts such as Marathi, Tamil, Hindi, and more. We have logged the feature for “Complex script text drawing support in Flutter PDF” and added it to our feature request list. We will implement this feature in any of our upcoming releases.
You can track the feature status using the feedback from https://www.syncfusion.com/feedback/20541/complex-script-text-drawing-support-in-flutter-pdf