修复 wkhtmltopdf 标题剪辑内容?

问题描述:

我的标题经常剪辑内容,因此它下面的内容并不完全可见,看起来好像页面在标题结束之前继续在标题下方,因此,并非所有内容都显示.

My headers often clip content so that the content below it is not completely visible, it appears as though the page continues underneath the header before the header ends and as a result, not all of the content is shown.

是否有我可以使用的 CSS 规则?还是 wkhtmltopdf 的 cmd 参数?或者其他方式?

Is there a CSS rule I can use for this? Or a cmd argument for wkhtmltopdf? Or any other way?

我了解到这实际上是一个已知问题,短时间内不太可能改变.解决方法是在标题 元素中使用 style="margin:0; padding:0;" .另一种解决方法是试验 --header-spacing n 参数.另一种方法是包装所有首页元素并在那里添加边距,但这是一个非常糟糕的非动态想法.

I have learned that this is actually a known issue and is unlikely to be changed in a while. The workaround is to use style="margin:0; padding:0;" in the header <body> element. Another workaround would be to experiment with the --header-spacing n parameter. Yet another way is to wrap all top-page elements and add margin there, but that is a very bad an non-dynamic idea.

有关更多信息,请参阅:

For for further information see:

http://code.google.com/p/wkhtmltopdf/问题/详细信息?id=182(此问题的副本)http://code.google.com/p/wkhtmltopdf/issues/detail?id=175(这个问题的起源)http://code.google.com/p/wkhtmltopdf/issues/detail?id=523(标头间距解决方法)

http://code.google.com/p/wkhtmltopdf/issues/detail?id=182 (duplicate of this issue) http://code.google.com/p/wkhtmltopdf/issues/detail?id=175 (the origins of this issue) http://code.google.com/p/wkhtmltopdf/issues/detail?id=523 (header-spacing workaround)