如何使用MigraDoc使表情符号出现在生成的PDF中

我正在尝试生成一个包含一些表情符号但没有成功的PDF。 为了使代码简单和可复制,这里是代码:

    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);

但不幸的是,出现了空矩形:

��
tian_tang123 回答:如何使用MigraDoc使表情符号出现在生成的PDF中

这是PDFsharp的已知限制。代理对尚不可用,需要两个16位值(0xffff以上)的Unicode字符将无法正确显示。

另请参阅:
https://github.com/empira/PDFsharp/issues/63

本文链接:https://www.f2er.com/3145577.html

大家都在问