Crystal Reports with Arabic text alignment - c#

I'm using ASP.NET, Visual Studio 2013- SP4 with Crystal Reports v13.0.15 and I have problem of Arabic text alignment as follows:
Right and center aligned text always appear left aligned on printing, it is shown OK in browser and designer (I have tried
different printers:my Deskjet printer, Microsoft XPS writer and pdf
writer).
This problem is with Arabic text only, English text aligned well when printed.
I face this problem with TextObject and with multiline FieldObject (or FieldObject with CanGrow set to true).
Exporting to pdf works well, I have problems with printing only (using the ActiveX Mode in CrystalReportViewer, IE11).
For example the following picture is browser view (everything is aligned Right, gray boxes are text objects):
while the printed version is as follows:
I appreciate any help. thanks in advance.

This is due to use english word with arabic.
if only arabic text come it work good if english text come with arabic then it align automatically left.

Related

How to justify text in text-field control in editable PDF using C# iTextSharp?

I am using iTextSharp to fill PDF. I have textfield and I am inserting 4-5 lines of text in textfield programmatically. Text lines are not properly aligned. I kept it as left aligned as textfield has only 3 options for alignment (left,right,center). How to justify text in PDF. I am using Nitro PDF software to edit files.
Please suggest with an example.
Thanks.

Text using Cambria Math font in Windows forms gets shifted vertically [duplicate]

I wanted to show some mathematical expressions in a winforms textbox. So I thought the "Cambria Math" font would be a good choice but the text looked strange due the high top and bottom margin of the font. First I thought I made a mistake but according to this question, it's the correct behavior of the font.
Why does Cambria Math have these big margin values and how can I display my string correctly in the textbox like Word 2010?
(Note that I know only a little bit about typography ;)
Edit: I had to make the textbox that tall otherwise the caret would be invisible. The font size of the textbox is set to 8.25pt
Cambria Math uses Microsoft's mathematical OpenType extensions.
Word 2007 and later understand these and display the text with reasonable spacing.
However, notepad and Word 2000 display the text with enormous spacing, just like winforms. I guess the font has this much space by default because some characters (like U+2320, top half integral) are much larger than the alphanumerics.
If you use Cambria Math with a font engine (such as the one used by winforms) that doesn't understand the math extensions, you're going to get the big spacing.
If you're displaying simple expressions you might as well use Cambria.

Printing in Crystal Reports in Visual Studio 2010

I have a project written in C# in VS2010. I am attempting to print a barcode but am having an issue. The barcode print page is located in a crystal report.
The bar code field has the formula that equals *25664A-1$1%0/A* which is correct.
It is in the font - SKANDATA C39.
When it prints, the rest of the report prints correctly but where the barcode should show, it instead shows- *25664A-1$1%0/A* .
Is this due to a wrong font? I need to get this to print the barcode instead of the numbers. It is something specifically wrong with the barcode field since the rest of the report works/prints fine and the formula extracts the correct data.
Any help would be appreciated? If you need more information let me know.
Thanks.
I downloaded a new barcode font - C39hrp24dhtt0 (from http://www.free-fonts.com/font/c39.html)
Simply changed my old font to my new font (SKANDATA C39 to C39hrp24dhtt0) (in format editor - font tab) and it now prints the barcode and scans perfectly. Had to make changes to the font size to get the same appearance but after that it works properly.

Chinese characters are rendering in bold

Silverlight renders few Chinese characters as Bold in a text box. This textbox has no font family set on it. Please refer to the following screenshot
In the above screenshot, first character is bolder than the other. One of the MSDN posts says that this is because of the font family problem and setting SimSun font family should fix the problem. Here is the screenshot after the applying the font family.
It looks like setting SimSun is actually fixing the issue. But I am not sure if this is the correct fix as my application allows to enter data in any language and not just Chinese. So I don't want to set font family to Chinese font.
I am wondering, since the data is Unicode (UTF16) encoded, the rendering engine should take care of choosing the correct font and render it properly right?
I am looking for proper ways to fix this problem. Any suggestions would be helpful.
Using Silverlight 3 with .NET3.5.
The problem is with the font's description of itself. Your default font, depending on your computer, is likely Arial, which may not render some Chinese characters very nicely. SimSun is a font that is designed to render Chinese characters, so just like Latin-based fonts tend to render English nicely, SimSun renders Han characters nicer.
Wikipedia has a list of Unicode fonts that are meant for internationalized text fields such as yours. Maybe give a few of them a try until you find one that meets your needs.
http://en.wikipedia.org/wiki/Unicode_typeface#List_of_Unicode_fonts

Reversing Strings in Right To Left (BiDirectional) Languages in iTextSharp

I'm using iTextSharp( C# iText port) to create pdfs from text/html. Most of my text is in Hebrew, a Right-To-Left language.
My problem is that PDFs show RTL langauge in reverse, so I need to reverse my strings in a way that would only reverse the RTL text without reversing any numbers or text in English.
It is my understanding that fribidi allows doing that on linux, but I couldn't find any solutions for this problem for Windows.
I would welcome any suggestions, including an alternative to iTextSharp that would do this automatically (if one exists).
To show RTL texts by using iTextSharp correctly:
You need to set the font's encoding to BaseFont.IDENTITY_H
Then you have to use container elements which support RunDirection, such as PdfPCell, ColumnText, etc. and now you can set their element.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
HTML displays Hebrew/Arabic in Logical mode, and in PDF you need to store it Visual mode. What you need to do is convert from Logical to Visual mode. There are some libraries which do this (google for minibidi which is BSD licensed IMHO, or fribidi which is GPL or LGPL).
My real suggestion would be to change direction. Write a very small application in Qt4 which takes as first argument the URL, and the second the PDF to write. Since Qt4 has HTML support (via QtWebKit) has has the option to print to PDF (post script and SVG as well) this should be simpler then writing your own HTML->PDF solution.
PDFCreator is a free tool to create PDF files from nearly any Windows application.
It installs as a Windows printer driver, such that it can be used by any Windows program that has a print functionality.
You can treat your input as simple text strings to be printed, and maybe using the print menu option of Notepad will create the correct PDF.
If you want to dive a little deeper into right to left C# printing, use StringFormatFlags.DirectionRightToLeft string format with Graphics.DrawString() calls.
A snippet from a PrintPage Event Handler:
lineFmt = new StringFormat(StringFormatFlags.DirectionRightToLeft);
e.Graphics.DrawString(textToPrint, font, Brushes.Black, startX, ypos, lineFmt);
Just put the string in table cell:
PdfPCell cell1 = new PdfPCell(new Phrase("מספר",font));
cell1.HorizontalAlignment = 2; //0=Left, 1=Centre, 2=Right

Categories

Resources