Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Printers and uC

Status
Not open for further replies.
You could learn PCL and send your datastream that way.

Last time I tinkered with a printing application it goes something like this.

1. Application to OS print subsystem
2. OS subsystem creates a printing metafile
3. The driver of the printer takes the metafile an puts it into something the printer understands.

So you "could" learn a bit of PCL and fire that at the printer directly, PCL is relatively old but still understood by most printers.

A sample datastream looks like this.

Code:
%!PS
/minidict 45 dict def minidict begin
/inch {72 mul} def
/ld {load def} def
/gs /gsave ld   /gr /grestore ld        /gray {gs setgray fill gr} def
/li /lineto ld  /rl /rlineto ld         /ct /curveto ld/set {gs setlinewidth st gr} def
/mt /moveto ld  /tr /translate ld       /np /newpath ld /cp /closepath ld
/st /stroke ld  /rp /repeat ld          /ro /rotate ld  /rt /rmoveto ld
/box {np mt rl rl rl cp set} def        /circle {np arc set} def
/newline {tm lg sub /tm exch def lm tm mt} def
/centre {dup stringwidth pop 2 div linewidth 2 div exch sub lm add tm mt} def
/right {dup stringwidth pop rm exch sub tm mt} def      /r {right n} def
/s /show ld     /n {show newline} def /L {newline} def
/c {centre n} def       /kern {0 rmoveto} def /k {kern} def
/F {findfont exch scalefont setfont} def
/w /widthshow load def  /h {0 32} def
/textbox {/lm 0 def /bm 0 def /rm 7 inch def /tm 0 inch def /lg 12 def lm tm moveto} def
/page {gsave 50 72 translate textbox} def
/close {grestore showpage end} def
/end


gs 0.75 inch 10.50 inch tr textbox
10 /Helvetica F
(Hello World) n
grestore

The top segment of code does the upfront stuff leaving the last "paragraph" of code to do something useful i.e. say "Hello World" 10.5 inches UP the page and 0.75 inches from the left.

Hope this is useful

Mark

p.s. USB = I don't think so!

I'm probably hair-splitting, but the code you have quoted is Postscript not PCL.
 
A lot of 90's Laser printers have built-in fonts, I just recently got an HP LaserJet 5 (with working, good condition drum and toner) for $10. You could also look for old IBM TrueMark, the only TrueMark's I've seen are the Power+USB versions (Made for SurePOS systems, or systems that generally have the USB+12V ports), maybe there are some old Serial ones floating around.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top