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

StackOverflow https://stackoverflow.com/questions/18062684

  •  23-06-2022
  •  | 
  •  

Pergunta

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).

Foi útil?

Solução

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 :)

Fonts which work and doesn't work

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top