Page 1 of 1

Problem generating PDF reports in eastern languages

Posted: Tue Nov 08, 2011 7:31 am
by marekb
Hi,

I have problem with generating reports using Stimulsoft.Reports for .NET version 2011.3.1107.0 into PDF format. If I use any of eastern languages (traditional chinese, korean, japanese), just squares are shown instead of proper characters.
If I export the same report into docx (or rtf, pptx...) format, characters are shown correctly. And finally, when I save docx report to PDF (using MS Word, for example), characters ale also correct.
My settings:
StiPdfExportSettings()
{ ImageQuality = DEFAULT_IMAGE_QUALITY, //1.5
ImageResolution = DEFAULT_IMAGE_RESOLUTION , //200
EmbeddedFonts = true,
UseUnicode = true
};

Did I miss something? Any help would be appreciated.


Note: I don't use built-in localization mechanism, instead I load resource strings directly from database using a db function.


Thanks,
Marek


Problem generating PDF reports in eastern languages

Posted: Tue Nov 08, 2011 8:03 am
by Ivan
Hello,

Most of the standard fonts does not contain national characters. In this case Windows uses the "font fallback".
This algorithm is very complicated and, therefore, is not realized in the exports.
To output national characters, please, use the font which contain all necessary characters.
For example, the "Arial Unicode MS" font contains many national characters. Also, in your case, you may try to use the "MS Mincho" font.

Thank you.

Problem generating PDF reports in eastern languages

Posted: Wed Nov 23, 2011 6:43 am
by marekb
Hi,
thanks for the reply.
We run into couple more issues.
Due to licensing limitations, we cannot embed Arial Unicode MS font into our application nor exported PDF files.
I did some research and found out that best solution for me will be to use specific font for the language (e.g. Tahoma for all "western languages", MS UI Gothic for japanese, Gulim for korean, PMinglu for chinese and so on). However, if I turn off font embedding, lot of text fields (but not all!) are ruined with nonsense characters (see picture below).

Image


The problem occurs when I open the PDF on different OS (e.g. if I export PDF on Win 7, it's ruined on Win XP and vice versa). Fonts are installed on both machines. I can PM you the PDF actual file if you need it.


Thanks,
Marek

Problem generating PDF reports in eastern languages

Posted: Wed Nov 23, 2011 7:19 am
by marekb
Update: According to this article http://www.microsoft.com/typography/Red ... onFAQ.mspx it's possible to embed mentioned fonts in PDF file, so the issue described above just disappeared ;-)

Is there a way to set font programatically on the whole document?

Problem generating PDF reports in eastern languages

Posted: Thu Nov 24, 2011 1:17 am
by HighAley
Hello.
marekb wrote:Update: According to this article http://www.microsoft.com/typography/Red ... onFAQ.mspx it's possible to embed mentioned fonts in PDF file, so the issue described above just disappeared ;-)

Is there a way to set font programatically on the whole document?
Please, try to use next code:

Code: Select all

foreach (StiComponent comp in rep.GetComponents())
{
    IStiFont fnt = comp as IStiFont;
    if (fnt != null)
    {
        fnt.Font = StiFontUtils.ChangeFontName(fnt.Font, "Courier New");
    }
}
Thank you.