Write special UTF8 characters in MigraDoc

2019-08-23 04:42发布

I want to write the "█"-character in a MigraDoc pdf file. The following code doesn't show the character. Here is a small part of my code.

PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, embedding);
row.Cells[1].AddParagraph().AddFormattedText("aaaaa \u2588", new Font("Arial Unicode MS"));

1条回答
Evening l夕情丶
2楼-- · 2019-08-23 05:35

Make sure to pass true to the c'tor of PdfDocumentRenderer to activate Unicode for rendering.

A small part of my code:

// Create a renderer for the MigraDoc document.
var pdfRenderer = new PdfDocumentRenderer(true) { Document = doc };

More code here:
http://www.pdfsharp.net/wiki/HelloMigraDoc-sample.ashx

查看更多
登录 后发表回答