diff options
Diffstat (limited to 'demo/main.html')
| -rw-r--r-- | demo/main.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/demo/main.html b/demo/main.html new file mode 100644 index 0000000..47f2c7a --- /dev/null +++ b/demo/main.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> + +<head> + <title>Document viewer</title> + <style> + .viewer { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin: 0 auto; + max-width: 60rem; + } + + .viewer_frame { + width: 100%; + } + </style> +</head> + +<body> + <main> + <h1> + Document viewer + </h1> + <button id="print-button">Print</button> + <section class="viewer"> + <iframe id="frame" class="viewer_frame" src="page.html"></iframe> + </section> + </main> + <script> + document.getElementById("print-button").onclick = (e) => { + let frame = document.getElementById("frame"); + frame.contentWindow.postMessage("print", "*"); + }; + </script> +</body> + +</html> |
