【问题标题】:How to get emoji to appear in the generated PDF using MigraDoc如何使用 MigraDoc 让表情符号出现在生成的 PDF 中
【发布时间】:2019-11-07 10:44:06
【问题描述】:

我正在尝试生成包含一些表情符号的 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);

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

��

【问题讨论】:

    标签: c# pdf pdf-generation emoji migradoc


    【解决方案1】:

    这是 PDFsharp 的一个已知限制。代理对还不起作用,需要两个 16 位值(大于 0xffff)的 Unicode 字符将无法正确显示。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-02
      • 2016-03-23
      • 2018-04-26
      • 1970-01-01
      • 2015-04-06
      • 1970-01-01
      • 2018-07-15
      • 2019-10-25
      相关资源
      最近更新 更多