Skip to content
Snippets Groups Projects
Commit 2a9850b3 authored by Fred Chasen's avatar Fred Chasen
Browse files

Emulate print media

parent 3b758ece
No related branches found
No related tags found
1 merge request!34Emulate print media
Pipeline #35865 passed with stages
in 1 minute and 58 seconds
......@@ -30,6 +30,7 @@ class Printer extends EventEmitter {
this.overrideDefaultBackgroundColor = options.overrideDefaultBackgroundColor;
this.timeout = options.timeout || 0;
this.closeAfter = typeof options.closeAfter !== "undefined" ? options.closeAfter : true;
this.emulateMedia = options.emulateMedia || "print";
this.pages = [];
}
......@@ -73,6 +74,8 @@ class Printer extends EventEmitter {
const page = await this.browser.newPage();
page.setDefaultTimeout(this.timeout);
await page.emulateMedia(this.emulateMedia);
if (this.overrideDefaultBackgroundColor) {
page._client.send("Emulation.setDefaultBackgroundColorOverride", { color: this.overrideDefaultBackgroundColor });
}
......
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