Emojis Not Rendering in IronPDF Using RenderHtmlAsPdf()
When rendering HTML that contains emoji characters using RenderHtmlAsPdf(), the resulting PDF does not display the emoji characters even though they appear correctly in browser print previews and the HTML is correctly encoded as UTF-8.
The string-based RenderHtmlAsPdf() method has Unicode handling limitations that cause emoji characters to be dropped from output PDFs. File-based rendering processes content in a context closer to a real browser, which improves Unicode and emoji handling.
Solution
Option 1: Use RenderHtmlFileAsPdf()
Write the HTML content to a temporary file and render from the file path instead of the string:
string tempPath = Path.GetTempFileName() + ".html";
File.WriteAllText(tempPath, htmlContent, System.Text.Encoding.UTF8);
var renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlFileAsPdf(tempPath);
File.Delete(tempPath);
pdf.SaveAs("output.pdf");
string tempPath = Path.GetTempFileName() + ".html";
File.WriteAllText(tempPath, htmlContent, System.Text.Encoding.UTF8);
var renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlFileAsPdf(tempPath);
File.Delete(tempPath);
pdf.SaveAs("output.pdf");
Imports System.IO
Imports System.Text
Imports IronPdf
Dim tempPath As String = Path.GetTempFileName() & ".html"
File.WriteAllText(tempPath, htmlContent, Encoding.UTF8)
Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlFileAsPdf(tempPath)
File.Delete(tempPath)
pdf.SaveAs("output.pdf")
Option 2: Convert emojis to numeric HTML entities
Replace emoji characters with their numeric HTML entity equivalents before rendering:
👋
😊
👋
😊
Option 1 avoids repeated entity lookups when the template contains many emoji characters.

