capawesome-team / capacitor-plugins

⚡️ Community plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/
239 stars 41 forks source link

feat(printer): add web support #331

Open macsupport opened 4 days ago

macsupport commented 4 days ago

Plugin(s)

Current problem

Printer plugin does not include web

Preferred solution

Have printer plugin support iOS, Android and Web.

Alternative options

It would be a great option to add the ability to print a specific element in the Webview. Ideally targeted by an 'id'. The old Cordova printer plugin was able to do this, I think.

https://github.com/katzer/cordova-plugin-printer

Additional context

No response

Before submitting

robingenz commented 4 days ago

Thank you for your request! So is your issue about the web platform being supported or that you can select a specific element by ID when printing the WebView on Android and iOS? These are two different things.

macsupport commented 4 days ago

Sorry for the confusion. I was specifically asking for web support. I previously used the cordova printer plugin to target printing a specific id on a page in device and web. It was just a comment/suggestion. I also was able to include print.css but that may be too much to ask!

Mike Sozanski DVM, DABVP

Check out my Veterinary Calculators: vetcalculators.com http://www.vetcalculators.com iOS https://itunes.apple.com/us/app/vetcalculators/id1403466061?ls=1&mt=8 and Android https://play.google.com/store/apps/details?id=com.vetcalculators.androidApp Available

On Thu, Nov 21, 2024 at 10:57 PM Robin Genz @.***> wrote:

Thank you for your request! So is your issue about the web platform being supported or that you can select a specific element by ID when printing the WebView on Android and iOS? These are two different things.

— Reply to this email directly, view it on GitHub https://github.com/capawesome-team/capacitor-plugins/issues/331#issuecomment-2492998176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYQEBPTOC3WW3MM2N6EHD2B3IWFAVCNFSM6AAAAABSIVPO2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJSHE4TQMJXGY . You are receiving this because you authored the thread.Message ID: @.***>

robingenz commented 4 days ago

Thanks for the clarification. I will have a look at the issue at the weekend. That shouldn't be too much work.

robingenz commented 2 days ago

@macsupport I've just added web support for the printWebView() method. You can use a print style sheet to customize the print output, see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Printing.

Feel free to give it a try using the following dev version:

npm i @capawesome-team/capacitor-printer@6.1.0-dev.202a1b7.1732369163

Let me know if you encounter any issues.