-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to call window.print() from VSCode extension? #320
Comments
No, we don't support printing from webviews and do not have plans to add support. You could try using a native module to control printing |
@mjbvz thanks for your answer. Could you please specify what is "native module"? Do you mean this node module https://github.com/tojocky/node-printer or something else? |
yes |
I think it would be extremely useful to print a webview to PDF. With project like Paged.js (based on W3C specifications) it's possible to produce high-quality PDF documents using web technologies (and especially the print to PDF feature provided by browsers). A typical use case, would be to generate a printable web page from a lightweight markup language such as AsciiDoc or Markdown and use the print to PDF feature to produce a PDF. I guess it's still possible to run an headless browser outside of VS Code (using Puppeteer) to generate a PDF but it seems extremely heavy as a workaround. @mjbvz Could you please give us some insights about this restriction? Thanks! |
Nothing to add besides printing is not a use case we feel is important enough to support or maintain. Your extension can use whatever tools it needs to print, but it's not something we are going to put into core |
I think it's unfortunate but I guess it's what it's. |
I have standalone app which has "Print" html button. And I'm rendering this page also into my VSCode extension. But when I click on print button doesn't happend into VSCode.
Also I've tried to emulate print html mechanism into VSCode DevConsole, but getting error:
Is it possible somehow to print html page which is rendering into webview of my VSCode extension?
P.S. I've seen this issue: WebView optionally add "allow-modals" to iframe sandbox options #67109
but not sure is it possible somehow to create an adapter for print the webview page into VSCode extension
The text was updated successfully, but these errors were encountered: