diff --git a/src/App.vue b/src/App.vue index 05c4189..38a69d1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -279,8 +279,28 @@ const handlePrint = (event) => { if ((event.metaKey || event.ctrlKey) && event.key === 'p') { event.preventDefault(); const frame = activeFrame.value; - if (frame && frame.contentWindow) { - frame.contentWindow.print(); + if (frame && frame.contentDocument) { + // Get the full HTML content of the iframe + const content = frame.contentDocument.documentElement.outerHTML; + + // Open a new window with the content + const printWindow = window.open('', '_blank'); + printWindow.document.write(content); + printWindow.document.close(); + + // Wait for content to load then print + printWindow.onload = () => { + printWindow.print(); + printWindow.close(); + }; + + // Fallback if onload doesn't fire + setTimeout(() => { + if (!printWindow.closed) { + printWindow.print(); + printWindow.close(); + } + }, 500); } } };