This is a migrated thread and some comments may be shown as answers.

Reporting PDF export of RTL languages

5 Answers 173 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ran
Top achievements
Rank 1
Ran asked on 24 Jun 2013, 10:41 AM
Update
Using:
Copy code
Hashtable deviceInfo = new Hashtable();
deviceInfo["FontEmbedding"] = "Subset";
deviceInfo["ViewerDirection"] = "R2L";

I have checked in Acrobat reader >> Properties, and the "Arial Unicode MS" Font is embedded/subset.
However, Hebrew chars still do not show up at all.

Additionally, I tried embedding a specific freeware Hebrew font (called 'Alef').
In the report it all shows fine, but in the PDF the end result is the same as before, where English chars display fine, but Hebrew chars simply do 
not show up at all.

any ideas?

Thanx

5 Answers, 1 is accepted

Sort by
0
Ran
Top achievements
Rank 1
answered on 24 Jun 2013, 01:44 PM
Hello,
I am following your quick-start examples for Telerik reporting.
I connected to a DB and created a WinForms report which includes Hebrew characters and English characters.
All is displayed fine, however, when exporting to PDF, in the PDF itself, although all English characters are displayed, Hebrew characters are not, as if they don't exists.

Does the Reporting PDF export option support RTL languages such as Hebrew? 

I Googled it quite a lot. can I explicitly embed the font to be used in the PDF?
http://www.telerik.com/help/reporting/device-information-settings-pdf.html )

Will it solve PDF export of RTL languages such as Hebrew? any example or help is appreciated :)

Also, in the context of this question, the "Telerik Reporting Configuration Section" page is not very helpful. is has a lot of data but not in context.
http://www.telerik.com/help/reporting/configuring-telerik-reporting.html
                   
Hashtable deviceInfo = new Hashtable();
deviceInfo["FontEmbedding"] = "Subset";
deviceInfo["ViewerDirection"] = "R2L";


Additionally, the evolution of 'Render' to 'RenderReport', and 'Telerik.Reporting.Report' to 'Telerik.Reporting.instanceReportSource' isn't making things simpler without a working example (Note that I am using the latest version, downloaded only a few days ago)

Bottom line:
The issue is exporting non standard characters to PDF. The same code creates no problems at all with exporting to CSV or RTF.
isn't there a working example of embedding a non-standard font, to suceed in PDF exporting?

From what I understand it should be done using 'deviceInfo' settings and "Telerik Reporting Configuration", all in context to embedding a font into the PDF?!

Many thanx
Ran


0
Peter
Telerik team
answered on 27 Jun 2013, 11:20 AM
Hi Ran,

Up to the Hebrew text rendering in PDF, we have made some tests with the latest Telerik Reporting release 7.1.13.621 internal build but we are unable to reproduce the unexpected behavior. Check out the attached sample report definition and rendered PDF report. Generally we have successfully viewed the Hebrew text with the latest version of Adobe Reader. In this line of thoughts if you are experiencing any further difficulties we will appreciate if you send us a sample report definition that exhibits the unexpected behavior to review and debug on our end.

Generally the default setting for font embedding is Subset because this is the best option for optimal PDF file size and compatibility. Thus you should not have to change the font embedding setting or any other device setting to render Hebrew text correctly.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Ran
Top achievements
Rank 1
answered on 27 Jun 2013, 01:42 PM
Thanx for the answer.

1. In the example you have provided, I see the attached PDF with valid Hebrew inside which you supplied, I also see the TextBox with the Hebrew data:
this.textBox1.Value = "זהו מבחן טקסט עברית.";
But I do not see where the conversion to PDF is executed.

2. My conversion to PDF is based on the following code based on your own tutorials. After exporting, the result is Valid Hebrew inside both the CSV and RTF, but not in the PDF

TelerikReporting1.TestReport report = new TelerikReporting1.TestReport();
Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
 
Hashtable deviceInfo = new Hashtable();
Telerik.Reporting.Processing.RenderingResult renderingResult = reportProcessor.RenderReport("PDF", report, deviceInfo);
//Telerik.Reporting.Processing.RenderingResult renderingResult = reportProcessor.RenderReport("RTF", report, deviceInfo);
 
using (FileStream fs = new FileStream(dlg.FileName, System.IO.FileMode.Create))
{
    fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length);
}

3. I made a code sample based on my real code running locally (attached). However, since my DB is a real SQL DB I tried to replace it with a local DB. it's the .sdf file in the attached solution.
The report itself works and displays data correctly in the preview. however, running the WinForm app to run the ReportViewer fails. I spent about 2 hours just on that, hopefully you will fix it easily, since I must be missing something obvious.

So specifically, my attached code can't run right now to prove to me or yourself, if the Hebrew problem in the PDF persists. hopefully you can fix the minor issue and see how the Hebrew in the PDF performs.
If it performs like when working with my real DB, you will get the same results as I did, which means no Hebrew in the PDF

Many thanx
Ran

PS - The file is just over 3 MB so it couldn't be attached here.
Here is a link for a "YouSendIt" service where it is downloadable. Don't worry, no viruses :)
https://www.yousendit.com/download/WFJWMFh1ZDVKV01sYzlVag
 
 
Hashtable deviceInfo = new Hashtable();
Telerik.Reporting.Processing.RenderingResult renderingResult = reportProcessor.RenderReport("PDF", report, deviceInfo);
 
using (FileStream fs = new FileStream(dlg.FileName, System.IO.FileMode.Create))
{
    fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length);
}

3. I made a code sample based on my real code running locally (attached). However, since my DB is a real SQL DB I tried to replace it with a local DB. it's the .sdf file in the attached solution.
The report itself works and displays data correctly in the preview. however, running the WinForm app to run the ReportViewer fails. I spent about 2 hours just on that, hopefully you will fix it easily, since I must be missing something.

So specifically, my attached code can't run right now to prove to me or yourself, if the Hebrew in the PDF persists, hopefully you can fix the minor issue and see how the Hebrew in the PDF performs.
If it performs like when working with my real DB, you will get the same results as I did, which means no Hebrew in the PDF

Many thanx
Ran

0
Ran
Top achievements
Rank 1
answered on 03 Jul 2013, 05:17 AM
Solved!

Here is the simple solution for anyone else who may be interested. This should work for reports in any language, exported to PDF.
You need only two simple additional settings:

1. For every field in the report, add the appropriate line (in the Telerik report cs class itself):
this.myTextBoxName.Style.Font.Name = "Arial Unicode MS";
and
2. 
Only once in the report:
this.Culture = new System.Globalization.CultureInfo("he"); // Or your own correct CultureInfo

et voilà :) Correct non-standard characters in the exported PDF

Ran
PS - I wish Telerik, who has good support, would invest more time in their documentation. it would solve many problems for beginners and would also create much less work for the support staff itself
 
0
Stef
Telerik team
answered on 03 Jul 2013, 10:50 AM
Hello Ran,

We are glad to hear you have dealt with the issue and thank you for sharing your findings with our community.

Handling Hebrew in the case is indeed related to the selection of Unicode-compatible font for the items displaying such strings.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
General Discussions
Asked by
Ran
Top achievements
Rank 1
Answers by
Ran
Top achievements
Rank 1
Peter
Telerik team
Stef
Telerik team
Share this question
or