I would like to use the react-to-print
library to print an iframe
from my Electron app. How can I use the iframe
reference to get the correct window/element to print?
const handleElectronPrint = async (target: HTMLIFrameElement) { // Instead of this (printing the whole page) // let win = BrowserWindow.getFocusedWindow(); // How do I print just the referenced iframe? // `target` iframe has id="printWindow", how to select it? let win = BrowserWindow.getMyIframe(); // Is this the right way to do the print once we have the iframe? const options = { printBackground: true }; win.webContents.print(options, (success, failureReason) => { if (!success) console.log(failureReason); console.log('Print Initiated'); }); };<ReactToPrint ... print={handleElectronPrint}/>