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

Font Awesome in PDF documents

Is there any way of adding a font awesome character to a table cell ? or anywhere really.

regards
Martin

4 Replies

SL Sowmiya Loganathan Syncfusion Team October 18, 2019 01:06 PM UTC

Hi Martin, 

Thank you for contacting Syncfusion support. 

We can achieve your requirement of “Add font awesome characters to a table cell” using the font file “fontawesome-webfont.ttf”. Please refer the below code snippet for more details, 

//Create a new PDF document 
PdfDocument document = new PdfDocument(); 
 
//Add a page 
PdfPage page = document.Pages.Add(); 
 
//Create font 
FileStream fontFileStream = new FileStream("fontawesome-webfont.ttf", FileMode.Open, FileAccess.Read); 
PdfFont font = new PdfTrueTypeFont(fontFileStream, 14); 
 
//Create a PdfGrid 
PdfGrid pdfGrid = new PdfGrid(); 
 
//Create a DataTable 
DataTable dataTable = new DataTable(); 
 
//Add columns to the DataTable 
dataTable.Columns.Add("Font Name"); 
dataTable.Columns.Add("Awesome Character"); 
 
//Add rows to the DataTable 
dataTable.Rows.Add(new object[] { "fontawesome-webfont", "\uf02d" }); 
 
//Assign data source 
pdfGrid.DataSource = dataTable; 
 
//Add cell style 
PdfGridCellStyle cellStyle = new PdfGridCellStyle(); 
cellStyle.Font = font; 
pdfGrid.Rows[0].Cells[1].Style = cellStyle; 
 
//Draw grid to the page of PDF document 
pdfGrid.Draw(page, new PointF(10, 10)); 
 
//Save the document 
MemoryStream stream = new MemoryStream(); 
document.Save(stream); 
document.Close(true); 


Please find the .ttf file downloaded link from below, 

Please try the above code snippet in your end and let us know the result. 

Regards, 
Sowmiya Loganathan 
 



SL Stefan Limpert December 22, 2022 05:06 PM UTC

Hello Sowmiya,

i also want to export a Grid with columns contains several FontAwesome icons. How can i achieve to export these icons with pdf export of Grid?

Regards

Stefan



RS Rajapandiyan Settu Syncfusion Team December 28, 2022 12:58 PM UTC

Hi Martin,


Currently, The EJ2 Grid does not have support to export icons and custom elements. You can export images and hyperlinks from the Grid. Please find the below demo for your reference.


Demo: https://ej2.syncfusion.com/aspnetcore/Grid/DefaultExporting#/fluent


We logged a feature task for your requirement as Need to provide support for exporting grid with column template and Detail template and added it to our feature request database. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technical feasibility, and customer interest. This feature will be included in any of our upcoming releases. 


Feedback Link: https://www.syncfusion.com/feedback/10384/need-to-provide-support-for-exporting-grid-with-column-template-and-detail


You can communicate with us regarding the open features any time using the above Feature Report page.  


Regards,

Rajapandiyan S



DM Dineshnarasimman Muthu Syncfusion Team September 19, 2023 01:58 PM UTC

Hi Martin,


We are glad to announce that our Essential Studio 2023 Volume 3 Release v23.1.36 is rolled out and is available for download under the following link.


https://www.syncfusion.com/forums/184588/essential-studio-2023-volume-3-main-release-v23-1-36-is-available-for-download


In this release, we have included the feature for “Need to provide support for exporting grid with column template and Detail template”. So please upgrade your Syncfusion package to the latest version to resolve your reported issue.


Feedback: https://www.syncfusion.com/feedback/10384/need-to-provide-support-for-exporting-grid-with-column-template-and-detail


Release Notes: https://ej2.syncfusion.com/angular/documentation/release-notes/23.1.36?type=all#grid


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Dineshnarasimman



Loader.
Up arrow icon