QR Code Templates
.preview-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); z-index: 10000; max-width: 90%; max-height: 90%; overflow: auto; }
.notification { position: fixed; top: 20px; right: 20px; background: #333; color: white; padding: 12px 24px; border-radius: 8px; z-index: 10001; animation: slideIn 0.3s ease; }
1. Basic Print Screen - Captures Entire Screen class PrintScreenFeature { constructor() { this.canvas = null; this.stream = null; } // Capture entire screen async captureFullScreen() { try { const stream = await navigator.mediaDevices.getDisplayMedia({ video: { mediaSource: "screen", width: { ideal: 1920 }, height: { ideal: 1080 } }, audio: false }); this.stream = stream; const videoTrack = stream.getVideoTracks()[0]; // Create video element to capture frame const video = document.createElement('video'); video.srcObject = stream; await video.play(); // Capture frame const screenshot = await this.captureFrame(video); // Stop the stream videoTrack.stop(); stream.getTracks().forEach(track => track.stop()); return screenshot; } catch (error) { console.error('Error capturing screen:', error); throw error; } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } } </style> </head> <body> <div class="screenshot-container"> <button class="screenshot-btn" id="fullScreenBtn">📸 Full Screen</button> <button class="screenshot-btn" id="viewportBtn">👁️ Viewport</button> <button class="screenshot-btn" id="elementBtn">🎯 Capture Card</button> </div>
// Full screen capture document.getElementById('fullScreenBtn').addEventListener('click', async () => { try { showNotification('Capturing full screen...'); const screenshot = await printScreen.captureFullScreen(); showPreview(screenshot); ScreenshotSaver.saveAsFile(screenshot); showNotification('Screenshot saved!'); } catch (error) { showNotification('Failed to capture screen', 'error'); } });