Actual 'Printer' support?
#1
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.
Reply }
#2
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.
Reply }
#3
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
Reply }
#4
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.
Reply }
#5
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
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   The Self Data Suite support thread PK8 0 3,719 07-18-2015, 09:41 PM
Last Post: PK8
   MultiSlots! / Charlie CTB Support habs11 14 20,867 08-18-2009, 04:46 AM
Last Post: habs11



Users browsing this thread: 2 Guest(s)