Printing arabic characters with GDI+ results in scrambled output with Microsoft XPS Document Writer

582 views Asked by At

I need to use GDI+ methods to print arabic characters and I'm encountering some issues which seem to be related to the specific printer.

This is the method that I'm using in my Windows application:

g.DrawString("اللائحة (EC) رقم 648/2004 (المنظفات)", new Font("Arial Unicode MS", 5), Brushes.Black, rectangle, new StringFormat(StringFormatFlags.DirectionRightToLeft));

g is the printer graphics object and rectangle is the printing area.

I'm trying it in Windows 10 with the default installed printers Microsoft Print to PDF and Microsoft XPS Document Writer.

This is the correct output with Microsoft Print to PDF:

enter image description here

This is the output from Microsoft XPS Document Writer:

enter image description here

As you can see all characters are scrambled!

Do you know why is this happening? Is there something that I can do to print correctly arabic characters with GDI+ to all printers?

0

There are 0 answers