azure - 在 Azure 函数中使用字体

标签 azure azure-functions

我尝试让 PdfSharp 在 Azure 函数中工作 但我的字体有一些问题

 // Create a new PDF document
  PdfDocument document = new PdfDocument();
  document.Info.Title = "Created with PDFsharp";

  // Create an empty page
  PdfPage page = document.AddPage();

  // Get an XGraphics object for drawing
  XGraphics gfx = XGraphics.FromPdfPage(page);

  // Create a font
  XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);

  // Draw the text
  gfx.DrawString("Hello, World!", font, XBrushes.Black,
    new XRect(0, 0, page.Width, page.Height),
    XStringFormats.Center);

这也是 PDFSharp 示例页面中的代码... 在字体行他给了我以下错误......

Exception while executing function: Functions.PDFGenerationFunction. PdfSharp: Internal error. Font data could not retrieved.

我需要引用一些特别的东西吗?或者是否无法在 Azure 函数中执行此操作?

PDFSharp 版本 --> "PDFsharp": "1.32.3057"

和/或在 Azure 函数中生成 PDF 文档的另一种解决方案...

最佳答案

这可能是 Azure Functions 和 Web 应用运行所在的沙箱存在问题。 查看此列表,了解可在沙箱中运行的已知 PDF 库。 https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks

关于azure - 在 Azure 函数中使用字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45162780/

相关文章:

azure - hive中如何将数据插入到单个文件中

c#-4.0 - 我们可以从服务总线中收集哪些信息?

Azure blob 私有(private)/容器级访问问题

azure - 在 azure 功能中,是否可以使用应用程序设置作为绑定(bind)路径的一部分?

azure - 无法使用 Azure Function Core Tools 在本地运行 cosmosDB 触发器

Azure 服务总线模拟器

multithreading - Azure 函数的多个输入

c# - 我在 Azure Function Monitor 日志屏幕中看到条目。如何在 Application Insights 中找到它们?

azure-functions - 将设置粘贴到暂存槽

azure - 将 Dropbox 文件内容从逻辑应用传递到 Azure 函数