mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-18 12:09:30 +00:00
Chore: Set margin & padding to HTML screenshot to prevent transparent top/left border
This commit is contained in:
@@ -160,11 +160,18 @@ export default {
|
||||
|
||||
const body = i.contentWindow.document.querySelector("body");
|
||||
|
||||
// Add body padding to prevent content touching edge of screenshot.
|
||||
body.style.padding = "20px";
|
||||
|
||||
// take screenshot of iframe
|
||||
domToPng(body, {
|
||||
backgroundColor: "#ffffff",
|
||||
height: i.contentWindow.document.body.scrollHeight + 20,
|
||||
height: i.contentWindow.document.body.scrollHeight,
|
||||
width,
|
||||
// remove the transparent 8px top and left gap from html object (default browser margins).
|
||||
style: {
|
||||
margin: "0",
|
||||
},
|
||||
}).then((dataUrl) => {
|
||||
const link = document.createElement("a");
|
||||
link.download = this.message.ID + ".png";
|
||||
|
||||
Reference in New Issue
Block a user