PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 12:08 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Nov 26, 2017 4:19 pm 
Offline

Joined: Sun Nov 26, 2017 3:14 pm
Posts: 2
HI.
I am developing a C# winforms application.
In PDFsharp how i can print arabic text and how to print right to left.

I used below to code to print Arabic. It print Arabic characters but not in right to left order.

XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
const string familyName1 = "Arial Unicode MS";
XFont fontB = new XFont(familyName1, 16, XFontStyle.Regular, options);

gfx.DrawString("فاتورة", fontB, XBrushes.MidnightBlue, new XRect(260, 90, 80, 15), XStringFormats.TopCenter)


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 26, 2017 6:20 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

For some languages you can fake "right to left" by simply reversing the string.
With Arabic you also must make sure you use the correct glyph for beginnings, ends, and middle positions. Support for that is not (yet) included with PDFsharp.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 26, 2017 6:50 pm 
Offline

Joined: Sun Nov 26, 2017 3:14 pm
Posts: 2
HI,
Which is correct glyph for Arabic?
When I reverse the string some characters looks get changes.


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 26, 2017 8:13 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
devan wrote:
Which is correct glyph for Arabic?
Not my area of expertise. I cannot read Arabic.
There are four variants of "letter Beeh": isolated, initial, medial, final. PDFsharp does not (yet) select the correct variant based on the context.
I assume that your code must translate "Letter Beeh" found in the text with one of the for special variants, depending on the context.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 08, 2019 7:28 pm 
Offline

Joined: Mon Apr 08, 2019 7:18 pm
Posts: 1
I did a workaround for Arabic texts, recently.
It works by converting the Arabic letters to correct glyphs, depending on letter positions. And then reversing those new characters.

I wrote this blog post about it: Rendering correct Arabic glyphs in PDF (using PdfSharp)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 127 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