Css 节点WebKit更改源代码中的打印设置
所以我有一个用node WebKit构建的应用程序,它创建了一个要打印的图像,但是我不能用CSS去除所有的边距,所以这里是我的CSSCss 节点WebKit更改源代码中的打印设置,css,node.js,node-webkit,Css,Node.js,Node Webkit,所以我有一个用node WebKit构建的应用程序,它创建了一个要打印的图像,但是我不能用CSS去除所有的边距,所以这里是我的CSS <style media="print"> @page { size: 216mm 356mm; margin: 0; padding: 0; width: 216mm; height: 356mm; } html, body { margin: 0; padding: 0; width: 216m
<style media="print">
@page {
size: 216mm 356mm;
margin: 0; padding: 0;
width: 216mm; height: 356mm;
}
html, body {
margin: 0; padding: 0;
width: 216mm; height: 356mm;
}
img {
display: block;
width: 100%; height: 100%;
}
</style>
@页面{
尺寸:216毫米356毫米;
边距:0;填充:0;
宽度:216mm;高度:356mm;
}
html,正文{
边距:0;填充:0;
宽度:216mm;高度:356mm;
}
img{
显示:块;
宽度:100%;高度:100%;
}
我尝试了大小、属性和破解的各种组合,但在输出上仍然存在巨大的空白/填充。既然Node WebKit是开源的,我想我会把我的C++帽子放在一个更高的水平上。
在Node Webkit中的数千个文件中,我应该编辑哪一个以保持向前兼容?在下载了Node Webkit源代码并构建了几次编辑
页面设置之后,我发现了这一点。cc::CalculateSizesWithinRect
允许我无边距打印
源代码现在可以读取
void PageSetup::CalculateSizesWithinRect(const gfx::Rect& bounds, int text_height) {
effective_margins_.header = 0;
effective_margins_.footer = 0;
effective_margins_.left = 0;
effective_margins_.top = 0;
effective_margins_.right = 0;
effective_margins_.bottom = 0;
您是否在节点webkit版本0.11或更高版本上尝试过此操作?我在源代码中找不到任何类似的引用或函数。我没有,你能成功构建吗?没有,我实际上放弃了这个:(感谢您的回复!在twitter上点击我,我会提供更多帮助。daveymackintosh