【问题标题】:Fonts not applied in Winnovative HTML to PDF ConverterWinnovative HTML to PDF Converter 中未应用的字体
【发布时间】:2014-02-15 12:04:45
【问题描述】:

我已经使用 Winnovative 将 HTML 转换为 PDF 现在我正面临已发布的相关字体,我使用了不同的字体,例如 HelveticaNeueLTStd-Cn.otf,它在 index.html 页面中看起来不错,但是当我尝试创建使用以下代码而不是字体的 PDF 不适用于 PDF。

                    pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
                pdfConverter.PdfDocumentOptions.EmbedFonts = true;
                pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.NoCompression;
                pdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Landscape;
                pdfConverter.PdfDocumentOptions.FitWidth = true;
                pdfConverter.PdfDocumentOptions.ShowHeader = false;
                pdfConverter.PdfDocumentOptions.ShowFooter = false;
                pdfConverter.PdfDocumentOptions.JpegCompressionEnabled = true;
                pdfConverter.NavigationTimeout = 3600;
                pdfConverter.AvoidTextBreak = true;
                pdfConverter.ConversionDelay = 3;
                pdfConverter.JavaScriptEnabled = true;
                string url = ConfigurationManager.AppSettings["RedirectUrl"].ToString();
                string URL = url + "index.aspx?" + querystring;
                byte[] pdfBytes = null;
                 System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                response.Clear();
                response.AddHeader("Content-Type", "application/pdf");
                response.AddHeader("Content-Disposition", "attachment; filename=" + "Testing" + ".pdf; size=" + pdfBytes.Length.ToString());
                response.Flush();
                response.BinaryWrite(pdfBytes);
                response.Flush();
                response.End();

谁能指导我如何在 Winnovative 中应用字体

【问题讨论】:

  • 对不起,除了建议您使用不同的 HTML 到 PDF 转换器外,我不知道如何解决您的问题。我一直在使用免费(开源)wkhtmltopdf(code.google.com/p/wkhtmltopdf),几乎没有问题。这概述了如何开始:stackoverflow.com/a/18767473/181771
  • High-chat.js 是否具有可计算性,因为我使用 High Chart.js 在 PDF 中绘制图表。??

标签: c# asp.net-mvc winnovative


【解决方案1】:

您是否在运行转换器的服务器上安装了该字体?如果您刚刚在服务器上安装了字体,您还必须重新启动服务器以使其可用于转换器。

另一种选择是不在服务器上安装字体,而是使用@font-face 规则在您的页面中定义网络字体,然后重新使用字体文件。您可以查看convert HTML with web fonts to PDF demo 以获取完整的 c# 和 HTML 代码示例。

【讨论】:

    猜你喜欢
    • 2016-04-19
    • 1970-01-01
    • 2012-01-12
    • 1970-01-01
    • 2011-09-03
    • 1970-01-01
    • 1970-01-01
    • 2021-08-22
    • 2015-07-17
    相关资源
    最近更新 更多