- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 NReco.PdfGenerator 库从 html 生成 pdf。它适用于英语。我还需要包括 non-english language(marathi) ,在那种情况下不能像预期的那样工作。渲染黑盒。
这是我的操作方法:
public ActionResult Assesment_DownloadResultSummaryData(string htmlContent){
var htmlToPdf = new HtmlToPdfConverter();
var margins = new PageMargins();
margins.Bottom = 10; // margins.Left = 5;margins.Right = 5;
margins.Top = 10;
htmlToPdf.Margins = margins;
htmlToPdf.CustomWkHtmlPageArgs = "--enable-smart-shrinking --encoding <encoding>";
htmlToPdf.PageFooterHtml = $@"page <span class=""page""></span> of <span class=""topage""></span><br />";
//htmlToPdf.Orientation = NReco.PdfGenerator.PageOrientation.Portrait;
htmlToPdf.Zoom = 1.0f;
return File(htmlToPdf.GeneratePdf(htmlContent, null), "application/pdf","myFile.pdf");
}
我也试过用
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
但不工作。也尝试像这样解码为 unicode:
byte[] utf8Bytes = Encoding.Default.GetBytes(htmlContent);
byte[] utf16Bytes = Encoding.Convert(Encoding.UTF8, Encoding.Unicode, utf8Bytes);
htmlContent = Encoding.Unicode.GetString(utf16Bytes);
这对我也不起作用。我的 html 包含像 विषय,मूल्यांकन प्रकार 这样的字符。在我的 pdf 中它显示为
部分htmlContent:
<tbody><tr>
<td colspan="6"><p><b>मुल्यांकन निकाल</b></p></td>
</tr>
<tr>
<td style="width:5%"><h4><b>वर्ग :</b></h4></td>
<td style="width:10%;text-align:left;"><h4><b>Class 1-A</b></h4></td>
<td style="width:10%"><h4><b>बॅच :</b></h4></td>
<td style="width:40%;text-align:left;"><h4><b> 25-07-2017-Class 1-A-General Knowledge-English-1</b></h4></td>
<td style="width:20%"><h4><b>विद्यार्थ्यांची एकूण संख्या :</b></h4></td>
<td style="width:10%"><h4><b>18</b></h4></td>
</tr>
<tr >
<td style="width:20%"><h4><b>विषय :</b></h4></td>
<td style="width:10%;text-align:left;"><h4><b>English</b></h4></td>
<td style="width:10%"><h4><b>विषय :</b></h4></td>
<td style="width:30%;text-align:left;"><h4><b>General Knowledge</b></h4></td>
<td style="width:20%"><h4><b>उपस्थित विद्यार्थी संख्या :</b></h4></td>
<td style="width:10%"><h4><b>17</b></h4></td>
</tr>
</tbody>
我们将不胜感激。
最佳答案
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
这个命令对我有用。
关于C# - NReco.PdfGenerator 非英文字符不呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45305211/
我正在使用 Nreco PdfGenerator 从 HTML 生成 pdf。一切都很好,但字符彼此靠得很近,不容易阅读。 有什么办法可以解决这个问题吗? HTML 版本 PDF版本 这是我的CSS
我已经使用这个工具大约一个星期了,现在,今天,它刚刚停止工作。我已将其余代码恢复到以前的状态,但我不断收到相同的错误。 我从抛出的异常中得到的是: An exception of type 'Syst
我正在使用 NReco.PdfGenerator 库从 html 生成 pdf。它适用于英语。我还需要包括 non-english language(marathi) ,在那种情况下不能像预期的那样工
我将“NReco.PdfGenerator.dll”用于我的网络项目(Visual Studio 2012,c#),并且它可以成功地从互联网网址(如 http://google.com.tw)导出但是
这个问题属于 NReco's PdfGenerator组件。 我使用此产品在使用 C# 的 .NET MVC 框架内将动态生成的 HTML 字符串转换为 Pdf 文档。 在寻找向 Pdf 页脚添加页码
我正在使用NReco .PdfGenerator 用于我的 PDF 文档(该组件基于 WkHtmlToPdf 工具),我的代码允许我创建一个 pdf,调用带有参数 Controller 、操作、模型的
我正在使用 VS2015 和 C# 开发 WPF 应用程序。 在该应用程序中,我有一个使用 NReco PdfGenerator 将 HTML 转换为 PDF 的功能。 在我的 PDF 中,我有一些标
我正在使用 NReco.PdfGenerator.LT从 HTML 页面创建 PDF 文档。如果我只是将它指向 wkhtmltopdf.exe 可执行文件,这在 Windows 上工作正常,但这在 L
我尝试使用 C# 中的库 TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator 生成 pdf 文档,但正文 HTML 中的内联图像没有显示。有没有人有想法或解决
我是一名优秀的程序员,十分优秀!