I have a method that retrieves margin top value from the backend. It works perfectly on the first page of print, but on the second page, the margin top space is missing.
initializePrintingSettings() {
this.printService.fetchPrintSettings().subscribe(response => {
if (response["status"] && response["data"].length > 0) {
this.printSettings = response["data"][0];
console.log(this.printSettings);
this.printSettings["margins"] =
this.printSettings["margins"].split(",").join("cm ") + "cm";
}
});
Additionally, I've created the following print function:
printContent.document.write(
'<body style="margin:' +
this.printSettings["margins"] +
'" onload="window.print();window.close();">'
);