Rotativa Pdf生成不尊重HTML字符间距 [英] Rotativa Pdf generation does not respect HTML character spacing

查看:628
本文介绍了Rotativa Pdf生成不尊重HTML字符间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Rotativa从MVC HTML转换为Pdf。在HTML一切看起来不错,但在Pdf格式,字符间距不是很好的格式,因为它太少。

I am converting from MVC HTML to Pdf using Rotativa. In HTML everything looks good, but in Pdf format, the characters spacing is not well formatted, as it is too little. This reduces the readability of the documents considerably.

下面的图片是HTML中的字符串:

In the following image is a string in HTML:

,这里是使用Rotativa生成的相同字符串:

and here is the same string generated with Rotativa:

我试图增加字符间距从css,但是当我改变为 1px ,在HTML端一切看起来更好,但在Pdf所有的字符串混乱和获得一个间距多于 10px 沿div和彼此重叠。

I have tried to increase the character spacing from css, but when I changed it to 1px, on the HTML side everything looks even better, but in Pdf all the strings mess-up and gain a spacing more than 10px splitting along the divs and overlapping with each other.

我发现这可能是Rotativa问题之一,例如这一个,这不帮助我这么多,因为它只是解决Debian Sid操作系统,我使用Windows,我已经安装Rotativa 1.64使用Nuget。

I found that this could be one of the Rotativa issues, like in this one, which does not help me so much as it is solved only for Debian Sid operating system, and I am using Windows, and I have installed Rotativa 1.64 using Nuget.

有人知道使用Rotativa修正字母间距吗?

Does anyone know a fix for letter spacing using Rotativa?

推荐答案

解决了这个问题后,我改变了 font-family 与从谷歌导入的一个。这个想法是在我阅读了这篇文章后提出的在其中描述如何改变 font-family 与一个给定的url解决了一个wkhtmltopdf类似的问题。

I have solved this issue after i changed the font-family with one imported from google. The idea came to me after I have read this article in which is described how changing font-family with a given one by url solved a wkhtmltopdf similar problem.

我用来解决这个问题的代码如下:

The code I have used to fix this is the following:

@import url('https://fonts.googleapis.com/css?family=Open+Sans');
body {
    font-family: "Open Sans";
}

这篇关于Rotativa Pdf生成不尊重HTML字符间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