We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

PDF Export not supporting RTL or Arabic

Dear Sir,

I have examined  ej2-Grid PDF export.
For English data, it works perfectly.

With the Grid "enableRT:true", the produced PDF document is 
still showing the columns in LTR (and not RTL) fashion.

However , there is a more serious problem which is:
    When some of the cells data is Arabic, the PDF document is
     not produced at all;  the error (in Dev Console):

Uncaught (in promise) Error: ArgumentOutOfRangeException:index, The character is not supported by the font.




13 Replies

DR Dhivya Rajendran Syncfusion Team May 8, 2018 12:47 PM UTC

Hi Patterngen, 
Thanks for contacting Syncfusion support. 
Query1: When some of the cells data is Arabic, the PDF document is not produced at all 

We have analyzed your requirement and we have already considered “Support for true type font in PDF library” as a feature request and logged a report for the same. This feature will be available in our Essential Studio Volume 2, 2018 release. 
 
Query2: PDF document is still showing the columns in LTR (and not RTL) fashion 
 
We have considered “Support for drawing RTL text in PDF” as a feature request and logged a report for the same. This feature will be available in any of our upcoming releases. 
Regards,
R.Dhivya
 



PA patterngen May 8, 2018 05:29 PM UTC

Thanks much  Mr.  R.Dhivya

Wow!  Good news for developers in the middle east.

I am also testing ASP.Net Report Viewer API  in a cross-origin setting
and having some problems ... more info. later.


YD Yuvaraj Devarajan Syncfusion Team May 9, 2018 01:49 PM UTC

Hi Patterngen, 

We have tested the reported issue by specifying the EnableCors (cross-origin) for the ReportViewer WebAPI controller as shown in shared code example and its working properly at our end. So, can you please share the error detail or issue reproducible screenshot to validate the mentioned problem at our end.  
 
WebAPI: 
    [EnableCors(origins: "*", headers: "*", methods: "*")] 
    public class AssetSummaryController : ApiController, IReportController 
    { 
        [System.Web.Http.ActionName("GetResource")] 
        [AcceptVerbs("GET")] 
        public object GetResource(string key, string resourceType, bool isPrinting) 
        { 
            //Returns the report resource for the requested key. 
            return ReportHelper.GetResource(key, resourceType, isPrinting); 
        } 
 
        public void OnInitReportOptions(ReportViewerOptions reportOptions) 
        { 
            reportOptions.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1"); 
            reportOptions.ReportModel.DataSourceCredentials.Add(new DataSourceCredentials("AdventureWorks", "ssrs1", "RDLReport1")); 
        } 
 
        public void OnReportLoaded(ReportViewerOptions reportOptions) 
        { 
             
        } 
 
        [HttpPost] 
        public object PostReportAction(Dictionary<string, object> jsonData) 
        { 
            //Processes the report request and returns the result. 
            return ReportHelper.ProcessReport(jsonData, this); 
        } 
 
        public string GetText() 
        { 
            return "WebAPI working"; 
        } 
    } 
 
Please refer to the below forum documentation for more information, 

Regards, 
Yuvaraj D. 



PA patterngen May 11, 2018 11:02 AM UTC

Yes it is working using the info. you outlined and adding a reference to  AspNet.WebApi.Cors.

Thank you much for speedy reply.


YD Yuvaraj Devarajan Syncfusion Team May 14, 2018 04:26 AM UTC

Hi Patterngen, 

Thanks for the update, we are happy to hear that your issue is resolved. 

Regards, 
Yuvaraj D. 



AJ Ayyoub Jadoo September 9, 2019 09:31 AM UTC

Dears,

Still facing issues with Arabic content in pdf export, I used a true type font `Arial` by converting it to base64 format then I gave it to the pdfExportProperties and it worked on Arabic content in the grid, but when I add a header for the PDF it fails when the header text contain Arabic text, the following error occurs in the console:

Error: ArgumentOutOfRangeException:index, The character is not supported by the font.

And if I add the font to the style of the Text content in the header explicitly the following error occurs:

