So I have an app built with node WebKit, it creates an image to be printed but I cannot get rid of all the margins by using CSS, so here is my CSS.
<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>
I've tried every combination of sizes, properties and hacks but there is still a huge margin/padding on the output. So since Node WebKit is open source I figured I'd put my C++ hat on and do it at a higher level.
Which of the many thousands of files in Node Webkit should I edit to remain forward compatible?
I figured this out, after downloading the node-webkit source code and building a few times editing page-setup.cc::CalculateSizesWithinRect has allowed me to print without margins.
The source code now reads
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With