Game Development Community

Send to printer

by David Alaves · in Torque Game Builder · 04/24/2008 (3:32 am) · 9 replies

Hi all,

Is it possible to send some text (or graphics) to a printer from Torquescript?

Thanks in advance

#1
04/24/2008 (5:34 am)
Interesting concept. If you mean something along the lines of running a game, and calling a function (via console or button press) you wrote in TS which causes whatever is on screen to print...no, that is not available out of the box as far as I know.
#2
04/25/2008 (1:26 am)
Thanks for your answer, Michael.

Yes, I want to program a Sudoku just for fun and I thought it would be nice to have an option to print the sudoku and, optionally, the solution.

Is there any resource in C++ to achieve this?
#3
04/25/2008 (6:51 am)
@David - Off the top of my head I wouldn't know. I know the methods would be platform and language specific. Plus you have to look at the fact that printers are now beasts to deal with. Almost all require some kind of driver. I found a couple of links, but some in depth research might need to be done:

Start by using Google: C++ send to printer

Thread about sending data to a printer

Let me know if you come up with anything.
#4
05/14/2008 (8:20 pm)
Couldnt you somehow run the windows keyboard by function i believe that has a print function?
#5
05/21/2008 (12:55 pm)
You'd have to modify the engine. TGB lets you make a screenshot. Why not make the screenshot and send it to a printer? It should work fine. I wrote a function to print a while back for a really simple image viewer program. Most printers nowadays let you print a bitmap (after some tinkering with the dimensions and pixel ratio and canvas size). I don't know if there's a cross-platform solution though, maybe wxWidgets.
#6
05/26/2008 (2:11 am)
Hi,

Good concept David. I need also same type of requirement for my game. If any help to send command to print text or image file to printer, will be very helpful for my requirement as well. How to modify code for this ?
any Guess !



cheers.
#7
05/26/2008 (8:50 am)
My solution was to save the screenshot as a png then open a web page that will display just that PNG and has a javascript onload print function.

Greg
#8
05/26/2008 (5:57 pm)
Very nice solution Tetraweb. I hadn't even considered using a web browser.

How do you open the web browser? Is there a cross-platform solution for that?
#9
05/27/2008 (8:05 pm)
GotoWebPage("http://www.google.com");

There seems to be no reliable way to open a local page, so you need to have an internet accessible page that has the javascript print routine.

Greg