Skip to content
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

Support to print the editor contents #5953

Open
OtterKring opened this issue Apr 28, 2016 · 198 comments
Open

Support to print the editor contents #5953

OtterKring opened this issue Apr 28, 2016 · 198 comments
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality
Milestone

Comments

@OtterKring
Copy link

  • VSCode Version: 1.0
  • OS Version: Windows 10.0.10586.218

Steps to Reproduce:

  1. Open a File in VSCode or enter some code
  2. Try to print it to a printer

Sometimes paper is unbeatable.

@bpasero bpasero changed the title Printing from VSCode? Support to print the editor contents Apr 29, 2016
@bpasero bpasero added feature-request Request for new features or functionality workbench labels Apr 29, 2016
@bpasero bpasero self-assigned this Apr 29, 2016
@bpasero bpasero added this to the Backlog milestone Apr 29, 2016
@bpasero bpasero removed their assignment Aug 17, 2016
@daldr-ntml
Copy link

Is printing support still on the backlog? It is tedious to have to switch temporarily to another editor just to print.

@Sub568
Copy link

Sub568 commented Jan 15, 2017

NetBeans handles this very nicely. Unfortunately the course I am taking (edx, naturally) defaults to Microsoft.

@nNullSpace
Copy link

Is editor printing going to be ready soon?
An editor without printing seems strange.

@ghost
Copy link

ghost commented Jan 18, 2017

I hope it will be in the pipeline anytime soon in '17 at least for insiders edition of vscode

@jaromirmuller
Copy link

Should be available.

@DrYSG
Copy link

DrYSG commented Feb 21, 2017

I am adding this as a wishlist item.

@jdhitsolutions
Copy link

Adding my vote for printing. Sometimes not so much as to dead trees but as to a PDF.

@nNullSpace
Copy link

Is there any official answer to why the printer function is not easy?
Such as foundation issues, electron limitations, git version, consideration of security, license issues....

@hbarr
Copy link

hbarr commented Mar 20, 2017

I don't print files frequently, but occasionally I really need a paper copy.

I was shocked, when I tried to print a file for the first time, to find that VSCode lacked this basic facility! It is standard in almost all editors. Currently I must switch to another editor, such as BBEdit, for a tidy syntax colour-coded printed copy. I would prefer to have the same syntax colouring for screen and paper.

I would think this facility should take precedence over some of the tweaks and features recently added to VSCode...

Please, can we have a definite deadline for adding printing to VSCode.

@nNullSpace
Copy link

Printing is useful, in addition paper printing, PDF file output or something else are needed in some cases.

Is the root cause is he limit of the foundation? V8 engine or some middle layers.

@anthcool
Copy link

Please add the ability to send your code to a printer. You'd think this would have been a 1.0 feature.

@clairernovotny
Copy link
Member

One thing to add here -- print isn't necessarily to a printer. It would be very convenient to print the preview window of a diagram (PlantUML) or Markdown file to the Microsoft PDF printer to obtain a sharable document.

@roundand
Copy link

I'd really like to be able to print Markdown - nothing is more legible than print on paper, and reviewing (and scribbling) on hard copy is a key part of my documentation workflow.

@anthcool
Copy link

anthcool commented Apr 18, 2017

So, since MSFT is sending a royal we-couldn't-care-less (kind version of what I'd like to say) to all of us because they think this isn't an important feature to address, I've found the following to help those of us that are willing to try and implement this ourselves. May take a stab at it at some point when time is more on my side if it doesn't get hit on soon by someone.

There's a node.js module dubbed node-printer that @tojocky has developed that brings native printing support to whatever OS you may be on. Maybe he'd be willing to chime in as well on this. Not sure if that would be a good starting point or not:
https://github.com/tojocky/node-printer

Also, found this thread that has some good insights within it:
https://discuss.atom.io/t/silent-print-support-add-to-print-queue/19072

Will keep looking around for options...

@sc0ttwad3
Copy link

This is something Microsoft has implemented hundreds of times for various applications they've created, APIs in Windows itself and so on... How hard can this really be for them? Why wasn't it available from the very beginning?

@Bjego
Copy link

Bjego commented Apr 23, 2017

I would love this feature, because I have to print code for the university..

@David-Else
Copy link

David-Else commented May 3, 2017

Come on, please sort it out! This is absolutely basic.

