tauri-apps / tauri-apps/plugins-workspace

[print] Add plugin for (silent) print API

Open
#293 17 comments 41 reactions 0 assignees View on GitHub
new plugin type: feature request
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

Upstream issue: https://github.com/tauri-apps/tauri/issues/4917 / https://github.com/tauri-apps/wry/issues/707

Short term goals:
- All APIs should be available in Rust and JavaScript
- [ ] Windows support
- [ ] macOS support
- [ ] Linux support
- [ ] Print currently displayed page to a PDF file
- [ ] Print currently displayed page with the default printer
- [ ] Make printer configurable - splitting this up because the Windows APIs look a bit tricky

Mid and long term goals are optional in the sense that i don't know if all them are possible to implement.

Mid term goals:
- [ ] Print the current viewport
- [ ] Print an arbitrary area
The webviews have screenshot apis that can take screenshots of the viewport and areas, in case the print apis don't support this.

Long term goals:
- [ ] Android support
- [ ] iOS support
- [ ] Print files that are not part of the frontend but can be opened by the webview
- [ ] Print arbitrary files, i'm not sure how viable this is, it also won't use the webview apis
- [ ] ESC/POS printing (thermal printers). This should probably be a different plugin but i think there will be some overlap so we'll see.

Since https://github.com/tauri-apps/wry/issues/707 is a thing we may end up upstreaming a few APIs but we'll see...

P.S. I don't want to see PRs being open for months/years so we should aim for small scoped PRs even if that means splitting it up per OS.

### Resources

- Electron api docs (getPrinersAsync, print, printToPDF): https://www.electronjs.org/de/docs/latest/api/web-contents#contentsgetprintersasync
- Windows APIs:
- [Print](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_16?view=webview2-1.0.1518.46&preserve-view=true#print)
- [PrintToPdf](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_7?view=webview2-1.0.1661.34&preserve-view=true#printtopdf) / [PrintToPdfStream](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_16?view=webview2-1.0.1518.46&preserve-view=true#print)
- [PrintSettings](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2printsettings?view=webview2-1.0.1661.34) / [PrintSettings2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2printsettings2?view=webview2-1.0.1661.34)
- [EnumPrinters](https://learn.microsoft.com/en-us/windows/win32/printdocs/enumprinters)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.