I'm trying to generate a PDF that contains some emojis but with no success. To make it simple and reproduce-able here is the code:
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraph = section.AddParagraph();
paragraph.AddFormattedText("👀 😀 💨 ♡", new Font("Segoe UI Emoji"));
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);
pdfRenderer.Document = document;
pdfRenderer.RenderDocument();
var memoryStream = new MemoryStream();
var path = Path.GetTempFileName() + ".pdf";
pdfRenderer.PdfDocument.Save(path);
Process.Start(path);
But unfortunately empty rectangles appear instead:
��
Update: PDFsharp 6.0.0 and higher supports surrogate pairs and emojis will show.
This is a known limitation of PDFsharp 1.5. Surrogate pairs do not work yet and Unicode chars that require two 16-bit values (above 0xffff) will not show correctly.