Reputation: 1
I am building an application with Electron and Vite which requires printing received file from some API.
Printing the file is one big task. Another is showing the print preview dialog. Any way I can show the print dialog before printing?
I have tried the following already:
node-printer
. The actual npm package is not maintained that well. I had to install a newer fork (@thesusheer/electron-printer
worked). It has support for printing PDF, TXT and Images (I would have to convert MS Office file types to pdf). This doesnt not offer any print preview.
Win32 API
. Since Node.js doesnt have offical Win32 API Documentation. I switched to Tauri (React with Rust). This could be done but a Web Developer like me can't wrap my head around documentation for languages like C++/Rust. I achieved a print dialog but each feature took a lot of time. Might have to finally pursue this.
webContents.print()
. Suits all my requirements except one, It cant print PDFs only HTML :((
Now, after struggling with this for 5 days almost, I am here to ask you folks if you have any ideas. Please don't restrict to Electron. As long as the frontend is web, I'm all ears!
Upvotes: 0
Views: 63