@sc0ttwad3
Copy link

sc0ttwad3 commented May 6, 2017

I'm exploring a few things until Microsoft finally adds basic File -->Print in VSCode:

  • The vscode-pandoc extension lets you quickly print/render as a pdf, word document or html file. I'm exploring this in my workflow.

  • the Markdown, Math, and TeX capable Markdown+Math extension for more complicated content.

  • @anthcool had a tip/pointer to the node-printer project.

Mildly related and outside VSCode there's also some tips in the following post for Printing Github Markdown.

@DrYSG
Copy link

DrYSG commented May 8, 2017

I just find myself opening up notepad++ and doing the printing. Which sorta indicates that this is probably not that hard to integrate.

@valh1996
Copy link

valh1996 commented May 22, 2017

+1 We need this feature absolutely!

@dgutson
Copy link

dgutson commented Feb 6, 2023

The bus factor. What if MS does a breaking change and Peter is no longer available to maintain it? It has to be forked, etc.
It is time for MS to formally make it part of the product.

@PeterWone
Copy link

PeterWone commented Feb 7, 2023

The bus factor. What if MS does a breaking change and Peter is no longer available to maintain it? It has to be forked, etc. It is time for MS to formally make it part of the product.

This is the point of open source, surely? Nothing would stop them from on-boarding it if reports of my demise were accurate.

But you are right. Microsoft has already made a breaking change in respect of the way commands are proxied between remote and workstation processes, which was the devil to work around and has resulted in reduced functionality - I cannot currently support printing with the alternate browser from a remote workspace. I provided a full bug report including a repro demo project more than a month ago. The silence is deafening.

