'Full-page body in Chrome print-to-pdf: omit area reserved for header and footer?

I don't want to just suppress/disable the running header and footer text. I'm already setting the following CSS:

@page {
  size: 6.6in 4.25in;
  margin: 0;
}

(yes, I'm setting a custom page size)

--print-to-pdf-no-header does not do what I'm asking for.

I'm guessing that, "under the covers", Chrome defines a page layout for printing to PDF that includes fixed areas for the header and footer. I want to override that page layout to omit those areas; to omit those currently unusable strips of white space across the top and bottom of the page. I want the body to occupy the full area of the page.

I'd prefer to do this via a chrome --headless --print-to-pdf command line, but I'm prepared to use another method if necessary (Puppeteer?).

I'm running Chrome 100.0.4896.60 (Official Build) (64-bit) on Windows 10.

Update (2022-04-28): If I use an SVG (.svg) file as input, rather than HTML, then I can make the SVG occupy the entire space (although, it's finicky tweaking the page width and height to correspond to the viewBox extents). But with an HTML file (I've zero'd all margins, padding in the HTML CSS), those top and bottom margins stubbornly remain in the PDF: I can't fit as much on the PDF page as I can with SVG input.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source