🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8519

Printing using windows API

#8519
From: Simon Elliott
Date: Wed, 20 Oct 2004 13:16
21 lines
1761 bytes
I'm doing this to print directly via windows:

OpenPrinter(printer, &handle, NULL);
StartDocPrinter(handle, 1, (LPBYTE)&DocInfo);
StartPagePrinter(handle);
WritePrinter(handle, (void*)buff, count, &dwBytesWritten);
EndPagePrinter(handle);
EndDocPrinter(handle);

The returns from the functions are always OK, but it only works
properly on certain printers. On a networked HP Colour LaserJet 2550LN
it prints correctly, but then prints gobbledygook and the printer has
an incorrect paper size error. Jaws PDF creator seems to interpret the
text being printed as a series of (invalid) commands. It works fine on
an Epson dot matrix printer.

Is there any way I can get the above to work on all printers? If not,
what's my best option? To get a device context and use TextOut?

-- 
Simon Elliott    http://www.ctsn.co.uk
Technical Details
Message-ID: <41766513@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.119.100.83.MISMATCH!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeeds.com!in.nntp.be!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,18e3c388aee13f92,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Simon Elliott" <Simon at ctsn.co.uk>
Subject: Printing using windows API
Newsgroups: borland.public.cppbuilder.nativeapi
Reply-To: "Simon Elliott" <News at ctsn.co.uk>
User-Agent: XanaNews/1.16.3.1
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 82.152.41.49
Message-ID: <41766513@newsgroups.borland.com>
Date: 20 Oct 2004 06:16:03 -0700
X-Trace: newsgroups.borland.com 1098278163 82.152.41.49 (20 Oct 2004 06:16:03 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.119.100.83.MISMATCH!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeeds.com!in.nntp.be!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail