aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNullptrderef <nullptrderef@proton.me>2024-08-11 19:08:31 +0200
committerNullptrderef <nullptrderef@proton.me>2024-08-11 19:08:31 +0200
commit46b6607b2af75fd6c2d3a44fbb265009dc9781b9 (patch)
treeffa77a5399ef3a226cddba7dd6df5dadf5d548d3
parentefd75a533a6b92b4ab5510ab604b483ce218ace7 (diff)
fix: make printWindow have DOCTYPE html
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
index 93a21bd80..f66fdaa83 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
@@ -86,18 +86,22 @@ export function QrPage({ id: templateId, onBack }: Props): VNode {
}
function saveAsPDF(name: string): void {
+ // TODO: Look into using media queries in the current page, to print the current page, instead of opening a new window
const printWindow = window.open("", "", "height=400,width=800");
if (!printWindow) return;
const divContents = document.getElementById("printThis");
if (!divContents) return;
printWindow.document.write(
- `<html><head><title>Order template for ${name}</title><style>`,
+ `<!DOCTYPE html><html><head><title>Order template for ${name}</title><style>`,
);
printWindow.document.write("</style></head><body>&nbsp;</body></html>");
printWindow.document.close();
printWindow.document.body.appendChild(divContents.cloneNode(true));
printWindow.addEventListener("load", () => {
printWindow.print();
+
+ // Why is the close commented out? Print is synchronous
+ // ~ Nullptrderef
// printWindow.close();
});
}