I want to know how i can access the printer in masm32. Especially to print condensed in dot matrix printer. can anyone help me ?
Posted on 2004-11-06 12:02:48 by kumar

Use these API's for Windows, in this order. You may not need to use StartPagePrinter and EndPagePrinter. Use WritePrinter to actually send the raw data to the printer. You can send the codes to set the printer into Condensed mode or whatever mode you want. You can send anything you want, just like in the DOS days! Using OpenPrinterA, you can send to any network or local printer.

szOpenPrinterA		db 'OpenPrinterA', 0

szStartDocPrinterA db 'StartDocPrinterA', 0
szStartPagePrinter db 'StartPagePrinter', 0
szWritePrinter db 'WritePrinter', 0
szEndPagePrinter db 'EndPagePrinter', 0
szEndDocPrinter db 'EndDocPrinter', 0
szClosePrinter db 'ClosePrinter', 0


Posted on 2004-11-06 20:04:32 by farrier
i am interested in your answer. i am thirsty for the printing knowledge recently.
But using the API
BOOL OpenPrinter(

LPTSTR pPrinterName, // pointer to printer or server name
LPHANDLE phPrinter, // pointer to printer or server handle
LPPRINTER_DEFAULTS pDefault // pointer to printer defaults structure

needs three Parameters, which is a little bit hard.

so would you please give us an example to show the details?
thank very much.
please send your code to my email: zhasm@126.com, if convenient.
Posted on 2005-02-24 23:36:47 by zhihui

pRepName is the Local name or the full Network name of the printer

PRepName			db '\\Left\Reports', 0

hPrinter dd ?

invoke OpenPrinter, addr PRepName, addr hPrinter, NULL


Posted on 2005-02-25 04:37:51 by farrier


... You can send anything you want, just like in the DOS days!  Using OpenPrinterA, you can send to any network or local printer.......

hi, farrier
if I want to send a document with pic to the printer, How can I do then ? Can you give me some tutorial or some codes ?  Thank you.
Posted on 2005-12-09 01:30:07 by miaomiao
once i wrote a prog to print text docs to the old dot-matrix printer in the manner i like. i've open file named "prn", write there and close it then. to set condensed you should send 15 (0Fh) symbol to printer, and to turn off it: 18 (12h) symbol.

if you wish print grafics, you can read how dot-matrix printer prints grafics and do it. although it is possible i've been using my prog only to print text docs - it was fast enough from winny instead of grafic printing ;)

although my prog has rus comments i'll post it as example - it was nearly the first my prog in asm under win so did not modified long time :) regards!
to send a document with pic to the printer, How can I do then >
you can look inet for esc/p codes, but it can be not easy to implement, if you plan to mix text output and grafic output. more possible if you will convert all document into grafics, but then can be more easy just print via windows (except, of course, if you plan to print from own-built os)
this is russian version: get translated to english below ?
Posted on 2005-12-09 04:33:43 by Shoo

I have never had a need to print graphics, but, sending text and graphics to a printer is just like sending them to the screen.  You have to obtain a DC for the printer just like for the screen.  You have to determine the dimensions of the page just like you need to determine the dimensions of the screen.  Then you send whatever you need to the printer as you would send it to the screen.

I wish I could help more, but I have done direct output to dot matrix printing, and sending RTF files directly to the default printer.  If I can help you with this, I'll be glad to!


Posted on 2005-12-09 14:21:05 by farrier
Hi All:

I have downloaded WINTP.ZIP
I think this file might be Trashed.
The comments are unreadeable,
WORD thinks it might be Greek?
WINTP.EXE brings up a window
with a lot of question marks all
over the place?
Posted on 2005-12-10 10:05:02 by herge
might be Greek > :D they are in russian :) it was written for own props 3 years ago and i just had no time to make translation. i just supposed that latin labels are informative enough. if it is needed i'll make a quick translation. it is a program to print text docs to dot-matrix printer, which also does not check end of paper (i have Robotron from 1988 still working ;) program also wraps lines, makes left space and splits doc to pages, and have 2 pages roll back!!! ;) (usefull when you are printing second page on the paper, and it is jammed :)

ok, my work is started, so, will be soon ;)
Posted on 2005-12-12 00:07:14 by Shoo
here you are. i can not test it now and do not plan to develop it far since i have laser-jet both at home and at work now. also, can not say it is best example of programming ;)
Posted on 2005-12-12 00:47:08 by Shoo