Rotativa Pdf generation does not respect HTML character spacing

こ雲淡風輕ζ 提交于 2019-12-23 23:33:51

问题


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.

In the following image is a string in HTML:

and here is the same string generated with Rotativa:

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.

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.

Does anyone know a fix for letter spacing using Rotativa?


回答1:


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";
}


来源:https://stackoverflow.com/questions/38229101/rotativa-pdf-generation-does-not-respect-html-character-spacing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!