Node WebKit will change print settings in source code

So, I have an application built using node WebKit, it creates an image for printing, but I can not get rid of all the fields 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 tried every combination of sizes, properties and hacks, but there is still a huge margin / indent on the output. Since node WebKit is open source, I decided that I would include my C ++ hat and do it at a higher level.

Which of the thousands of files in node Webkit should be changed to stay in redirect mode?

+3
source share
1 answer

I realized this, after downloading the source code for node -webkit and creating several times, editing page-setup.cc::CalculateSizesWithinRectallowed me to print borderless.

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;
+1

All Articles