There is an example in the Electron Demos App. It is "Print to PDF" but would work the same with print.
To only print a specific section I see two solutions:
- The easy way is to blend the unnecessary parts out with a CSS selector:
@media print {
.no-print {
display: none;
}
}
- The harder way is to export the content of the section to a new hidden window and print that window. In this solution, you have to build a proper template to include your section.
Peter Scheler
JS enthusiast
There is a print function in electron.
To style the print use a media query (
@media print {...}) and related css properties likepage-break-before.