Commit d15175d2 authored by Guillaume's avatar Guillaume

experiments

parent 91def272
Pipeline #689 passed with stage
in 4 minutes and 40 seconds
const puppeteer = require("puppeteer")
;(async () => {
const browser = await puppeteer.launch();
const page1 = await browser.newPage();
await page1.goto(`file://${__dirname}/without-pagedjs.html`);
/*
await page.addStyleTag(
{"content": "@page {size: A4 portrait}\n@media print { @page {size: A4 portrait} @page portrait { size: A4 portrait } }"}
);
*/
await page1.pdf({
path: "page1.pdf",
pageRanges: "1",
format: "A4"
});
const page2 = await browser.newPage();
await page2.goto(`file://${__dirname}/without-pagedjs.html`);
await page2.addStyleTag(
{"content": `\t\t@media print {
\t\t\t@page {
\t\t\t\tsize: A4 landscape
\t\t\t}
\t\t\t@page portrait {
\t\t\t\tsize: A4 landscape
\t\t\t}
\t\t}`}
);
await page2.pdf({
path: "page2.pdf",
landscape: true,
pageRanges: "2",
format: "A4"
});
await browser.close();
})();
......@@ -36,6 +36,20 @@
}
}
@media print {
.portrait {
page: unset;
}
@page {
size: A4 portrait
}
@page portrait {
size: A4 portrait
}
}
</style>
</head>
<body>
......
This diff is collapsed.
{
"name": "mix",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"puppeteer": "^5.5.0"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment