Problem generating PDF reports in eastern languages

Stimulsoft Reports.NET discussion
Post Reply
marekb
Posts: 3
Joined: Tue Nov 08, 2011 7:07 am

Problem generating PDF reports in eastern languages

Post 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

Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Problem generating PDF reports in eastern languages

Post 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.
marekb
Posts: 3
Joined: Tue Nov 08, 2011 7:07 am

Problem generating PDF reports in eastern languages

Post 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
marekb
Posts: 3
Joined: Tue Nov 08, 2011 7:07 am

Problem generating PDF reports in eastern languages

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Problem generating PDF reports in eastern languages

Post 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.
Post Reply