简体   繁体   English

Dynamics CRM 2011在插件内添加字体

[英]Dynamics CRM 2011 add font within plugin

our CRM system allows user to download info about an entity in form of pdf file. 我们的CRM系统允许用户以pdf文件的形式下载有关实体的信息。 My task is to add Japanese version. 我的任务是添加日语版。
The library used to create the pdf is "itextsharp". 用于创建pdf的库为“ itextsharp”。
The problem here is font. 这里的问题是字体。 How can I add new font or maybe there is a font with Japanese characters in the CRM? 如何添加新字体,或者CRM中可能包含日文字符的字体?

The font is loaded in the following way: 字体通过以下方式加载:
BaseFont basefont = BaseFont.CreateFont("filename", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font font = new Font(basefont);

But now where to store the "filename"? 但是现在在哪里存储“文件名”?

The quick and dirty solution to adding a font into Dynamics CRM is to create a new web resource of type StyleSheet (CSS) and then add .css to the end of the file name before uploading. 向Dynamics CRM中添加字体的快速而又肮脏的解决方案是创建一个StyleSheet(CSS)类型的新Web资源,然后在上传之前将.css添加到文件名的末尾。

eg myfont.ttf.css 例如myfont.ttf.css

CRM will think it is a StyleSheet when uploading so it will pass validation and when you go to retrieve the file in your code it will still be the font. CRM在上载时会认为这是一个StyleSheet,因此它将通过验证,并且当您去检索代码中的文件时,它仍然是字体。

There was an article detailing how this works here: https://community.dynamics.com/crm/b/sonomapartners/archive/2013/07/19/font-files-as-crm-web-resources 有一篇文章详细介绍了它的工作原理: https//community.dynamics.com/crm/b/sonomapartners/archive/2013/07/19/font-files-as-crm-web-resources

You could also host the font somewhere else eg Azure storage or use one which is already hosted somewhere such as https://fonts.google.com/ 您还可以在其他位置(例如Azure存储)托管字体,或使用已在诸如https://fonts.google.com/的位置托管的字体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM