pdfsharp - font embed?

孤街浪徒 提交于 2019-12-04 05:52:40

There are two ways to do this. For each font you want to embed like this:

var options = new XPdfFontOptions(PdfFontEmbedding.Always);
var font = new XFont("Times New Roman", 12, XFontStyle.Regular, options);

Then if you use the font, it will get embedded.

If you want all fonts use on a page to be embedded you can do it like this:

var page = new PdfPage();
var gfx = XGraphics.FromPdfPage(page);
gfx.MFEH = PdfFontEmbedding.Automatic;

The second approach will also work for any fonts used in MigraDoc code.

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