🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to send string to an USB printer ?

#13755
From: Bob Gonder
Date: Thu, 11 Sep 2003 20:21
58 lines
3263 bytes
Richard Yu wrote:

>    aPrinterName=PrinterName;
>    aPSList->Add(" 350 30 moveto ");
>    aPSList->Add("("+aPrinterName+")"+" show");
>    aPSList->Add("showpage");

Does that actually print anything?
You might try hard-coding the second Add to "(SOMETHING) show"
Probably 99% of us here know nothing about PS.
Probably supposed to print "Hp 20" at 350,30
Is 350,30 actually on the page?

The rest of the code looks ok, and the fact that it prints on other
printers supports that.

Did you check for the simple things, like, is the spooler on Pause?
And can other apps print on it?

I think you need to contact HP directly.
Or at the least, download the manual for your printer.
The manual is on HP's web  www.hp.com

Are you sure you want/need to use PS?
You should be able to use Window's DC printing methods with all
printers.
	OpenPrinter("HP 20",&PrinterHandle,NULL)
//	Get a DEVMODE
	num_bytes = DocumentProperties(NULL, printerHandle, "HP 20",
NULL, NULL, 0);

DevMode=(DEVMODE*)GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT,num_bytes);
//	Fill in the DEVMODE
	DocumentProperties(NULL, printerHandle, "HP 20", DevMode,
NULL, DM_OUT_BUFFER);
//	Get the DC
	printerDC = CreateDC( NULL, "HP 20", NULL, DevMode); 
//	Done with DEVMODE
	GlobalFree(DevMode);
	printerDy=GetDeviceCaps(printerDC, VERTRES)/linesperpage;
	printerDx=GetDeviceCaps(printerDC,HORZRES)/charperline;
	printerJob=StartDoc(printerDC,&lpdi);
	StartPage(printerDC);
// you might need to set a font: see CreateFont() and SelectObject()
//	Any DC output operation works here (Drawing, graphics, etc.)
	SetTextAlign(printerDC,TA_LEFT+TA_TOP+TA_NOUPDATECP);
	SetBkMode (printerDC, TRANSPARENT);
	ExtTextOut(printerDC,printerDx * x, printerDy * y,
		0,	// text-output options
		(RECT*)NULL,	// optional clipping and/or opaquing
		str,		// points to string
		z,		// number of characters in string 
		(INT *)NULL ); 	// pointer to array of intercharacter 
	EndPage(printerDC);	// send page to the printer
	EndDoc(printerDC);	// closes the print job
                /* Delete the printer DC. */ 
	DeleteDC(printerDC);
	ClosePrinter(printerHandle);
Technical Details
Message-ID: <muj1mv0jj94mv81pisjm7s3m3qp59356tt@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f60a170$1@newsgroups.borland.com> <3f60ac51$2@newsgroups.borland.com> <3f60bd58$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9c6ded6a64b04e7e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-11 13:37:31 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: How to send string to an USB printer ?
Date: Thu, 11 Sep 2003 13:21:50 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <muj1mv0jj94mv81pisjm7s3m3qp59356tt@4ax.com>
References: <3f60a170$1@newsgroups.borland.com> <3f60ac51$2@newsgroups.borland.com> <3f60bd58$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.164.85
X-Trace: newsgroups.borland.com 1063311708 67.31.164.85 (11 Sep 2003 13:21:48 -0700)
Lines: 60
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail