- Home
- Forum
- Angular - EJ 2
- PDF export throwing error for font "ArgumentOutOfRangeException:index, The character is not supported by the font."
PDF export throwing error for font "ArgumentOutOfRangeException:index, The character is not supported by the font."
Respected Person,

I hope you doing well.
I am using Ejs-Grid for my Angular Application. I would like to export grid data as a pdf. while doing that I am getting such error:
It seems like I am missing font. but I don't know which fonts I need to import.
here is the code
<ejs-grid #grid id='Grid'
[dataSource]='data'
[allowPaging]="true"
[pageSettings]='pageSettings'
[allowSorting]="true"
[toolbar]='toolbar'
[allowExcelExport]='true'
[allowPdfExport]="true"
(toolbarClick)='toolbarClick($event)'>
<ng-template #detailTemplate let-data>
<table class="detailtable" width="100%">
<colgroup>
<col width="35%">
<col width="35%">
<col width="30%">
</colgroup>
<tbody>
<tr>
<td rowspan="4" style="text-align: center;">
<div [ngStyle]="loadProdImage(data.prodImage)"
class="imgformitwirkende_all">
</div>
</td>
<td>
<span style="font-weight: 500;">Gebuchte Produktion: </span>
<a [routerLink]="['/production-view', betriebService.sanitizeForRoute(data.produktion_name), data.produktion_id]">{{data.produktion_name}} </a>
</td>
<td>
<span style="font-weight: 500;">basierend auf dem Werk: </span>
<a [routerLink]="['/werk-view', betriebService.sanitizeForRoute(data.produktion_name), data.werk_ID]">{{data.produktion_name}} </a>
</td>
</tr>
<tr>
<td>
<span style="font-weight: 500;">Preis: </span> {{data.preisangabe}}
</td>
<td>
</td>
</tr>
<tr>
<td>
<span style="font-weight: 500;">Anbieter: </span>
<a [routerLink]="['/betrieb_view', betriebService.sanitizeForRoute(data.anbieter_Betriewb_Name), data.anbieter_Betrieb_id]">{{data.anbieter_Betriewb_Name}}</a>
</td>
<td>
</td>
</tr>
<tr>
<td>
<span style="font-weight: 500;">Veranstalter: </span>
<a [routerLink]="['/betrieb_view', betriebService.sanitizeForRoute(data.veranstalter_Betrieb_Name), data.veranstalter_Betrieb_id]"> {{data.veranstalter_Betrieb_Name}} </a>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</ng-template>
<e-columns>
<e-column field='produktion_name' headerText='Gebuchte Produktion' textAlign='Right' width=90></e-column>
<e-column field='termin_von' [format]='dateFormatOptions' headerText='Gebuchte Daten' width=120></e-column>
<e-column field='preisangabe' headerText='Preis' textAlign='Right' width=90></e-column>
<e-column field='anbieter_Betriewb_Name' headerText='Anbieter' textAlign='Right' width=120></e-column>
<e-column field='veranstalter_Betrieb_Name' headerText='Veranstalter' textAlign='Right' width=120></e-column>
</e-columns>
</ejs-grid>
toolbarClick(args: ClickEventArgs): void {
if (args.item.id == 'Grid_pdfexport') { // 'Grid_pdfexport' -> Grid component id + _ + toolbar item name
console.log('check excel and pdf export: ', args.item.id);
this.grid.pdfExport();
} else if (args.item.id == 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
console.log('check excel and pdf export: ', args.item.id);
this.grid.excelExport();
}
}
please provide some guidance for this error.Regards,Parth
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
TS
Thiyagu Subramani
Syncfusion Team
February 24, 2021 12:47 AM UTC
Hi Parthkumar ,
Greetings from Syncfusion support.
By default, currently we are don’t have the support to export (Pdf Export) the Grid with detailTemplate because template has any html element or custom components. So, it is not feasible to export the template to an pdf file.
And your reported problem – “Error: ArgumentOutOfRangeException:index, The character is not supported by the font.” occurs if the text used in grid header or content is not supported by the default fonts . So we suggest you to use TrueTypeFont instead of StandardFont to resolve the problem. Please refer to the below documentation link for using custom font while exporting.
Documentation: https://ej2.syncfusion.com/documentation/grid/pdf-export/#add-custom-font-for-pdf-exporting
If you are still facing issue then please get back to us with issue reproducing sample if possible.
Let us know if you have any concerns.
Regards,
Thiyagu S
Marked as answer
SL
Steven Lord
December 13, 2023 11:04 PM UTC
I currently have the same issue and trying the solution. I would like to see what the TrueTypeFont looks like in the example. I have a Helvetica b64 but it is not working for me as of yet.
PS
Pavithra Subramaniyam
Syncfusion Team
December 14, 2023 10:29 AM UTC
Hi Steven Lord,
By default, the Grid uses the Helvetica font in the exported document. So, there is no need to use base 64 string of the Helvetica font externally for your requirement. Please refer to the below documentation link for more information.
Regards,
Pavithra S
I changed to Verdana and tried the changes. I still get the same error. I attached my font file.
Attachment: fonts_80923f5b.zip
PS
Pavithra Subramaniyam
Syncfusion Team
December 19, 2023 09:28 AM UTC
Hi Steven Lord,
To validate further, could you please share the below details which will be helpful for us to check the issue with our source and provide a better solution as early as possible?
- Share the example data of your Grid.
- Share the Syncfusion package version you are using.
- Share an issue reproducible sample which will be easier to validate.
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
- Marked answer
-
PK Parthkumar Kakadiya
- Feb 22, 2021 04:46 PM UTC
- Dec 19, 2023 09:28 AM UTC