Write special UTF8 characters in MigraDoc

本小妞迷上赌 提交于 2019-12-24 23:12: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:


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



来源:https://stackoverflow.com/questions/48191592/write-special-utf8-characters-in-migradoc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!