PDFsharp generates blank page in Azure, but works locally

后端 未结 1 1839
一个人的身影
一个人的身影 2021-01-19 04:12

This works in an ASP.NET MVC application when run locally, but not when deployed on Azure:

Document doc = new Document();  
Section section = doc.Ad         


        
相关标签:
1条回答
  • 2021-01-19 04:36

    It's likely a font problem if a complete PDF arrives at the client (I asked for conformation in a comment but got no answer yet).

    PDFsharp must have access to the TTF files to extract information. Are the fonts you use in the %windir%\fonts folder and does your process have privileges to read them?

    Azure is a candidate for IFontResolver because many fonts are missing and privileges are usually not granted.

    With IFontResolver you give PDFsharp direct access to the TTF files (as byte[]).

    You can use my class EZFontResolver for that purpose:
    http://developer.th-soft.com/developer/2015/12/11/ezfontresolver-a-generic-font-resolver-for-pdfsharp-and-migradoc/

    I also have a sample that shows how to implement your own IFontResolver:
    http://developer.th-soft.com/developer/2015/09/21/using-private-fonts-with-pdfsharp-1-50-beta-2-or-migradoc/

    0 讨论(0)
提交回复
热议问题