Open shestero opened 5 years ago
Interesting idea! Perhaps one way would be to introduce printing by opening produced PDF in an iframe..
I think printing goes outside the scope of this project at the moment (which is to build a PDF document).
If anyone is looking for a solution to this that works on recent browsers, try the following snippet in the callback:
const blob = new Blob([data], {
type: 'application/pdf'
});
let iframe = document.createElement('iframe');
iframe.onload = () => {
setTimeout(() => {
iframe.contentWindow.print()
}, 1);
}
iframe.src = URL.createObjectURL(blob);
iframe.style.position = 'fixed';
iframe.style.top = '-150vh';
iframe.style.left = '-150vw';
iframe.style.width = '100vw';
iframe.style.height = '100vh';
document.body.appendChild(iframe);
It's very interesting if it is possible to initiate print process after PDF window open. (May be using window.print method). I see no way to print from wasm application, especially from Qt WebAssembly. This looks like a glimpse of solution. Note that Qt can generate PDF itself.
Can you provide some examples how to print PDF?