Posts: 11,214
Threads: 648
Joined: May 2009
Yeah, I don't mean by using the print command to show text on the screen, but actually sending formatted text to a printer. Would be good if you wanted to use ruby to create a database system.
Anyone got any code, demo, ideas? Even a ouija board couldn't hurt.
Posts: 11,214
Threads: 648
Joined: May 2009
According to Zeriab
Zeriab Wrote:But you would be able to call a DLL through Win32API
Which makes me think that there's a chance some scripter can create a
PrinterDevice module or class.
I have been looking through commands like the CreateDC, ReleaseDC and like drawing APIs. But I didn't have much luck coding with them.
Posts: 111
Threads: 26
Joined: May 2009
I think that even if you find a way of sending information to a printer service you would have to provide it in PostScript or something similar.
Therefore I suggest you take a look at PostScript
http://www.adobe.com/print/features/psvspdf/main.html
It is a programming language which focuses on how a page looks like.
A module which helps generate PostScript code would be a start.
*hugs*
- Zeriab
Posts: 11,214
Threads: 648
Joined: May 2009
Actually, I was thinking of sending a more basic level of information that the printer would be able to understand. I mean, I wasn't considering anything graphics-intensive but a text based series of output.
Merely detecting and initializing a printer device, sending font information and the text (characters, carriage returns, page breaks, etc) would be enough for now.
I dislike needing to supply too many .dlls, required files or the like if I can avoid it.
Thanks though.
Posts: 111
Threads: 26
Joined: May 2009
I believe most printers support PostScript by now and the printer spooling service in Windows supports it as well. Should that be the case then what you were thinking about could easily be a more abstract (high) level of information.
Text are by no means simple. You would have to convert them to vector graphics and rasterize them.
Either way you probably don't have to worry about how it works, but rather have to find out how to satisfy the input requirements for the printing service.
Here is a snippet you can study more closely:
http://rubyforge.org/snippet/detail.php?...ppet&id=19
*huggles* :3
Edit: Note that you can use
system('notepad.exe /p text.txt') to print out a text file