As a matter of interest, I just refactored the whole thing to support language associated rendering providers implemented as separate extensions. This means if you want special handling for a particular format you can achieve this without having to build a whole system for managing resource delivery to concurrent print sessions and cross-platform browser wrangling. Printing of rendered Markdown is the original use-case for this, and it's re-implemented to internally use the API. There's a sample extension for printing SVG files. This is intended as a simple worked sample (you don't have to do much to embed SVG in a web page).

Refactored like this, the Print extension proper really should be integrated into VSCode. Apart from anything else, once you have all the machinery for generating and styling HTML, there's very little remaining in building a preview pane. I was planning on getting a demo of this into shape as preparation for pitching official adoption of my project.

@strelec
Copy link

strelec commented Mar 4, 2023

Nobody prints their code. What you are asking is a 1 in a million usecase.

Maybe "Export to PDF" could be useful, but print that PDF however you see fit.

@DyessGG
Copy link

DyessGG commented Mar 4, 2023 via email

@hbarr
Copy link

hbarr commented Mar 4, 2023 via email

@ToxicSmurf
Copy link

Nobody prints their code. What you are asking is a 1 in a million usecase.

Maybe "Export to PDF" could be useful, but print that PDF however you see fit.

Uninformed, unconstructive, and overall unnecessary addition to this conversation, but thanks for your opinion?

@PeterWone
Copy link

PeterWone commented Mar 5, 2023

Nobody prints their code. What you are asking is a 1 in a million usecase.

500 nobodies install my print extension every day. To date there are about 440,000 installs of a print extension. I'm fairly sure the user base for VS Code isn't 440 billion.

You created a GitHub account in 2022 and you seem to focus on Scala.

I checked the job listings just now.

Language Listed jobs
C# 3914
C++ 2536
Java 5656
JavaScript 3195
SQL 9457
Scala 335

Tell me again what nobody uses.

Snark aside, there are 7 COBOL jobs listed, and all of them pay well because the banks in question care deeply about a language that nobody uses.

@FlightControl-User
Copy link

Let me explain you the use case that I concretely was going through needing the functionality of requiring paper based copies of the source code.

I was teaching c language to young children aged 12 to 14 years old.

I had code examples, skeletons, that I wanted them to complete. However to check if they really u understood the code, wanted them to FIRST complete on paper before they could type in the examples.

What is wrong with this approach? Seems your feedback is very narrow minded. A decent source code editor should be able to print code on a piece of paper.

@strelec
Copy link

strelec commented Mar 5, 2023

By nobody I did not mean the literal nobody, chill folks. I meant a tiny fraction. Printing dependencies are heavy and there is no reason the majority of users carry this cost of a tiny minority of users.

This is why I suggested you export the code to PDF, then print the resulting PDF in a program of your choice. Or an extension - this is exactly what extensions are for, so every person can customize their program according to their needs.

VS code is already quite bloated, and we managed to cut the printing stuff out (see bug #166511). So technically your feature request is even farther from being delivered now, and that is definitely right thing to do.

You created a GitHub account in 2022 and you seem to focus on Scala.

Wrong. I created my GitHub account in 2013 and Scala is only my passion, not my job.

@FlightControl-User
Copy link

FlightControl-User commented Mar 5, 2023

Since when are library dependencies a reason not to include a functionality?

Strangely there are 3rd party developers who have added print functionality to vs-code without the need for heavy library dependencies ...

If I would have known that these extensions existed I would have used them to print the papers.

So folks: for your clarity, there will be no print function in vs-code, to ensure you all understand it. Vs-code is an editor that does not need a print function. Only a tiny fraction of users want to print code on paper.

This is honestly one of the most incompetent feedback I've seen in years. Mind boggling.

I printed my source code in visual studio instead.

@DyessGG
Copy link

DyessGG commented Mar 5, 2023 via email

@ams-tschoening
Copy link

ams-tschoening commented Mar 5, 2023

This is why I suggested you export the code to PDF, then print the resulting PDF in a program of your choice.[...]

In which way exactly is that different to "printing"? Do you suggest to create PDFs without taking concepts like paper sizes, layouts, colors, text rendering etc. into account?

Nobody has printers these days.

#166511 (comment)

It's REALLY about time that you leave your tiny little bubble and get in touch with the real world. :-)

@hbarr
Copy link

hbarr commented Mar 5, 2023 via email

@PeterWone
Copy link

PeterWone commented Mar 6, 2023

Some while back @strelec raised [Regression] Vscode has a hard dependency on a printing library (CUPS), but does not even offer printing (#166511). I investigated this, and it's because Electron has support for printing.

You'll never guess how they do it. They generate HTML and pull the chain of Chrome.

@binaryben
Copy link

Can we lock this conversation please?

@shawngmc
Copy link

shawngmc commented Mar 6, 2023

Just tried to print some YAML today to review it while I was going to be PC-less temporarily - Ctrl-P doesn't Print. :)

Some while back @strelec raised [Regression] Vscode has a hard dependency on a printing library (CUPS), but does not even offer printing (#166511). I investigated this, and it's because Electron has support for printing.

You'll never guess how they do it. They generate HTML and pull the chain of Chrome.

I mean, if you already have most of Chrome under the hood for HTML rendering, JS runtime, etc. - I've heard worse plans, assuming this hasn't been stripped from the VSCode build.

VS code is already quite bloated, and we managed to cut the printing stuff out (see bug #166511). So technically your feature request is even farther from being delivered now, and that is definitely right thing to do.

So that was Debian-specific CUPS removal. How does that affect the basic build and other platforms (Windows, specifically, doesn't use CUPS).

@PeterWone
Copy link

You'll never guess how they do it. They generate HTML and pull the chain of Chrome.

I mean, if you already have most of Chrome under the hood for HTML rendering, JS runtime, etc. - I've heard worse plans, assuming this hasn't been stripped from the VSCode build.

Sure, but I get a lot of "waah I don't wanna use your hacky extension that drives a browser, I want real printing"

@rampageservices
Copy link

rampageservices commented Oct 25, 2023

I was a Microsoft Explorer Intern in 2006. We had to take a massive code-base and understand it quickly so that we could (in the matter of a few weeks) integrate the latest .Net framework into this existing project. It was extremely stressful as someone with only a year or two of programming experience however, it was only when I printed about 100 pages of C# code and used a pen and paper in the break-room with my colleague who was also an intern were we able to make a plan of attack and quickly accomplish our goal. Sometimes, it is not a matter of "save the environment" or "no body has printers", it is a matter of a printer is a tool in our toolbox that sometimes we need to use to do our jobs. It was why it was created so many years ago and why Xerox is still a company in existence today.
This week, I am doing consulting and I have to take a massive SDK and drill-down why an issue is not working. I can not stare at a screen 12 hours a day anymore like I was younger. Printers still exist, it is a tool I need to use to quickly get this project out the door for my client. I go-to print and find that VS code does not have a printing features AND I need to install a 3rd party extension. This is a terrible decision to exclude printing functionality or keep it on indefinite Hiatus.

Please reconsider Microsoft.

@PeterWone
Copy link

PeterWone commented Oct 27, 2023

VS code does not have a printing features AND I need to install a 3rd party extension.

Why is installing an extension such a problem?

  • It's not as though you have to pay for it.
  • Why should people who don't need it be obliged to put up with what is, from their point of view, useless bloat?
  • When they finally do need it, they can pretend they didn't say all those nasty things and just install it.
  • Everything is an extension.
    • Windows is an extension to the BIOS.
    • VS Code is an extension to Windows.
    • You can extend the Print extension with more extensions contributing new document rendering strategies.
  • Extensions allow demand loading for smaller footprint.
  • Extensions allow async loading for quicker usability.

@ethzero
Copy link

ethzero commented Nov 2, 2023

Compromise: Printing is an extension. An official Microsoft extension installed on-demand when navigating to a Print option. Somewhat like VSCode does already when it detects a document type that could be handled by a Marketplace Extension?

@rampageservices
Copy link

Compromise: Printing is an extension. An official Microsoft extension installed on-demand when navigating to a Print option. Somewhat like VSCode does already when it detects a document type that could be handled by a Marketplace Extension?

One of the ideal scenarios.

@PeterWone
Copy link

Compromise: Printing is an extension. An official Microsoft extension installed on-demand when navigating to a Print option. Somewhat like VSCode does already when it detects a document type that could be handled by a Marketplace Extension?

That behaviour is actually pretty trivial for Microsoft to implement, There's a recommendations mechanism. Source code repos can use it to suggest extensions. There are also "baked-in" recommendations to which you refer. These respond to detected language identifiers, which is how they know to suggest eg the C# tooling. Print applies to damn near everything. What do you think should trigger the suggestion?

There is also the issue of differences between the built-in Markdown preview, which is non-optional and impossible to replace with a better one, and printing via a browser the way I do it in the Print extension.

They ought to use the same rendering pipeline so that you can expect anything that works in preview to work in print. This is why, despite the point-blank refusal of the vscode team to support an API for the Markdown rendering pipeline, I had to use a hack to access it. Because it's not a supported thing, the fellow responsible for the Markdown rendering pipeline (let's call it the MRP I'm tired of typing that) feels free to change things with no regard to anyone else's needs. I have a quarter of a million users but from his perspective only one person cares about this (me).

As a result, the built in MRP is becoming more trouble than it's worth and I'm looking at running my own MRP with common markdown-it extensions baked-in. The problem with this from the user's perspective is it doesn't cater for user driven Markdown extension, and there is drift between the built in preview and printing.

The solution is for me to provide both preview and print. This is an improvement on several fronts:

  • Preview and print are in perfect sync
  • Support for new document types via installable language renderers (by default there are three, one for source code with syntax colouring and line numbers, one for plain text and one for rendered Markdown)
  • When preview is in a browser you can put it on another monitor
  • You can preview more than one document at a time
  • This will allow me to resolve Markdown extension clashes eg Mathpix and Mermaid

Frankly I'd be very happy about it if MS put me on the payroll to maintain print/preview. But they won't for a variety of reasons. Some extensions need to render in the browser, which means you have to serve script. This introduces security considerations and potential liability.

@Alex976925
Copy link

Copeeel @memark

@rampageservices
Copy link

It would be great if Microsoft can consult with @PeterWone to improve this part of VS code if they have not already.

@llamahunter
Copy link

Where is File->Print?

@PeterWone
Copy link

PeterWone commented Jun 22, 2024

Where is File->Print?

Microsoft doesn't want to do Print, and it is not supported for an extension to contribute a menu item to the main menus, only to context menus.

The official justification has to do with technical problems in localising dynamic menus. Personally, I find this unlikely. VS Code has handled dynamic menus since day one (the file history) so there must be some other reason they don't want to do it. As for localisation, the fact that you can't do the menus in the Electron start-up phase is irrelevant, a menu is basically a popup window full of buttons. with click events triggering command messages. Get the menu label text from the contributing extension dynamically and there's your localisation, or not, depending on the extension.

Don't hold your breath.

@rampageservices
Copy link

The official justification has to do with technical problems in localising dynamic menus.

Is this justification public somewhere?

@DyessGG
Copy link

DyessGG commented Oct 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests