As @aliaksandr-s pointed out:
No, what you are trying to do is impossible. Browsers intentionally do not allow web pages to change print dialog settings. If what you want is a PDF then use a library to generate it on the Server/Client side.
He is correct, it's not possible to change Chrome's default print margin setting using JavaScript or CSS.
The best you can do is try to minimize margins:
@media print {
@page { margin: 0; }
html, body { margin: 0; padding: 0; }
}
But, if you did this server-side, you could set zero margins in the PDF. A example would be:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://examplecom', { waitUntil: 'networkidle0' });
await page.pdf({
path: 'output.pdf',
margin: { top: 0, right: 0, bottom: 0, left: 0 },
printBackground: true,
format: 'A4'
});
await browser.close();
})();