```
TypeError: Cannot read property 'textDirection' of undefined
    at PdfTrueTypeFont../node_modules/@syncfusion/ej2-pdf-export/src/implementation/graphics/fonts/pdf-true-type-font.js.PdfTrueTypeFont.getLineWidth (pdf-true-type-font.js:53)
    at PdfStringLayouter../node_modules/@syncfusion/ej2-pdf-export/src/implementation/graphics/fonts/string-layouter.js.PdfStringLayouter.getLineWidth (string-layouter.js:133)
    at PdfStringLayouter../node_modules/@syncfusion/ej2-pdf-export/src/implementation/graphics/fonts/string-layouter.js.PdfStringLayouter.layoutLine (string-layouter.js:146)
    at PdfStringLayouter../node_modules/@syncfusion/ej2-pdf-export/src/implementation/graphics/fonts/string-layouter.js.PdfStringLayouter.doLayout (string-layouter.js:82)
    at PdfStringLayouter../node_modules/@syncfusion/ej2-pdf-export/src/implementation/graphics/fonts/string-layouter.js.PdfStringLayouter.layout (string-layouter.js:35)
    at PdfGraphics../node_modules/@syncfusion/ej2-pdf-export/src/implementation/graphics/pdf-graphics.js.PdfGraphics.drawString (pdf-graphics.js:413)
    at PdfExport../node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.drawText (pdf-export.js:533)
    at PdfExport../node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.drawPageTemplate (pdf-export.js:453)
    at PdfExport../node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processExportProperties (pdf-export.js:401)
    at PdfExport../node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processGridExport (pdf-export.js:170)
```

Used properties:
const pdfExportProperties = {
            fileName: "ABCD.pdf",
            theme: {
              header: { font: new PdfTrueTypeFont(arialFont12) },
              caption: { font: new PdfTrueTypeFont(arialFont10) },
              record: { font: new PdfTrueTypeFont(arialFont9) }
            },
            pageOrientation: "Landscape",
            header: {
              fromTop: 0,
              height: 130,
              contents: [
                {
                  // font: new PdfTrueTypeFont(arialFont, 15),
                  type: "Text",
                  value: "عربي",
                  position: { x: 100y: 100 },
                  style: { font: new PdfTrueTypeFont(arialFont15), textBrushColor: "#000000"hAlign: "Right" }
                }
              ]
            }
          };


MS Manivel Sellamuthu Syncfusion Team September 12, 2019 02:54 AM UTC

Hi Ayyoub, 

Thanks for contacting us. 

We are able to reproduce the reported issue at our end. We have logged a bug report for the reported issue as “Truetype font is not working in pdf export header”. Thank you for taking  time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming Volume 3 release which is expected to be rolled out in the end of September. 
 
Until then we appreciate your patience. 
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
   
 
Note: Above feedback link is under review, once approved it will be visible. 

Regards, 
Manivel 



MA mahmod November 10, 2019 08:34 AM UTC

Dears,

Thank you for support data arabic in pdf ,
but the issue it's still exist Regarding in(RTL) ,
thanks


PS Pavithra Subramaniyam Syncfusion Team November 11, 2019 06:01 AM UTC

Hi mahmod, 
 
Query#: The issue it's still exist Regarding in(RTL) 
 
Thanks for the update. 
 
Based on your query we have prepared a sample but we are not able to reproduce the issue. The issue does not occur while enabling RTL with pdfexport. Its work fine from our end. Please refer the below sample for more information. 
 
 
If you still had the issue, Please share the below details that will be helpful for us to provide better solution. 
 
  1. Please try to reproduce the issue with our above attached sample.
  2. Please share your exact requirement scenario with brief explanation and share the issue screenshot.
 
Regards, 
Pavithra S. 



MA mahmod November 11, 2019 11:36 AM UTC

Dears,

The issue is with the order of the columns in the exported PDF.. it's shown on the UI as RTL so the exported should be the same.

I checked your sample and the issue of Right-to-Left is still existing, the first column from the right in the grid is shown as the first column from the left in the PDF.

Regards.


PS Pavithra Subramaniyam Syncfusion Team November 14, 2019 11:28 AM UTC

Hi mahmod, 
 
Thanks for your update.  
 
We have checked the feasible ways to achieve PDF export in RTL direction but there is no  support for ordering the column based on the RTL in our PDF library.  
 
Regards, 
Pavithra S. 



MA mahmod March 1, 2020 02:28 PM UTC

Dears,

Is RTL support issue resolved in pdf ?


TS Thiyagu Subramani Syncfusion Team March 3, 2020 01:02 PM UTC

Hi mahmod,  

Thanks for your update. 

No, we currently do not provide support for PDF export to RTL because it is out of scope in our PDF library. 

Please get back to us, if you need any further assistance. 
  
Regards,  
Thiyagu S 


Loader.
Live Chat Icon For mobile
Up arrow icon