Print function for paper?

Thanks, ill take a look at it!

2 Likes

I always insist on features like this being fully 100% unit tested before I will allow them into a codebase. If a developer is willing to do that amount of work, then they really believe in the feature. If they are not - then they self-select out. Generally I prefer 80% unit test coverage on a codebase. But I typically enforce 100% on new features and then let people argue why they couldn’t hit 100%.

But more importantly it means that after that developer is on a new project, we still have documentation through unit test code of how a feature was intended to work.

1 Like

Hardware and driver related things are unfortunately a nightmare to unit test or to test in general, and as anyone who has used printers knows they’re fickle and hard to make work to begin with, from a driver and OS perspective, making it hard to know what is wrong if something doesn’t work

2 Likes

I actually used to test printers. I worked with a trade group of printer manufactures implementing Bluetooth printing many years ago. But going back to the idea that they’re a nightmare to test, that’s how I would keep something like this out. The sheer volume of unit tests would make it infeasible to use. Basically I would weaponize the difficulty of testing. Which is why in my first post I recommended to OP to just make a PDF using Adobe’s library. Then all the fiddly bits are tested by Adobe.

3 Likes

Exporting to PDF is absolutely the portable and convenient solution, especially as even when printing a lot of it is to documents to send by email etc. anyway (I haven’t printed much in years, except some contracts, most of the things I do like invoices or paperwork to the government etc. are either digital forms or PDFs)

3 Likes

This can already be achieved by following these steps:

  • Make your Godot project write an HTML file using the FileAccess class.
  • Add <script>window.print()</script> at the bottom of the <body> of the HTML file, so that the browser’s print dialog appears immediately.
  • Open the HTML file in the user’s default web browser using OS.shell_open(path_to_html_file).
  • The page will open and show the print dialog immediately. In all modern browsers, the user can choose to print to PDF (saving a PDF file), or print using a local or network printer.
6 Likes

I just got a cool idea.

A game you need a PRINTER to play, as the game prints hints enigms etc

This is just a totally rough concept that I have no idea how could be put in action

but still, if we wanted to use a printer in video games, that’s one way

2 Likes

This is the most common and simple way to do the simple things that is not in Godot,use the OS thing! Like for checking vram,printing and many cool things!

But someone says WinDowS Doesn’t Allows it!

Why! Why Bill?

Where did you see this?

ohh,someone said that windows don’t allows new apps to run cmd commands, execute exe etc ,Which is I am pretty sure true.I think windows thinks someone will install a malware

@Calinou I found it

I’m going to make my own “Xbox Live Gold” for gaming printer ink / toner service. Thanks for the idea :money_bag:

3 Likes

Genius.

I’ve never thought I’d hear of a gaming ink lol.

1 Like

That comment only applies to PowerShell script execution, not executing commands (or even Batch files) using OS.execute().

You need to use PowerShell to get the GPU VRAM amount without external programs, but you don’t need to run an external program.

That said, here, we don’t even need to use OS.execute(). We just use OS.shell_open(), which makes the file be opened with the user’s default program for the given file type.

3 Likes