Why some fonts (e.g. Code 128) work locally but not in server when generating pdf file with PDFsharp

流过昼夜 提交于 2020-01-07 06:05:20

问题


I'm creating some labels with PDFsharp (using ASP.Net+VB) and everything works OK in my development PC: the PDF file shows correctly the sizes and fonts I choose (Code 128, for barcodes, and Arial. Booth are ttf).

When publishing the code to the server the generated PDF shows Microsoft Sans MS instead of Code 128. The pdf is being generated in the server and downloaded to the client (My PC), and I can't see the bar codes in generated PDF neither in server nor in client.

I'm sure the font is installed in the Server and my local PC (I can open a MS Word Document and use the font).

Private loFuenteCode128 As XFont = New XFont("Code 128", 26, XFontStyle.Regular)

It looks to me that the problem is somewhere in the server (Windows 2008).


回答1:


I Found the problem (kind of): I just gave total rights to the font Code 128 to the users group (yes I know, I'm in a hurry...) and restarted the server (I hadn't restarted since I installed the font). I'm not sure what fixed the problem but I have to move to another issue now.

Some thing else: The original problem holds for "some" windows fonts (tested in local PC and two different servers), for example: I can use Courier New, but not Courier. I tried some fonts and it looks like I can use "fonts with styles" (I mean: those which include regular and at least another style in the ttf file); but when I try fonts that only have "regular" style it prints Microsoft Sans MS instead. I leave it here in case somebody else can benefits from my findings :)



来源:https://stackoverflow.com/questions/18062684/why-some-fonts-e-g-code-128-work-locally-but-not-in-server-when-generating-pd

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